]>
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 | |
997176a3 VZ |
15 | #include "wx/defs.h" |
16 | ||
1e6feb95 VZ |
17 | #if wxUSE_BMPBUTTON |
18 | ||
19 | #include "wx/bitmap.h" | |
20 | #include "wx/button.h" | |
21 | ||
22 | WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr; | |
23 | ||
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 | // ---------------------------------------------------------------------------- | |
28 | ||
29 | class WXDLLEXPORT wxBitmapButtonBase : public wxButton | |
30 | { | |
31 | public: | |
1169a919 | 32 | wxBitmapButtonBase(); |
1e6feb95 VZ |
33 | |
34 | // set the bitmaps | |
35 | void SetBitmapLabel(const wxBitmap& bitmap) | |
36 | { m_bmpNormal = bitmap; OnSetBitmap(); } | |
37 | void SetBitmapSelected(const wxBitmap& sel) | |
38 | { m_bmpSelected = sel; OnSetBitmap(); }; | |
39 | void SetBitmapFocus(const wxBitmap& focus) | |
40 | { m_bmpFocus = focus; OnSetBitmap(); }; | |
41 | void SetBitmapDisabled(const wxBitmap& disabled) | |
42 | { m_bmpDisabled = disabled; OnSetBitmap(); }; | |
43 | void SetLabel(const wxBitmap& bitmap) | |
44 | { SetBitmapLabel(bitmap); } | |
45 | ||
46 | // retrieve the bitmaps | |
47 | const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; } | |
48 | const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; } | |
49 | const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; } | |
50 | const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } | |
51 | wxBitmap& GetBitmapLabel() { return m_bmpNormal; } | |
52 | wxBitmap& GetBitmapSelected() { return m_bmpSelected; } | |
53 | wxBitmap& GetBitmapFocus() { return m_bmpFocus; } | |
54 | wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; } | |
55 | ||
56 | // set/get the margins around the button | |
57 | virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } | |
58 | int GetMarginX() const { return m_marginX; } | |
59 | int GetMarginY() const { return m_marginY; } | |
60 | ||
61 | protected: | |
62 | // function called when any of the bitmaps changes | |
63 | virtual void OnSetBitmap() { } | |
64 | ||
65 | // the bitmaps for various states | |
66 | wxBitmap m_bmpNormal, | |
67 | m_bmpSelected, | |
68 | m_bmpFocus, | |
69 | m_bmpDisabled; | |
70 | ||
71 | // the margins around the bitmap | |
72 | int m_marginX, | |
73 | m_marginY; | |
fc7a2a60 | 74 | |
210a651b DW |
75 | private: |
76 | // Prevent Virtual function hiding warnings | |
77 | void SetLabel(const wxString& rsLabel) | |
fc7a2a60 VZ |
78 | { wxWindowBase::SetLabel(rsLabel); } |
79 | ||
80 | DECLARE_NO_COPY_CLASS(wxBitmapButtonBase) | |
1e6feb95 VZ |
81 | }; |
82 | ||
83 | #if defined(__WXUNIVERSAL__) | |
84 | #include "wx/univ/bmpbuttn.h" | |
85 | #elif defined(__WXMSW__) | |
86 | #include "wx/msw/bmpbuttn.h" | |
2049ba38 | 87 | #elif defined(__WXMOTIF__) |
1e6feb95 | 88 | #include "wx/motif/bmpbuttn.h" |
2049ba38 | 89 | #elif defined(__WXGTK__) |
1e6feb95 | 90 | #include "wx/gtk/bmpbuttn.h" |
34138703 | 91 | #elif defined(__WXMAC__) |
1e6feb95 | 92 | #include "wx/mac/bmpbuttn.h" |
e64df9bc DE |
93 | #elif defined(__WXCOCOA__) |
94 | #include "wx/cocoa/bmpbuttn.h" | |
1777b9bb | 95 | #elif defined(__WXPM__) |
1e6feb95 | 96 | #include "wx/os2/bmpbuttn.h" |
c801d85f KB |
97 | #endif |
98 | ||
1e6feb95 VZ |
99 | #endif // wxUSE_BMPBUTTON |
100 | ||
101 | #endif // _WX_BMPBUTTON_H_BASE_ |