Debugger: Implement value editor hook for more handlers.
{Bool,Enumeration}ValueHandler:
- Implement GetTableCellValueEditor() hook.
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "BoolValue.h"
|
#include "BoolValue.h"
|
||||||
#include "BoolValueFormatter.h"
|
#include "BoolValueFormatter.h"
|
||||||
|
#include "TableCellBoolEditor.h"
|
||||||
#include "TableCellFormattedValueRenderer.h"
|
#include "TableCellFormattedValueRenderer.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ BoolValueHandler::GetTableCellValueRenderer(Value* value,
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
ValueFormatter* formatter = NULL;
|
ValueFormatter* formatter = NULL;
|
||||||
if (GetValueFormatter(value, formatter))
|
if (GetValueFormatter(value, formatter) != B_OK)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
BReference<ValueFormatter> formatterReference(formatter, true);
|
BReference<ValueFormatter> formatterReference(formatter, true);
|
||||||
|
|
||||||
@@ -75,3 +76,33 @@ BoolValueHandler::GetTableCellValueRenderer(Value* value,
|
|||||||
_renderer = renderer;
|
_renderer = renderer;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BoolValueHandler::GetTableCellValueEditor(Value* _value, Settings* settings,
|
||||||
|
TableCellValueEditor*& _editor)
|
||||||
|
{
|
||||||
|
BoolValue* value = dynamic_cast<BoolValue*>(_value);
|
||||||
|
if (value == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
ValueFormatter* formatter;
|
||||||
|
status_t error = GetValueFormatter(value, formatter);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
BReference<ValueFormatter> formatterReference(formatter, true);
|
||||||
|
|
||||||
|
TableCellBoolEditor* editor = new(std::nothrow)
|
||||||
|
TableCellBoolEditor(value, formatter);
|
||||||
|
if (editor == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
BReference<TableCellBoolEditor> editorReference(editor, true);
|
||||||
|
error = editor->Init();
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
editorReference.Detach();
|
||||||
|
_editor = editor;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ public:
|
|||||||
ValueFormatter*& _formatter);
|
ValueFormatter*& _formatter);
|
||||||
virtual status_t GetTableCellValueRenderer(Value* value,
|
virtual status_t GetTableCellValueRenderer(Value* value,
|
||||||
TableCellValueRenderer*& _renderer);
|
TableCellValueRenderer*& _renderer);
|
||||||
|
virtual status_t GetTableCellValueEditor(Value* _value,
|
||||||
|
Settings* settings,
|
||||||
|
TableCellValueEditor*& _editor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "EnumerationValue.h"
|
#include "EnumerationValue.h"
|
||||||
#include "EnumerationValueFormatter.h"
|
#include "EnumerationValueFormatter.h"
|
||||||
|
#include "TableCellEnumerationEditor.h"
|
||||||
#include "TableCellFormattedValueRenderer.h"
|
#include "TableCellFormattedValueRenderer.h"
|
||||||
#include "Type.h"
|
#include "Type.h"
|
||||||
|
|
||||||
@@ -64,6 +65,42 @@ EnumerationValueHandler::GetValueFormatter(Value* _value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
EnumerationValueHandler::GetTableCellValueEditor(Value* _value,
|
||||||
|
Settings* settings, TableCellValueEditor*& _editor)
|
||||||
|
{
|
||||||
|
EnumerationValue* value = dynamic_cast<EnumerationValue*>(_value);
|
||||||
|
if (value == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
IntegerValueFormatter::Config* config = NULL;
|
||||||
|
status_t error = CreateIntegerFormatterConfig(value, config);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
BReference<IntegerValueFormatter::Config> configReference(config, true);
|
||||||
|
|
||||||
|
ValueFormatter* formatter;
|
||||||
|
error = CreateValueFormatter(config, formatter);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
BReference<ValueFormatter> formatterReference(formatter, true);
|
||||||
|
|
||||||
|
TableCellEnumerationEditor* editor = new(std::nothrow)
|
||||||
|
TableCellEnumerationEditor(value, formatter);
|
||||||
|
if (editor == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
BReference<TableCellEnumerationEditor> editorReference(editor, true);
|
||||||
|
error = editor->Init();
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
editorReference.Detach();
|
||||||
|
_editor = editor;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
integer_format
|
integer_format
|
||||||
EnumerationValueHandler::DefaultIntegerFormat(IntegerValue* _value)
|
EnumerationValueHandler::DefaultIntegerFormat(IntegerValue* _value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ public:
|
|||||||
virtual float SupportsValue(Value* value);
|
virtual float SupportsValue(Value* value);
|
||||||
virtual status_t GetValueFormatter(Value* value,
|
virtual status_t GetValueFormatter(Value* value,
|
||||||
ValueFormatter*& _formatter);
|
ValueFormatter*& _formatter);
|
||||||
|
virtual status_t GetTableCellValueEditor(Value* value,
|
||||||
|
Settings* settings,
|
||||||
|
TableCellValueEditor*& _editor);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual integer_format DefaultIntegerFormat(IntegerValue* value);
|
virtual integer_format DefaultIntegerFormat(IntegerValue* value);
|
||||||
|
|||||||
Reference in New Issue
Block a user