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