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 WXDLLEXPORT_DATA(extern 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
33 : m_bmpNormal(), m_bmpSelected(), m_bmpFocus(), m_bmpDisabled()
34 , m_marginX(0), m_marginY(0)
38 void SetBitmapLabel(const wxBitmap
& bitmap
)
39 { m_bmpNormal
= bitmap
; OnSetBitmap(); }
40 void SetBitmapSelected(const wxBitmap
& sel
)
41 { m_bmpSelected
= sel
; OnSetBitmap(); };
42 void SetBitmapFocus(const wxBitmap
& focus
)
43 { m_bmpFocus
= focus
; OnSetBitmap(); };
44 void SetBitmapDisabled(const wxBitmap
& disabled
)
45 { m_bmpDisabled
= disabled
; OnSetBitmap(); };
46 void SetLabel(const wxBitmap
& bitmap
)
47 { SetBitmapLabel(bitmap
); }
49 // retrieve the bitmaps
50 const wxBitmap
& GetBitmapLabel() const { return m_bmpNormal
; }
51 const wxBitmap
& GetBitmapSelected() const { return m_bmpSelected
; }
52 const wxBitmap
& GetBitmapFocus() const { return m_bmpFocus
; }
53 const wxBitmap
& GetBitmapDisabled() const { return m_bmpDisabled
; }
54 wxBitmap
& GetBitmapLabel() { return m_bmpNormal
; }
55 wxBitmap
& GetBitmapSelected() { return m_bmpSelected
; }
56 wxBitmap
& GetBitmapFocus() { return m_bmpFocus
; }
57 wxBitmap
& GetBitmapDisabled() { return m_bmpDisabled
; }
59 // set/get the margins around the button
60 virtual void SetMargins(int x
, int y
) { m_marginX
= x
; m_marginY
= y
; }
61 int GetMarginX() const { return m_marginX
; }
62 int GetMarginY() const { return m_marginY
; }
65 // function called when any of the bitmaps changes
66 virtual void OnSetBitmap() { }
68 // the bitmaps for various states
74 // the margins around the bitmap
79 // Prevent Virtual function hiding warnings
80 void SetLabel(const wxString
& rsLabel
)
81 { wxWindowBase::SetLabel(rsLabel
); }
83 DECLARE_NO_COPY_CLASS(wxBitmapButtonBase
)
86 #if defined(__WXUNIVERSAL__)
87 #include "wx/univ/bmpbuttn.h"
88 #elif defined(__WXMSW__)
89 #include "wx/msw/bmpbuttn.h"
90 #elif defined(__WXMOTIF__)
91 #include "wx/motif/bmpbuttn.h"
92 #elif defined(__WXGTK__)
93 #include "wx/gtk/bmpbuttn.h"
94 #elif defined(__WXMAC__)
95 #include "wx/mac/bmpbuttn.h"
96 #elif defined(__WXCOCOA__)
97 #include "wx/cocoa/bmpbuttn.h"
98 #elif defined(__WXPM__)
99 #include "wx/os2/bmpbuttn.h"
102 #endif // wxUSE_BMPBUTTON
104 #endif // _WX_BMPBUTTON_H_BASE_