]>
Commit | Line | Data |
---|---|---|
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 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #include "wx/control.h" | |
15 | ||
16 | #ifndef WX_PRECOMP | |
17 | #include "wx/app.h" | |
18 | #include "wx/panel.h" | |
19 | #include "wx/dc.h" | |
20 | #include "wx/dcclient.h" | |
21 | #include "wx/button.h" | |
22 | #include "wx/dialog.h" | |
23 | #include "wx/scrolbar.h" | |
24 | #include "wx/stattext.h" | |
25 | #include "wx/statbox.h" | |
26 | #include "wx/radiobox.h" | |
27 | #include "wx/sizer.h" | |
28 | #endif // WX_PRECOMP | |
29 | ||
1f0c8f31 | 30 | #include "wx/osx/private.h" |
489468fe SC |
31 | |
32 | IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) | |
33 | ||
34 | ||
35 | wxControl::wxControl() | |
36 | { | |
37 | } | |
38 | ||
39 | bool wxControl::Create( wxWindow *parent, | |
40 | wxWindowID id, | |
41 | const wxPoint& pos, | |
42 | const wxSize& size, | |
43 | long style, | |
44 | const wxValidator& validator, | |
45 | const wxString& name ) | |
46 | { | |
47 | bool rval = wxWindow::Create( parent, id, pos, size, style, name ); | |
48 | ||
49 | #if 0 | |
50 | // no automatic inheritance as we most often need transparent backgrounds | |
51 | if ( parent ) | |
52 | { | |
53 | m_backgroundColour = parent->GetBackgroundColour(); | |
54 | m_foregroundColour = parent->GetForegroundColour(); | |
55 | } | |
56 | #endif | |
57 | ||
58 | #if wxUSE_VALIDATORS | |
59 | if (rval) | |
60 | SetValidator( validator ); | |
61 | #endif | |
62 | ||
63 | return rval; | |
64 | } | |
65 | ||
66 | wxControl::~wxControl() | |
67 | { | |
68 | m_isBeingDeleted = true; | |
69 | } | |
70 | ||
71 | bool wxControl::ProcessCommand( wxCommandEvent &event ) | |
72 | { | |
73 | // Tries: | |
74 | // 1) OnCommand, starting at this window and working up parent hierarchy | |
75 | // 2) OnCommand then calls ProcessEvent to search the event tables. | |
76 | return HandleWindowEvent( event ); | |
77 | } | |
78 | ||
79 | void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) ) | |
80 | { | |
b2680ced | 81 | if ( m_peer == NULL || !m_peer->IsOk() ) |
489468fe SC |
82 | return; |
83 | ||
524c47aa | 84 | #if wxOSX_USE_CARBON |
489468fe SC |
85 | UInt32 keyCode, modifiers; |
86 | char charCode; | |
87 | ||
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 ); | |
91 | ||
92 | m_peer->HandleKey( keyCode, charCode, modifiers ); | |
524c47aa SC |
93 | #else |
94 | // TODO | |
95 | #endif | |
489468fe | 96 | } |