button.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/button.h
  3. // Purpose: wxGTK wxButton class declaration
  4. // Author: Robert Roebling
  5. // Copyright: (c) 1998 Robert Roebling
  6. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_GTK_BUTTON_H_
  9. #define _WX_GTK_BUTTON_H_
  10. //-----------------------------------------------------------------------------
  11. // wxButton
  12. //-----------------------------------------------------------------------------
  13. class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
  14. {
  15. public:
  16. wxButton() {}
  17. wxButton(wxWindow *parent, wxWindowID id,
  18. const wxString& label = wxEmptyString,
  19. const wxPoint& pos = wxDefaultPosition,
  20. const wxSize& size = wxDefaultSize, long style = 0,
  21. const wxValidator& validator = wxDefaultValidator,
  22. const wxString& name = wxButtonNameStr)
  23. {
  24. Create(parent, id, label, pos, size, style, validator, name);
  25. }
  26. bool Create(wxWindow *parent, wxWindowID id,
  27. const wxString& label = wxEmptyString,
  28. const wxPoint& pos = wxDefaultPosition,
  29. const wxSize& size = wxDefaultSize, long style = 0,
  30. const wxValidator& validator = wxDefaultValidator,
  31. const wxString& name = wxButtonNameStr);
  32. virtual wxWindow *SetDefault();
  33. virtual void SetLabel( const wxString &label );
  34. // implementation
  35. // --------------
  36. static wxVisualAttributes
  37. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  38. // helper to allow access to protected member from GTK callback
  39. void MoveWindow(int x, int y, int width, int height) { DoMoveWindow(x, y, width, height); }
  40. // called from GTK callbacks: they update the button state and call
  41. // GTKUpdateBitmap()
  42. void GTKMouseEnters();
  43. void GTKMouseLeaves();
  44. void GTKPressed();
  45. void GTKReleased();
  46. protected:
  47. virtual wxSize DoGetBestSize() const;
  48. virtual void DoApplyWidgetStyle(GtkRcStyle *style);
  49. #if wxUSE_MARKUP
  50. virtual bool DoSetLabelMarkup(const wxString& markup);
  51. #endif // wxUSE_MARKUP
  52. private:
  53. typedef wxButtonBase base_type;
  54. // Return the GtkLabel used by this button.
  55. GtkLabel *GTKGetLabel() const;
  56. DECLARE_DYNAMIC_CLASS(wxButton)
  57. };
  58. #endif // _WX_GTK_BUTTON_H_