]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/carbon/control.cpp
positioning of the insertion point at the end
[wxWidgets.git] / src / mac / carbon / control.cpp
... / ...
CommitLineData
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#ifdef __GNUG__
13#pragma implementation "control.h"
14#endif
15
16#include "wx/defs.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#if !USE_SHARED_LIBRARY
35IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
36#endif
37
38#include "wx/mac/uma.h"
39#include "wx/mac/private.h"
40
41// Item members
42
43wxControl::wxControl()
44{
45}
46
47bool wxControl::Create(wxWindow *parent, wxWindowID id,
48 const wxPoint& pos,
49 const wxSize& size, long style,
50 const wxValidator& validator,
51 const wxString& name)
52{
53 bool rval = wxWindow::Create(parent, id, pos, size, style, name);
54
55#if 0
56 // no automatic inheritance as we most often need transparent backgrounds
57 if ( parent )
58 {
59 m_backgroundColour = parent->GetBackgroundColour() ;
60 m_foregroundColour = parent->GetForegroundColour() ;
61 }
62#endif
63
64 if (rval)
65 {
66#if wxUSE_VALIDATORS
67 SetValidator(validator);
68#endif
69 }
70 return rval;
71}
72
73wxControl::~wxControl()
74{
75 m_isBeingDeleted = TRUE;
76}
77
78bool wxControl::ProcessCommand (wxCommandEvent & event)
79{
80 // Tries:
81 // 1) OnCommand, starting at this window and working up parent hierarchy
82 // 2) OnCommand then calls ProcessEvent to search the event tables.
83 return GetEventHandler()->ProcessEvent(event);
84}
85
86void wxControl::OnKeyDown( wxKeyEvent &event )
87{
88 if ( (ControlRef) m_macControl == NULL )
89 return ;
90
91#if TARGET_CARBON
92
93 char charCode ;
94 UInt32 keyCode ;
95 UInt32 modifiers ;
96
97 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
98 GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
99 GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
100
101 ::HandleControlKey( (ControlRef) m_macControl , keyCode , charCode , modifiers ) ;
102
103#else
104 EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
105 short keycode ;
106 short keychar ;
107 keychar = short(ev->message & charCodeMask);
108 keycode = short(ev->message & keyCodeMask) >> 8 ;
109
110 ::HandleControlKey( (ControlRef) m_macControl , keycode , keychar , ev->modifiers ) ;
111#endif
112}
113