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:
parent
1f8d1f68ce
commit
1f3db0d0d6
@ -38,3 +38,18 @@ TableCellBoolEditor::ConfigureOptions()
|
||||
|
||||
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();
|
||||
|
||||
protected:
|
||||
virtual status_t GetSelectedValue(::Value*& _value) const;
|
||||
};
|
||||
|
||||
#endif // TABLE_CELL_BOOL_EDITOR_H
|
||||
|
@ -46,3 +46,23 @@ TableCellEnumerationEditor::ConfigureOptions()
|
||||
|
||||
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();
|
||||
|
||||
protected:
|
||||
virtual status_t GetSelectedValue(::Value*& _value) const;
|
||||
};
|
||||
|
||||
#endif // TABLE_CELL_ENUMERATION_EDITOR_H
|
||||
|
@ -65,7 +65,13 @@ TableCellOptionPopUpEditor::MessageReceived(BMessage* message)
|
||||
switch (message->what) {
|
||||
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;
|
||||
}
|
||||
default:
|
||||
|
@ -27,6 +27,8 @@ public:
|
||||
virtual status_t ConfigureOptions() = 0;
|
||||
|
||||
protected:
|
||||
virtual status_t GetSelectedValue(::Value*& _value) const = 0;
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user