wxMaxima
Loading...
Searching...
No Matches
ToolBarSectionsPanel.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
26#ifndef WXMAXIMA_TOOLBARSECTIONSPANEL_H
27#define WXMAXIMA_TOOLBARSECTIONSPANEL_H
28
29#include <vector>
30#include <wx/panel.h>
31#include <wx/rearrangectrl.h>
32#include <wx/scrolwin.h>
33#include "ToolBarSections.h"
34
46class ToolBarSectionsPanel : public wxScrolled<wxPanel>
47{
48public:
49 explicit ToolBarSectionsPanel(wxWindow *parent);
50
52 std::vector<ToolBarSections::Section> GetOrder() const;
54 bool IsSectionShown(ToolBarSections::Section section) const;
56 void SetSectionShown(ToolBarSections::Section section, bool show);
57
63 void MoveEntry(int from, int to);
64
66 void ResetToDefaults();
67
69 void Write() const;
70
71private:
73 int PositionOf(ToolBarSections::Section section) const;
75 void Fill(const std::vector<ToolBarSections::Section> &order,
76 const std::vector<bool> &shown);
77
78 void OnLeftDown(wxMouseEvent &event);
79 void OnMotion(wxMouseEvent &event);
80 void OnLeftUp(wxMouseEvent &event);
81
83 wxRearrangeList *m_list = nullptr;
85 int m_dragFrom = wxNOT_FOUND;
86};
87
88#endif // WXMAXIMA_TOOLBARSECTIONSPANEL_H
The sections the main toolbar is made of, and the order they are shown in.
Section
A section of the main toolbar.
Definition: ToolBarSections.h:48
Lets the user reorder the main toolbar's sections and show or hide them.
Definition: ToolBarSectionsPanel.h:47
bool IsSectionShown(ToolBarSections::Section section) const
Is the check box of this section set?
Definition: ToolBarSectionsPanel.cpp:98
void SetSectionShown(ToolBarSections::Section section, bool show)
Check or uncheck the box of a section.
Definition: ToolBarSectionsPanel.cpp:102
std::vector< ToolBarSections::Section > GetOrder() const
The sections in the order the list now shows them in.
Definition: ToolBarSectionsPanel.cpp:81
void ResetToDefaults()
Put the list back to the default order and visibility (stores nothing)
Definition: ToolBarSectionsPanel.cpp:126
void MoveEntry(int from, int to)
Move the entry at position from of the list to position to.
Definition: ToolBarSectionsPanel.cpp:106
void Write() const
Store the order and visibility in the config. ToolBar::AddTools() applies it.
Definition: ToolBarSectionsPanel.cpp:134
Definition: CellPointers.h:35