button.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/button.h
  3. // Purpose: wxButton class
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2002/12/29
  7. // Copyright: (c) 2002 David Elliott
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef __WX_COCOA_BUTTON_H__
  11. #define __WX_COCOA_BUTTON_H__
  12. #include "wx/cocoa/NSButton.h"
  13. // ========================================================================
  14. // wxButton
  15. // ========================================================================
  16. class WXDLLIMPEXP_CORE wxButton : public wxButtonBase, protected wxCocoaNSButton
  17. {
  18. DECLARE_DYNAMIC_CLASS(wxButton)
  19. DECLARE_EVENT_TABLE()
  20. WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView)
  21. // ------------------------------------------------------------------------
  22. // initialization
  23. // ------------------------------------------------------------------------
  24. public:
  25. wxButton() { }
  26. wxButton(wxWindow *parent, wxWindowID winid,
  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. {
  33. Create(parent, winid, label, pos, size, style, validator, name);
  34. }
  35. bool Create(wxWindow *parent, wxWindowID winid,
  36. const wxString& label = wxEmptyString,
  37. const wxPoint& pos = wxDefaultPosition,
  38. const wxSize& size = wxDefaultSize, long style = 0,
  39. const wxValidator& validator = wxDefaultValidator,
  40. const wxString& name = wxButtonNameStr);
  41. virtual ~wxButton();
  42. // ------------------------------------------------------------------------
  43. // Cocoa callbacks
  44. // ------------------------------------------------------------------------
  45. protected:
  46. virtual void Cocoa_wxNSButtonAction(void);
  47. // ------------------------------------------------------------------------
  48. // Implementation
  49. // ------------------------------------------------------------------------
  50. public:
  51. wxString GetLabel() const;
  52. void SetLabel(const wxString& label);
  53. wxSize DoGetBestSize() const;
  54. };
  55. #endif
  56. // __WX_COCOA_BUTTON_H__