]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/control.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
16 #pragma interface "control.h"
20 class WXDLLEXPORT wxControl
: public wxControlBase
22 DECLARE_ABSTRACT_CLASS(wxControl
)
29 virtual void Command(wxCommandEvent
& event
) { ProcessCommand(event
); }
31 // implementation from now on
32 // --------------------------
34 // Calls the callback and appropriate event handlers
35 bool ProcessCommand(wxCommandEvent
& event
);
39 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
42 // For ownerdraw items
43 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
44 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
46 wxList
& GetSubcontrols() { return m_subControls
; }
48 void OnEraseBackground(wxEraseEvent
& event
);
50 #if WXWIN_COMPATIBILITY
51 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
52 wxColour
* GetButtonColour() const { return NULL
; }
54 inline virtual void SetLabelFont(const wxFont
& font
);
55 inline virtual void SetButtonFont(const wxFont
& font
);
56 inline wxFont
& GetLabelFont() const;
57 inline wxFont
& GetButtonFont() const;
60 inline void Callback(const wxFunction function
);
62 wxFunction
GetCallback() { return m_callback
; }
65 wxFunction m_callback
; // Callback associated with the window
66 #endif // WXWIN_COMPATIBILITY
69 // For controls like radiobuttons which are really composite
72 virtual wxSize
DoGetBestSize() const;
74 // create the control of the given class with the given style, returns FALSE
77 // All parameters except classname and style are optional, if the
78 // size/position are not given, they should be set later with SetSize() and,
79 // label (the title of the window), of course, is left empty. The extended
80 // style is determined from the style and the app 3D settings automatically
81 // if it's not specified explicitly.
82 bool MSWCreateControl(const wxChar
*classname
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
86 const wxString
& label
= wxEmptyString
,
87 WXDWORD exstyle
= (WXDWORD
)-1);
89 // determine the extended styles combination for this window (may slightly
90 // modify style parameter, this is why it's non const)
91 WXDWORD
GetExStyle(WXDWORD
& style
, bool *want3D
) const;
98 #if WXWIN_COMPATIBILITY
99 inline void wxControl::Callback(const wxFunction f
) { m_callback
= f
; };
100 inline wxFont
& wxControl::GetLabelFont() const { return GetFont(); }
101 inline wxFont
& wxControl::GetButtonFont() const { return GetFont(); }
102 inline void wxControl::SetLabelFont(const wxFont
& font
) { SetFont(font
); }
103 inline void wxControl::SetButtonFont(const wxFont
& font
) { SetFont(font
); }
104 #endif // WXWIN_COMPATIBILITY