Debugger: Flesh out option-based value editors.
TableCellOptionPopUpEditor: - Add virtual hook for retrieving the final selected value. Implement accordingly in Bool and Enumeration editor subclasses. - Implement calling the edit completion hook upon value changes.
This commit is contained in:
@@ -38,3 +38,18 @@ TableCellBoolEditor::ConfigureOptions()
|
|||||||
|
|
||||||
return SelectOptionFor(initialValue->GetValue());
|
return SelectOptionFor(initialValue->GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TableCellBoolEditor::GetSelectedValue(::Value*& _value) const
|
||||||
|
{
|
||||||
|
const char* name = NULL;
|
||||||
|
int32 selectedValue = 0;
|
||||||
|
SelectedOption(&name, &selectedValue);
|
||||||
|
BoolValue* value = new(std::nothrow) BoolValue((bool)selectedValue);
|
||||||
|
if (value == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
_value = value;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public:
|
|||||||
|
|
||||||
virtual status_t ConfigureOptions();
|
virtual status_t ConfigureOptions();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual status_t GetSelectedValue(::Value*& _value) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABLE_CELL_BOOL_EDITOR_H
|
#endif // TABLE_CELL_BOOL_EDITOR_H
|
||||||
|
|||||||
@@ -46,3 +46,23 @@ TableCellEnumerationEditor::ConfigureOptions()
|
|||||||
|
|
||||||
return SelectOptionFor(integerValue.ToInt32());
|
return SelectOptionFor(integerValue.ToInt32());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TableCellEnumerationEditor::GetSelectedValue(::Value*& _value) const
|
||||||
|
{
|
||||||
|
EnumerationValue* initialValue = dynamic_cast<EnumerationValue*>(
|
||||||
|
InitialValue());
|
||||||
|
EnumerationType* type = initialValue->GetType();
|
||||||
|
const char* name = NULL;
|
||||||
|
int32 selectedValue = 0;
|
||||||
|
SelectedOption(&name, &selectedValue);
|
||||||
|
|
||||||
|
EnumerationValue* value = new(std::nothrow) EnumerationValue(type,
|
||||||
|
BVariant(selectedValue));
|
||||||
|
if (value == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
_value = value;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public:
|
|||||||
|
|
||||||
virtual status_t ConfigureOptions();
|
virtual status_t ConfigureOptions();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual status_t GetSelectedValue(::Value*& _value) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABLE_CELL_ENUMERATION_EDITOR_H
|
#endif // TABLE_CELL_ENUMERATION_EDITOR_H
|
||||||
|
|||||||
@@ -65,7 +65,13 @@ TableCellOptionPopUpEditor::MessageReceived(BMessage* message)
|
|||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case MSG_SELECTED_OPTION_CHANGED:
|
case MSG_SELECTED_OPTION_CHANGED:
|
||||||
{
|
{
|
||||||
// TODO: implement
|
::Value* value = NULL;
|
||||||
|
if (GetSelectedValue(value) == B_OK) {
|
||||||
|
BReference< ::Value> valueReference(value, true);
|
||||||
|
NotifyEditCompleted(value);
|
||||||
|
} else
|
||||||
|
NotifyEditCancelled();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public:
|
|||||||
virtual status_t ConfigureOptions() = 0;
|
virtual status_t ConfigureOptions() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual status_t GetSelectedValue(::Value*& _value) const = 0;
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user