// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
-// RCS-ID: $Id: window.cpp 54981 2008-08-05 17:52:02Z SC $
+// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __WXUNIVERSAL__
IMPLEMENT_ABSTRACT_CLASS(wxWindowMac, wxWindowBase)
-#else
- IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
#endif
BEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase)
{
public:
wxBlindPlateWindow() { Init(); }
-
+
// Old-style constructor (no default values for coordinates to avoid
// ambiguity with the new one)
wxBlindPlateWindow(wxWindow *parent,
const wxString& name = wxPanelNameStr)
{
Init();
-
+
Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name);
}
-
+
// Constructor
wxBlindPlateWindow(wxWindow *parent,
wxWindowID winid = wxID_ANY,
const wxString& name = wxPanelNameStr)
{
Init();
-
+
Create(parent, winid, pos, size, style, name);
}
-
+
// Pseudo ctor
bool Create(wxWindow *parent,
wxWindowID winid = wxID_ANY,
{
if ( !wxWindow::Create(parent, winid, pos, size, style, name) )
return false;
-
+
// so that non-solid background renders correctly under GTK+:
SetThemeEnabled(true);
+ return true;
}
-
+
virtual ~wxBlindPlateWindow();
-
+
virtual bool AcceptsFocus() const
{
return false;
}
-
+
protected:
// common part of all ctors
void Init()
{
}
-
+
DECLARE_DYNAMIC_CLASS_NO_COPY(wxBlindPlateWindow)
DECLARE_EVENT_TABLE()
};
// delete our drop target if we've got one
#if wxUSE_DRAG_AND_DROP
- if ( m_dropTarget != NULL )
- {
- delete m_dropTarget;
- m_dropTarget = NULL;
- }
+ wxDELETE(m_dropTarget);
#endif
delete m_peer ;
m_peer->SetData<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
#endif
-
+
switch ( variant )
{
case wxWINDOW_VARIANT_NORMAL :
{
if ( !wxWindowBase::SetBackgroundStyle(style) )
return false;
-
+
if ( m_peer )
m_peer->SetBackgroundStyle(style);
return true;
bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
{
#ifndef __WXUNIVERSAL__
- menu->SetInvokingWindow((wxWindow*)this);
menu->UpdateUI();
if ( x == wxDefaultCoord && y == wxDefaultCoord )
ClientToScreen( &x , &y ) ;
}
menu->GetPeer()->PopUp(this, x, y);
- menu->SetInvokingWindow( NULL );
return true;
#else
// actually this shouldn't be called, because universal is having its own implementation
if ( m_tooltip )
m_tooltip->SetWindow(this);
-
+
if (m_peer)
m_peer->SetToolTip(tooltip);
}
}
}
+float wxWindowMac::GetContentScaleFactor() const
+{
+ return m_peer->GetContentScaleFactor();
+}
+
void wxWindowMac::SetLabel(const wxString& title)
{
if ( title == m_label )
m_peer->SetVisibility( show ) ;
#ifdef __WXOSX_IPHONE__
- // only when there's no native event support
+ // only when there's no native event support
if ( !IsTopLevel() )
#endif
{
wxShowEvent eventShow(GetId(), show);
eventShow.SetEventObject(this);
-
+
HandleWindowEvent(eventShow);
}
-
+
return true;
}
if ( IsTopLevel() )
return ;
- bool hasFocus = m_peer->NeedsFocusRect() && m_peer->HasFocus() ;
+ bool hasFocus = m_peer->NeedsFocusRect() && HasFocus();
// back to the surrounding frame rectangle
int tx,ty,tw,th;
int range, bool refresh)
{
#if wxUSE_SCROLLBAR
+ // Updating scrollbars when window is being deleted is useless and
+ // currently results in asserts in client-to-screen coordinates conversion
+ // code which is used by DoUpdateScrollbarVisibility() so just skip it.
+ if ( m_isBeingDeleted )
+ return;
+
if ( orient == wxHORIZONTAL && m_hScrollBar )
m_hScrollBar->SetScrollbar(pos, thumb, range, thumb, refresh);
else if ( orient == wxVERTICAL && m_vScrollBar )
if (child->IsTopLevel())
continue;
-
+
if ( !IsClientAreaChild(child) )
continue;
return wxFindWindowFromWXWidget(wxWidgetImpl::FindFocus());
}
-void wxWindowMac::OnInternalIdle()
-{
- // This calls the UI-update mechanism (querying windows for
- // menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
- UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
-}
-
// Raise the window to the top of the Z order
void wxWindowMac::Raise()
{
}
}
-long wxWindowMac::MacGetLeftBorderSize() const
+long wxWindowMac::MacGetWXBorderSize() const
{
if ( IsTopLevel() )
return 0 ;
return border ;
}
+long wxWindowMac::MacGetLeftBorderSize() const
+{
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= left;
+ }
+
+ return border;
+}
+
+
long wxWindowMac::MacGetRightBorderSize() const
{
- // they are all symmetric in mac themes
- return MacGetLeftBorderSize() ;
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= right;
+ }
+
+ return border;
}
long wxWindowMac::MacGetTopBorderSize() const
{
- // they are all symmetric in mac themes
- return MacGetLeftBorderSize() ;
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= top;
+ }
+
+ return border;
}
long wxWindowMac::MacGetBottomBorderSize() const
{
- // they are all symmetric in mac themes
- return MacGetLeftBorderSize() ;
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= bottom;
+ }
+
+ return border;
}
long wxWindowMac::MacRemoveBordersFromStyle( long style )
bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent& event )
{
- bool handled = HandleWindowEvent( event ) ;
- if ( handled && event.GetSkipped() )
- handled = false ;
+ bool handled = false;
+
+ // moved the ordinary key event sending AFTER the accel evaluation
#if wxUSE_ACCEL
if ( !handled && event.GetEventType() == wxEVT_KEY_DOWN)
}
}
#endif // wxUSE_ACCEL
+
+ if ( !handled )
+ {
+ handled = HandleWindowEvent( event ) ;
+ if ( handled && event.GetSkipped() )
+ handled = false ;
+ }
return handled ;
}