Fix bugs related to two phase creation of wxRibbon classes.
Add missing wxRibbonControl::Create() method. Ensure that member variables are always initialized by the ctor. Check that we're fully initialized in EVT_SIZE handler. Closes #12018. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,13 +24,24 @@ class wxRibbonArtProvider;
|
|||||||
class WXDLLIMPEXP_RIBBON wxRibbonControl : public wxControl
|
class WXDLLIMPEXP_RIBBON wxRibbonControl : public wxControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxRibbonControl() { m_art = NULL; }
|
wxRibbonControl() { Init(); }
|
||||||
|
|
||||||
wxRibbonControl(wxWindow *parent, wxWindowID id,
|
wxRibbonControl(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize, long style = 0,
|
const wxSize& size = wxDefaultSize, long style = 0,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxControlNameStr);
|
const wxString& name = wxControlNameStr)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
|
Create(parent, id, pos, size, style, validator, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize, long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxControlNameStr);
|
||||||
|
|
||||||
virtual void SetArtProvider(wxRibbonArtProvider* art);
|
virtual void SetArtProvider(wxRibbonArtProvider* art);
|
||||||
wxRibbonArtProvider* GetArtProvider() const {return m_art;}
|
wxRibbonArtProvider* GetArtProvider() const {return m_art;}
|
||||||
@@ -52,6 +63,9 @@ protected:
|
|||||||
virtual wxSize DoGetNextLargerSize(wxOrientation direction,
|
virtual wxSize DoGetNextLargerSize(wxOrientation direction,
|
||||||
wxSize relative_to) const;
|
wxSize relative_to) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init() { m_art = NULL; }
|
||||||
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
DECLARE_CLASS(wxRibbonControl)
|
DECLARE_CLASS(wxRibbonControl)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -178,6 +178,7 @@ public:
|
|||||||
wxRibbonButtonBar::wxRibbonButtonBar()
|
wxRibbonButtonBar::wxRibbonButtonBar()
|
||||||
{
|
{
|
||||||
m_layouts_valid = false;
|
m_layouts_valid = false;
|
||||||
|
CommonInit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRibbonButtonBar::wxRibbonButtonBar(wxWindow* parent,
|
wxRibbonButtonBar::wxRibbonButtonBar(wxWindow* parent,
|
||||||
|
@@ -28,20 +28,22 @@
|
|||||||
|
|
||||||
IMPLEMENT_CLASS(wxRibbonControl, wxControl)
|
IMPLEMENT_CLASS(wxRibbonControl, wxControl)
|
||||||
|
|
||||||
wxRibbonControl::wxRibbonControl(wxWindow *parent, wxWindowID id,
|
bool wxRibbonControl::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size, long style,
|
const wxSize& size, long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
: wxControl(parent, id, pos, size, style, validator, name)
|
|
||||||
{
|
{
|
||||||
m_art = NULL;
|
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
|
||||||
|
return false;
|
||||||
|
|
||||||
wxRibbonControl *ribbon_parent = wxDynamicCast(parent, wxRibbonControl);
|
wxRibbonControl *ribbon_parent = wxDynamicCast(parent, wxRibbonControl);
|
||||||
if(ribbon_parent)
|
if(ribbon_parent)
|
||||||
{
|
{
|
||||||
m_art = ribbon_parent->GetArtProvider();
|
m_art = ribbon_parent->GetArtProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art)
|
void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art)
|
||||||
|
@@ -415,9 +415,12 @@ void wxRibbonPage::OnSize(wxSizeEvent& evt)
|
|||||||
{
|
{
|
||||||
wxSize new_size = evt.GetSize();
|
wxSize new_size = evt.GetSize();
|
||||||
|
|
||||||
wxMemoryDC temp_dc;
|
if (m_art)
|
||||||
wxRect invalid_rect = m_art->GetPageBackgroundRedrawArea(temp_dc, this, m_old_size, new_size);
|
{
|
||||||
Refresh(true, &invalid_rect);
|
wxMemoryDC temp_dc;
|
||||||
|
wxRect invalid_rect = m_art->GetPageBackgroundRedrawArea(temp_dc, this, m_old_size, new_size);
|
||||||
|
Refresh(true, &invalid_rect);
|
||||||
|
}
|
||||||
|
|
||||||
m_old_size = new_size;
|
m_old_size = new_size;
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ BEGIN_EVENT_TABLE(wxRibbonPanel, wxRibbonControl)
|
|||||||
EVT_SIZE(wxRibbonPanel::OnSize)
|
EVT_SIZE(wxRibbonPanel::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxRibbonPanel::wxRibbonPanel()
|
wxRibbonPanel::wxRibbonPanel() : m_expanded_dummy(NULL), m_expanded_panel(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user