Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/foxtools/MFXMenuCheckIcon.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2004-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file MFXMenuCheckIcon.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2021
17
///
18
//
19
/****************************************************************************/
20
21
#pragma once
22
#include <config.h>
23
24
25
#include "fxheader.h"
26
#include <string>
27
28
/**
29
* The menu check widget is used to change a state in the
30
* application from a menu. Menu checks may reflect
31
* the state of the application by graying out, becoming hidden,
32
* or by a check mark.
33
* When activated, a menu check sends a SEL_COMMAND to its target;
34
* the void* argument of the message contains the new state.
35
*/
36
class MFXMenuCheckIcon : public FXMenuCommand {
37
/// @brief FOX-declaration
38
FXDECLARE(MFXMenuCheckIcon)
39
40
public:
41
/// @brief Construct a menu check
42
MFXMenuCheckIcon(FXComposite* p, const std::string& text, const std::string& shortcut, const std::string& info, const FXIcon* icon, FXObject* tgt = NULL, FXSelector sel = 0, FXuint opts = 0);
43
44
/// @brief Return default width
45
virtual FXint getDefaultWidth();
46
47
/// @brief Return default height
48
virtual FXint getDefaultHeight();
49
50
/// @brief Set check state (TRUE, FALSE or MAYBE)
51
void setCheck(FXbool s = TRUE);
52
53
/// @brief Toggle current check state
54
void toggleCheck();
55
56
/// @brief Get check state (TRUE, FALSE or MAYBE)
57
FXbool getCheck() const;
58
59
/// @brief Get the box background color
60
FXColor getBoxColor() const;
61
62
/// @brief Set the box background color
63
void setBoxColor(FXColor clr);
64
65
/// @brief Save menu to a stream
66
virtual void save(FXStream& store) const;
67
68
/// @brief Load menu from a stream
69
virtual void load(FXStream& store);
70
71
/// @name FOX calls
72
/// @{
73
long onPaint(FXObject*, FXSelector, void*);
74
long onButtonPress(FXObject*, FXSelector, void*);
75
long onButtonRelease(FXObject*, FXSelector, void*);
76
long onKeyPress(FXObject*, FXSelector, void*);
77
long onKeyRelease(FXObject*, FXSelector, void*);
78
long onHotKeyPress(FXObject*, FXSelector, void*);
79
long onHotKeyRelease(FXObject*, FXSelector, void*);
80
long onCheck(FXObject*, FXSelector, void*);
81
long onUncheck(FXObject*, FXSelector, void*);
82
long onUnknown(FXObject*, FXSelector, void*);
83
long onCmdSetValue(FXObject*, FXSelector, void*);
84
long onCmdSetIntValue(FXObject*, FXSelector, void*);
85
long onCmdGetIntValue(FXObject*, FXSelector, void*);
86
long onCmdAccel(FXObject*, FXSelector, void*);
87
/// @}
88
89
protected:
90
/// @brief default constructor
91
MFXMenuCheckIcon();
92
93
/// @brief Icon
94
const FXIcon* myIcon;
95
96
/// @brief State of menu
97
FXuchar myCheck;
98
99
/// @brief Box color
100
FXColor myBoxColor;
101
102
private:
103
/// @brief Invalidated copy constructor.
104
MFXMenuCheckIcon(const MFXMenuCheckIcon&) = delete;
105
106
/// @brief Invalidated assignment operator.
107
MFXMenuCheckIcon& operator=(const MFXMenuCheckIcon&) = delete;
108
};
109
110