]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/control.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / osx / carbon / control.cpp
CommitLineData
489468fe 1/////////////////////////////////////////////////////////////////////////////
524c47aa 2// Name: src/osx/carbon/control.cpp
489468fe
SC
3// Purpose: wxControl class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
489468fe
SC
7// Copyright: (c) Stefan Csomor
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#include "wx/wxprec.h"
12
13#include "wx/control.h"
14
15#ifndef WX_PRECOMP
16 #include "wx/app.h"
17 #include "wx/panel.h"
18 #include "wx/dc.h"
19 #include "wx/dcclient.h"
20 #include "wx/button.h"
21 #include "wx/dialog.h"
22 #include "wx/scrolbar.h"
23 #include "wx/stattext.h"
24 #include "wx/statbox.h"
25 #include "wx/radiobox.h"
26 #include "wx/sizer.h"
27#endif // WX_PRECOMP
28
1f0c8f31 29#include "wx/osx/private.h"
489468fe
SC
30
31IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
32
33
34wxControl::wxControl()
35{
36}
37
38bool wxControl::Create( wxWindow *parent,
39 wxWindowID id,
40 const wxPoint& pos,
41 const wxSize& size,
42 long style,
43 const wxValidator& validator,
44 const wxString& name )
45{
46 bool rval = wxWindow::Create( parent, id, pos, size, style, name );
47
48#if 0
49 // no automatic inheritance as we most often need transparent backgrounds
50 if ( parent )
51 {
52 m_backgroundColour = parent->GetBackgroundColour();
53 m_foregroundColour = parent->GetForegroundColour();
54 }
55#endif
56
57#if wxUSE_VALIDATORS
58 if (rval)
59 SetValidator( validator );
60#endif
61
62 return rval;
63}
64
489468fe
SC
65bool wxControl::ProcessCommand( wxCommandEvent &event )
66{
67 // Tries:
68 // 1) OnCommand, starting at this window and working up parent hierarchy
69 // 2) OnCommand then calls ProcessEvent to search the event tables.
70 return HandleWindowEvent( event );
71}
72
73void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
74{
22756322 75 if ( GetPeer() == NULL || !GetPeer()->IsOk() )
489468fe
SC
76 return;
77
524c47aa 78#if wxOSX_USE_CARBON
489468fe
SC
79 UInt32 keyCode, modifiers;
80 char charCode;
81
82 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
784d9056 83 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
489468fe
SC
84 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
85
22756322 86 GetPeer()->HandleKey( keyCode, charCode, modifiers );
524c47aa
SC
87#else
88 // TODO
89#endif
489468fe 90}