X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a6c255cbc0a0f6757b9bef432aa30becd1b3da91..e4c903b2ea42fe104ef50d0ea6028f14d8309dfa:/include/wx/msw/bmpbuttn.h?ds=sidebyside diff --git a/include/wx/msw/bmpbuttn.h b/include/wx/msw/bmpbuttn.h index fc92a31363..aff0c0fe14 100644 --- a/include/wx/msw/bmpbuttn.h +++ b/include/wx/msw/bmpbuttn.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bmpbuttn.h +// Name: wx/msw/bmpbuttn.h // Purpose: wxBitmapButton class // Author: Julian Smart // Modified by: @@ -12,21 +12,15 @@ #ifndef _WX_BMPBUTTN_H_ #define _WX_BMPBUTTN_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "bmpbuttn.h" -#endif - #include "wx/button.h" #include "wx/bitmap.h" #include "wx/brush.h" -#define wxDEFAULT_BUTTON_MARGIN 4 - -class WXDLLEXPORT wxBitmapButton: public wxBitmapButtonBase +class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase { public: - wxBitmapButton() - { m_marginX = m_marginY = wxDEFAULT_BUTTON_MARGIN; } + wxBitmapButton() { Init(); } + wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, @@ -36,6 +30,8 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr) { + Init(); + Create(parent, id, bitmap, pos, size, style, validator, name); } @@ -48,21 +44,28 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr); - // Implementation - virtual bool SetBackgroundColour(const wxColour& colour); - virtual void SetDefault(); - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); - virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); - virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); - protected: - virtual wxSize DoGetBestSize() const; + // common part of all ctors + void Init() + { + m_disabledSetByUser = + m_hoverSetByUser = false; + } + + // reimplement some base class virtuals + virtual void DoSetBitmap(const wxBitmap& bitmap, State which); + + // true if disabled bitmap was set by user, false if we created it + // ourselves from the normal one + bool m_disabledSetByUser; + + // true if hover bitmap was set by user, false if it was set from focused + // one + bool m_hoverSetByUser; - wxBrush m_brushDisabled; + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) }; -#endif - // _WX_BMPBUTTN_H_ +#endif // _WX_BMPBUTTN_H_