SDFormat Editor
Loading...
Searching...
No Matches
gui_interface.h
1/*
2* sdformat-editor
3* Copyright 2025 sdformat-editor
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17* Developer: Zaid Duraid, Ean Wheeler, Evan Vokey
18*/
19
20#ifndef SDFORMAT_EDITOR_GUI_INTERFACE_HH_
21#define SDFORMAT_EDITOR_GUI_INTERFACE_HH_
22
23#include <iostream>
24#include <atomic>
25#include <memory>
26#include <mutex>
27
28#include <interfaces/sdformat_parser_interface.h>
29#include <interfaces/command_factory_interface.h>
30
31// Predeclare CommandFactoryI to avoid circular dependencies
32class CommandFactoryI;
33
38class GUII : public std::enable_shared_from_this<GUII>
39{
46 protected: virtual void Initialize(const std::string &windowName, std::shared_ptr<SDFormatParserI> sdformat_parser, bool &success) = 0;
47
52 public: virtual std::unique_ptr<CommandI> Update(std::shared_ptr<CommandFactoryI> command_factory) = 0;
53
56 public: virtual bool ShouldClose() = 0;
57
60 public: struct DialogMessage
61 {
62 const std::string header;
63 const std::string body;
64 const std::string footer;
65 };
66
71 public: virtual void OpenChoiceDialog(DialogMessage dialogMessage, std::vector<std::pair<std::string, bool>>& choices) = 0;
72
77 public: virtual void SetPreventInputFlag(bool set) = 0;
78
81 public: virtual std::unique_lock<std::mutex> LockMutex() = 0;
82
83};;
84
85#endif
Interface for the SDFormat Editor's Command Factory.
Definition command_factory_interface.h:37
Interface for the SDFormat Editor's Graphical User Interface Note that this class also inherits from ...
Definition gui_interface.h:39
virtual void OpenChoiceDialog(DialogMessage dialogMessage, std::vector< std::pair< std::string, bool > > &choices)=0
Enables a choice dialog message in the GUI that will be override everything else.
virtual void Initialize(const std::string &windowName, std::shared_ptr< SDFormatParserI > sdformat_parser, bool &success)=0
Initialization of the GUI. Should be wrapped in the constructor of the implementation....
virtual std::unique_lock< std::mutex > LockMutex()=0
Method to lock mutex.
virtual void SetPreventInputFlag(bool set)=0
Method to change the flag which can be set to prevent the GUI from taking user input....
virtual bool ShouldClose()=0
Indicate if the GUI should close
virtual std::unique_ptr< CommandI > Update(std::shared_ptr< CommandFactoryI > command_factory)=0
Updating the GUI.
Struct representing a dialog message. This struct encapsulates the components of a dialog message.
Definition gui_interface.h:61