]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: bmpbuttn.h | |
3 | // Purpose: wxBitmapButton class | |
37f214d5 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
37f214d5 | 6 | // Created: 10/13/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
37f214d5 DW |
8 | // Copyright: (c) David Webster |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_BMPBUTTN_H_ | |
13 | #define _WX_BMPBUTTN_H_ | |
14 | ||
0e320a79 DW |
15 | #include "wx/button.h" |
16 | ||
17 | WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr; | |
18 | ||
19 | #define wxDEFAULT_BUTTON_MARGIN 4 | |
20 | ||
210a651b | 21 | class WXDLLEXPORT wxBitmapButton: public wxBitmapButtonBase |
0e320a79 | 22 | { |
db16e5c3 DW |
23 | public: |
24 | inline wxBitmapButton() | |
25 | { | |
26 | m_marginX = wxDEFAULT_BUTTON_MARGIN; | |
27 | m_marginY = wxDEFAULT_BUTTON_MARGIN; | |
28 | } | |
29 | inline wxBitmapButton( wxWindow* pParent | |
30 | ,wxWindowID vId | |
31 | ,const wxBitmap& rBitmap | |
32 | ,const wxPoint& rPos = wxDefaultPosition | |
33 | ,const wxSize& rSize = wxDefaultSize | |
34 | ,long lStyle = wxBU_AUTODRAW | |
57c4d796 | 35 | #if wxUSE_VALIDATORS |
db16e5c3 | 36 | ,const wxValidator& rValidator = wxDefaultValidator |
57c4d796 | 37 | #endif |
db16e5c3 DW |
38 | ,const wxString& rsName = wxButtonNameStr |
39 | ) | |
40 | { | |
41 | Create( pParent | |
42 | ,vId | |
43 | ,rBitmap | |
44 | ,rPos | |
45 | ,rSize | |
46 | ,lStyle | |
57c4d796 | 47 | #if wxUSE_VALIDATORS |
db16e5c3 | 48 | ,rValidator |
57c4d796 | 49 | #endif |
db16e5c3 DW |
50 | ,rsName |
51 | ); | |
52 | } | |
0e320a79 | 53 | |
db16e5c3 DW |
54 | bool Create( wxWindow* pParent |
55 | ,wxWindowID vId | |
56 | ,const wxBitmap& rBitmap | |
57 | ,const wxPoint& rPos = wxDefaultPosition | |
58 | ,const wxSize& rSize = wxDefaultSize | |
59 | ,long lStyle = wxBU_AUTODRAW | |
60 | #if wxUSE_VALIDATORS | |
61 | ,const wxValidator& rValidator = wxDefaultValidator | |
62 | #endif | |
63 | ,const wxString& rsName = wxButtonNameStr | |
64 | ); | |
0e320a79 | 65 | |
db16e5c3 DW |
66 | virtual void SetLabel(const wxBitmap& rBitmap) |
67 | { | |
68 | SetBitmapLabel(rBitmap); | |
69 | } | |
0e320a79 | 70 | |
37f214d5 | 71 | #if WXWIN_COMPATIBILITY |
db16e5c3 DW |
72 | wxBitmap* GetBitmap(void) const |
73 | { | |
74 | return (wxBitmap *)&m_buttonBitmap; | |
75 | } | |
37f214d5 DW |
76 | #endif |
77 | ||
db16e5c3 DW |
78 | // |
79 | // Implementation | |
80 | // | |
81 | virtual void SetDefault(); | |
82 | virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* pItem); | |
0e320a79 | 83 | |
db16e5c3 | 84 | private: |
0e320a79 | 85 | |
db16e5c3 DW |
86 | virtual void DrawFace( wxClientDC& rDC |
87 | ,bool bSel | |
88 | ); | |
89 | virtual void DrawButtonFocus(wxClientDC& rDC); | |
90 | virtual void DrawButtonDisable( wxClientDC& rDC | |
91 | ,wxBitmap& rBmp | |
92 | ); | |
93 | DECLARE_DYNAMIC_CLASS(wxBitmapButton) | |
0e320a79 | 94 | |
db16e5c3 DW |
95 | virtual void SetLabel(const wxString& rsString) |
96 | { | |
97 | wxButton::SetLabel(rsString); | |
98 | } | |
99 | }; // end of CLASS wxBitmapButton | |
0e320a79 | 100 | |
db16e5c3 | 101 | #endif // _WX_BMPBUTTN_H_ |
0e320a79 | 102 |