]> git.saurik.com Git - wxWidgets.git/blob - include/wx/bmpbuttn.h
fix PCH-less build after changing timer id type to WPARAM (closes #10901)
[wxWidgets.git] / include / wx / bmpbuttn.h
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
12 #ifndef _WX_BMPBUTTON_H_BASE_
13 #define _WX_BMPBUTTON_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_BMPBUTTON
18
19 #include "wx/button.h"
20
21 // FIXME: right now only wxMSW implements bitmap support in wxButton
22 // itself, this shouldn't be used for the other platforms neither
23 // when all of them do it
24 #ifdef __WXMSW__
25 #define wxHAS_BUTTON_BITMAP
26 #endif
27
28 // ----------------------------------------------------------------------------
29 // wxBitmapButton: a button which shows bitmaps instead of the usual string.
30 // It has different bitmaps for different states (focused/disabled/pressed)
31 // ----------------------------------------------------------------------------
32
33 class WXDLLIMPEXP_CORE wxBitmapButtonBase : public wxButton
34 {
35 public:
36 wxBitmapButtonBase()
37 {
38 #ifndef wxHAS_BUTTON_BITMAP
39 m_marginX =
40 m_marginY = 0;
41 #endif // wxHAS_BUTTON_BITMAP
42 }
43
44 // set/get the margins around the button
45 virtual void SetMargins(int x, int y)
46 {
47 DoSetBitmapMargins(x, y);
48 }
49
50 int GetMarginX() const { return DoGetBitmapMargins().x; }
51 int GetMarginY() const { return DoGetBitmapMargins().y; }
52
53 // deprecated synonym for SetBitmapLabel()
54 #if WXWIN_COMPATIBILITY_2_6
55 wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap).
56 SetBitmapLabel(bitmap); );
57
58 // prevent virtual function hiding
59 virtual void SetLabel(const wxString& label)
60 { wxWindow::SetLabel(label); }
61 #endif // WXWIN_COMPATIBILITY_2_6
62
63 protected:
64 #ifndef wxHAS_BUTTON_BITMAP
65 // function called when any of the bitmaps changes
66 virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
67
68 virtual wxBitmap DoGetBitmap(State which) const { return m_bitmaps[which]; }
69 virtual void DoSetBitmap(const wxBitmap& bitmap, State which)
70 { m_bitmaps[which] = bitmap; OnSetBitmap(); }
71
72 virtual wxSize DoGetBitmapMargins() const
73 {
74 return wxSize(m_marginX, m_marginY);
75 }
76
77 virtual void DoSetBitmapMargins(int x, int y)
78 {
79 m_marginX = x;
80 m_marginY = y;
81 }
82
83 // the bitmaps for various states
84 wxBitmap m_bitmaps[State_Max];
85
86 // the margins around the bitmap
87 int m_marginX,
88 m_marginY;
89 #endif // !wxHAS_BUTTON_BITMAP
90
91 wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase);
92 };
93
94 #if defined(__WXUNIVERSAL__)
95 #include "wx/univ/bmpbuttn.h"
96 #elif defined(__WXMSW__)
97 #include "wx/msw/bmpbuttn.h"
98 #elif defined(__WXMOTIF__)
99 #include "wx/motif/bmpbuttn.h"
100 #elif defined(__WXGTK20__)
101 #include "wx/gtk/bmpbuttn.h"
102 #elif defined(__WXGTK__)
103 #include "wx/gtk1/bmpbuttn.h"
104 #elif defined(__WXMAC__)
105 #include "wx/osx/bmpbuttn.h"
106 #elif defined(__WXCOCOA__)
107 #include "wx/cocoa/bmpbuttn.h"
108 #elif defined(__WXPM__)
109 #include "wx/os2/bmpbuttn.h"
110 #elif defined(__WXPALMOS__)
111 #include "wx/palmos/bmpbuttn.h"
112 #endif
113
114 #endif // wxUSE_BMPBUTTON
115
116 #endif // _WX_BMPBUTTON_H_BASE_