]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/control.cpp
reformat for readability; more prep. for patch 1376506
[wxWidgets.git] / src / mac / carbon / control.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.cpp
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #include "wx/control.h"
15 #include "wx/panel.h"
16 #include "wx/app.h"
17 #include "wx/dc.h"
18 #include "wx/dcclient.h"
19 #include "wx/notebook.h"
20 #include "wx/tabctrl.h"
21 #include "wx/radiobox.h"
22 #include "wx/spinbutt.h"
23 #include "wx/scrolbar.h"
24 #include "wx/button.h"
25 #include "wx/dialog.h"
26 #include "wx/statbox.h"
27 #include "wx/sizer.h"
28 #include "wx/stattext.h"
29
30 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
31
32 #include "wx/mac/uma.h"
33 #include "wx/mac/private.h"
34
35 // Item members
36
37 wxControl::wxControl()
38 {
39 }
40
41 bool wxControl::Create(wxWindow *parent, wxWindowID id,
42 const wxPoint& pos,
43 const wxSize& size, long style,
44 const wxValidator& validator,
45 const wxString& name)
46 {
47 bool rval = wxWindow::Create(parent, id, pos, size, style, name);
48
49 #if 0
50 // no automatic inheritance as we most often need transparent backgrounds
51 if ( parent )
52 {
53 m_backgroundColour = parent->GetBackgroundColour() ;
54 m_foregroundColour = parent->GetForegroundColour() ;
55 }
56 #endif
57
58 if (rval)
59 {
60 #if wxUSE_VALIDATORS
61 SetValidator(validator);
62 #endif
63 }
64 return rval;
65 }
66
67 wxControl::~wxControl()
68 {
69 m_isBeingDeleted = TRUE;
70 }
71
72 bool wxControl::ProcessCommand (wxCommandEvent & event)
73 {
74 // Tries:
75 // 1) OnCommand, starting at this window and working up parent hierarchy
76 // 2) OnCommand then calls ProcessEvent to search the event tables.
77 return GetEventHandler()->ProcessEvent(event);
78 }
79
80 void wxControl::OnKeyDown( wxKeyEvent &event )
81 {
82 if ( m_peer == NULL || !m_peer->Ok() )
83 return ;
84
85 char charCode ;
86 UInt32 keyCode ;
87 UInt32 modifiers ;
88
89 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
90 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
91 GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
92
93 m_peer->HandleKey( keyCode , charCode , modifiers ) ;
94 }
95