]>
Commit | Line | Data |
---|---|---|
1e6feb95 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/bmpbutton.h | |
3 | // Purpose: wxBitmapButton class interface | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 25.08.00 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2000 Vadim Zeitlin | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
34138703 JS |
12 | #ifndef _WX_BMPBUTTON_H_BASE_ |
13 | #define _WX_BMPBUTTON_H_BASE_ | |
c801d85f | 14 | |
1e6feb95 VZ |
15 | #if wxUSE_BMPBUTTON |
16 | ||
17 | #include "wx/bitmap.h" | |
18 | #include "wx/button.h" | |
19 | ||
20 | WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr; | |
21 | ||
22 | // ---------------------------------------------------------------------------- | |
23 | // wxBitmapButton: a button which shows bitmaps instead of the usual string. | |
24 | // It has different bitmaps for different states (focused/disabled/pressed) | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | class WXDLLEXPORT wxBitmapButtonBase : public wxButton | |
28 | { | |
29 | public: | |
30 | wxBitmapButtonBase() { m_marginX = m_marginY = 0; } | |
31 | ||
32 | // set the bitmaps | |
33 | void SetBitmapLabel(const wxBitmap& bitmap) | |
34 | { m_bmpNormal = bitmap; OnSetBitmap(); } | |
35 | void SetBitmapSelected(const wxBitmap& sel) | |
36 | { m_bmpSelected = sel; OnSetBitmap(); }; | |
37 | void SetBitmapFocus(const wxBitmap& focus) | |
38 | { m_bmpFocus = focus; OnSetBitmap(); }; | |
39 | void SetBitmapDisabled(const wxBitmap& disabled) | |
40 | { m_bmpDisabled = disabled; OnSetBitmap(); }; | |
41 | void SetLabel(const wxBitmap& bitmap) | |
42 | { SetBitmapLabel(bitmap); } | |
43 | ||
44 | // retrieve the bitmaps | |
45 | const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; } | |
46 | const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; } | |
47 | const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; } | |
48 | const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } | |
49 | wxBitmap& GetBitmapLabel() { return m_bmpNormal; } | |
50 | wxBitmap& GetBitmapSelected() { return m_bmpSelected; } | |
51 | wxBitmap& GetBitmapFocus() { return m_bmpFocus; } | |
52 | wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; } | |
53 | ||
54 | // set/get the margins around the button | |
55 | virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } | |
56 | int GetMarginX() const { return m_marginX; } | |
57 | int GetMarginY() const { return m_marginY; } | |
58 | ||
59 | protected: | |
60 | // function called when any of the bitmaps changes | |
61 | virtual void OnSetBitmap() { } | |
62 | ||
63 | // the bitmaps for various states | |
64 | wxBitmap m_bmpNormal, | |
65 | m_bmpSelected, | |
66 | m_bmpFocus, | |
67 | m_bmpDisabled; | |
68 | ||
69 | // the margins around the bitmap | |
70 | int m_marginX, | |
71 | m_marginY; | |
210a651b DW |
72 | private: |
73 | // Prevent Virtual function hiding warnings | |
74 | void SetLabel(const wxString& rsLabel) | |
75 | { wxWindowBase::SetLabel(rsLabel); } | |
1e6feb95 VZ |
76 | }; |
77 | ||
78 | #if defined(__WXUNIVERSAL__) | |
79 | #include "wx/univ/bmpbuttn.h" | |
80 | #elif defined(__WXMSW__) | |
81 | #include "wx/msw/bmpbuttn.h" | |
2049ba38 | 82 | #elif defined(__WXMOTIF__) |
1e6feb95 | 83 | #include "wx/motif/bmpbuttn.h" |
2049ba38 | 84 | #elif defined(__WXGTK__) |
1e6feb95 | 85 | #include "wx/gtk/bmpbuttn.h" |
b4e76e0d | 86 | #elif defined(__WXQT__) |
1e6feb95 | 87 | #include "wx/qt/bmpbuttn.h" |
34138703 | 88 | #elif defined(__WXMAC__) |
1e6feb95 | 89 | #include "wx/mac/bmpbuttn.h" |
1777b9bb | 90 | #elif defined(__WXPM__) |
1e6feb95 | 91 | #include "wx/os2/bmpbuttn.h" |
34138703 | 92 | #elif defined(__WXSTUBS__) |
1e6feb95 | 93 | #include "wx/stubs/bmpbuttn.h" |
c801d85f KB |
94 | #endif |
95 | ||
1e6feb95 VZ |
96 | #endif // wxUSE_BMPBUTTON |
97 | ||
98 | #endif // _WX_BMPBUTTON_H_BASE_ |