]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/bmpbuttn.h
Further performance optimizations
[wxWidgets.git] / include / wx / gtk / bmpbuttn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/bmpbutton.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GTK_BMPBUTTON_H_
11 #define _WX_GTK_BMPBUTTON_H_
12
13 // ----------------------------------------------------------------------------
14 // wxBitmapButton
15 // ----------------------------------------------------------------------------
16
17 class WXDLLIMPEXP_CORE wxBitmapButton: public wxBitmapButtonBase
18 {
19 public:
20 wxBitmapButton() { Init(); }
21
22 wxBitmapButton(wxWindow *parent,
23 wxWindowID id,
24 const wxBitmap& bitmap,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize,
27 long style = wxBU_AUTODRAW,
28 const wxValidator& validator = wxDefaultValidator,
29 const wxString& name = wxButtonNameStr)
30 {
31 Init();
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 = wxBU_AUTODRAW,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxButtonNameStr);
44
45 void SetLabel( const wxString &label );
46 virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); }
47
48 virtual bool Enable(bool enable = true);
49
50 // implementation
51 // --------------
52
53 void GTKMouseEnters();
54 void GTKMouseLeaves();
55 void GTKPressed();
56 void GTKReleased();
57
58 protected:
59 virtual void OnSetBitmap();
60 virtual wxSize DoGetBestSize() const;
61 void DoApplyWidgetStyle(GtkRcStyle *style);
62
63 void Init();
64
65 private:
66 void OnFocusChange(wxFocusEvent& event);
67
68 // true iff mouse hovers over the button
69 bool m_mouseHovers;
70 // true iff the button is in pressed state
71 bool m_isPressed;
72
73 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
74 DECLARE_EVENT_TABLE()
75 };
76
77 #endif // _WX_GTK_BMPBUTTON_H_