1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/control.cpp
3 // Purpose: wxControl class
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
13 #include "wx/control.h"
19 #include "wx/dcclient.h"
20 #include "wx/button.h"
21 #include "wx/dialog.h"
22 #include "wx/scrolbar.h"
23 #include "wx/stattext.h"
24 #include "wx/statbox.h"
25 #include "wx/radiobox.h"
29 #include "wx/osx/private.h"
31 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
34 wxControl::wxControl()
38 bool wxControl::Create( wxWindow
*parent
,
43 const wxValidator
& validator
,
44 const wxString
& name
)
46 bool rval
= wxWindow::Create( parent
, id
, pos
, size
, style
, name
);
49 // no automatic inheritance as we most often need transparent backgrounds
52 m_backgroundColour
= parent
->GetBackgroundColour();
53 m_foregroundColour
= parent
->GetForegroundColour();
59 SetValidator( validator
);
65 bool wxControl::ProcessCommand( wxCommandEvent
&event
)
68 // 1) OnCommand, starting at this window and working up parent hierarchy
69 // 2) OnCommand then calls ProcessEvent to search the event tables.
70 return HandleWindowEvent( event
);
73 void wxControl::OnKeyDown( wxKeyEvent
&WXUNUSED(event
) )
75 if ( GetPeer() == NULL
|| !GetPeer()->IsOk() )
79 UInt32 keyCode
, modifiers
;
82 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyCode
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &keyCode
);
83 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyMacCharCodes
, typeChar
, NULL
, 1, NULL
, &charCode
);
84 GetEventParameter( (EventRef
)wxTheApp
->MacGetCurrentEvent(), kEventParamKeyModifiers
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &modifiers
);
86 GetPeer()->HandleKey( keyCode
, charCode
, modifiers
);