]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: control.h | |
3 | // Purpose: wxControl class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 09/17/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
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 | ||
19 | // General item class | |
20 | class WXDLLEXPORT wxControl : public wxControlBase | |
21 | { | |
22 | DECLARE_ABSTRACT_CLASS(wxControl) | |
23 | ||
24 | public: | |
25 | wxControl(); | |
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 | // OS2-specific | |
38 | virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); | |
39 | ||
40 | // For ownerdraw items | |
41 | virtual bool OS2OnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; }; | |
42 | virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; }; | |
43 | ||
44 | wxList& GetSubcontrols() { return m_subControls; } | |
45 | ||
46 | void OnEraseBackground(wxEraseEvent& event); | |
47 | ||
48 | #if WXWIN_COMPATIBILITY | |
49 | virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } | |
50 | wxColour* GetButtonColour() const { return NULL; } | |
51 | ||
52 | inline virtual void SetLabelFont(const wxFont& font); | |
53 | inline virtual void SetButtonFont(const wxFont& font); | |
54 | inline wxFont& GetLabelFont() const; | |
55 | inline wxFont& GetButtonFont() const; | |
56 | ||
57 | // Adds callback | |
58 | inline void Callback(const wxFunction function); | |
59 | ||
60 | wxFunction GetCallback() { return m_callback; } | |
61 | ||
62 | protected: | |
63 | wxFunction m_callback; // Callback associated with the window | |
64 | #endif // WXWIN_COMPATIBILITY | |
65 | ||
66 | protected: | |
67 | // For controls like radiobuttons which are really composite | |
68 | wxList m_subControls; | |
69 | ||
70 | virtual wxSize DoGetBestSize(); | |
71 | ||
72 | // create the control of the given class with the given style, returns FALSE | |
73 | // if creation failed | |
74 | bool OS2CreateControl(const wxChar *classname, WXDWORD style); | |
75 | ||
76 | // determine the extended styles combination for this window (may slightly | |
77 | // modify styl parameter) | |
78 | WXDWORD GetExStyle(WXDWORD& style) const; | |
79 | ||
80 | private: | |
81 | DECLARE_EVENT_TABLE() | |
82 | }; | |
83 | ||
84 | ||
85 | #if WXWIN_COMPATIBILITY | |
86 | inline void wxControl::Callback(const wxFunction f) { m_callback = f; }; | |
87 | inline wxFont& wxControl::GetLabelFont() const { return GetFont(); } | |
88 | inline wxFont& wxControl::GetButtonFont() const { return GetFont(); } | |
89 | inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } | |
90 | inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); } | |
91 | #endif // WXWIN_COMPATIBILITY | |
92 | ||
93 | #endif | |
94 | // _WX_CONTROL_H_ |