]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/control.cpp
replaced annoying wxLogDebug()s with wxLogTrace()
[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#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
e9576ca5
SC
13#pragma implementation "control.h"
14#endif
15
3d1a4878 16#include "wx/wxprec.h"
d8c736e5 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
8208e181 34IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
e9576ca5 35
d497dca4 36#include "wx/mac/uma.h"
7372fd0a 37#include "wx/mac/private.h"
519cb848 38
e9576ca5 39// Item members
519cb848 40
e9576ca5
SC
41wxControl::wxControl()
42{
e9576ca5
SC
43}
44
2f1ae414
SC
45bool wxControl::Create(wxWindow *parent, wxWindowID id,
46 const wxPoint& pos,
47 const wxSize& size, long style,
48 const wxValidator& validator,
49 const wxString& name)
50{
2f1ae414 51 bool rval = wxWindow::Create(parent, id, pos, size, style, name);
facd6764
SC
52
53#if 0
54 // no automatic inheritance as we most often need transparent backgrounds
327788ac
SC
55 if ( parent )
56 {
57 m_backgroundColour = parent->GetBackgroundColour() ;
58 m_foregroundColour = parent->GetForegroundColour() ;
59 }
facd6764
SC
60#endif
61
62 if (rval)
63 {
2f1ae414
SC
64#if wxUSE_VALIDATORS
65 SetValidator(validator);
66#endif
67 }
68 return rval;
69}
70
e9576ca5
SC
71wxControl::~wxControl()
72{
e7549107 73 m_isBeingDeleted = TRUE;
e9576ca5
SC
74}
75
e7549107 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.
81 return GetEventHandler()->ProcessEvent(event);
e9576ca5
SC
82}
83
519cb848
SC
84void wxControl::OnKeyDown( wxKeyEvent &event )
85{
21fd5529 86 if ( m_peer == NULL || !m_peer->Ok() )
89ebf1c9
RR
87 return ;
88
e40298d5
JS
89 char charCode ;
90 UInt32 keyCode ;
c5c9378c
SC
91 UInt32 modifiers ;
92
e40298d5
JS
93 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
94 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
95 GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
c5c9378c 96
5ca0d812 97 m_peer->HandleKey( keyCode , charCode , modifiers ) ;
519cb848
SC
98}
99