]>
Commit | Line | Data |
---|---|---|
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 | ||
27 | //----------------------------------------------------------------------------- | |
28 | // classes | |
29 | //----------------------------------------------------------------------------- | |
30 | ||
31 | class wxBitmapButton; | |
32 | ||
33 | //----------------------------------------------------------------------------- | |
34 | // global data | |
35 | //----------------------------------------------------------------------------- | |
36 | ||
37 | extern const wxChar *wxButtonNameStr; | |
38 | ||
39 | //----------------------------------------------------------------------------- | |
40 | // wxBitmapButton | |
41 | //----------------------------------------------------------------------------- | |
42 | ||
43 | class wxBitmapButton: public wxControl | |
44 | { | |
45 | DECLARE_DYNAMIC_CLASS(wxBitmapButton) | |
46 | ||
47 | public: | |
48 | wxBitmapButton(); | |
49 | inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, | |
52 | const wxValidator& validator = wxDefaultValidator, | |
53 | const wxString& name = wxButtonNameStr ) | |
54 | { | |
55 | Create(parent, id, bitmap, pos, size, style, validator, name); | |
56 | } | |
57 | bool Create( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, | |
58 | const wxPoint& pos = wxDefaultPosition, | |
59 | const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, | |
60 | const wxValidator& validator = wxDefaultValidator, | |
61 | const wxString& name = wxButtonNameStr); | |
62 | void SetDefault(); | |
63 | ||
64 | void SetLabel( const wxString &label ); | |
65 | wxString GetLabel() const; | |
66 | virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); } | |
67 | ||
68 | wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_disabled; } | |
69 | wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_focus; } | |
70 | wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_bitmap; } | |
71 | wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_selected; } | |
72 | ||
73 | void SetBitmapDisabled( const wxBitmap& bitmap ); | |
74 | void SetBitmapFocus( const wxBitmap& bitmap ); | |
75 | void SetBitmapLabel( const wxBitmap& bitmap ); | |
76 | void SetBitmapSelected( const wxBitmap& bitmap ); | |
77 | ||
78 | virtual bool Enable(bool enable); | |
79 | ||
80 | // implementation | |
81 | ||
82 | void HasFocus(); | |
83 | void NotFocus(); | |
84 | void StartSelect(); | |
85 | void EndSelect(); | |
86 | void SetBitmap(); | |
87 | void ApplyWidgetStyle(); | |
88 | ||
89 | bool m_hasFocus; | |
90 | bool m_isSelected; | |
91 | wxBitmap m_bitmap; | |
92 | wxBitmap m_disabled; | |
93 | wxBitmap m_focus; | |
94 | wxBitmap m_selected; | |
95 | }; | |
96 | ||
97 | #endif | |
98 | ||
99 | #endif // __BMPBUTTONH__ |