]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/control.cpp
Add missing WXK constants for the control keys
[wxWidgets.git] / src / osx / carbon / control.cpp
CommitLineData
489468fe 1/////////////////////////////////////////////////////////////////////////////
524c47aa 2// Name: src/osx/carbon/control.cpp
489468fe
SC
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
16#ifndef WX_PRECOMP
17 #include "wx/app.h"
18 #include "wx/panel.h"
19 #include "wx/dc.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"
27 #include "wx/sizer.h"
28#endif // WX_PRECOMP
29
1f0c8f31 30#include "wx/osx/private.h"
489468fe
SC
31
32IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
33
34
35wxControl::wxControl()
36{
37}
38
39bool wxControl::Create( wxWindow *parent,
40 wxWindowID id,
41 const wxPoint& pos,
42 const wxSize& size,
43 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 wxUSE_VALIDATORS
59 if (rval)
60 SetValidator( validator );
61#endif
62
63 return rval;
64}
65
489468fe
SC
66bool wxControl::ProcessCommand( wxCommandEvent &event )
67{
68 // Tries:
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 );
72}
73
74void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
75{
22756322 76 if ( GetPeer() == NULL || !GetPeer()->IsOk() )
489468fe
SC
77 return;
78
524c47aa 79#if wxOSX_USE_CARBON
489468fe
SC
80 UInt32 keyCode, modifiers;
81 char charCode;
82
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 );
86
22756322 87 GetPeer()->HandleKey( keyCode, charCode, modifiers );
524c47aa
SC
88#else
89 // TODO
90#endif
489468fe 91}