]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/anybutton.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / anybutton.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/anybutton.h
3 // Purpose: wxAnyButton class
4 // Author: Julian Smart
5 // Created: 1997-02-01 (extracted from button.h)
6 // Copyright: (c) Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_MSW_ANYBUTTON_H_
11 #define _WX_MSW_ANYBUTTON_H_
12
13 // ----------------------------------------------------------------------------
14 // Common button functionality
15 // ----------------------------------------------------------------------------
16
17 class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
18 {
19 public:
20 wxAnyButton()
21 {
22 m_imageData = NULL;
23 #if wxUSE_MARKUP
24 m_markupText = NULL;
25 #endif // wxUSE_MARKUP
26 }
27
28 virtual ~wxAnyButton();
29
30 // overridden base class methods
31 virtual void SetLabel(const wxString& label);
32 virtual bool SetBackgroundColour(const wxColour &colour);
33 virtual bool SetForegroundColour(const wxColour &colour);
34
35 // implementation from now on
36 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
37
38 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
39 virtual State GetNormalState() const { return State_Normal; }
40
41 // returns true if the platform should explicitly apply a theme border
42 virtual bool CanApplyThemeBorder() const { return false; }
43
44 protected:
45 // usually overridden base class virtuals
46 virtual wxSize DoGetBestSize() const;
47
48 virtual wxBitmap DoGetBitmap(State which) const;
49 virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
50 virtual wxSize DoGetBitmapMargins() const;
51 virtual void DoSetBitmapMargins(wxCoord x, wxCoord y);
52 virtual void DoSetBitmapPosition(wxDirection dir);
53
54 #if wxUSE_MARKUP
55 virtual bool DoSetLabelMarkup(const wxString& markup);
56 #endif // wxUSE_MARKUP
57
58 // Increases the passed in size to account for the button image.
59 //
60 // Should only be called if we do have a button, i.e. if m_imageData is
61 // non-NULL.
62 void AdjustForBitmapSize(wxSize& size) const;
63
64 class wxButtonImageData *m_imageData;
65
66 #if wxUSE_MARKUP
67 class wxMarkupText *m_markupText;
68 #endif // wxUSE_MARKUP
69
70 // Switches button into owner-drawn mode: this is used if we need to draw
71 // something not supported by the native control, such as using non default
72 // colours or a bitmap on pre-XP systems.
73 void MakeOwnerDrawn();
74 bool IsOwnerDrawn() const;
75
76 private:
77 wxDECLARE_NO_COPY_CLASS(wxAnyButton);
78 };
79
80 #endif // _WX_MSW_ANYBUTTON_H_