1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "control.h"
18 #include "wx/control.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"
32 #include "wx/stattext.h"
34 #if !USE_SHARED_LIBRARY
35 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
38 #include "wx/mac/uma.h"
39 #include "wx/mac/private.h"
43 wxControl::wxControl()
47 bool wxControl::Create(wxWindow
*parent
, wxWindowID id
,
49 const wxSize
& size
, long style
,
50 const wxValidator
& validator
,
53 bool rval
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
56 // no automatic inheritance as we most often need transparent backgrounds
59 m_backgroundColour
= parent
->GetBackgroundColour() ;
60 m_foregroundColour
= parent
->GetForegroundColour() ;
67 SetValidator(validator
);
73 wxControl::~wxControl()
75 m_isBeingDeleted
= TRUE
;
78 bool wxControl::ProcessCommand (wxCommandEvent
& event
)
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
);
86 void wxControl::OnKeyDown( wxKeyEvent
&event
)
88 if ( (ControlRef
) m_macControl
== NULL
)
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
);
101 ::HandleControlKey( (ControlRef
) m_macControl
, keyCode
, charCode
, modifiers
) ;
104 EventRecord
*ev
= (EventRecord
*) wxTheApp
->MacGetCurrentEvent() ;
107 keychar
= short(ev
->message
& charCodeMask
);
108 keycode
= short(ev
->message
& keyCodeMask
) >> 8 ;
110 ::HandleControlKey( (ControlRef
) m_macControl
, keycode
, keychar
, ev
->modifiers
) ;