Debugger: Extend value handler interface.
- Add new interface class TableCellValueEditor, which provides a controller for handling editing of table cell values, and corresponding listener notifications. ValueHandler: - Add new hook for requesting such an editor, given a corresponding value.
This commit is contained in:
@@ -304,6 +304,7 @@ Application Debugger :
|
|||||||
TableCellFloatRenderer.cpp
|
TableCellFloatRenderer.cpp
|
||||||
TableCellIntegerRenderer.cpp
|
TableCellIntegerRenderer.cpp
|
||||||
TableCellStringRenderer.cpp
|
TableCellStringRenderer.cpp
|
||||||
|
TableCellValueEditor.cpp
|
||||||
TableCellValueRenderer.cpp
|
TableCellValueRenderer.cpp
|
||||||
TableCellValueRendererUtils.cpp
|
TableCellValueRendererUtils.cpp
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "TableCellValueEditor.h"
|
||||||
|
|
||||||
|
#include "Value.h"
|
||||||
|
|
||||||
|
|
||||||
|
TableCellValueEditor::TableCellValueEditor()
|
||||||
|
:
|
||||||
|
BReferenceable(),
|
||||||
|
fInitialValue(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TableCellValueEditor::~TableCellValueEditor()
|
||||||
|
{
|
||||||
|
if (fInitialValue != NULL)
|
||||||
|
fInitialValue->ReleaseReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::AddListener(Listener* listener)
|
||||||
|
{
|
||||||
|
fListeners.Add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::RemoveListener(Listener* listener)
|
||||||
|
{
|
||||||
|
fListeners.Remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::SetInitialValue(Value* value)
|
||||||
|
{
|
||||||
|
if (fInitialValue != NULL)
|
||||||
|
fInitialValue->ReleaseReference();
|
||||||
|
|
||||||
|
fInitialValue = value;
|
||||||
|
if (fInitialValue != NULL)
|
||||||
|
fInitialValue->AcquireReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::NotifyEditBeginning()
|
||||||
|
{
|
||||||
|
for (ListenerList::Iterator it = fListeners.GetIterator();
|
||||||
|
Listener* listener = it.Next();) {
|
||||||
|
listener->TableCellEditBeginning();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::NotifyEditCancelled()
|
||||||
|
{
|
||||||
|
for (ListenerList::Iterator it = fListeners.GetIterator();
|
||||||
|
Listener* listener = it.Next();) {
|
||||||
|
listener->TableCellEditCancelled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::NotifyEditCompleted(Value* newValue)
|
||||||
|
{
|
||||||
|
for (ListenerList::Iterator it = fListeners.GetIterator();
|
||||||
|
Listener* listener = it.Next();) {
|
||||||
|
listener->TableCellEditEnded(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - TableCellValueEditor::Listener
|
||||||
|
|
||||||
|
|
||||||
|
TableCellValueEditor::Listener::~Listener()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::Listener::TableCellEditBeginning()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::Listener::TableCellEditCancelled()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TableCellValueEditor::Listener::TableCellEditEnded(Value* newValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef TABLE_CELL_VALUE_EDITOR_H
|
||||||
|
#define TABLE_CELL_VALUE_EDITOR_H
|
||||||
|
|
||||||
|
#include <Referenceable.h>
|
||||||
|
|
||||||
|
#include <util/DoublyLinkedList.h>
|
||||||
|
|
||||||
|
|
||||||
|
class BView;
|
||||||
|
class Value;
|
||||||
|
|
||||||
|
|
||||||
|
class TableCellValueEditor : public BReferenceable {
|
||||||
|
public:
|
||||||
|
class Listener;
|
||||||
|
TableCellValueEditor();
|
||||||
|
virtual ~TableCellValueEditor();
|
||||||
|
|
||||||
|
void AddListener(Listener* listener);
|
||||||
|
void RemoveListener(Listener* listener);
|
||||||
|
|
||||||
|
inline Value* InitialValue() const { return fInitialValue; }
|
||||||
|
void SetInitialValue(Value* value);
|
||||||
|
|
||||||
|
virtual BView* GetView() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void NotifyEditBeginning();
|
||||||
|
void NotifyEditCancelled();
|
||||||
|
void NotifyEditCompleted(Value* newValue);
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef DoublyLinkedList<Listener> ListenerList;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ListenerList fListeners;
|
||||||
|
Value* fInitialValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TableCellValueEditor::Listener : public
|
||||||
|
DoublyLinkedListLinkImpl<TableCellValueEditor::Listener> {
|
||||||
|
public:
|
||||||
|
virtual ~Listener();
|
||||||
|
|
||||||
|
virtual void TableCellEditBeginning();
|
||||||
|
virtual void TableCellEditCancelled();
|
||||||
|
virtual void TableCellEditEnded(Value* newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TABLE_CELL_VALUE_EDITOR_H
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
|
* Copyright 2015, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -19,3 +20,12 @@ ValueHandler::CreateTableCellValueSettingsMenu(Value* value, Settings* settings,
|
|||||||
_menu = NULL;
|
_menu = NULL;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
ValueHandler::GetTableCellValueEditor(Value* value, Settings* settings,
|
||||||
|
TableCellValueEditor*& _editor)
|
||||||
|
{
|
||||||
|
_editor = NULL;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
|
* Copyright 2015, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef VALUE_HANDLER_H
|
#ifndef VALUE_HANDLER_H
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
|
|
||||||
class Settings;
|
class Settings;
|
||||||
class SettingsMenu;
|
class SettingsMenu;
|
||||||
|
class TableCellValueEditor;
|
||||||
class TableCellValueRenderer;
|
class TableCellValueRenderer;
|
||||||
class Value;
|
class Value;
|
||||||
class ValueFormatter;
|
class ValueFormatter;
|
||||||
@@ -27,6 +29,12 @@ public:
|
|||||||
virtual status_t GetTableCellValueRenderer(Value* value,
|
virtual status_t GetTableCellValueRenderer(Value* value,
|
||||||
TableCellValueRenderer*& _renderer) = 0;
|
TableCellValueRenderer*& _renderer) = 0;
|
||||||
// returns a reference
|
// returns a reference
|
||||||
|
virtual status_t GetTableCellValueEditor(Value* value,
|
||||||
|
Settings* settings,
|
||||||
|
// may be NULL if preconfiguration with
|
||||||
|
// particular settings isn't desired.
|
||||||
|
TableCellValueEditor*& _editor);
|
||||||
|
// may return NULL, otherwise a reference
|
||||||
virtual status_t CreateTableCellValueSettingsMenu(Value* value,
|
virtual status_t CreateTableCellValueSettingsMenu(Value* value,
|
||||||
Settings* settings, SettingsMenu*& _menu);
|
Settings* settings, SettingsMenu*& _menu);
|
||||||
// may return NULL, otherwise a reference
|
// may return NULL, otherwise a reference
|
||||||
|
|||||||
Reference in New Issue
Block a user