wxMaxima
Loading...
Searching...
No Matches
src
MaximaMenuSync.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
37
#ifndef MAXIMAMENUSYNC_H
38
#define MAXIMAMENUSYNC_H
39
40
#include "precomp.h"
41
#include <wx/menu.h>
42
#include <wx/string.h>
43
#include <cstdint>
44
#include <vector>
45
48
struct
MaximaMenuSyncEntry
49
{
51
wxString
m_value
;
53
int
m_menuId
;
54
};
55
58
struct
MaximaMenuSyncRow
59
{
60
enum class
Kind
: std::int8_t {
62
CheckedIfEqual
,
64
UncheckedIfEqual
,
66
RadioFromValue
,
68
RadioFromSuffix
69
};
71
wxString
m_variable
;
73
Kind
m_kind
;
75
std::vector<MaximaMenuSyncEntry>
m_entries
;
81
int
m_enableId
= wxID_NONE;
82
};
83
89
const
std::vector<MaximaMenuSyncRow> &
MaximaMenuSyncRows
();
90
100
bool
SyncMenusToMaximaVariable
(wxMenuBar *menubar,
const
wxString &variable,
101
const
wxString &value);
102
103
#endif
// MAXIMAMENUSYNC_H
SyncMenusToMaximaVariable
bool SyncMenusToMaximaVariable(wxMenuBar *menubar, const wxString &variable, const wxString &value)
Update the menu check marks that mirror one Maxima variable.
Definition:
MaximaMenuSync.cpp:85
MaximaMenuSyncRows
const std::vector< MaximaMenuSyncRow > & MaximaMenuSyncRows()
The variable-to-menu-items table itself.
Definition:
MaximaMenuSync.cpp:31
MaximaMenuSyncEntry
One menu item a Maxima variable value maps to.
Definition:
MaximaMenuSync.h:49
MaximaMenuSyncEntry::m_menuId
int m_menuId
The id of the menu item to check when the value matches.
Definition:
MaximaMenuSync.h:53
MaximaMenuSyncEntry::m_value
wxString m_value
The variable value (or value suffix) that selects this menu item.
Definition:
MaximaMenuSync.h:51
MaximaMenuSyncRow
How the check marks of one Maxima variable's menu items follow its value.
Definition:
MaximaMenuSync.h:59
MaximaMenuSyncRow::m_enableId
int m_enableId
A menu item to enable whenever any value arrives, or wxID_NONE.
Definition:
MaximaMenuSync.h:81
MaximaMenuSyncRow::m_variable
wxString m_variable
The name of the Maxima variable this row watches.
Definition:
MaximaMenuSync.h:71
MaximaMenuSyncRow::Kind
Kind
Definition:
MaximaMenuSync.h:60
MaximaMenuSyncRow::Kind::RadioFromValue
@ RadioFromValue
Radio items: check the entry whose value equals the variable's value.
MaximaMenuSyncRow::Kind::UncheckedIfEqual
@ UncheckedIfEqual
A check item: checked exactly if the value differs from the entry's value.
MaximaMenuSyncRow::Kind::CheckedIfEqual
@ CheckedIfEqual
A check item: checked exactly if the value equals the entry's value.
MaximaMenuSyncRow::Kind::RadioFromSuffix
@ RadioFromSuffix
Radio items: check the entry whose value the variable's value ends in.
MaximaMenuSyncRow::m_kind
Kind m_kind
How to match the variable's value against the entries.
Definition:
MaximaMenuSync.h:73
MaximaMenuSyncRow::m_entries
std::vector< MaximaMenuSyncEntry > m_entries
Which menu item(s) the value selects between.
Definition:
MaximaMenuSync.h:75
Generated by
1.9.6