]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/control.cpp
export wxSettableHeaderColumn from DLL
[wxWidgets.git] / src / osx / carbon / control.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/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 #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
30 #include "wx/notebook.h"
31 #include "wx/tabctrl.h"
32 #include "wx/spinbutt.h"
33
34 #include "wx/osx/private.h"
35
36 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
37
38
39 wxControl::wxControl()
40 {
41 }
42
43 bool wxControl::Create( wxWindow *parent,
44 wxWindowID id,
45 const wxPoint& pos,
46 const wxSize& size,
47 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 wxUSE_VALIDATORS
63 if (rval)
64 SetValidator( validator );
65 #endif
66
67 return rval;
68 }
69
70 wxControl::~wxControl()
71 {
72 m_isBeingDeleted = true;
73 }
74
75 bool wxControl::ProcessCommand( wxCommandEvent &event )
76 {
77 // Tries:
78 // 1) OnCommand, starting at this window and working up parent hierarchy
79 // 2) OnCommand then calls ProcessEvent to search the event tables.
80 return HandleWindowEvent( event );
81 }
82
83 void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
84 {
85 if ( m_peer == NULL || !m_peer->IsOk() )
86 return;
87
88 #if wxOSX_USE_CARBON
89 UInt32 keyCode, modifiers;
90 char charCode;
91
92 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
93 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
94 GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
95
96 m_peer->HandleKey( keyCode, charCode, modifiers );
97 #else
98 // TODO
99 #endif
100 }