]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/button.h
Removed wxOSX conditional code from generic calendar control.
[wxWidgets.git] / include / wx / msw / button.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
1e6feb95 2// Name: wx/msw/button.h
2bda0e17
KB
3// Purpose: wxButton class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_BUTTON_H_
13#define _WX_BUTTON_H_
2bda0e17 14
edccf428 15// ----------------------------------------------------------------------------
2bda0e17 16// Pushbutton
edccf428
VZ
17// ----------------------------------------------------------------------------
18
53a2db12 19class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
2bda0e17 20{
bfc6fde4 21public:
6af59fe7 22 wxButton() { Init(); }
1e6feb95
VZ
23 wxButton(wxWindow *parent,
24 wxWindowID id,
5f7bcb48 25 const wxString& label = wxEmptyString,
1e6feb95
VZ
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 long style = 0,
29 const wxValidator& validator = wxDefaultValidator,
30 const wxString& name = wxButtonNameStr)
bfc6fde4 31 {
6af59fe7 32 Init();
233f10bf 33
bfc6fde4
VZ
34 Create(parent, id, label, pos, size, style, validator, name);
35 }
fcf90ee1 36
1e6feb95
VZ
37 bool Create(wxWindow *parent,
38 wxWindowID id,
5f7bcb48 39 const wxString& label = wxEmptyString,
1e6feb95
VZ
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxButtonNameStr);
bfc6fde4 45
edccf428
VZ
46 virtual ~wxButton();
47
94aff5ff 48 virtual wxWindow *SetDefault();
edccf428 49
d94de683
VZ
50 // overridden base class methods
51 virtual void SetLabel(const wxString& label);
52 virtual bool SetBackgroundColour(const wxColour &colour);
53 virtual bool SetForegroundColour(const wxColour &colour);
54
edccf428 55 // implementation from now on
bfc6fde4 56 virtual void Command(wxCommandEvent& event);
c140b7e7 57 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
bfc6fde4 58 virtual bool MSWCommand(WXUINT param, WXWORD id);
bfc6fde4 59
cd0b1709 60 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
6f02a879 61 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
cd0b1709 62
a047aff2
JS
63 // returns true if the platform should explicitly apply a theme border
64 virtual bool CanApplyThemeBorder() const { return false; }
65
bfc6fde4 66protected:
fcf90ee1 67 // send a notification event, return true if processed
edccf428
VZ
68 bool SendClickEvent();
69
036da5e3
VZ
70 // default button handling
71 void SetTmpDefault();
72 void UnsetTmpDefault();
73
7fb1b2b4
VZ
74 // set or unset BS_DEFPUSHBUTTON style
75 static void SetDefaultStyle(wxButton *btn, bool on);
036da5e3 76
5b2f31eb 77 // usually overridden base class virtuals
f68586e5 78 virtual wxSize DoGetBestSize() const;
1e6feb95 79
f2d7fdf7
VZ
80 virtual bool DoGetAuthNeeded() const;
81 virtual void DoSetAuthNeeded(bool show);
233f10bf
VZ
82 virtual wxBitmap DoGetBitmap(State which) const;
83 virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
a6fd73d3 84 virtual wxSize DoGetBitmapMargins() const;
233f10bf
VZ
85 virtual void DoSetBitmapMargins(wxCoord x, wxCoord y);
86 virtual void DoSetBitmapPosition(wxDirection dir);
87
95912bdd
VZ
88#if wxUSE_MARKUP
89 virtual bool DoSetLabelMarkup(const wxString& markup);
90#endif // wxUSE_MARKUP
91
65034d07
VZ
92 // Increases the passed in size to account for the button image.
93 //
94 // Should only be called if we do have a button, i.e. if m_imageData is
95 // non-NULL.
3571e1ad
VZ
96 void AdjustForBitmapSize(wxSize& size) const;
97
233f10bf
VZ
98 class wxButtonImageData *m_imageData;
99
95912bdd
VZ
100#if wxUSE_MARKUP
101 class wxMarkupText *m_markupText;
102#endif // wxUSE_MARKUP
103
f2d7fdf7
VZ
104 // true if the UAC symbol is shown
105 bool m_authNeeded;
106
1e6feb95 107private:
6af59fe7
VZ
108 void Init()
109 {
110 m_imageData = NULL;
95912bdd
VZ
111#if wxUSE_MARKUP
112 m_markupText = NULL;
113#endif // wxUSE_MARKUP
98977bf4 114 m_authNeeded = false;
6af59fe7
VZ
115 }
116
3b5651af
VZ
117 // Switches button into owner-drawn mode: this is used if we need to draw
118 // something not supported by the native control, such as using non default
119 // colours or a bitmap on pre-XP systems.
120 void MakeOwnerDrawn();
121
3571e1ad 122 wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton);
2bda0e17
KB
123};
124
d94de683 125#endif // _WX_BUTTON_H_