]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/control.cpp
cleanup - reformat
[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
8208e181 30IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
e9576ca5 31
d497dca4 32#include "wx/mac/uma.h"
7372fd0a 33#include "wx/mac/private.h"
519cb848 34
e9576ca5 35// Item members
519cb848 36
e9576ca5
SC
37wxControl::wxControl()
38{
e9576ca5
SC
39}
40
25eb6881
DS
41bool wxControl::Create(wxWindow *parent,
42 wxWindowID id,
43 const wxPoint& pos,
44 const wxSize& size,
45 long style,
46 const wxValidator& validator,
47 const wxString& name)
2f1ae414 48{
2f1ae414 49 bool rval = wxWindow::Create(parent, id, pos, size, style, name);
facd6764
SC
50
51#if 0
52 // no automatic inheritance as we most often need transparent backgrounds
327788ac
SC
53 if ( parent )
54 {
55 m_backgroundColour = parent->GetBackgroundColour() ;
56 m_foregroundColour = parent->GetForegroundColour() ;
57 }
facd6764
SC
58#endif
59
2f1ae414 60#if wxUSE_VALIDATORS
25eb6881 61 if (rval)
2f1ae414
SC
62 SetValidator(validator);
63#endif
25eb6881 64
2f1ae414
SC
65 return rval;
66}
67
e9576ca5
SC
68wxControl::~wxControl()
69{
25eb6881 70 m_isBeingDeleted = true;
e9576ca5
SC
71}
72
e7549107 73bool wxControl::ProcessCommand (wxCommandEvent & event)
e9576ca5 74{
a3bf7524
VS
75 // Tries:
76 // 1) OnCommand, starting at this window and working up parent hierarchy
77 // 2) OnCommand then calls ProcessEvent to search the event tables.
78 return GetEventHandler()->ProcessEvent(event);
e9576ca5
SC
79}
80
519cb848
SC
81void wxControl::OnKeyDown( wxKeyEvent &event )
82{
21fd5529 83 if ( m_peer == NULL || !m_peer->Ok() )
89ebf1c9 84 return ;
25eb6881 85
e40298d5 86 char charCode ;
25eb6881 87 UInt32 keyCode, modifiers ;
c5c9378c 88
25eb6881
DS
89 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL,&charCode );
90 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
91 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
c5c9378c 92
5ca0d812 93 m_peer->HandleKey( keyCode , charCode , modifiers ) ;
519cb848
SC
94}
95