]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/classic/control.h
wxBrush::SetColour and wxPen::SetColour unified. Source cleaning.
[wxWidgets.git] / include / wx / mac / classic / control.h
CommitLineData
52479aef
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.h
3// Purpose: wxControl class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
52479aef
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_CONTROL_H_
13#define _WX_CONTROL_H_
14
52479aef
SC
15WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
16
17// General item class
18class WXDLLEXPORT wxControl : public wxControlBase
19{
20 DECLARE_ABSTRACT_CLASS(wxControl)
21
22public:
23 wxControl();
24 wxControl(wxWindow *parent, wxWindowID id,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize, long style = 0,
27 const wxValidator& validator = wxDefaultValidator,
28 const wxString& name = wxControlNameStr)
29 {
30 Create(parent, id, pos, size, style, validator, name);
31 }
32
33 bool Create(wxWindow *parent, wxWindowID id,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize, long style = 0,
36 const wxValidator& validator = wxDefaultValidator,
37 const wxString& name = wxControlNameStr);
38 virtual ~wxControl();
39
40 // Simulates an event
41 virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
42
43 // implementation from now on
44 // --------------------------
45
46 // Calls the callback and appropriate event handlers
47 bool ProcessCommand(wxCommandEvent& event);
48 virtual void SetLabel(const wxString& title) ;
49
50 wxList& GetSubcontrols() { return m_subControls; }
51
52 void OnEraseBackground(wxEraseEvent& event);
53
54 virtual bool Enable(bool enable = TRUE) ;
55 virtual bool Show(bool show = TRUE) ;
56 virtual void DoSetWindowVariant( wxWindowVariant variant ) ;
57
58 virtual void MacRedrawControl () ;
59 virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
60 virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
61 const wxPoint& pos,
62 const wxSize& size, long style,
63 const wxValidator& validator,
64 const wxString& name ,
65 WXRECTPTR outBounds ,
66 unsigned char* maclabel ) ;
67 virtual void MacPostControlCreate() ;
68 virtual void MacAdjustControlRect() ;
69 virtual WXWidget MacGetContainerForEmbedding() ;
70 virtual void MacSuperChangedPosition() ;
71 virtual void MacSuperEnabled( bool enabled ) ;
72 virtual void MacSuperShown( bool show ) ;
73 virtual bool MacCanFocus() const ;
74 virtual void MacUpdateDimensions() ;
75 void* MacGetControlAction() { return m_macControlAction ; }
76
77 virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
78 void OnKeyDown( wxKeyEvent &event ) ;
79 void OnMouseEvent( wxMouseEvent &event ) ;
80 void OnPaint(wxPaintEvent& event) ;
81 virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL) ;
82 WXWidget GetMacControl() { return m_macControl ;}
83
84protected:
85 // For controls like radiobuttons which are really composite
86 WXWidget m_macControl ;
87 void* m_macControlAction ;
88 bool m_macControlIsShown ;
89 wxList m_subControls;
90 int m_macHorizontalBorder ;
91 int m_macVerticalBorder ;
92
93 virtual wxSize DoGetBestSize() const;
94
95private:
96 DECLARE_EVENT_TABLE()
97};
98
99
100wxControl *wxFindControlFromMacControl(WXWidget inControl ) ;
101void wxAssociateControlWithMacControl(WXWidget inControl, wxControl *control) ;
102void wxRemoveMacControlAssociation(wxControl *control) ;
103
104#endif
105 // _WX_CONTROL_H_