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