BButton: Add flat property

* Add methods SetFlat()/IsFlat(). A flat button doesn't draw its frame,
  unless the mouse is hovering over it or it is otherwise activated.
* As a side effect this change also activates the hover glow that was
  already implemented in BControlLook, but not activated in BButton.
This commit is contained in:
Ingo Weinhold
2013-12-29 00:13:49 +01:00
parent 94c2eb2092
commit a249edfbfc
4 changed files with 106 additions and 19 deletions
+9 -1
View File
@@ -39,6 +39,9 @@ public:
virtual void SetLabel(const char* string);
bool IsDefault() const;
bool IsFlat() const;
void SetFlat(bool flat);
virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool active);
virtual void MouseMoved(BPoint point, uint32 transit,
@@ -79,7 +82,6 @@ private:
virtual void _ReservedButton2();
virtual void _ReservedButton3();
private:
BButton& operator=(const BButton &);
BSize _ValidatePreferredSize();
@@ -87,9 +89,15 @@ private:
BRect _DrawDefault(BRect bounds, bool enabled);
void _DrawFocusLine(float x, float y, float width,
bool bVisible);
inline bool _Flag(uint32 flag) const;
inline bool _SetFlag(uint32 flag, bool set);
private:
BSize fPreferredSize;
uint32 fFlags;
bool fDrawAsDefault;
bool fFlat;
uint32 _reserved[2];
};