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,9 +24,20 @@ class wxRibbonArtProvider;
|
||||
class WXDLLIMPEXP_RIBBON wxRibbonControl : public wxControl
|
||||
{
|
||||
public:
|
||||
wxRibbonControl() { m_art = NULL; }
|
||||
wxRibbonControl() { Init(); }
|
||||
|
||||
wxRibbonControl(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
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,
|
||||
@@ -52,6 +63,9 @@ protected:
|
||||
virtual wxSize DoGetNextLargerSize(wxOrientation direction,
|
||||
wxSize relative_to) const;
|
||||
|
||||
private:
|
||||
void Init() { m_art = NULL; }
|
||||
|
||||
#ifndef SWIG
|
||||
DECLARE_CLASS(wxRibbonControl)
|
||||
#endif
|
||||
|
@@ -178,6 +178,7 @@ public:
|
||||
wxRibbonButtonBar::wxRibbonButtonBar()
|
||||
{
|
||||
m_layouts_valid = false;
|
||||
CommonInit (0);
|
||||
}
|
||||
|
||||
wxRibbonButtonBar::wxRibbonButtonBar(wxWindow* parent,
|
||||
|
@@ -28,20 +28,22 @@
|
||||
|
||||
IMPLEMENT_CLASS(wxRibbonControl, wxControl)
|
||||
|
||||
wxRibbonControl::wxRibbonControl(wxWindow *parent, wxWindowID id,
|
||||
bool wxRibbonControl::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
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);
|
||||
if(ribbon_parent)
|
||||
{
|
||||
m_art = ribbon_parent->GetArtProvider();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art)
|
||||
|
@@ -415,9 +415,12 @@ void wxRibbonPage::OnSize(wxSizeEvent& evt)
|
||||
{
|
||||
wxSize new_size = evt.GetSize();
|
||||
|
||||
if (m_art)
|
||||
{
|
||||
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;
|
||||
|
||||
|
@@ -43,7 +43,7 @@ BEGIN_EVENT_TABLE(wxRibbonPanel, wxRibbonControl)
|
||||
EVT_SIZE(wxRibbonPanel::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxRibbonPanel::wxRibbonPanel()
|
||||
wxRibbonPanel::wxRibbonPanel() : m_expanded_dummy(NULL), m_expanded_panel(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user