fd6e15974c
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
113 lines
2.8 KiB
C++
113 lines
2.8 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: src/ribbon/control.cpp
|
|
// Purpose: Extension of wxControl with common ribbon methods
|
|
// Author: Peter Cawley
|
|
// Modified by:
|
|
// Created: 2009-06-05
|
|
// RCS-ID: $Id$
|
|
// Copyright: (C) Peter Cawley
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
#ifdef __BORLANDC__
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#if wxUSE_RIBBON
|
|
|
|
#include "wx/ribbon/control.h"
|
|
|
|
#ifndef WX_PRECOMP
|
|
#endif
|
|
|
|
#ifdef __WXMSW__
|
|
#include "wx/msw/private.h"
|
|
#endif
|
|
|
|
IMPLEMENT_CLASS(wxRibbonControl, wxControl)
|
|
|
|
bool wxRibbonControl::Create(wxWindow *parent, wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size, long style,
|
|
const wxValidator& validator,
|
|
const wxString& name)
|
|
{
|
|
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)
|
|
{
|
|
m_art = art;
|
|
}
|
|
|
|
wxSize wxRibbonControl::DoGetNextSmallerSize(wxOrientation direction,
|
|
wxSize size) const
|
|
{
|
|
// Dummy implementation for code which doesn't check for IsSizingContinuous() == true
|
|
wxSize minimum(GetMinSize());
|
|
if((direction & wxHORIZONTAL) && size.x > minimum.x)
|
|
{
|
|
size.x--;
|
|
}
|
|
if((direction & wxVERTICAL) && size.y > minimum.y)
|
|
{
|
|
size.y--;
|
|
}
|
|
return size;
|
|
}
|
|
|
|
wxSize wxRibbonControl::DoGetNextLargerSize(wxOrientation direction,
|
|
wxSize size) const
|
|
{
|
|
// Dummy implementation for code which doesn't check for IsSizingContinuous() == true
|
|
if(direction & wxHORIZONTAL)
|
|
{
|
|
size.x++;
|
|
}
|
|
if(direction & wxVERTICAL)
|
|
{
|
|
size.y++;
|
|
}
|
|
return size;
|
|
}
|
|
|
|
wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction,
|
|
wxSize relative_to) const
|
|
{
|
|
return DoGetNextSmallerSize(direction, relative_to);
|
|
}
|
|
|
|
wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction,
|
|
wxSize relative_to) const
|
|
{
|
|
return DoGetNextLargerSize(direction, relative_to);
|
|
}
|
|
|
|
wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction) const
|
|
{
|
|
return DoGetNextSmallerSize(direction, GetSize());
|
|
}
|
|
|
|
wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction) const
|
|
{
|
|
return DoGetNextLargerSize(direction, GetSize());
|
|
}
|
|
|
|
bool wxRibbonControl::Realize()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
#endif // wxUSE_RIBBON
|