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