Added wxRIBBON_PANEL_STRETCH to allow a single panel to stretch to fill the parent page.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70852 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,11 +20,12 @@
|
|||||||
|
|
||||||
enum wxRibbonPanelOption
|
enum wxRibbonPanelOption
|
||||||
{
|
{
|
||||||
wxRIBBON_PANEL_NO_AUTO_MINIMISE = 1 << 0,
|
wxRIBBON_PANEL_NO_AUTO_MINIMISE = 1 << 0,
|
||||||
wxRIBBON_PANEL_EXT_BUTTON = 1 << 3,
|
wxRIBBON_PANEL_EXT_BUTTON = 1 << 3,
|
||||||
wxRIBBON_PANEL_MINIMISE_BUTTON = 1 << 4,
|
wxRIBBON_PANEL_MINIMISE_BUTTON = 1 << 4,
|
||||||
|
wxRIBBON_PANEL_STRETCH = 1 << 5,
|
||||||
|
|
||||||
wxRIBBON_PANEL_DEFAULT_STYLE = 0
|
wxRIBBON_PANEL_DEFAULT_STYLE = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLIMPEXP_RIBBON wxRibbonPanel : public wxRibbonControl
|
class WXDLLIMPEXP_RIBBON wxRibbonPanel : public wxRibbonControl
|
||||||
|
@@ -12,18 +12,18 @@
|
|||||||
Serves as a container for a group of (ribbon) controls. A wxRibbonPage will
|
Serves as a container for a group of (ribbon) controls. A wxRibbonPage will
|
||||||
typically have panels for children, with the controls for that page placed
|
typically have panels for children, with the controls for that page placed
|
||||||
on the panels.
|
on the panels.
|
||||||
|
|
||||||
A panel adds a border and label to a group of controls, and can be
|
A panel adds a border and label to a group of controls, and can be
|
||||||
minimised (either automatically to conserve space, or manually by the user).
|
minimised (either automatically to conserve space, or manually by the user).
|
||||||
|
|
||||||
Non ribbon controls can be placed on a panel using wxSizers to manage
|
Non ribbon controls can be placed on a panel using wxSizers to manage
|
||||||
layout. Panel size is governed by the sizer's minimum calculated size and
|
layout. Panel size is governed by the sizer's minimum calculated size and
|
||||||
the parent wxRibbonPage's dimensions. For functional and aesthetic reasons
|
the parent wxRibbonPage's dimensions. For functional and aesthetic reasons
|
||||||
it is recommended that ribbon and non ribbon controls are not mixed in one
|
it is recommended that ribbon and non ribbon controls are not mixed in one
|
||||||
panel.
|
panel.
|
||||||
|
|
||||||
@sa wxRibbonPage
|
@sa wxRibbonPage
|
||||||
|
|
||||||
@beginStyleTable
|
@beginStyleTable
|
||||||
@style{wxRIBBON_PANEL_DEFAULT_STYLE}
|
@style{wxRIBBON_PANEL_DEFAULT_STYLE}
|
||||||
Defined as no other flags set.
|
Defined as no other flags set.
|
||||||
@@ -43,6 +43,8 @@
|
|||||||
typically combined with wxRIBBON_PANEL_NO_AUTO_MINIMISE to make a
|
typically combined with wxRIBBON_PANEL_NO_AUTO_MINIMISE to make a
|
||||||
panel which the user always has manual control over when it
|
panel which the user always has manual control over when it
|
||||||
minimises.
|
minimises.
|
||||||
|
@style{wxRIBBON_PANEL_STRETCH}
|
||||||
|
Stretches a single panel to fit the parent page.
|
||||||
@endStyleTable
|
@endStyleTable
|
||||||
|
|
||||||
@library{wxribbon}
|
@library{wxribbon}
|
||||||
@@ -52,7 +54,7 @@ class wxRibbonPanel : public wxRibbonControl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Default constructor.
|
Default constructor.
|
||||||
With this constructor, Create() should be called in order to create
|
With this constructor, Create() should be called in order to create
|
||||||
the ribbon panel.
|
the ribbon panel.
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +62,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Constructs a ribbon panel.
|
Constructs a ribbon panel.
|
||||||
|
|
||||||
@param parent
|
@param parent
|
||||||
Pointer to a parent window, which is typically a wxRibbonPage,
|
Pointer to a parent window, which is typically a wxRibbonPage,
|
||||||
though it can be any window.
|
though it can be any window.
|
||||||
@@ -89,7 +91,7 @@ public:
|
|||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxRIBBON_PANEL_DEFAULT_STYLE);
|
long style = wxRIBBON_PANEL_DEFAULT_STYLE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a ribbon panel in two-step ribbon panel construction.
|
Create a ribbon panel in two-step ribbon panel construction.
|
||||||
Should only be called when the default constructor is used, and
|
Should only be called when the default constructor is used, and
|
||||||
@@ -114,53 +116,53 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxBitmap& GetMinimisedIcon();
|
wxBitmap& GetMinimisedIcon();
|
||||||
const wxBitmap& GetMinimisedIcon() const;
|
const wxBitmap& GetMinimisedIcon() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Query if the panel is currently minimised.
|
Query if the panel is currently minimised.
|
||||||
*/
|
*/
|
||||||
bool IsMinimised() const;
|
bool IsMinimised() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Query if the panel would be minimised at a given size.
|
Query if the panel would be minimised at a given size.
|
||||||
*/
|
*/
|
||||||
bool IsMinimised(wxSize at_size) const;
|
bool IsMinimised(wxSize at_size) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Query is the mouse is currently hovered over the panel.
|
Query is the mouse is currently hovered over the panel.
|
||||||
@return @true if the cursor is within the bounds of the panel (i.e.
|
@return @true if the cursor is within the bounds of the panel (i.e.
|
||||||
hovered over the panel or one of its children), @false otherwise.
|
hovered over the panel or one of its children), @false otherwise.
|
||||||
*/
|
*/
|
||||||
bool IsHovered() const;
|
bool IsHovered() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Query if the panel can automatically minimise itself at small sizes.
|
Query if the panel can automatically minimise itself at small sizes.
|
||||||
*/
|
*/
|
||||||
bool CanAutoMinimise() const;
|
bool CanAutoMinimise() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Show the panel externally expanded.
|
Show the panel externally expanded.
|
||||||
|
|
||||||
When a panel is minimised, it can be shown full-size in a pop-out
|
When a panel is minimised, it can be shown full-size in a pop-out
|
||||||
window, which is referred to as being (externally) expanded. Note that
|
window, which is referred to as being (externally) expanded. Note that
|
||||||
when a panel is expanded, there exist two panels - the original panel
|
when a panel is expanded, there exist two panels - the original panel
|
||||||
(which is referred to as the dummy panel) and the expanded panel. The
|
(which is referred to as the dummy panel) and the expanded panel. The
|
||||||
original is termed a dummy as it sits in the ribbon bar doing nothing,
|
original is termed a dummy as it sits in the ribbon bar doing nothing,
|
||||||
while the expanded panel holds the panel children.
|
while the expanded panel holds the panel children.
|
||||||
|
|
||||||
@return @true if the panel was expanded, @false if it was not (possibly
|
@return @true if the panel was expanded, @false if it was not (possibly
|
||||||
due to it not being minimised, or already being expanded).
|
due to it not being minimised, or already being expanded).
|
||||||
|
|
||||||
@see HideExpanded()
|
@see HideExpanded()
|
||||||
@see GetExpandedPanel()
|
@see GetExpandedPanel()
|
||||||
*/
|
*/
|
||||||
bool ShowExpanded();
|
bool ShowExpanded();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Hide the panel's external expansion.
|
Hide the panel's external expansion.
|
||||||
|
|
||||||
@return @true if the panel was un-expanded, @false if it was not
|
@return @true if the panel was un-expanded, @false if it was not
|
||||||
(normally due to it not being expanded in the first place).
|
(normally due to it not being expanded in the first place).
|
||||||
|
|
||||||
@see HideExpanded()
|
@see HideExpanded()
|
||||||
@see GetExpandedPanel()
|
@see GetExpandedPanel()
|
||||||
*/
|
*/
|
||||||
@@ -170,35 +172,35 @@ public:
|
|||||||
Set the art provider to be used. Normally called automatically by
|
Set the art provider to be used. Normally called automatically by
|
||||||
wxRibbonPage when the panel is created, or the art provider changed on the
|
wxRibbonPage when the panel is created, or the art provider changed on the
|
||||||
page.
|
page.
|
||||||
|
|
||||||
The new art provider will be propagated to the children of the panel.
|
The new art provider will be propagated to the children of the panel.
|
||||||
*/
|
*/
|
||||||
void SetArtProvider(wxRibbonArtProvider* art);
|
void SetArtProvider(wxRibbonArtProvider* art);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Realize all children of the panel.
|
Realize all children of the panel.
|
||||||
*/
|
*/
|
||||||
bool Realize();
|
bool Realize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the dummy panel of an expanded panel.
|
Get the dummy panel of an expanded panel.
|
||||||
|
|
||||||
Note that this should be called on an expanded panel to get the dummy
|
Note that this should be called on an expanded panel to get the dummy
|
||||||
associated with it - it will return NULL when called on the dummy
|
associated with it - it will return NULL when called on the dummy
|
||||||
itself.
|
itself.
|
||||||
|
|
||||||
@see ShowExpanded()
|
@see ShowExpanded()
|
||||||
@see GetExpandedPanel()
|
@see GetExpandedPanel()
|
||||||
*/
|
*/
|
||||||
wxRibbonPanel* GetExpandedDummy();
|
wxRibbonPanel* GetExpandedDummy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the expanded panel of a dummy panel.
|
Get the expanded panel of a dummy panel.
|
||||||
|
|
||||||
Note that this should be called on a dummy panel to get the expanded
|
Note that this should be called on a dummy panel to get the expanded
|
||||||
panel associated with it - it will return NULL when called on the
|
panel associated with it - it will return NULL when called on the
|
||||||
expanded panel itself.
|
expanded panel itself.
|
||||||
|
|
||||||
@see ShowExpanded()
|
@see ShowExpanded()
|
||||||
@see GetExpandedDummy()
|
@see GetExpandedDummy()
|
||||||
*/
|
*/
|
||||||
|
@@ -238,7 +238,7 @@ void wxRibbonPanel::DoSetSize(int x, int y, int width, int height, int sizeFlags
|
|||||||
if(minimised != m_minimised)
|
if(minimised != m_minimised)
|
||||||
{
|
{
|
||||||
m_minimised = minimised;
|
m_minimised = minimised;
|
||||||
// Note that for sizers, this routine disallows the use of mixed shown
|
// Note that for sizers, this routine disallows the use of mixed shown
|
||||||
// and hidden controls
|
// and hidden controls
|
||||||
// TODO ? use some list of user set invisible children to restore status.
|
// TODO ? use some list of user set invisible children to restore status.
|
||||||
for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
||||||
@@ -259,7 +259,7 @@ bool wxRibbonPanel::IsMinimised(wxSize at_size) const
|
|||||||
{
|
{
|
||||||
if(GetSizer())
|
if(GetSizer())
|
||||||
{
|
{
|
||||||
// we have no information on size change direction
|
// we have no information on size change direction
|
||||||
// so check both
|
// so check both
|
||||||
wxSize size = GetMinNotMinimisedSize();
|
wxSize size = GetMinNotMinimisedSize();
|
||||||
if(size.x > at_size.x || size.y > at_size.y)
|
if(size.x > at_size.x || size.y > at_size.y)
|
||||||
@@ -303,7 +303,12 @@ bool wxRibbonPanel::IsSizingContinuous() const
|
|||||||
{
|
{
|
||||||
// A panel never sizes continuously, even if all of its children can,
|
// A panel never sizes continuously, even if all of its children can,
|
||||||
// as it would appear out of place along side non-continuous panels.
|
// as it would appear out of place along side non-continuous panels.
|
||||||
return false;
|
|
||||||
|
// JS 2012-03-09: introducing wxRIBBON_PANEL_STRETCH to allow
|
||||||
|
// the panel to fill its parent page. For example we might have
|
||||||
|
// a list of styles in one of the pages, which should stretch to
|
||||||
|
// fill available space.
|
||||||
|
return (m_flags & wxRIBBON_PANEL_STRETCH) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction,
|
wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction,
|
||||||
@@ -348,7 +353,7 @@ wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction,
|
|||||||
wxRibbonControl* ribbon_child = wxDynamicCast(child, wxRibbonControl);
|
wxRibbonControl* ribbon_child = wxDynamicCast(child, wxRibbonControl);
|
||||||
if(ribbon_child != NULL)
|
if(ribbon_child != NULL)
|
||||||
{
|
{
|
||||||
smaller = ribbon_child->GetNextSmallerSize(direction, child_relative);
|
smaller = ribbon_child->GetNextSmallerSize(direction, child_relative);
|
||||||
minimise = (smaller == child_relative);
|
minimise = (smaller == child_relative);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,7 +450,7 @@ wxSize wxRibbonPanel::DoGetNextLargerSize(wxOrientation direction,
|
|||||||
|
|
||||||
if(GetSizer())
|
if(GetSizer())
|
||||||
{
|
{
|
||||||
// We could just let the sizer expand in flow direction but see comment
|
// We could just let the sizer expand in flow direction but see comment
|
||||||
// in IsSizingContinuous()
|
// in IsSizingContinuous()
|
||||||
larger = GetPanelSizerBestSize();
|
larger = GetPanelSizerBestSize();
|
||||||
// and adjust for page in non flow direction
|
// and adjust for page in non flow direction
|
||||||
@@ -560,8 +565,8 @@ wxSize wxRibbonPanel::GetPanelSizerMinSize() const
|
|||||||
}
|
}
|
||||||
// else use previously calculated m_smallest_unminimised_size
|
// else use previously calculated m_smallest_unminimised_size
|
||||||
wxClientDC dc((wxRibbonPanel*) this);
|
wxClientDC dc((wxRibbonPanel*) this);
|
||||||
return m_art->GetPanelClientSize(dc,
|
return m_art->GetPanelClientSize(dc,
|
||||||
this,
|
this,
|
||||||
m_smallest_unminimised_size,
|
m_smallest_unminimised_size,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -766,10 +771,10 @@ bool wxRibbonPanel::ShowExpanded()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move sizer to new panel
|
// Move sizer to new panel
|
||||||
if(GetSizer())
|
if(GetSizer())
|
||||||
{
|
{
|
||||||
wxSizer* sizer = GetSizer();
|
wxSizer* sizer = GetSizer();
|
||||||
SetSizer(NULL, false);
|
SetSizer(NULL, false);
|
||||||
m_expanded_panel->SetSizer(sizer);
|
m_expanded_panel->SetSizer(sizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user