wxMaxima
Loading...
Searching...
No Matches
AdaptiveSplitter.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2026 Gunter Königsmann <wxMaxima@physikbuch.de>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//
20// SPDX-License-Identifier: GPL-2.0+
21
27#ifndef ADAPTIVESPLITTER_H
28#define ADAPTIVESPLITTER_H
29
30#include <wx/splitter.h>
31
48class AdaptiveSplitter : public wxSplitterWindow
49{
50public:
51 AdaptiveSplitter(wxWindow *parent, wxWindowID id = wxID_ANY);
52
62 void SplitAdaptively(wxWindow *settings, wxWindow *preview,
63 wxSize preferredSettingsSize = wxDefaultSize);
64
75 static wxSplitMode ChooseSplitMode(wxSize available, wxSize preferredSettingsSize);
76
78 wxSize GetPreferredSettingsSize() const {return m_preferredSettingsSize;}
79
89 void RememberSashIn(const wxString &configKey);
90
91private:
93 void OnSize(wxSizeEvent &event);
95 void SplitIn(wxSplitMode mode);
97 void OnSashMoved(wxSplitterEvent &event);
98
99 wxWindow *m_settings = nullptr;
100 wxWindow *m_preview = nullptr;
101 wxSize m_preferredSettingsSize;
103 wxString m_configKey;
104};
105
106#endif // ADAPTIVESPLITTER_H
A splitter between a settings pane and a preview of what the settings do.
Definition: AdaptiveSplitter.h:49
wxSize GetPreferredSettingsSize() const
The size the settings pane gets whenever the split direction is chosen anew.
Definition: AdaptiveSplitter.h:78
void RememberSashIn(const wxString &configKey)
Remembers where the user puts the sash, across dialog sessions.
Definition: AdaptiveSplitter.cpp:108
static wxSplitMode ChooseSplitMode(wxSize available, wxSize preferredSettingsSize)
Which split leaves more room for the preview.
Definition: AdaptiveSplitter.cpp:44
void SplitAdaptively(wxWindow *settings, wxWindow *preview, wxSize preferredSettingsSize=wxDefaultSize)
Shows settings and preview, split in whichever direction fits best.
Definition: AdaptiveSplitter.cpp:55