Eclipse SUMO - Simulation of Urban MObility
FXGroupBoxModule.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2006-2022 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 /****************************************************************************/
18 //
19 /****************************************************************************/
20 
21 #pragma once
22 #include <config.h>
23 
24 #include "fxheader.h"
25 
27 class FXGroupBoxModule : protected FXVerticalFrame {
28  FXDECLARE(FXGroupBoxModule)
29 
30 public:
32  enum Options {
33  NOTHING = 1 << 0, // Collapsible groupBox
34  COLLAPSIBLE = 1 << 1, // Collapsible groupBox
35  SAVE = 1 << 2, // Save contents
36  LOAD = 1 << 3, // Load contents
37  };
38 
40  FXGroupBoxModule(FXVerticalFrame* contentFrame, const std::string& text, const int options = Options::COLLAPSIBLE);
41 
44 
46  void setText(const std::string& text);
47 
49  FXVerticalFrame* getCollapsableFrame();
50 
52  long onPaint(FXObject*, FXSelector, void*);
53 
55  long onCmdCollapseButton(FXObject*, FXSelector, void*);
56 
58  long onCmdSaveButton(FXObject*, FXSelector, void*);
59 
61  long onCmdLoadButton(FXObject*, FXSelector, void*);
62 
63 protected:
66 
68  virtual bool saveContents() const;
69 
71  virtual bool loadContents() const;
72 
74  void toogleSaveButton(const bool value);
75 
76 private:
78  const int myOptions;
79 
81  FXVerticalFrame* myCollapsableFrame = nullptr;
82 
84  FXLabel* myLabel = nullptr;
85 
87  FXButton* myCollapseButton = nullptr;
88 
90  FXButton* mySaveButton = nullptr;
91 
93  FXButton* myLoadButton = nullptr;
94 
97 };
FXGroupBoxModule (based on FXGroupBox)
FXButton * myCollapseButton
button for collapse elements
long onCmdSaveButton(FXObject *, FXSelector, void *)
save contents
long onCmdCollapseButton(FXObject *, FXSelector, void *)
collapse GroupBoxModule
FXLabel * myLabel
label used in non collapsable FXGroupBoxModule
FXButton * mySaveButton
button for save elements
long onCmdLoadButton(FXObject *, FXSelector, void *)
load contents
~FXGroupBoxModule()
destructor
Options
GroupBoxModule options.
FXGroupBoxModule()
FOX need this.
const int myOptions
GroupBoxModule options.
FXButton * myLoadButton
button for load elements
virtual bool loadContents() const
load contents (can be reimplemented in children)
void toogleSaveButton(const bool value)
enable or disable save buttons
FXVerticalFrame * myCollapsableFrame
vertical collapsable frame
long onPaint(FXObject *, FXSelector, void *)
draw FXGroupBoxModule
virtual bool saveContents() const
save contents (can be reimplemented in children)
void setText(const std::string &text)
set text
bool myCollapsed
flag to check if this groupbox is collapsed
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)