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