1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/bmpbutton.h
3 // Purpose: wxBitmapButton class interface
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_BMPBUTTON_H_BASE_
13 #define _WX_BMPBUTTON_H_BASE_
19 #include "wx/bitmap.h"
20 #include "wx/button.h"
22 extern WXDLLEXPORT_DATA(const wxChar
*) wxButtonNameStr
;
24 // ----------------------------------------------------------------------------
25 // wxBitmapButton: a button which shows bitmaps instead of the usual string.
26 // It has different bitmaps for different states (focused/disabled/pressed)
27 // ----------------------------------------------------------------------------
29 class WXDLLEXPORT wxBitmapButtonBase
: public wxButton
39 void SetBitmapLabel(const wxBitmap
& bitmap
)
40 { m_bmpNormal
= bitmap
; OnSetBitmap(); }
41 void SetBitmapSelected(const wxBitmap
& sel
)
42 { m_bmpSelected
= sel
; OnSetBitmap(); };
43 void SetBitmapFocus(const wxBitmap
& focus
)
44 { m_bmpFocus
= focus
; OnSetBitmap(); };
45 void SetBitmapDisabled(const wxBitmap
& disabled
)
46 { m_bmpDisabled
= disabled
; OnSetBitmap(); };
48 // retrieve the bitmaps
49 const wxBitmap
& GetBitmapLabel() const { return m_bmpNormal
; }
50 const wxBitmap
& GetBitmapSelected() const { return m_bmpSelected
; }
51 const wxBitmap
& GetBitmapFocus() const { return m_bmpFocus
; }
52 const wxBitmap
& GetBitmapDisabled() const { return m_bmpDisabled
; }
53 wxBitmap
& GetBitmapLabel() { return m_bmpNormal
; }
54 wxBitmap
& GetBitmapSelected() { return m_bmpSelected
; }
55 wxBitmap
& GetBitmapFocus() { return m_bmpFocus
; }
56 wxBitmap
& GetBitmapDisabled() { return m_bmpDisabled
; }
58 // set/get the margins around the button
59 virtual void SetMargins(int x
, int y
) { m_marginX
= x
; m_marginY
= y
; }
60 int GetMarginX() const { return m_marginX
; }
61 int GetMarginY() const { return m_marginY
; }
63 // deprecated synonym for SetBitmapLabel()
64 #if WXWIN_COMPATIBILITY_2_6
65 wxDEPRECATED( void SetLabel(const wxBitmap
& bitmap
) );
66 { SetBitmapLabel(bitmap
); }
68 // prevent virtual function hiding
69 virtual void SetLabel(const wxString
& label
)
70 { wxWindowBase::SetLabel(label
); }
71 #endif // WXWIN_COMPATIBILITY_2_6
74 // function called when any of the bitmaps changes
75 virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
77 // the bitmaps for various states
83 // the margins around the bitmap
88 DECLARE_NO_COPY_CLASS(wxBitmapButtonBase
)
91 #if WXWIN_COMPATIBILITY_2_6
92 inline void SetLabel(const wxBitmap
& bitmap
) { SetBitmapLabel(bitmap
); }
93 #endif // WXWIN_COMPATIBILITY_2_6
95 #if defined(__WXUNIVERSAL__)
96 #include "wx/univ/bmpbuttn.h"
97 #elif defined(__WXMSW__)
98 #include "wx/msw/bmpbuttn.h"
99 #elif defined(__WXMOTIF__)
100 #include "wx/motif/bmpbuttn.h"
101 #elif defined(__WXGTK__)
102 #include "wx/gtk/bmpbuttn.h"
103 #elif defined(__WXMAC__)
104 #include "wx/mac/bmpbuttn.h"
105 #elif defined(__WXCOCOA__)
106 #include "wx/cocoa/bmpbuttn.h"
107 #elif defined(__WXPM__)
108 #include "wx/os2/bmpbuttn.h"
111 #endif // wxUSE_BMPBUTTON
113 #endif // _WX_BMPBUTTON_H_BASE_