yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
new_project_dialog.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SHELL_DIALOGS_NEW_PROJECT_DIALOG_H_
2#define YAZE_APP_EDITOR_SHELL_DIALOGS_NEW_PROJECT_DIALOG_H_
3
4#include <functional>
5#include <string>
6
7namespace yaze {
8namespace editor {
9
10// Guided "New Project" modal. Replaces the old one-click template -> ROM
11// dialog chain with a single surface that captures the three inputs project
12// creation actually needs: template choice, source ROM, and a human-readable
13// project name. Lives inside the welcome-screen surface but is owned by
14// UICoordinator so it survives welcome-screen teardown during startup
15// transitions.
17 public:
18 // Invoked when the user hits "Create". All three strings are non-empty by
19 // the time the callback fires; the dialog enforces it on the UI side.
20 using CreateCallback = std::function<void(const std::string& template_name,
21 const std::string& rom_path,
22 const std::string& project_name)>;
23
25 create_callback_ = std::move(cb);
26 }
27
28 // Open the modal with a preselected template. `initial_template` should
29 // match one of the display names in templates_table_[] (e.g. "Vanilla ROM
30 // Hack"); empty defaults to the first entry.
31 void Open(const std::string& initial_template = "");
32
33 // Render one frame. Returns true if the modal is currently visible.
34 bool Draw();
35
36 bool IsOpen() const { return open_requested_; }
37
38 private:
39 void ApplyTemplateSelection(const std::string& name);
40 void Reset();
41
43
44 bool open_requested_ = false;
45 bool just_opened_ = false;
46
48 char rom_path_buffer_[1024] = {};
49 char project_name_buffer_[128] = {};
50
51 // Status line shown under the Create button — empty when the form is in a
52 // clean state, populated when validation fails (missing ROM, bad name).
53 std::string status_message_;
54};
55
56} // namespace editor
57} // namespace yaze
58
59#endif // YAZE_APP_EDITOR_SHELL_DIALOGS_NEW_PROJECT_DIALOG_H_
void Open(const std::string &initial_template="")
std::function< void(const std::string &template_name, const std::string &rom_path, const std::string &project_name)> CreateCallback
void SetCreateCallback(CreateCallback cb)
void ApplyTemplateSelection(const std::string &name)