]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/control.cpp
IsModal now has the newer meaning.
[wxWidgets.git] / src / mac / carbon / control.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.cpp
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "control.h"
14 #endif
15
16 #include "wx/wxprec.h"
17
18 #include "wx/control.h"
19 #include "wx/panel.h"
20 #include "wx/app.h"
21 #include "wx/dc.h"
22 #include "wx/dcclient.h"
23 #include "wx/notebook.h"
24 #include "wx/tabctrl.h"
25 #include "wx/radiobox.h"
26 #include "wx/spinbutt.h"
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"
33
34 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
35
36 #include "wx/mac/uma.h"
37 #include "wx/mac/private.h"
38
39 // Item members
40
41 wxControl::wxControl()
42 {
43 }
44
45 bool 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 {
51 bool rval = wxWindow::Create(parent, id, pos, size, style, name);
52
53 #if 0
54 // no automatic inheritance as we most often need transparent backgrounds
55 if ( parent )
56 {
57 m_backgroundColour = parent->GetBackgroundColour() ;
58 m_foregroundColour = parent->GetForegroundColour() ;
59 }
60 #endif
61
62 if (rval)
63 {
64 #if wxUSE_VALIDATORS
65 SetValidator(validator);
66 #endif
67 }
68 return rval;
69 }
70
71 wxControl::~wxControl()
72 {
73 m_isBeingDeleted = TRUE;
74 }
75
76 bool wxControl::ProcessCommand (wxCommandEvent & event)
77 {
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);
82 }
83
84 void wxControl::OnKeyDown( wxKeyEvent &event )
85 {
86 if ( m_peer == NULL || !m_peer->Ok() )
87 return ;
88
89 char charCode ;
90 UInt32 keyCode ;
91 UInt32 modifiers ;
92
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);
96
97 m_peer->HandleKey( keyCode , charCode , modifiers ) ;
98 }
99