wxMaxima
Loading...
Searching...
No Matches
Functions
ToolbarPane.h File Reference

Declares AddToolbarPane() and SetToolbarPaneProperties(), which give the main toolbar's wxAUI pane its properties – both when the pane is first added and again after a stored perspective has been loaded over it. More...

#include <wx/aui/framemanager.h>
#include <wx/aui/auibar.h>
Include dependency graph for ToolbarPane.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

wxAuiPaneInfo & SetToolbarPaneProperties (wxAuiPaneInfo &pane, const wxAuiToolBar *toolbar)
 Sets the main toolbar pane's properties, its size included.
 
void AddToolbarPane (wxAuiManager &manager, wxAuiToolBar *toolbar, wxAuiPaneInfo pane)
 Adds the main toolbar to manager, with SetToolbarPaneProperties().
 

Detailed Description

Declares AddToolbarPane() and SetToolbarPaneProperties(), which give the main toolbar's wxAUI pane its properties – both when the pane is first added and again after a stored perspective has been loaded over it.

Function Documentation

◆ AddToolbarPane()

void AddToolbarPane ( wxAuiManager &  manager,
wxAuiToolBar *  toolbar,
wxAuiPaneInfo  pane 
)

Adds the main toolbar to manager, with SetToolbarPaneProperties().

Use this instead of calling wxAuiManager::AddPane() directly: since wxWidgets 3.3.4, AddPane() also makes a pane's best size the size of the dock the pane is in. That size is the dock's outer one, though, so the pane's border is taken off it, and the toolbar would end up two pixels shorter than its contents need. This function lets the dock be sized from the toolbar instead, as older wxWidgets versions always did.

Parameters
managerThe frame's AUI manager.
toolbarThe toolbar; Realize() must already have been called on it.
paneThe pane's name and dock position.

◆ SetToolbarPaneProperties()

wxAuiPaneInfo & SetToolbarPaneProperties ( wxAuiPaneInfo &  pane,
const wxAuiToolBar *  toolbar 
)

Sets the main toolbar pane's properties, its size included.

The toolbar's height follows entirely from its contents – icon size, which depends on the display's resolution, and the height of the controls in it, which depends on the font and the platform's theme. It is nothing the user can set, so it must be taken from the toolbar every time and never from a stored layout.

wxAuiManager::SavePerspective() stores it anyway (as the pane's best size, and as the size of the dock the pane sits in), and LoadPerspective() restores the stored value over the one wxAuiManager::AddPane() had just taken from the toolbar. From then on nothing in wxAUI recomputes it: the toolbar is sized to whatever the previous session saved, which that session in turn had from the one before. So a size that once came out wrong is kept forever, and on the platforms without DPI-independent pixels (MS Windows) wxAUI additionally rescales the stored best size whenever the window changes to a display with a different DPI – rounding every time, so the value can drift from one session to the next.

Calling this after LoadPerspective() takes the size from the toolbar again. It also re-applies the pane's flags, which LoadPerspective() equally replaces by whatever an older wxMaxima stored: without DockFixed() the dock keeps its stored size instead of being sized from its contents on the next layout.

The dock direction is left alone, as the user may have moved the toolbar to the bottom.

Parameters
paneThe toolbar's pane.
toolbarThe toolbar itself; Realize() must already have been called on it so that its hint size is up to date.
Returns
pane, so that further settings can be chained.