|
wxMaxima
|
A splitter between a settings pane and a preview of what the settings do. More...
#include <AdaptiveSplitter.h>
Public Member Functions | |
| AdaptiveSplitter (wxWindow *parent, wxWindowID id=wxID_ANY) | |
| void | SplitAdaptively (wxWindow *settings, wxWindow *preview, wxSize preferredSettingsSize=wxDefaultSize) |
| Shows settings and preview, split in whichever direction fits best. | |
| wxSize | GetPreferredSettingsSize () const |
| The size the settings pane gets whenever the split direction is chosen anew. | |
| void | RememberSashIn (const wxString &configKey) |
| Remembers where the user puts the sash, across dialog sessions. | |
Static Public Member Functions | |
| static wxSplitMode | ChooseSplitMode (wxSize available, wxSize preferredSettingsSize) |
| Which split leaves more room for the preview. | |
A splitter between a settings pane and a preview of what the settings do.
The first pane holds the settings, the second one a preview (in the configuration dialog: the example worksheet). Whenever the splitter is resized it decides whether the preview goes below the settings (a horizontal split) or to their right (a vertical split), see ChooseSplitMode(). The user can move the sash to give the preview more room: the settings pane can shrink down to its minimum size, which the caller sets to something smaller than its preferred size (in the Style tab the "Style for" list shrinks to a few lines).
Where the user drags the sash becomes the settings pane's preferred size in that direction, so it survives resizing the dialog, and switching to the other split direction and back. When the splitter grows, the preview gets the new room.
|
static |
Which split leaves more room for the preview.
The preview gets what the settings pane at its preferred size leaves of available: below it, available.x by available.y - settings.y; beside it, available.x - settings.x by available.y. The larger area wins, and a tie goes to the horizontal split (preview below the settings), which is what the Style tab always used to look like.
Pure geometry, so it is tested directly.
| void AdaptiveSplitter::RememberSashIn | ( | const wxString & | configKey | ) |
Remembers where the user puts the sash, across dialog sessions.
Call after SplitAdaptively(). Whenever the user drags the sash, the settings pane's new height (horizontal split) or width (vertical split) becomes its preferred size in that direction and is written to the configuration under configKey; this call reads what was stored there before. A user who shrank the settings to see more preview therefore gets the same layout the next time.
| void AdaptiveSplitter::SplitAdaptively | ( | wxWindow * | settings, |
| wxWindow * | preview, | ||
| wxSize | preferredSettingsSize = wxDefaultSize |
||
| ) |
Shows settings and preview, split in whichever direction fits best.
| settings | The first pane. Its GetMinSize() is how far the user can shrink it by moving the sash. |
| preview | The second pane. |
| preferredSettingsSize | The size the settings pane gets whenever the split direction is (re-)chosen, and what ChooseSplitMode() reserves for it. wxDefaultSize means settings->GetBestSize(). |