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