1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBitmapButton class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_BMPBUTTN_H_
13 #define _WX_BMPBUTTN_H_
16 #pragma interface "bmpbuttn.h"
19 #include "wx/button.h"
21 WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr
;
23 #define wxDEFAULT_BUTTON_MARGIN 4
25 class WXDLLEXPORT wxBitmapButton
: public wxButton
27 DECLARE_DYNAMIC_CLASS(wxBitmapButton
)
29 inline wxBitmapButton() { m_marginX
= wxDEFAULT_BUTTON_MARGIN
; m_marginY
= wxDEFAULT_BUTTON_MARGIN
; }
30 inline wxBitmapButton(wxWindow
*parent
, wxWindowID id
, const wxBitmap
& bitmap
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
, long style
= wxBU_AUTODRAW
,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxButtonNameStr
)
36 Create(parent
, id
, bitmap
, pos
, size
, style
, validator
, name
);
39 bool Create(wxWindow
*parent
, wxWindowID id
, const wxBitmap
& bitmap
,
40 const wxPoint
& pos
= wxDefaultPosition
,
41 const wxSize
& size
= wxDefaultSize
, long style
= wxBU_AUTODRAW
,
42 const wxValidator
& validator
= wxDefaultValidator
,
43 const wxString
& name
= wxButtonNameStr
);
45 virtual void SetLabel(const wxBitmap
& bitmap
)
47 SetBitmapLabel(bitmap
);
50 virtual void SetLabel( const wxString
&name
) {}
52 virtual void SetBitmapLabel(const wxBitmap
& bitmap
);
54 inline wxBitmap
& GetBitmapLabel() const { return (wxBitmap
&) m_buttonBitmap
; }
55 inline wxBitmap
& GetBitmapSelected() const { return (wxBitmap
&) m_buttonBitmapSelected
; }
56 inline wxBitmap
& GetBitmapFocus() const { return (wxBitmap
&) m_buttonBitmapFocus
; }
57 inline wxBitmap
& GetBitmapDisabled() const { return (wxBitmap
&) m_buttonBitmapDisabled
; }
59 inline void SetBitmapSelected(const wxBitmap
& sel
) { m_buttonBitmapSelected
= sel
; };
60 inline void SetBitmapFocus(const wxBitmap
& focus
) { m_buttonBitmapFocus
= focus
; };
61 inline void SetBitmapDisabled(const wxBitmap
& disabled
) { m_buttonBitmapDisabled
= disabled
; };
63 inline void SetMargins(int x
, int y
) { m_marginX
= x
; m_marginY
= y
; }
64 inline int GetMarginX() { return m_marginX
; }
65 inline int GetMarginY() { return m_marginY
; }
68 // TODO: Implementation
69 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
70 virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel );
71 virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
72 virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
76 wxBitmap m_buttonBitmap
;
77 wxBitmap m_buttonBitmapSelected
;
78 wxBitmap m_buttonBitmapFocus
;
79 wxBitmap m_buttonBitmapDisabled
;