]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/bmpbuttn.h
Cleaned up paint DC cache in ~wxPaintDC to avoid spurious memory warning
[wxWidgets.git] / include / wx / gtk / bmpbuttn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: bmpbutton.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __BMPBUTTONH__
12 #define __BMPBUTTONH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19
20 #if wxUSE_BMPBUTTON
21
22 #include "wx/object.h"
23 #include "wx/list.h"
24 #include "wx/control.h"
25 #include "wx/bitmap.h"
26 #include "wx/button.h"
27
28 //-----------------------------------------------------------------------------
29 // classes
30 //-----------------------------------------------------------------------------
31
32 class wxBitmapButton;
33
34 //-----------------------------------------------------------------------------
35 // global data
36 //-----------------------------------------------------------------------------
37
38 extern const wxChar *wxButtonNameStr;
39
40 //-----------------------------------------------------------------------------
41 // wxBitmapButton
42 //-----------------------------------------------------------------------------
43
44 class wxBitmapButton: public wxButton
45 {
46 public:
47 wxBitmapButton();
48 inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
51 const wxValidator& validator = wxDefaultValidator,
52 const wxString& name = wxButtonNameStr )
53 {
54 Create(parent, id, bitmap, pos, size, style, validator, name);
55 }
56 bool Create( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
59 const wxValidator& validator = wxDefaultValidator,
60 const wxString& name = wxButtonNameStr);
61 virtual void SetDefault();
62
63 void SetLabel( const wxString &label );
64 wxString GetLabel() const;
65 virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); }
66
67 wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_disabled; }
68 wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_focus; }
69 wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_bitmap; }
70 wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_selected; }
71
72 void SetBitmapDisabled( const wxBitmap& bitmap );
73 void SetBitmapFocus( const wxBitmap& bitmap );
74 void SetBitmapLabel( const wxBitmap& bitmap );
75 void SetBitmapSelected( const wxBitmap& bitmap );
76
77 virtual bool Enable(bool enable);
78
79 // implementation
80
81 void HasFocus();
82 void NotFocus();
83 void StartSelect();
84 void EndSelect();
85 void SetBitmap();
86 void ApplyWidgetStyle();
87
88 bool m_hasFocus;
89 bool m_isSelected;
90 wxBitmap m_bitmap;
91 wxBitmap m_disabled;
92 wxBitmap m_focus;
93 wxBitmap m_selected;
94
95 private:
96 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
97 };
98
99 #endif
100
101 #endif // __BMPBUTTONH__