wxMessageBox off the main thread lost result code.
[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 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MSW_BUTTON_H_
12 #define _WX_MSW_BUTTON_H_
13
14 // ----------------------------------------------------------------------------
15 // Pushbutton
16 // ----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
19 {
20 public:
21 wxButton() { Init(); }
22 wxButton(wxWindow *parent,
23 wxWindowID id,
24 const wxString& label = wxEmptyString,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize,
27 long style = 0,
28 const wxValidator& validator = wxDefaultValidator,
29 const wxString& name = wxButtonNameStr)
30 {
31 Init();
32
33 Create(parent, id, label, pos, size, style, validator, name);
34 }
35
36 bool Create(wxWindow *parent,
37 wxWindowID id,
38 const wxString& label = wxEmptyString,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxButtonNameStr);
44
45 virtual ~wxButton();
46
47 virtual wxWindow *SetDefault();
48
49 // implementation from now on
50 virtual void Command(wxCommandEvent& event);
51 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
52 virtual bool MSWCommand(WXUINT param, WXWORD id);
53
54 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
55
56 protected:
57 // send a notification event, return true if processed
58 bool SendClickEvent();
59
60 // default button handling
61 void SetTmpDefault();
62 void UnsetTmpDefault();
63
64 // set or unset BS_DEFPUSHBUTTON style
65 static void SetDefaultStyle(wxButton *btn, bool on);
66
67 virtual bool DoGetAuthNeeded() const;
68 virtual void DoSetAuthNeeded(bool show);
69
70 // true if the UAC symbol is shown
71 bool m_authNeeded;
72
73 private:
74 void Init()
75 {
76 m_authNeeded = false;
77 }
78
79 void OnCharHook(wxKeyEvent& event);
80
81 wxDECLARE_EVENT_TABLE();
82 wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton);
83 };
84
85 #endif // _WX_MSW_BUTTON_H_