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