]>
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 | ||
4765d335 SC |
19 | WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr; |
20 | ||
0dbd6262 | 21 | // General item class |
519cb848 | 22 | class WXDLLEXPORT wxControl : public wxControlBase |
0dbd6262 | 23 | { |
519cb848 SC |
24 | DECLARE_ABSTRACT_CLASS(wxControl) |
25 | ||
0dbd6262 SC |
26 | public: |
27 | wxControl(); | |
05adb9d2 SC |
28 | wxControl(wxWindow *parent, wxWindowID id, |
29 | const wxPoint& pos = wxDefaultPosition, | |
30 | const wxSize& size = wxDefaultSize, long style = 0, | |
31 | const wxValidator& validator = wxDefaultValidator, | |
32 | const wxString& name = wxControlNameStr) | |
33 | { | |
34 | Create(parent, id, pos, size, style, validator, name); | |
35 | } | |
519cb848 | 36 | |
4765d335 SC |
37 | bool Create(wxWindow *parent, wxWindowID id, |
38 | const wxPoint& pos = wxDefaultPosition, | |
39 | const wxSize& size = wxDefaultSize, long style = 0, | |
40 | const wxValidator& validator = wxDefaultValidator, | |
41 | const wxString& name = wxControlNameStr); | |
05adb9d2 | 42 | virtual ~wxControl(); |
4765d335 | 43 | |
519cb848 SC |
44 | // Simulates an event |
45 | virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } | |
46 | ||
47 | // implementation from now on | |
48 | // -------------------------- | |
49 | ||
50 | // Calls the callback and appropriate event handlers | |
51 | bool ProcessCommand(wxCommandEvent& event); | |
e7549107 | 52 | virtual void SetLabel(const wxString& title) ; |
519cb848 SC |
53 | |
54 | wxList& GetSubcontrols() { return m_subControls; } | |
03e11df5 | 55 | |
519cb848 | 56 | void OnEraseBackground(wxEraseEvent& event); |
03e11df5 | 57 | |
2f3eee09 | 58 | virtual bool Enable(bool enable = TRUE) ; |
03e11df5 GD |
59 | virtual bool Show(bool show = TRUE) ; |
60 | ||
61 | virtual void MacRedrawControl () ; | |
5273bf2f | 62 | virtual void MacHandleControlClick( WXWidget control , short controlpart ) ; |
03e11df5 GD |
63 | virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label , |
64 | const wxPoint& pos, | |
65 | const wxSize& size, long style, | |
66 | const wxValidator& validator, | |
67 | const wxString& name , | |
5273bf2f SC |
68 | WXRECTPTR outBounds , |
69 | unsigned char* maclabel ) ; | |
03e11df5 GD |
70 | virtual void MacPostControlCreate() ; |
71 | virtual void MacAdjustControlRect() ; | |
5273bf2f | 72 | virtual WXWidget MacGetContainerForEmbedding() ; |
03e11df5 GD |
73 | virtual void MacSuperChangedPosition() ; |
74 | virtual void MacSuperEnabled( bool enabled ) ; | |
75 | virtual void MacSuperShown( bool show ) ; | |
76 | virtual bool MacCanFocus() const ; | |
77 | ||
9453cf2b | 78 | virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ; |
03e11df5 GD |
79 | virtual void OnKeyDown( wxKeyEvent &event ) ; |
80 | virtual void OnMouseEvent( wxMouseEvent &event ) ; | |
81 | virtual void OnPaint(wxPaintEvent& event) ; | |
82 | virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL) ; | |
5273bf2f | 83 | WXWidget GetMacControl() { return m_macControl ;} |
e7549107 | 84 | |
519cb848 SC |
85 | #if WXWIN_COMPATIBILITY |
86 | virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } | |
87 | wxColour* GetButtonColour() const { return NULL; } | |
0dbd6262 | 88 | |
519cb848 SC |
89 | inline virtual void SetLabelFont(const wxFont& font); |
90 | inline virtual void SetButtonFont(const wxFont& font); | |
91 | inline wxFont& GetLabelFont() const; | |
92 | inline wxFont& GetButtonFont() const; | |
0dbd6262 | 93 | |
519cb848 SC |
94 | // Adds callback |
95 | inline void Callback(const wxFunction function); | |
0dbd6262 | 96 | |
519cb848 | 97 | wxFunction GetCallback() { return m_callback; } |
0dbd6262 SC |
98 | |
99 | protected: | |
100 | wxFunction m_callback; // Callback associated with the window | |
519cb848 | 101 | #endif // WXWIN_COMPATIBILITY |
0dbd6262 | 102 | |
519cb848 SC |
103 | protected: |
104 | // For controls like radiobuttons which are really composite | |
d84afea9 GD |
105 | WXWidget m_macControl ; |
106 | bool m_macControlIsShown ; | |
107 | wxList m_subControls; | |
108 | int m_macHorizontalBorder ; | |
109 | int m_macVerticalBorder ; | |
519cb848 | 110 | |
05adb9d2 | 111 | virtual wxSize DoGetBestSize() const; |
519cb848 | 112 | |
519cb848 SC |
113 | private: |
114 | DECLARE_EVENT_TABLE() | |
0dbd6262 SC |
115 | }; |
116 | ||
519cb848 SC |
117 | |
118 | #if WXWIN_COMPATIBILITY | |
119 | inline void wxControl::Callback(const wxFunction f) { m_callback = f; }; | |
120 | inline wxFont& wxControl::GetLabelFont() const { return GetFont(); } | |
121 | inline wxFont& wxControl::GetButtonFont() const { return GetFont(); } | |
122 | inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } | |
123 | inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); } | |
124 | #endif // WXWIN_COMPATIBILITY | |
125 | ||
5273bf2f SC |
126 | wxControl *wxFindControlFromMacControl(WXWidget inControl ) ; |
127 | void wxAssociateControlWithMacControl(WXWidget inControl, wxControl *control) ; | |
519cb848 SC |
128 | void wxRemoveMacControlAssociation(wxControl *control) ; |
129 | ||
0dbd6262 SC |
130 | #endif |
131 | // _WX_CONTROL_H_ |