1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/control.cpp
3 // Purpose: wxControl class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/control.h"
20 #include "wx/dcclient.h"
21 #include "wx/button.h"
22 #include "wx/dialog.h"
23 #include "wx/scrolbar.h"
26 #include "wx/notebook.h"
27 #include "wx/tabctrl.h"
28 #include "wx/radiobox.h"
29 #include "wx/spinbutt.h"
30 #include "wx/statbox.h"
32 #include "wx/stattext.h"
34 #include "wx/mac/uma.h"
35 #include "wx/mac/private.h"
37 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
40 wxControl::wxControl()
44 bool wxControl::Create( wxWindow
*parent
,
49 const wxValidator
& validator
,
50 const wxString
& name
)
52 bool rval
= wxWindow::Create( parent
, id
, pos
, size
, style
, name
);
55 // no automatic inheritance as we most often need transparent backgrounds
58 m_backgroundColour
= parent
->GetBackgroundColour();
59 m_foregroundColour
= parent
->GetForegroundColour();
65 SetValidator( validator
);
71 wxControl::~wxControl()
73 m_isBeingDeleted
= true;
76 bool wxControl::ProcessCommand( wxCommandEvent
&event
)
79 // 1) OnCommand, starting at this window and working up parent hierarchy
80 // 2) OnCommand then calls ProcessEvent to search the event tables.
81 return GetEventHandler()->ProcessEvent( event
);
84 void wxControl::OnKeyDown( wxKeyEvent
&event
)
86 if ( m_peer
== NULL
|| !m_peer
->Ok() )
89 UInt32 keyCode
, modifiers
;
92 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyCode
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &keyCode
);
93 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyMacCharCodes
, typeChar
, NULL
, sizeof(char), NULL
, &charCode
);
94 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyModifiers
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &modifiers
);
96 m_peer
->HandleKey( keyCode
, charCode
, modifiers
);