return m_peer == kOSXNoWidgetImpl ? NULL : m_peer ;
}
+bool wxWindowMac::ShouldCreatePeer() const
+{
+ return m_peer != kOSXNoWidgetImpl;
+}
+
void wxWindowMac::DontCreatePeer()
{
m_peer = kOSXNoWidgetImpl;
GetParent()->MacChildAdded() ;
// adjust font, controlsize etc
- DoSetWindowVariant( m_windowVariant ) ;
+ GetPeer()->SetControlSize( m_windowVariant );
+ InheritAttributes();
+ // in case nothing has been set, use the variant default fonts
+ if ( !m_hasFont )
+ DoSetWindowVariant( m_windowVariant );
GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ;
/*
* Right now we have the following setup :
* a border that is not part of the native control is always outside the
- * control's border (otherwise we loose all native intelligence, future ways
+ * control's border (otherwise we lose all native intelligence, future ways
* may be to have a second embedding control responsible for drawing borders
* and backgrounds eventually)
* so all this border calculations have to be taken into account when calling
return;
GetPeer()->SetControlSize( variant );
-#if wxOSX_USE_CARBON
- ControlSize size ;
-
- // we will get that from the settings later
- // and make this NORMAL later, but first
- // we have a few calculations that we must fix
-
- switch ( variant )
- {
- case wxWINDOW_VARIANT_NORMAL :
- size = kControlSizeNormal;
- break ;
-
- case wxWINDOW_VARIANT_SMALL :
- size = kControlSizeSmall;
- break ;
-
- case wxWINDOW_VARIANT_MINI :
- // not always defined in the headers
- size = 3 ;
- break ;
-
- case wxWINDOW_VARIANT_LARGE :
- size = kControlSizeLarge;
- break ;
-
- default:
- wxFAIL_MSG(wxT("unexpected window variant"));
- break ;
- }
- GetPeer()->SetData<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
-#endif
-
switch ( variant )
{
GetPeer()->SetFocus() ;
}
+void wxWindowMac::OSXSimulateFocusEvents()
+{
+ wxWindow* former = FindFocus() ;
+ if ( former != NULL && former != this )
+ {
+ {
+ wxFocusEvent event( wxEVT_KILL_FOCUS, former->GetId());
+ event.SetEventObject(former);
+ event.SetWindow(this);
+ former->HandleWindowEvent(event) ;
+ }
+
+ {
+ wxFocusEvent event(wxEVT_SET_FOCUS, former->GetId());
+ event.SetEventObject(former);
+ event.SetWindow(this);
+ former->HandleWindowEvent(event);
+ }
+ }
+}
+
void wxWindowMac::DoCaptureMouse()
{
wxApp::s_captureWindow = (wxWindow*) this ;
delete m_dropTarget;
m_dropTarget = pDropTarget;
- if ( m_dropTarget != NULL )
- {
- // TODO:
- }
+
+ GetPeer()->SetDropTarget(m_dropTarget) ;
}
#endif
void wxWindowMac::MacEnabledStateChanged()
{
- OnEnabled( GetPeer()->IsEnabled() );
}
//
if ( !IsShownOnScreen() )
return ;
+
+ if ( IsFrozen() )
+ return;
GetPeer()->SetNeedsDisplay( rect ) ;
}
void wxWindowMac::DoFreeze()
{
-#if wxOSX_USE_CARBON
if ( GetPeer() && GetPeer()->IsOk() )
GetPeer()->SetDrawingEnabled( false ) ;
-#endif
}
void wxWindowMac::DoThaw()
{
-#if wxOSX_USE_CARBON
if ( GetPeer() && GetPeer()->IsOk() )
- {
GetPeer()->SetDrawingEnabled( true ) ;
- GetPeer()->InvalidateWithChildren() ;
- }
-#endif
}
wxWindow *wxGetActiveWindow()
if ( wxRect2DInt( clientorigin.x , clientorigin.y , clientsize.x , clientsize.y ).Contains( wxPoint2DInt( pt ) ) )
{
wxSetCursorEvent event( pt.x , pt.y );
+ event.SetId(GetId());
+ event.SetEventObject(this);
bool processedEvtSetCursor = HandleWindowEvent(event);
if ( processedEvtSetCursor && event.HasCursor() )
const wxFrame *frame = wxDynamicCast( win, wxFrame ) ;
if ( frame )
{
- if ( frame->GetWindowStyleFlag() & wxRESIZE_BORDER )
+ // starting from 10.7 there are no resize indicators anymore
+ if ( (frame->GetWindowStyleFlag() & wxRESIZE_BORDER) && UMAGetSystemVersion() < 0x1070)
{
// Parent frame has resize handle
wxPoint frameBottomRight = frame->GetScreenRect().GetBottomRight();
int x, y, w, h ;
window->MacGetBoundsForControl( pos , size , x , y, w, h , adjustForOrigin ) ;
- Rect bounds = { y, x, y + h, x + w };
+ Rect bounds = { static_cast<short>(y), static_cast<short>(x), static_cast<short>(y + h), static_cast<short>(x + w) };
return bounds ;
}
unsigned char charCode ;
UInt32 keyCode ;
UInt32 modifiers ;
- Point where ;
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
- GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
+ GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
- GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &where );
UInt32 keymessage = (keyCode << 8) + charCode;
wxKeyEvent wxevent(wxEVT_HOTKEY);
wxevent.SetId(hotKeyId.id);
wxTheApp->MacCreateKeyEvent( wxevent, s_hotkeys[i].window , keymessage ,
- modifiers , when , where.h , where.v , 0 ) ;
+ modifiers , when , 0 ) ;
s_hotkeys[i].window->HandleWindowEvent(wxevent);
}
bool wxWindowMac::UnregisterHotKey(int hotkeyId)
{
- for ( unsigned i = s_hotkeys.size()-1; i>=0; -- i )
+ for ( int i = ((int)s_hotkeys.size())-1; i>=0; -- i )
{
if ( s_hotkeys[i].keyId == hotkeyId )
{
{
wxEvtHandler * const handler = ancestor->GetEventHandler();
- wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
+ wxCommandEvent command_event( wxEVT_MENU, command );
handled = handler->ProcessEvent( command_event );
if ( !handled )
{
// accelerators can also be used with buttons, try them too
- command_event.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
+ command_event.SetEventType(wxEVT_BUTTON);
handled = handler->ProcessEvent( command_event );
}
{
return m_needsFrame;
}
+
+void wxWidgetImpl::SetDrawingEnabled(bool WXUNUSED(enabled))
+{
+}