1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBitmapButton class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
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
)
31 inline wxBitmapButton(wxWindow
*parent
, wxWindowID id
, const wxBitmap
& bitmap
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
, long style
= wxBU_AUTODRAW
,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxButtonNameStr
)
37 Create(parent
, id
, bitmap
, pos
, size
, style
, validator
, name
);
40 bool Create(wxWindow
*parent
, wxWindowID id
, const wxBitmap
& bitmap
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
, long style
= wxBU_AUTODRAW
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxButtonNameStr
);
46 virtual void SetLabel(const wxBitmap
& bitmap
)
48 SetBitmapLabel(bitmap
);
51 virtual void SetBitmapLabel(const wxBitmap
& bitmap
);
53 inline wxBitmap
& GetBitmapLabel() const { return (wxBitmap
&) m_buttonBitmap
; }
54 inline wxBitmap
& GetBitmapSelected() const { return (wxBitmap
&) m_buttonBitmapSelected
; }
55 inline wxBitmap
& GetBitmapFocus() const { return (wxBitmap
&) m_buttonBitmapFocus
; }
56 inline wxBitmap
& GetBitmapDisabled() const { return (wxBitmap
&) m_buttonBitmapDisabled
; }
58 void SetBitmapSelected(const wxBitmap
& sel
);
59 void SetBitmapFocus(const wxBitmap
& focus
);
60 void SetBitmapDisabled(const wxBitmap
& disabled
);
62 inline void SetMargins(int x
, int y
) { m_marginX
= x
; m_marginY
= y
; }
63 inline int GetMarginX() { return m_marginX
; }
64 inline int GetMarginY() { return m_marginY
; }
68 virtual void ChangeBackgroundColour();
71 wxBitmap m_buttonBitmapFocus
;
72 wxBitmap m_buttonBitmap
;
73 wxBitmap m_buttonBitmapOriginal
; // May be different from m_buttonBitmap
74 // if m_buttonBitmap has been changed
75 // to reflect button background colour
76 wxBitmap m_buttonBitmapSelected
;
77 wxBitmap m_buttonBitmapSelectedOriginal
;
79 wxBitmap m_buttonBitmapDisabled
;
80 wxBitmap m_buttonBitmapDisabledOriginal
;
85 WXPixmap m_insensPixmap
;