Path: blob/main/src/netedit/frames/common/GNEGroupBoxModule.h
185790 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2006-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEGroupBoxModule.h14/// @author Pablo Alvarez Lopez15/// @date Dec 202116///17//18/****************************************************************************/1920#pragma once21#include <config.h>22#include <string>2324#include <utils/foxtools/fxheader.h>2526// ===========================================================================27// class declarations28// ===========================================================================29class GNEFrame;30class MFXButtonTooltip;313233// ===========================================================================34// class definitions35// ===========================================================================36/// @brief GNEGroupBoxModule (based on FXGroupBox)37class GNEGroupBoxModule : protected FXVerticalFrame {38FXDECLARE(GNEGroupBoxModule)3940public:41/// @brief GroupBoxModule options42enum Options {43NOTHING = 1 << 0, // Basic GroupBox44COLLAPSIBLE = 1 << 1, // Collapsible groupBox45EXTENSIBLE = 1 << 2, // Extensible groupBox46SAVE = 1 << 3, // Save contents47LOAD = 1 << 4, // Load contents48};4950/// @brief constructor for frames51GNEGroupBoxModule(GNEFrame* frame, const std::string& text, const int options = Options::COLLAPSIBLE);5253/// @brief constructor for fix dialogs54GNEGroupBoxModule(FXVerticalFrame* contentFrame, const std::string& text, const int options = Options::NOTHING);5556/// @brief destructor57~GNEGroupBoxModule();5859/// @brief set text60void setText(const std::string& text);6162/// @brief get collapsable frame (used by all elements that will be collapsed if button is toggled)63FXVerticalFrame* getCollapsableFrame();6465/// @brief draw GNEGroupBoxModule66long onPaint(FXObject*, FXSelector, void*);6768/// @brief collapse GroupBoxModule69long onCmdCollapseButton(FXObject*, FXSelector, void*);7071/// @brief extends GroupBoxModule72long onCmdExtendButton(FXObject*, FXSelector, void*);7374/// @brief reset GroupBoxModule75long onCmdResetButton(FXObject*, FXSelector, void*);7677/// @brief update reset GroupBoxModule78long onUpdResetButton(FXObject*, FXSelector, void*);7980/// @brief save contents81long onCmdSaveButton(FXObject*, FXSelector, void*);8283/// @brief load contents84long onCmdLoadButton(FXObject*, FXSelector, void*);8586protected:87/// @brief FOX need this88GNEGroupBoxModule();8990/// @brief save contents (can be reimplemented in children)91virtual bool saveContents() const;9293/// @brief load contents (can be reimplemented in children)94virtual bool loadContents() const;9596/// @brief enable or disable save buttons97void toggleSaveButton(const bool value);9899private:100/// @brief GroupBoxModule options101const int myOptions;102103/// @brief GNEFrame in which this GroupBox is placed104GNEFrame* myFrameParent = nullptr;105106/// @brief vertical collapsable frame107FXVerticalFrame* myCollapsableFrame = nullptr;108109/// @brief label used in non collapsable GNEGroupBoxModule110FXLabel* myLabel = nullptr;111112/// @brief button for collapse elements113FXButton* myCollapseButton = nullptr;114115/// @brief button for extend elements116MFXButtonTooltip* myExtendButton = nullptr;117118/// @brief button for reset frame width119FXButton* myResetWidthButton = nullptr;120121/// @brief button for save elements122FXButton* mySaveButton = nullptr;123124/// @brief button for load elements125FXButton* myLoadButton = nullptr;126127/// @brief flag to check if this groupbox is collapsed128bool myCollapsed;129};130131132