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