X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/233f10bf15c7201e8733426cffdeb6595df539ae..be19c556083cc197be55acbd05db76ec6dc2e0c4:/include/wx/button.h diff --git a/include/wx/button.h b/include/wx/button.h index e2d3dbcd85..0e987d1eda 100644 --- a/include/wx/button.h +++ b/include/wx/button.h @@ -43,6 +43,13 @@ // small as possible #define wxBU_EXACTFIT 0x0001 +// this flag can be used to disable using the text label in the button: it is +// mostly useful when creating buttons showing bitmap and having stock id as +// without it both the standard label corresponding to the stock id and the +// bitmap would be shown +#define wxBU_NOTEXT 0x0002 + + #include "wx/bitmap.h" #include "wx/control.h" @@ -57,6 +64,12 @@ class WXDLLIMPEXP_CORE wxButtonBase : public wxControl public: wxButtonBase() { } + // show the authentication needed symbol on the button: this is currently + // only implemented on Windows Vista and newer (on which it shows the UAC + // shield symbol) + void SetAuthNeeded(bool show = true) { DoSetAuthNeeded(show); } + bool GetAuthNeeded() const { return DoGetAuthNeeded(); } + // show the image in the button in addition to the label: this method is // supported on all (major) platforms void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT) @@ -96,6 +109,7 @@ public: // set the margins around the image void SetBitmapMargins(wxCoord x, wxCoord y) { DoSetBitmapMargins(x, y); } void SetBitmapMargins(const wxSize& sz) { DoSetBitmapMargins(sz.x, sz.y); } + wxSize GetBitmapMargins() { return DoGetBitmapMargins(); } // set the image position relative to the text, i.e. wxLEFT means that the // image is to the left of the text (this is the default) @@ -146,17 +160,38 @@ public: State_Max }; + // return true if this button shouldn't show the text label, either because + // it doesn't have it or because it was explicitly disabled with wxBU_NOTEXT + bool DontShowLabel() const + { + return HasFlag(wxBU_NOTEXT) || GetLabel().empty(); + } + + // return true if we do show the label + bool ShowsLabel() const + { + return !DontShowLabel(); + } + protected: // choose the default border for this window virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual bool DoGetAuthNeeded() const { return false; } + virtual void DoSetAuthNeeded(bool WXUNUSED(show)) { } + virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const { return wxBitmap(); } virtual void DoSetBitmap(const wxBitmap& WXUNUSED(bitmap), State WXUNUSED(which)) { } + + virtual wxSize DoGetBitmapMargins() const + { return wxSize(0, 0); } + virtual void DoSetBitmapMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } + virtual void DoSetBitmapPosition(wxDirection WXUNUSED(dir)) { }