yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
popup_manager.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_POPUP_MANAGER_H
2#define YAZE_APP_EDITOR_POPUP_MANAGER_H
3
4#include <functional>
5#include <string>
6#include <unordered_map>
7
8#include "absl/status/status.h"
9
10namespace yaze {
11namespace editor {
12
13// Forward declaration
14class EditorManager;
15
17 std::string name;
18 bool is_visible = false;
19 std::function<void()> draw_function;
20};
21
22// ImGui popup manager.
24 public:
25 PopupManager(EditorManager* editor_manager);
26
27 // Initialize popups
28 void Initialize();
29
30 // Draw all popups
31 void DrawPopups();
32
33 // Show a specific popup
34 void Show(const char* name);
35
36 // Hide a specific popup
37 void Hide(const char* name);
38
39 // Check if a popup is visible
40 bool IsVisible(const char* name) const;
41
42 // Set the status for status popup
43 void SetStatus(const absl::Status& status);
44
45 // Get the current status
46 absl::Status GetStatus() const { return status_; }
47
48 private:
49 // Helper function to begin a centered popup
50 bool BeginCentered(const char* name);
51
52 // Draw the about popup
53 void DrawAboutPopup();
54
55 // Draw the ROM info popup
56 void DrawRomInfoPopup();
57
58 // Draw the status popup
59 void DrawStatusPopup();
60
61 // Draw the save as popup
62 void DrawSaveAsPopup();
63
64 // Draw the new project popup
66
67 // Draw the supported features popup
69
70 // Draw the open ROM help popup
72
73 // Draw the manage project popup
75
77 std::unordered_map<std::string, PopupParams> popups_;
78 absl::Status status_;
79 bool show_status_ = false;
80 absl::Status prev_status_;
81};
82
83} // namespace editor
84} // namespace yaze
85
86#endif // YAZE_APP_EDITOR_POPUP_MANAGER_H
The EditorManager controls the main editor window and manages the various editor classes.
void SetStatus(const absl::Status &status)
absl::Status GetStatus() const
bool IsVisible(const char *name) const
void Show(const char *name)
void Hide(const char *name)
PopupManager(EditorManager *editor_manager)
std::unordered_map< std::string, PopupParams > popups_
EditorManager * editor_manager_
bool BeginCentered(const char *name)
Editors are the view controllers for the application.
Main namespace for the application.
Definition controller.cc:18
std::function< void()> draw_function