1///////////////////////////////////////////////////////////////////////////// 2// Name: wx/univ/bmpbuttn.h 3// Purpose: wxBitmapButton class for wxUniversal 4// Author: Vadim Zeitlin 5// Modified by: 6// Created: 25.08.00 7// RCS-ID: $Id: bmpbuttn.h 35650 2005-09-23 12:56:45Z MR $ 8// Copyright: (c) Vadim Zeitlin 9// Licence: wxWindows licence 10///////////////////////////////////////////////////////////////////////////// 11 12#ifndef _WX_UNIV_BMPBUTTN_H_ 13#define _WX_UNIV_BMPBUTTN_H_ 14 15class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase 16{ 17public: 18 wxBitmapButton() { } 19 20 wxBitmapButton(wxWindow *parent, 21 wxWindowID id, 22 const wxBitmap& bitmap, 23 const wxPoint& pos = wxDefaultPosition, 24 const wxSize& size = wxDefaultSize, 25 long style = 0, 26 const wxValidator& validator = wxDefaultValidator, 27 const wxString& name = wxButtonNameStr) 28 { 29 Create(parent, id, bitmap, pos, size, style, validator, name); 30 } 31 32 bool Create(wxWindow *parent, 33 wxWindowID id, 34 const wxBitmap& bitmap, 35 const wxPoint& pos = wxDefaultPosition, 36 const wxSize& size = wxDefaultSize, 37 long style = 0, 38 const wxValidator& validator = wxDefaultValidator, 39 const wxString& name = wxButtonNameStr); 40 41 virtual void SetMargins(int x, int y) 42 { 43 SetImageMargins(x, y); 44 45 wxBitmapButtonBase::SetMargins(x, y); 46 } 47 48 virtual bool Enable(bool enable = true); 49 50 virtual bool SetCurrent(bool doit = true); 51 52 virtual void Press(); 53 virtual void Release(); 54 55protected: 56 void OnSetFocus(wxFocusEvent& event); 57 void OnKillFocus(wxFocusEvent& event); 58 59 // called when one of the bitmap is changed by user 60 virtual void OnSetBitmap(); 61 62 // set bitmap to the given one if it's ok or to m_bmpNormal and return 63 // true if the bitmap really changed 64 bool ChangeBitmap(const wxBitmap& bmp); 65 66private: 67 DECLARE_EVENT_TABLE() 68 DECLARE_DYNAMIC_CLASS(wxBitmapButton) 69}; 70 71#endif // _WX_UNIV_BMPBUTTN_H_ 72 73