mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:25:07 +00:00
TextEditor: Add New/Open/Save actions.
They aren't hooked up to anything, I just felt like making some icons. ;^)
This commit is contained in:
parent
c3bb84239e
commit
be0ac86b63
7 changed files with 19 additions and 0 deletions
|
@ -58,6 +58,18 @@ int main(int argc, char** argv)
|
|||
text_editor->set_text(builder.to_string());
|
||||
}
|
||||
|
||||
auto new_action = GAction::create("New document", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/newdocument16.rgb", { 16, 16 }), [] (const GAction&) {
|
||||
dbgprintf("FIXME: Implement File/New");
|
||||
});
|
||||
|
||||
auto open_action = GAction::create("Open document", { Mod_Ctrl, Key_O }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/open16.rgb", { 16, 16 }), [] (const GAction&) {
|
||||
dbgprintf("FIXME: Implement File/Open");
|
||||
});
|
||||
|
||||
auto save_action = GAction::create("Save document", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/save16.rgb", { 16, 16 }), [] (const GAction&) {
|
||||
dbgprintf("FIXME: Implement File/Save");
|
||||
});
|
||||
|
||||
auto menubar = make<GMenuBar>();
|
||||
auto app_menu = make<GMenu>("TextEditor");
|
||||
app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
|
||||
|
@ -67,6 +79,9 @@ int main(int argc, char** argv)
|
|||
menubar->add_menu(move(app_menu));
|
||||
|
||||
auto file_menu = make<GMenu>("File");
|
||||
file_menu->add_action(new_action.copy_ref());
|
||||
file_menu->add_action(open_action.copy_ref());
|
||||
file_menu->add_action(save_action.copy_ref());
|
||||
menubar->add_menu(move(file_menu));
|
||||
|
||||
auto edit_menu = make<GMenu>("Edit");
|
||||
|
@ -80,6 +95,10 @@ int main(int argc, char** argv)
|
|||
|
||||
app.set_menubar(move(menubar));
|
||||
|
||||
toolbar->add_action(move(new_action));
|
||||
toolbar->add_action(move(open_action));
|
||||
toolbar->add_action(move(save_action));
|
||||
|
||||
auto* window = new GWindow;
|
||||
window->set_title(String::format("TextEditor: %s", path.characters()));
|
||||
window->set_rect(20, 200, 640, 400);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue