]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: bmpbutton.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
dbf858b5 | 5 | // Id: $Id$ |
01111366 | 6 | // Copyright: (c) 1998 Robert Roebling |
c801d85f KB |
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" | |
dcf924a3 RR |
19 | |
20 | #if wxUSE_BMPBUTTON | |
21 | ||
c801d85f KB |
22 | #include "wx/object.h" |
23 | #include "wx/list.h" | |
24 | #include "wx/control.h" | |
ac57418f | 25 | #include "wx/bitmap.h" |
42b4e99e | 26 | #include "wx/button.h" |
c801d85f KB |
27 | |
28 | //----------------------------------------------------------------------------- | |
29 | // classes | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
32 | class wxBitmapButton; | |
33 | ||
151ccd11 RR |
34 | //----------------------------------------------------------------------------- |
35 | // global data | |
36 | //----------------------------------------------------------------------------- | |
37 | ||
c980c992 | 38 | extern const wxChar *wxButtonNameStr; |
151ccd11 | 39 | |
c801d85f KB |
40 | //----------------------------------------------------------------------------- |
41 | // wxBitmapButton | |
42 | //----------------------------------------------------------------------------- | |
43 | ||
42b4e99e | 44 | class wxBitmapButton: public wxButton |
151ccd11 | 45 | { |
43a18898 | 46 | public: |
738f9e5a RR |
47 | wxBitmapButton(); |
48 | inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, | |
43a18898 RR |
49 | const wxPoint& pos = wxDefaultPosition, |
50 | const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, | |
51 | const wxValidator& validator = wxDefaultValidator, | |
52 | const wxString& name = wxButtonNameStr ) | |
738f9e5a RR |
53 | { |
54 | Create(parent, id, bitmap, pos, size, style, validator, name); | |
55 | } | |
56 | bool Create( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, | |
43a18898 RR |
57 | const wxPoint& pos = wxDefaultPosition, |
58 | const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, | |
59 | const wxValidator& validator = wxDefaultValidator, | |
60 | const wxString& name = wxButtonNameStr); | |
738f9e5a | 61 | virtual void SetDefault(); |
151ccd11 | 62 | |
738f9e5a RR |
63 | void SetLabel( const wxString &label ); |
64 | wxString GetLabel() const; | |
65 | virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); } | |
58614078 | 66 | |
738f9e5a RR |
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; } | |
43a18898 | 71 | |
738f9e5a RR |
72 | void SetBitmapDisabled( const wxBitmap& bitmap ); |
73 | void SetBitmapFocus( const wxBitmap& bitmap ); | |
74 | void SetBitmapLabel( const wxBitmap& bitmap ); | |
75 | void SetBitmapSelected( const wxBitmap& bitmap ); | |
151ccd11 | 76 | |
f6bcfd97 BP |
77 | void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } |
78 | int GetMarginX() const { return m_marginX; } | |
79 | int GetMarginY() const { return m_marginY; } | |
80 | ||
738f9e5a | 81 | virtual bool Enable(bool enable); |
43a18898 | 82 | |
20e05ffb RR |
83 | // implementation |
84 | // -------------- | |
85 | ||
738f9e5a RR |
86 | void HasFocus(); |
87 | void NotFocus(); | |
88 | void StartSelect(); | |
89 | void EndSelect(); | |
90 | void SetBitmap(); | |
91 | void ApplyWidgetStyle(); | |
92 | ||
93 | bool m_hasFocus; | |
94 | bool m_isSelected; | |
95 | wxBitmap m_bitmap; | |
96 | wxBitmap m_disabled; | |
97 | wxBitmap m_focus; | |
98 | wxBitmap m_selected; | |
43a18898 | 99 | |
f6bcfd97 BP |
100 | protected: |
101 | int m_marginX; | |
102 | int m_marginY; | |
103 | ||
738f9e5a RR |
104 | private: |
105 | DECLARE_DYNAMIC_CLASS(wxBitmapButton) | |
151ccd11 | 106 | }; |
43a18898 | 107 | |
dcf924a3 RR |
108 | #endif |
109 | ||
c801d85f | 110 | #endif // __BMPBUTTONH__ |