BButton: Add optional pop-up marker

* Add behavior constant B_POP_UP_BEHAVIOR which adds a pop-up marker
  to the button (similar to that of BMenuField).
* Add methods [Set]PopUpMessage(). To set/get the the message that is
  sent to the button's target when the pop-up marker is clicked.
This commit is contained in:
Ingo Weinhold
2013-12-30 04:42:52 +01:00
parent 87f392c9f0
commit a0848a1916
4 changed files with 277 additions and 47 deletions
+7 -3
View File
@@ -13,6 +13,7 @@ public:
enum BBehavior {
B_BUTTON_BEHAVIOR,
B_TOGGLE_BEHAVIOR,
B_POP_UP_BEHAVIOR,
};
public:
@@ -51,6 +52,9 @@ public:
BBehavior Behavior() const;
void SetBehavior(BBehavior behavior);
BMessage* PopUpMessage() const;
void SetPopUpMessage(BMessage* message);
virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool active);
virtual void MouseMoved(BPoint point, uint32 transit,
@@ -82,7 +86,6 @@ public:
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
protected:
virtual void LayoutInvalidated(bool descendants = false);
@@ -95,6 +98,8 @@ private:
BSize _ValidatePreferredSize();
BRect _PopUpRect() const;
inline bool _Flag(uint32 flag) const;
inline bool _SetFlag(uint32 flag, bool set);
@@ -102,8 +107,7 @@ private:
BSize fPreferredSize;
uint32 fFlags;
BBehavior fBehavior;
uint32 _reserved[1];
BMessage* fPopUpMessage;
};
#endif // _BUTTON_H