bmpbuttn.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. // Copyright: (c) Vadim Zeitlin
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_UNIV_BMPBUTTN_H_
  11. #define _WX_UNIV_BMPBUTTN_H_
  12. class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
  13. {
  14. public:
  15. wxBitmapButton() { }
  16. wxBitmapButton(wxWindow *parent,
  17. wxWindowID id,
  18. const wxBitmap& bitmap,
  19. const wxPoint& pos = wxDefaultPosition,
  20. const wxSize& size = wxDefaultSize,
  21. long style = 0,
  22. const wxValidator& validator = wxDefaultValidator,
  23. const wxString& name = wxButtonNameStr)
  24. {
  25. Create(parent, id, bitmap, pos, size, style, validator, name);
  26. }
  27. bool Create(wxWindow *parent,
  28. wxWindowID id,
  29. const wxBitmap& bitmap,
  30. const wxPoint& pos = wxDefaultPosition,
  31. const wxSize& size = wxDefaultSize,
  32. long style = 0,
  33. const wxValidator& validator = wxDefaultValidator,
  34. const wxString& name = wxButtonNameStr);
  35. virtual void SetMargins(int x, int y)
  36. {
  37. SetBitmapMargins(x, y);
  38. wxBitmapButtonBase::SetMargins(x, y);
  39. }
  40. virtual bool Enable(bool enable = true);
  41. virtual bool SetCurrent(bool doit = true);
  42. virtual void Press();
  43. virtual void Release();
  44. protected:
  45. void OnSetFocus(wxFocusEvent& event);
  46. void OnKillFocus(wxFocusEvent& event);
  47. // called when one of the bitmap is changed by user
  48. virtual void OnSetBitmap();
  49. // set bitmap to the given one if it's ok or to the normal bitmap and
  50. // return true if the bitmap really changed
  51. bool ChangeBitmap(const wxBitmap& bmp);
  52. private:
  53. DECLARE_EVENT_TABLE()
  54. DECLARE_DYNAMIC_CLASS(wxBitmapButton)
  55. };
  56. #endif // _WX_UNIV_BMPBUTTN_H_