BOptionPopUp: move mennu setup to AttachedToWindow
* There is no need to delay this to AllAttached * Apps may want to override the SetDivider, and doing it as late as AllAttached can be annoying. Fixes #10734.
This commit is contained in:
@@ -27,7 +27,7 @@ public:
|
||||
BOptionPopUp(const char* name,
|
||||
const char* label, BMessage* message,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
|
||||
|
||||
virtual ~BOptionPopUp();
|
||||
|
||||
BMenuField* MenuField();
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
int32 index);
|
||||
|
||||
virtual void AllAttached();
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void SetLabel(const char* text);
|
||||
virtual void SetValue(int32 value);
|
||||
@@ -47,7 +48,7 @@ public:
|
||||
virtual void GetPreferredSize(float* _width,
|
||||
float* _height);
|
||||
virtual void ResizeToPreferred();
|
||||
|
||||
|
||||
virtual int32 SelectedOption(const char** _name = 0,
|
||||
int32* _value = 0) const;
|
||||
private:
|
||||
|
||||
@@ -184,11 +184,18 @@ BOptionPopUp::AddOptionAt(const char* name, int32 value, int32 index)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Called to take special actions when the child views are attached.
|
||||
It's used to set correctly the divider for the BMenuField.
|
||||
*/
|
||||
// BeOS R5 compatibility, do not remove
|
||||
void
|
||||
BOptionPopUp::AllAttached()
|
||||
{
|
||||
BOptionControl::AllAttached();
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the divider for the BMenuField and target the menu items to ourselves.
|
||||
*/
|
||||
void
|
||||
BOptionPopUp::AttachedToWindow()
|
||||
{
|
||||
BMenu* menu = fMenuField->Menu();
|
||||
if (menu != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user