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 WXDLLIMPEXP_DATA_CORE(const char) 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 WXDLLIMPEXP_CORE wxBitmapButtonBase
: public wxButton
38 // set/get the margins around the button
39 virtual void SetMargins(int x
, int y
) { m_marginX
= x
; m_marginY
= y
; }
40 int GetMarginX() const { return m_marginX
; }
41 int GetMarginY() const { return m_marginY
; }
43 // deprecated synonym for SetBitmapLabel()
44 #if WXWIN_COMPATIBILITY_2_6
45 wxDEPRECATED( void SetLabel(const wxBitmap
& bitmap
) );
47 // prevent virtual function hiding
48 virtual void SetLabel(const wxString
& label
)
49 { wxWindow::SetLabel(label
); }
50 #endif // WXWIN_COMPATIBILITY_2_6
53 // function called when any of the bitmaps changes
54 virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
56 virtual wxBitmap
DoGetBitmap(State which
) const { return m_bitmaps
[which
]; }
57 virtual void DoSetBitmap(const wxBitmap
& bitmap
, State which
)
58 { m_bitmaps
[which
] = bitmap
; OnSetBitmap(); }
60 // the bitmaps for various states
61 wxBitmap m_bitmaps
[State_Max
];
63 // the margins around the bitmap
68 wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase
);
71 #if WXWIN_COMPATIBILITY_2_6
72 inline void wxBitmapButtonBase::SetLabel(const wxBitmap
& bitmap
)
74 SetBitmapLabel(bitmap
);
76 #endif // WXWIN_COMPATIBILITY_2_6
78 #if defined(__WXUNIVERSAL__)
79 #include "wx/univ/bmpbuttn.h"
80 #elif defined(__WXMSW__)
81 #include "wx/msw/bmpbuttn.h"
82 #elif defined(__WXMOTIF__)
83 #include "wx/motif/bmpbuttn.h"
84 #elif defined(__WXGTK20__)
85 #include "wx/gtk/bmpbuttn.h"
86 #elif defined(__WXGTK__)
87 #include "wx/gtk1/bmpbuttn.h"
88 #elif defined(__WXMAC__)
89 #include "wx/osx/bmpbuttn.h"
90 #elif defined(__WXCOCOA__)
91 #include "wx/cocoa/bmpbuttn.h"
92 #elif defined(__WXPM__)
93 #include "wx/os2/bmpbuttn.h"
94 #elif defined(__WXPALMOS__)
95 #include "wx/palmos/bmpbuttn.h"
98 #endif // wxUSE_BMPBUTTON
100 #endif // _WX_BMPBUTTON_H_BASE_