]> git.saurik.com Git - wxWidgets.git/blob - include/wx/bmpbuttn.h
use WPARAM (which is 64 bit under Win64) for timer ids instead of long (which is...
[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/bitmap.h"
20 #include "wx/button.h"
21
22 extern WXDLLIMPEXP_DATA_CORE(const char) 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 WXDLLIMPEXP_CORE wxBitmapButtonBase : public wxButton
30 {
31 public:
32 wxBitmapButtonBase()
33 {
34 m_marginX =
35 m_marginY = 0;
36 }
37
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; }
42
43 // deprecated synonym for SetBitmapLabel()
44 #if WXWIN_COMPATIBILITY_2_6
45 wxDEPRECATED( void SetLabel(const wxBitmap& bitmap) );
46
47 // prevent virtual function hiding
48 virtual void SetLabel(const wxString& label)
49 { wxWindow::SetLabel(label); }
50 #endif // WXWIN_COMPATIBILITY_2_6
51
52 protected:
53 // function called when any of the bitmaps changes
54 virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
55
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(); }
59
60 // the bitmaps for various states
61 wxBitmap m_bitmaps[State_Max];
62
63 // the margins around the bitmap
64 int m_marginX,
65 m_marginY;
66
67
68 wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase);
69 };
70
71 #if WXWIN_COMPATIBILITY_2_6
72 inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap)
73 {
74 SetBitmapLabel(bitmap);
75 }
76 #endif // WXWIN_COMPATIBILITY_2_6
77
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"
96 #endif
97
98 #endif // wxUSE_BMPBUTTON
99
100 #endif // _WX_BMPBUTTON_H_BASE_