]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/bmpbuttn.h
applied patch 432814: saving BMP in 1, 4 and 8 bpp
[wxWidgets.git] / include / wx / univ / bmpbuttn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/bmpbuttn.h
3 // Purpose: wxBitmapButton class for wxUniversal
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 25.08.00
7 // RCS-ID: $Id$
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_UNIV_BMPBUTTN_H_
13 #define _WX_UNIV_BMPBUTTN_H_
14
15 #ifdef __GNUG__
16 #pragma interface "univbmpbuttn.h"
17 #endif
18
19 class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase
20 {
21 public:
22 wxBitmapButton() { }
23
24 wxBitmapButton(wxWindow *parent,
25 wxWindowID id,
26 const wxBitmap& bitmap,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = 0,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxButtonNameStr)
32 {
33 Create(parent, id, bitmap, pos, size, style, validator, name);
34 }
35
36 bool Create(wxWindow *parent,
37 wxWindowID id,
38 const wxBitmap& bitmap,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxButtonNameStr);
44
45 virtual void SetMargins(int x, int y)
46 {
47 SetImageMargins(x, y);
48
49 wxBitmapButtonBase::SetMargins(x, y);
50 }
51
52 virtual bool Enable(bool enable = TRUE);
53
54 virtual bool SetCurrent(bool doit = TRUE);
55
56 virtual void Press();
57 virtual void Release();
58
59 protected:
60 void OnSetFocus(wxFocusEvent& event);
61 void OnKillFocus(wxFocusEvent& event);
62
63 // called when one of the bitmap is changed by user
64 virtual void OnSetBitmap();
65
66 // set bitmap to the given one if it's ok or to m_bmpNormal and return
67 // TRUE if the bitmap really changed
68 bool ChangeBitmap(const wxBitmap& bmp);
69
70 private:
71 DECLARE_EVENT_TABLE()
72 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
73 };
74
75 #endif // _WX_UNIV_BMPBUTTN_H_
76