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/notebook.h"
31 #include "wx/tabctrl.h"
32 #include "wx/spinbutt.h"
34 #include "wx/osx/private.h"
36 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
39 wxControl::wxControl()
43 bool wxControl::Create( wxWindow
*parent
,
48 const wxValidator
& validator
,
49 const wxString
& name
)
51 bool rval
= wxWindow::Create( parent
, id
, pos
, size
, style
, name
);
54 // no automatic inheritance as we most often need transparent backgrounds
57 m_backgroundColour
= parent
->GetBackgroundColour();
58 m_foregroundColour
= parent
->GetForegroundColour();
64 SetValidator( validator
);
70 wxControl::~wxControl()
72 m_isBeingDeleted
= true;
75 bool wxControl::ProcessCommand( wxCommandEvent
&event
)
78 // 1) OnCommand, starting at this window and working up parent hierarchy
79 // 2) OnCommand then calls ProcessEvent to search the event tables.
80 return HandleWindowEvent( event
);
83 void wxControl::OnKeyDown( wxKeyEvent
&WXUNUSED(event
) )
85 if ( m_peer
== NULL
|| !m_peer
->IsOk() )
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
);