]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: control.h | |
3 | // Purpose: wxControl class | |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CONTROL_H_ | |
13 | #define _WX_CONTROL_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "control.h" | |
17 | #endif | |
18 | ||
0dbd6262 | 19 | // General item class |
519cb848 | 20 | class WXDLLEXPORT wxControl : public wxControlBase |
0dbd6262 | 21 | { |
519cb848 SC |
22 | DECLARE_ABSTRACT_CLASS(wxControl) |
23 | ||
0dbd6262 SC |
24 | public: |
25 | wxControl(); | |
519cb848 SC |
26 | virtual ~wxControl(); |
27 | ||
28 | // Simulates an event | |
29 | virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } | |
30 | ||
31 | // implementation from now on | |
32 | // -------------------------- | |
33 | ||
34 | // Calls the callback and appropriate event handlers | |
35 | bool ProcessCommand(wxCommandEvent& event); | |
36 | ||
37 | ||
38 | wxList& GetSubcontrols() { return m_subControls; } | |
39 | ||
40 | void OnEraseBackground(wxEraseEvent& event); | |
41 | ||
42 | #if WXWIN_COMPATIBILITY | |
43 | virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } | |
44 | wxColour* GetButtonColour() const { return NULL; } | |
0dbd6262 | 45 | |
519cb848 SC |
46 | inline virtual void SetLabelFont(const wxFont& font); |
47 | inline virtual void SetButtonFont(const wxFont& font); | |
48 | inline wxFont& GetLabelFont() const; | |
49 | inline wxFont& GetButtonFont() const; | |
0dbd6262 | 50 | |
519cb848 SC |
51 | // Adds callback |
52 | inline void Callback(const wxFunction function); | |
0dbd6262 | 53 | |
519cb848 | 54 | wxFunction GetCallback() { return m_callback; } |
0dbd6262 SC |
55 | |
56 | protected: | |
57 | wxFunction m_callback; // Callback associated with the window | |
519cb848 | 58 | #endif // WXWIN_COMPATIBILITY |
0dbd6262 | 59 | |
519cb848 SC |
60 | protected: |
61 | // For controls like radiobuttons which are really composite | |
62 | wxList m_subControls; | |
63 | ||
64 | virtual wxSize DoGetBestSize(); | |
65 | ||
66 | // create the control of the given class with the given style, returns FALSE | |
67 | // if creation failed | |
68 | bool MSWCreateControl(const wxChar *classname, WXDWORD style); | |
69 | ||
70 | // determine the extended styles combination for this window (may slightly | |
71 | // modify styl parameter) | |
72 | WXDWORD GetExStyle(WXDWORD& style) const; | |
73 | ||
74 | private: | |
75 | DECLARE_EVENT_TABLE() | |
0dbd6262 SC |
76 | }; |
77 | ||
519cb848 SC |
78 | |
79 | #if WXWIN_COMPATIBILITY | |
80 | inline void wxControl::Callback(const wxFunction f) { m_callback = f; }; | |
81 | inline wxFont& wxControl::GetLabelFont() const { return GetFont(); } | |
82 | inline wxFont& wxControl::GetButtonFont() const { return GetFont(); } | |
83 | inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } | |
84 | inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); } | |
85 | #endif // WXWIN_COMPATIBILITY | |
86 | ||
87 | wxControl *wxFindControlFromMacControl(ControlHandle inControl ) ; | |
88 | void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *control) ; | |
89 | void wxRemoveMacControlAssociation(wxControl *control) ; | |
90 | ||
0dbd6262 SC |
91 | #endif |
92 | // _WX_CONTROL_H_ |