]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: control.h | |
3 | // Purpose: wxControl class | |
45fcbf3b | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
45fcbf3b | 6 | // Created: 09/17/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
45fcbf3b DW |
8 | // Copyright: (c) Julian Smart |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CONTROL_H_ | |
13 | #define _WX_CONTROL_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
45fcbf3b | 16 | #pragma interface "control.h" |
0e320a79 DW |
17 | #endif |
18 | ||
0e320a79 | 19 | // General item class |
45fcbf3b | 20 | class WXDLLEXPORT wxControl : public wxControlBase |
0e320a79 | 21 | { |
45fcbf3b DW |
22 | DECLARE_ABSTRACT_CLASS(wxControl) |
23 | ||
0e320a79 DW |
24 | public: |
25 | wxControl(); | |
45fcbf3b DW |
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); | |
0e320a79 | 47 | |
45fcbf3b DW |
48 | #if WXWIN_COMPATIBILITY |
49 | virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } | |
50 | wxColour* GetButtonColour() const { return NULL; } | |
0e320a79 | 51 | |
45fcbf3b DW |
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; | |
0e320a79 | 56 | |
45fcbf3b DW |
57 | // Adds callback |
58 | inline void Callback(const wxFunction function); | |
59 | ||
60 | wxFunction GetCallback() { return m_callback; } | |
0e320a79 DW |
61 | |
62 | protected: | |
63 | wxFunction m_callback; // Callback associated with the window | |
45fcbf3b DW |
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(); | |
0e320a79 | 71 | |
45fcbf3b DW |
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() | |
0e320a79 DW |
82 | }; |
83 | ||
45fcbf3b DW |
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 | ||
0e320a79 DW |
93 | #endif |
94 | // _WX_CONTROL_H_ |