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