change grow box implementation - was incorrectly getting the focus in panels before
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -228,7 +228,7 @@ public:
|
|||||||
{ return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; }
|
{ return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; }
|
||||||
virtual bool IsClientAreaChild(const wxWindow *child) const
|
virtual bool IsClientAreaChild(const wxWindow *child) const
|
||||||
{
|
{
|
||||||
return !MacIsWindowScrollbar(child) &&
|
return !MacIsWindowScrollbar(child) && !((wxWindow*)m_growBox==child) &&
|
||||||
wxWindowBase::IsClientAreaChild(child);
|
wxWindowBase::IsClientAreaChild(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ protected:
|
|||||||
wxScrollBar* m_vScrollBar ;
|
wxScrollBar* m_vScrollBar ;
|
||||||
bool m_hScrollBarAlwaysShown;
|
bool m_hScrollBarAlwaysShown;
|
||||||
bool m_vScrollBarAlwaysShown;
|
bool m_vScrollBarAlwaysShown;
|
||||||
wxPanel* m_growBox ;
|
wxWindow* m_growBox ;
|
||||||
wxString m_label ;
|
wxString m_label ;
|
||||||
|
|
||||||
// set to true if we do a sharp clip at the content area of this window
|
// set to true if we do a sharp clip at the content area of this window
|
||||||
|
@@ -93,6 +93,81 @@ END_EVENT_TABLE()
|
|||||||
// implementation
|
// implementation
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
// the grow box has to be implemented as an inactive window, so that nothing can direct
|
||||||
|
// the focus to it
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxBlindPlateWindow : public wxWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxBlindPlateWindow() { Init(); }
|
||||||
|
|
||||||
|
// Old-style constructor (no default values for coordinates to avoid
|
||||||
|
// ambiguity with the new one)
|
||||||
|
wxBlindPlateWindow(wxWindow *parent,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||||
|
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 wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||||
|
const wxString& name = wxPanelNameStr)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
|
Create(parent, winid, pos, size, style, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pseudo ctor
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID winid = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||||
|
const wxString& name = wxPanelNameStr)
|
||||||
|
{
|
||||||
|
if ( !wxWindow::Create(parent, winid, pos, size, style, name) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// so that non-solid background renders correctly under GTK+:
|
||||||
|
SetThemeEnabled(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()
|
||||||
|
};
|
||||||
|
|
||||||
|
wxBlindPlateWindow::~wxBlindPlateWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxBlindPlateWindow, wxWindow)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxBlindPlateWindow, wxWindow)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constructors and such
|
// constructors and such
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -398,6 +473,14 @@ bool wxWindowMac::SetForegroundColour(const wxColour& col )
|
|||||||
|
|
||||||
bool wxWindowMac::SetBackgroundColour(const wxColour& col )
|
bool wxWindowMac::SetBackgroundColour(const wxColour& col )
|
||||||
{
|
{
|
||||||
|
if (m_growBox)
|
||||||
|
{
|
||||||
|
if ( m_backgroundColour.Ok() )
|
||||||
|
m_growBox->SetBackgroundColour(m_backgroundColour);
|
||||||
|
else
|
||||||
|
m_growBox->SetBackgroundColour(*wxWHITE);
|
||||||
|
}
|
||||||
|
|
||||||
if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol )
|
if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
@@ -1531,16 +1614,12 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
|||||||
child = node->GetData();
|
child = node->GetData();
|
||||||
if (child == NULL)
|
if (child == NULL)
|
||||||
continue;
|
continue;
|
||||||
#if wxUSE_SCROLLBAR
|
|
||||||
if (child == m_vScrollBar)
|
|
||||||
continue;
|
|
||||||
if (child == m_hScrollBar)
|
|
||||||
continue;
|
|
||||||
if (child == m_growBox)
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
if (child->IsTopLevel())
|
if (child->IsTopLevel())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ( !IsClientAreaChild(child) )
|
||||||
|
continue;
|
||||||
|
|
||||||
child->GetPosition( &x, &y );
|
child->GetPosition( &x, &y );
|
||||||
child->GetSize( &w, &h );
|
child->GetSize( &w, &h );
|
||||||
@@ -1890,7 +1969,8 @@ bool wxWindowMac::MacDoRedraw( long time )
|
|||||||
wxFAIL_MSG( "unsupported background style" );
|
wxFAIL_MSG( "unsupported background style" );
|
||||||
}
|
}
|
||||||
|
|
||||||
MacPaintGrowBox();
|
// as this is a full window, shouldn't be necessary anymore
|
||||||
|
// MacPaintGrowBox();
|
||||||
|
|
||||||
// calculate a client-origin version of the update rgn and set
|
// calculate a client-origin version of the update rgn and set
|
||||||
// m_updateRegion to that
|
// m_updateRegion to that
|
||||||
@@ -2069,7 +2149,7 @@ void wxWindowMac::MacCreateScrollBars( long style )
|
|||||||
|
|
||||||
wxPoint gPoint(width - scrlsize, height - scrlsize);
|
wxPoint gPoint(width - scrlsize, height - scrlsize);
|
||||||
wxSize gSize(scrlsize, scrlsize);
|
wxSize gSize(scrlsize, scrlsize);
|
||||||
m_growBox = new wxPanel((wxWindow *)this, wxID_ANY, gPoint, gSize, 0);
|
m_growBox = new wxBlindPlateWindow((wxWindow *)this, wxID_ANY, gPoint, gSize, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// because the create does not take into account the client area origin
|
// because the create does not take into account the client area origin
|
||||||
|
Reference in New Issue
Block a user