button.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/button.h
  3. // Purpose: wxButton class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSW_BUTTON_H_
  11. #define _WX_MSW_BUTTON_H_
  12. // ----------------------------------------------------------------------------
  13. // Pushbutton
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
  16. {
  17. public:
  18. wxButton() { Init(); }
  19. wxButton(wxWindow *parent,
  20. wxWindowID id,
  21. const wxString& label = wxEmptyString,
  22. const wxPoint& pos = wxDefaultPosition,
  23. const wxSize& size = wxDefaultSize,
  24. long style = 0,
  25. const wxValidator& validator = wxDefaultValidator,
  26. const wxString& name = wxButtonNameStr)
  27. {
  28. Init();
  29. Create(parent, id, label, pos, size, style, validator, name);
  30. }
  31. bool Create(wxWindow *parent,
  32. wxWindowID id,
  33. const wxString& label = wxEmptyString,
  34. const wxPoint& pos = wxDefaultPosition,
  35. const wxSize& size = wxDefaultSize,
  36. long style = 0,
  37. const wxValidator& validator = wxDefaultValidator,
  38. const wxString& name = wxButtonNameStr);
  39. virtual ~wxButton();
  40. virtual wxWindow *SetDefault();
  41. // implementation from now on
  42. virtual void Command(wxCommandEvent& event);
  43. virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
  44. virtual bool MSWCommand(WXUINT param, WXWORD id);
  45. virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
  46. protected:
  47. // send a notification event, return true if processed
  48. bool SendClickEvent();
  49. // default button handling
  50. void SetTmpDefault();
  51. void UnsetTmpDefault();
  52. // set or unset BS_DEFPUSHBUTTON style
  53. static void SetDefaultStyle(wxButton *btn, bool on);
  54. virtual bool DoGetAuthNeeded() const;
  55. virtual void DoSetAuthNeeded(bool show);
  56. // true if the UAC symbol is shown
  57. bool m_authNeeded;
  58. private:
  59. void Init()
  60. {
  61. m_authNeeded = false;
  62. }
  63. void OnCharHook(wxKeyEvent& event);
  64. wxDECLARE_EVENT_TABLE();
  65. wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton);
  66. };
  67. #endif // _WX_MSW_BUTTON_H_