]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/control.cpp
Fix for non-CG mode
[wxWidgets.git] / src / mac / carbon / control.cpp
CommitLineData
e9576ca5 1/////////////////////////////////////////////////////////////////////////////
670f9935 2// Name: src/mac/carbon/control.cpp
e9576ca5 3// Purpose: wxControl class
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878 12#include "wx/wxprec.h"
d8c736e5 13
e9576ca5 14#include "wx/control.h"
670f9935
WS
15
16#ifndef WX_PRECOMP
17 #include "wx/app.h"
8e609c82 18 #include "wx/panel.h"
da80ae71 19 #include "wx/dc.h"
ed4b0fdc 20 #include "wx/dcclient.h"
f1e01716 21 #include "wx/button.h"
fdf565fe 22 #include "wx/dialog.h"
851dee09 23 #include "wx/scrolbar.h"
ccdc11bb 24 #include "wx/stattext.h"
876cd6f7 25 #include "wx/statbox.h"
cc11cc69 26 #include "wx/radiobox.h"
ed2fbeb8 27 #include "wx/sizer.h"
670f9935
WS
28#endif // WX_PRECOMP
29
519cb848
SC
30#include "wx/notebook.h"
31#include "wx/tabctrl.h"
32#include "wx/spinbutt.h"
e9576ca5 33
d497dca4 34#include "wx/mac/uma.h"
7372fd0a 35#include "wx/mac/private.h"
519cb848 36
162d3be3
DS
37IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
38
519cb848 39
e9576ca5
SC
40wxControl::wxControl()
41{
e9576ca5
SC
42}
43
162d3be3 44bool wxControl::Create( wxWindow *parent,
25eb6881
DS
45 wxWindowID id,
46 const wxPoint& pos,
47 const wxSize& size,
48 long style,
49 const wxValidator& validator,
162d3be3 50 const wxString& name )
2f1ae414 51{
162d3be3 52 bool rval = wxWindow::Create( parent, id, pos, size, style, name );
facd6764
SC
53
54#if 0
55 // no automatic inheritance as we most often need transparent backgrounds
327788ac
SC
56 if ( parent )
57 {
162d3be3
DS
58 m_backgroundColour = parent->GetBackgroundColour();
59 m_foregroundColour = parent->GetForegroundColour();
327788ac 60 }
facd6764
SC
61#endif
62
2f1ae414 63#if wxUSE_VALIDATORS
162d3be3
DS
64 if (rval)
65 SetValidator( validator );
2f1ae414 66#endif
25eb6881 67
2f1ae414
SC
68 return rval;
69}
70
e9576ca5
SC
71wxControl::~wxControl()
72{
25eb6881 73 m_isBeingDeleted = true;
e9576ca5
SC
74}
75
162d3be3 76bool wxControl::ProcessCommand( wxCommandEvent &event )
e9576ca5 77{
a3bf7524
VS
78 // Tries:
79 // 1) OnCommand, starting at this window and working up parent hierarchy
80 // 2) OnCommand then calls ProcessEvent to search the event tables.
162d3be3 81 return GetEventHandler()->ProcessEvent( event );
e9576ca5
SC
82}
83
162d3be3 84void wxControl::OnKeyDown( wxKeyEvent &event )
519cb848 85{
21fd5529 86 if ( m_peer == NULL || !m_peer->Ok() )
162d3be3 87 return;
25eb6881 88
162d3be3
DS
89 UInt32 keyCode, modifiers;
90 char charCode;
c5c9378c 91
162d3be3
DS
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 );
c5c9378c 95
162d3be3 96 m_peer->HandleKey( keyCode, charCode, modifiers );
519cb848 97}