mirror of
https://github.com/RGBCube/serenity
synced 2025-07-05 17:47:36 +00:00
HackStudio: Add a simple app icon and some initial menus
This commit is contained in:
parent
e9f6e1e287
commit
2638a94094
2 changed files with 34 additions and 10 deletions
BIN
Base/res/icons/16x16/app-hack-studio.png
Normal file
BIN
Base/res/icons/16x16/app-hack-studio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 327 B |
|
@ -1,11 +1,14 @@
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
#include "TerminalWrapper.h"
|
#include "TerminalWrapper.h"
|
||||||
#include <LibCore/CFile.h>
|
#include <LibCore/CFile.h>
|
||||||
|
#include <LibGUI/GAboutDialog.h>
|
||||||
#include <LibGUI/GAction.h>
|
#include <LibGUI/GAction.h>
|
||||||
#include <LibGUI/GApplication.h>
|
#include <LibGUI/GApplication.h>
|
||||||
#include <LibGUI/GBoxLayout.h>
|
#include <LibGUI/GBoxLayout.h>
|
||||||
#include <LibGUI/GInputBox.h>
|
#include <LibGUI/GInputBox.h>
|
||||||
#include <LibGUI/GListView.h>
|
#include <LibGUI/GListView.h>
|
||||||
|
#include <LibGUI/GMenu.h>
|
||||||
|
#include <LibGUI/GMenuBar.h>
|
||||||
#include <LibGUI/GMessageBox.h>
|
#include <LibGUI/GMessageBox.h>
|
||||||
#include <LibGUI/GSplitter.h>
|
#include <LibGUI/GSplitter.h>
|
||||||
#include <LibGUI/GStatusBar.h>
|
#include <LibGUI/GStatusBar.h>
|
||||||
|
@ -68,7 +71,8 @@ int main(int argc, char** argv)
|
||||||
statusbar->set_text(String::format("Line: %d, Column: %d", text_editor->cursor().line(), text_editor->cursor().column()));
|
statusbar->set_text(String::format("Line: %d, Column: %d", text_editor->cursor().line(), text_editor->cursor().column()));
|
||||||
};
|
};
|
||||||
|
|
||||||
text_editor->add_custom_context_menu_action(GAction::create("Go to line...", { Mod_Ctrl, Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [&](auto&) {
|
text_editor->add_custom_context_menu_action(GAction::create(
|
||||||
|
"Go to line...", { Mod_Ctrl, Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [&](auto&) {
|
||||||
auto input_box = GInputBox::construct("Line:", "Go to line", window);
|
auto input_box = GInputBox::construct("Line:", "Go to line", window);
|
||||||
auto result = input_box->exec();
|
auto result = input_box->exec();
|
||||||
if (result == GInputBox::ExecOK) {
|
if (result == GInputBox::ExecOK) {
|
||||||
|
@ -78,7 +82,27 @@ int main(int argc, char** argv)
|
||||||
text_editor->set_cursor(line_number - 1, 0);
|
text_editor->set_cursor(line_number - 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, text_editor));
|
},
|
||||||
|
text_editor));
|
||||||
|
|
||||||
|
auto menubar = make<GMenuBar>();
|
||||||
|
auto app_menu = make<GMenu>("HackStudio");
|
||||||
|
app_menu->add_action(GCommonActions::make_quit_action([&](auto&) {
|
||||||
|
app.quit();
|
||||||
|
}));
|
||||||
|
menubar->add_menu(move(app_menu));
|
||||||
|
|
||||||
|
auto small_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png");
|
||||||
|
|
||||||
|
auto help_menu = make<GMenu>("Help");
|
||||||
|
help_menu->add_action(GAction::create("About", [&](auto&) {
|
||||||
|
GAboutDialog::show("HackStudio", small_icon, window);
|
||||||
|
}));
|
||||||
|
menubar->add_menu(move(help_menu));
|
||||||
|
|
||||||
|
app.set_menubar(move(menubar));
|
||||||
|
|
||||||
|
window->set_icon(small_icon);
|
||||||
|
|
||||||
window->show();
|
window->show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue