]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/control.cpp
no changes, just corrected the comment for wxConvLocal
[wxWidgets.git] / src / mac / carbon / control.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.cpp
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"
03e11df5
GD
15#include "wx/panel.h"
16#include "wx/app.h"
5fde6fcc 17#include "wx/dc.h"
456c94e1 18#include "wx/dcclient.h"
519cb848
SC
19#include "wx/notebook.h"
20#include "wx/tabctrl.h"
2f1ae414 21#include "wx/radiobox.h"
519cb848 22#include "wx/spinbutt.h"
03e11df5
GD
23#include "wx/scrolbar.h"
24#include "wx/button.h"
25#include "wx/dialog.h"
26#include "wx/statbox.h"
27#include "wx/sizer.h"
28#include "wx/stattext.h"
e9576ca5 29
d497dca4 30#include "wx/mac/uma.h"
7372fd0a 31#include "wx/mac/private.h"
519cb848 32
162d3be3
DS
33IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
34
519cb848 35
e9576ca5
SC
36wxControl::wxControl()
37{
e9576ca5
SC
38}
39
162d3be3 40bool wxControl::Create( wxWindow *parent,
25eb6881
DS
41 wxWindowID id,
42 const wxPoint& pos,
43 const wxSize& size,
44 long style,
45 const wxValidator& validator,
162d3be3 46 const wxString& name )
2f1ae414 47{
162d3be3 48 bool rval = wxWindow::Create( parent, id, pos, size, style, name );
facd6764
SC
49
50#if 0
51 // no automatic inheritance as we most often need transparent backgrounds
327788ac
SC
52 if ( parent )
53 {
162d3be3
DS
54 m_backgroundColour = parent->GetBackgroundColour();
55 m_foregroundColour = parent->GetForegroundColour();
327788ac 56 }
facd6764
SC
57#endif
58
2f1ae414 59#if wxUSE_VALIDATORS
162d3be3
DS
60 if (rval)
61 SetValidator( validator );
2f1ae414 62#endif
25eb6881 63
2f1ae414
SC
64 return rval;
65}
66
e9576ca5
SC
67wxControl::~wxControl()
68{
25eb6881 69 m_isBeingDeleted = true;
e9576ca5
SC
70}
71
162d3be3 72bool wxControl::ProcessCommand( wxCommandEvent &event )
e9576ca5 73{
a3bf7524
VS
74 // Tries:
75 // 1) OnCommand, starting at this window and working up parent hierarchy
76 // 2) OnCommand then calls ProcessEvent to search the event tables.
162d3be3 77 return GetEventHandler()->ProcessEvent( event );
e9576ca5
SC
78}
79
162d3be3 80void wxControl::OnKeyDown( wxKeyEvent &event )
519cb848 81{
21fd5529 82 if ( m_peer == NULL || !m_peer->Ok() )
162d3be3 83 return;
25eb6881 84
162d3be3
DS
85 UInt32 keyCode, modifiers;
86 char charCode;
c5c9378c 87
162d3be3
DS
88 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
89 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
90 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
c5c9378c 91
162d3be3 92 m_peer->HandleKey( keyCode, charCode, modifiers );
519cb848
SC
93}
94