yaze 0.3.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
21enum class PopupType {
22 kInfo, // Information display (About, ROM Info, etc.)
23 kHelp, // Help documentation (Getting Started, etc.)
24 kSettings, // Settings dialogs (Display Settings, etc.)
25 kFileOperation, // File operations (Save As, New Project, etc.)
26 kConfirmation, // Confirmation dialogs (Layout Reset, etc.)
27 kWarning, // Warning messages (Session Limit, etc.)
28 kEditor // Editor-specific dialogs
29};
30
36 const char* id; // Unique constant identifier
37 const char* display_name; // Human-readable name for UI
38 PopupType type; // Type classification
39 bool allow_resize; // Whether popup can be resized
40 std::function<void()> draw_function; // Drawing callback (set at runtime)
41};
42
48 std::string name;
50 bool is_visible = false;
51 bool allow_resize = false;
52 std::function<void()> draw_function;
53};
54
59namespace PopupID {
60// File Operations
61constexpr const char* kSaveAs = "Save As..";
62constexpr const char* kNewProject = "New Project";
63constexpr const char* kManageProject = "Manage Project";
64
65// Information
66constexpr const char* kAbout = "About";
67constexpr const char* kRomInfo = "ROM Information";
68constexpr const char* kSupportedFeatures = "Supported Features";
69constexpr const char* kStatus = "Status";
70
71// Help Documentation
72constexpr const char* kGettingStarted = "Getting Started";
73constexpr const char* kAsarIntegration = "Asar Integration";
74constexpr const char* kBuildInstructions = "Build Instructions";
75constexpr const char* kCLIUsage = "CLI Usage";
76constexpr const char* kTroubleshooting = "Troubleshooting";
77constexpr const char* kContributing = "Contributing";
78constexpr const char* kWhatsNew = "Whats New v03";
79constexpr const char* kOpenRomHelp = "Open a ROM";
80
81// Settings
82constexpr const char* kDisplaySettings = "Display Settings";
83constexpr const char* kFeatureFlags = "Feature Flags";
84
85// Workspace
86constexpr const char* kWorkspaceHelp = "Workspace Help";
87constexpr const char* kSessionLimitWarning = "Session Limit Warning";
88constexpr const char* kLayoutResetConfirm = "Reset Layout Confirmation";
89constexpr const char* kLayoutPresets = "Layout Presets";
90constexpr const char* kSessionManager = "Session Manager";
91
92// Debug/Testing
93constexpr const char* kDataIntegrity = "Data Integrity Check";
94
95// Future expansion
96constexpr const char* kQuickExport = "Quick Export";
97constexpr const char* kAssetImport = "Asset Import";
98constexpr const char* kScriptGenerator = "Script Generator";
99} // namespace PopupID
100
101// ImGui popup manager.
103 public:
104 PopupManager(EditorManager* editor_manager);
105
106 // Initialize popups
107 void Initialize();
108
109 // Draw all popups
110 void DrawPopups();
111
112 // Show a specific popup
113 void Show(const char* name);
114
115 // Hide a specific popup
116 void Hide(const char* name);
117
118 // Check if a popup is visible
119 bool IsVisible(const char* name) const;
120
121 // Set the status for status popup
122 void SetStatus(const absl::Status& status);
123
124 // Get the current status
125 absl::Status GetStatus() const { return status_; }
126
127 private:
128 // Helper function to begin a centered popup
129 bool BeginCentered(const char* name);
130
131 // Draw the about popup
132 void DrawAboutPopup();
133
134 // Draw the ROM info popup
135 void DrawRomInfoPopup();
136
137 // Draw the status popup
138 void DrawStatusPopup();
139
140 // Draw the save as popup
141 void DrawSaveAsPopup();
142
143 // Draw the new project popup
144 void DrawNewProjectPopup();
145
146 // Draw the supported features popup
148
149 // Draw the open ROM help popup
151
152 // Draw the manage project popup
154
155 // v0.3 Help Documentation popups
159 void DrawCLIUsagePopup();
162 void DrawWhatsNewPopup();
163
164 // Workspace-related popups
170
171 // Settings popups (accessible without ROM)
174
175 // Debug/Testing popups
177
179 std::unordered_map<std::string, PopupParams> popups_;
180 absl::Status status_;
181 bool show_status_ = false;
182 absl::Status prev_status_;
183};
184
185} // namespace editor
186} // namespace yaze
187
188#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)
String constants for all popup identifiers to prevent typos.
constexpr const char * kRomInfo
constexpr const char * kLayoutPresets
constexpr const char * kAbout
constexpr const char * kSessionManager
constexpr const char * kTroubleshooting
constexpr const char * kAssetImport
constexpr const char * kWhatsNew
constexpr const char * kStatus
constexpr const char * kSupportedFeatures
constexpr const char * kDataIntegrity
constexpr const char * kQuickExport
constexpr const char * kManageProject
constexpr const char * kNewProject
constexpr const char * kSaveAs
constexpr const char * kDisplaySettings
constexpr const char * kSessionLimitWarning
constexpr const char * kCLIUsage
constexpr const char * kScriptGenerator
constexpr const char * kLayoutResetConfirm
constexpr const char * kAsarIntegration
constexpr const char * kOpenRomHelp
constexpr const char * kFeatureFlags
constexpr const char * kGettingStarted
constexpr const char * kContributing
constexpr const char * kBuildInstructions
constexpr const char * kWorkspaceHelp
PopupType
Type classification for popups to enable future filtering and organization.
Complete definition of a popup including metadata.
std::function< void()> draw_function
Runtime state for a registered popup.
std::function< void()> draw_function