Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/common/GNEGroupBoxModule.h
185790 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2006-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 GNEGroupBoxModule.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Dec 2021
17
///
18
//
19
/****************************************************************************/
20
21
#pragma once
22
#include <config.h>
23
#include <string>
24
25
#include <utils/foxtools/fxheader.h>
26
27
// ===========================================================================
28
// class declarations
29
// ===========================================================================
30
class GNEFrame;
31
class MFXButtonTooltip;
32
33
34
// ===========================================================================
35
// class definitions
36
// ===========================================================================
37
/// @brief GNEGroupBoxModule (based on FXGroupBox)
38
class GNEGroupBoxModule : protected FXVerticalFrame {
39
FXDECLARE(GNEGroupBoxModule)
40
41
public:
42
/// @brief GroupBoxModule options
43
enum Options {
44
NOTHING = 1 << 0, // Basic GroupBox
45
COLLAPSIBLE = 1 << 1, // Collapsible groupBox
46
EXTENSIBLE = 1 << 2, // Extensible groupBox
47
SAVE = 1 << 3, // Save contents
48
LOAD = 1 << 4, // Load contents
49
};
50
51
/// @brief constructor for frames
52
GNEGroupBoxModule(GNEFrame* frame, const std::string& text, const int options = Options::COLLAPSIBLE);
53
54
/// @brief constructor for fix dialogs
55
GNEGroupBoxModule(FXVerticalFrame* contentFrame, const std::string& text, const int options = Options::NOTHING);
56
57
/// @brief destructor
58
~GNEGroupBoxModule();
59
60
/// @brief set text
61
void setText(const std::string& text);
62
63
/// @brief get collapsable frame (used by all elements that will be collapsed if button is toggled)
64
FXVerticalFrame* getCollapsableFrame();
65
66
/// @brief draw GNEGroupBoxModule
67
long onPaint(FXObject*, FXSelector, void*);
68
69
/// @brief collapse GroupBoxModule
70
long onCmdCollapseButton(FXObject*, FXSelector, void*);
71
72
/// @brief extends GroupBoxModule
73
long onCmdExtendButton(FXObject*, FXSelector, void*);
74
75
/// @brief reset GroupBoxModule
76
long onCmdResetButton(FXObject*, FXSelector, void*);
77
78
/// @brief update reset GroupBoxModule
79
long onUpdResetButton(FXObject*, FXSelector, void*);
80
81
/// @brief save contents
82
long onCmdSaveButton(FXObject*, FXSelector, void*);
83
84
/// @brief load contents
85
long onCmdLoadButton(FXObject*, FXSelector, void*);
86
87
protected:
88
/// @brief FOX need this
89
GNEGroupBoxModule();
90
91
/// @brief save contents (can be reimplemented in children)
92
virtual bool saveContents() const;
93
94
/// @brief load contents (can be reimplemented in children)
95
virtual bool loadContents() const;
96
97
/// @brief enable or disable save buttons
98
void toggleSaveButton(const bool value);
99
100
private:
101
/// @brief GroupBoxModule options
102
const int myOptions;
103
104
/// @brief GNEFrame in which this GroupBox is placed
105
GNEFrame* myFrameParent = nullptr;
106
107
/// @brief vertical collapsable frame
108
FXVerticalFrame* myCollapsableFrame = nullptr;
109
110
/// @brief label used in non collapsable GNEGroupBoxModule
111
FXLabel* myLabel = nullptr;
112
113
/// @brief button for collapse elements
114
FXButton* myCollapseButton = nullptr;
115
116
/// @brief button for extend elements
117
MFXButtonTooltip* myExtendButton = nullptr;
118
119
/// @brief button for reset frame width
120
FXButton* myResetWidthButton = nullptr;
121
122
/// @brief button for save elements
123
FXButton* mySaveButton = nullptr;
124
125
/// @brief button for load elements
126
FXButton* myLoadButton = nullptr;
127
128
/// @brief flag to check if this groupbox is collapsed
129
bool myCollapsed;
130
};
131
132