1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/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"
24 #include "wx/stattext.h"
25 #include "wx/statbox.h"
26 #include "wx/radiobox.h"
30 #include "wx/osx/private.h"
32 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
35 wxControl::wxControl()
39 bool wxControl::Create( wxWindow
*parent
,
44 const wxValidator
& validator
,
45 const wxString
& name
)
47 bool rval
= wxWindow::Create( parent
, id
, pos
, size
, style
, name
);
50 // no automatic inheritance as we most often need transparent backgrounds
53 m_backgroundColour
= parent
->GetBackgroundColour();
54 m_foregroundColour
= parent
->GetForegroundColour();
60 SetValidator( validator
);
66 bool wxControl::ProcessCommand( wxCommandEvent
&event
)
69 // 1) OnCommand, starting at this window and working up parent hierarchy
70 // 2) OnCommand then calls ProcessEvent to search the event tables.
71 return HandleWindowEvent( event
);
74 void wxControl::OnKeyDown( wxKeyEvent
&WXUNUSED(event
) )
76 if ( m_peer
== NULL
|| !m_peer
->IsOk() )
80 UInt32 keyCode
, modifiers
;
83 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyCode
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &keyCode
);
84 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyMacCharCodes
, typeChar
, NULL
, sizeof(char), NULL
, &charCode
);
85 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyModifiers
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &modifiers
);
87 m_peer
->HandleKey( keyCode
, charCode
, modifiers
);