]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/button.h
assert -> wxASSERT
[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_BUTTON_H_
13 #define _WX_BUTTON_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "button.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // Pushbutton
21 // ----------------------------------------------------------------------------
22
23 class WXDLLEXPORT wxButton : public wxButtonBase
24 {
25 public:
26 wxButton() { }
27 wxButton(wxWindow *parent,
28 wxWindowID id,
29 const wxString& label = wxEmptyString,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxButtonNameStr)
35 {
36 Create(parent, id, label, pos, size, style, validator, name);
37 }
38
39 bool Create(wxWindow *parent,
40 wxWindowID id,
41 const wxString& label = wxEmptyString,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxButtonNameStr);
47
48 virtual ~wxButton();
49
50 virtual void SetDefault();
51
52 // implementation from now on
53 virtual void Command(wxCommandEvent& event);
54 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
55 virtual bool MSWCommand(WXUINT param, WXWORD id);
56
57 // coloured buttons support
58 virtual bool SetBackgroundColour(const wxColour &colour);
59 virtual bool SetForegroundColour(const wxColour &colour);
60
61 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
62
63 private:
64 void MakeOwnerDrawn();
65
66 protected:
67 // send a notification event, return true if processed
68 bool SendClickEvent();
69
70 // default button handling
71 void SetTmpDefault();
72 void UnsetTmpDefault();
73
74 // set or unset BS_DEFPUSHBUTTON style
75 static void SetDefaultStyle(wxButton *btn, bool on);
76
77 // usually overridden base class virtuals
78 virtual wxSize DoGetBestSize() const;
79 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const ;
80
81 private:
82 DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton)
83 };
84
85 #endif
86 // _WX_BUTTON_H_