]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/control.h
7d8f6d185d3598347c3f0320e8a5e45c6431c730
[wxWidgets.git] / include / wx / mac / control.h
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
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
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; }
45
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;
50
51 // Adds callback
52 inline void Callback(const wxFunction function);
53
54 wxFunction GetCallback() { return m_callback; }
55
56 protected:
57 wxFunction m_callback; // Callback associated with the window
58 #endif // WXWIN_COMPATIBILITY
59
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()
76 };
77
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
91 #endif
92 // _WX_CONTROL_H_