summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-05 15:03:38 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-05 15:03:38 +0200
commita3457b5d756f434e887288341559a9e5fa6f9f69 (patch)
tree5e627e6eba584b0be4c47256695f8c39efc6915a /src/ui/window.c
parent71f3f34782aa6050ede4bf143fa6028653adae6d (diff)
Defined a set of UI icons; use in menus
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 008290b9..bf7214f4 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "window.h" 23#include "window.h"
24 24
25#include "defs.h"
25#include "labelwidget.h" 26#include "labelwidget.h"
26#include "inputwidget.h" 27#include "inputwidget.h"
27#include "documentwidget.h" 28#include "documentwidget.h"
@@ -162,7 +163,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
162#if !defined (iPlatformAppleMobile) 163#if !defined (iPlatformAppleMobile)
163/* TODO: Submenus wouldn't hurt here. */ 164/* TODO: Submenus wouldn't hurt here. */
164static const iMenuItem navMenuItems_[] = { 165static const iMenuItem navMenuItems_[] = {
165 { "New Tab", 't', KMOD_PRIMARY, "tabs.new" }, 166 { add_Icon " New Tab", 't', KMOD_PRIMARY, "tabs.new" },
166 { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" }, 167 { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" },
167 { "---", 0, 0, NULL }, 168 { "---", 0, 0, NULL },
168 { "Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" }, 169 { "Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" },
@@ -314,14 +315,14 @@ static const iMenuItem identityButtonMenuItems_[] = {
314 { "---", 0, 0, NULL }, 315 { "---", 0, 0, NULL },
315 { "Show Identities", '4', KMOD_PRIMARY, "sidebar.mode arg:3 show:1" }, 316 { "Show Identities", '4', KMOD_PRIMARY, "sidebar.mode arg:3 show:1" },
316# else 317# else
317 { "New Identity...", 0, 0, "ident.new" }, 318 { add_Icon " New Identity...", 0, 0, "ident.new" },
318 { "---", 0, 0, NULL }, 319 { "---", 0, 0, NULL },
319 { "Show Identities", 0, 0, "sidebar.mode arg:3 show:1" }, 320 { person_Icon " Show Identities", 0, 0, "sidebar.mode arg:3 show:1" },
320#endif 321#endif
321}; 322};
322#endif 323#endif
323 324
324static const char *reloadCStr_ = "\U0001f503"; 325static const char *reloadCStr_ = reload_Icon;
325 326
326/* TODO: A preference for these, maybe? */ 327/* TODO: A preference for these, maybe? */
327static const char *stopSeqCStr_[] = { 328static const char *stopSeqCStr_[] = {
@@ -894,7 +895,7 @@ static void setupUserInterface_Window(iWindow *d) {
894 frameless_WidgetFlag); 895 frameless_WidgetFlag);
895 setId_Widget(as_Widget(appMax), "winbar.max"); 896 setId_Widget(as_Widget(appMax), "winbar.max");
896 addChildFlags_Widget(winBar, 897 addChildFlags_Widget(winBar,
897 iClob(appClose = newLargeIcon_LabelWidget("\u2a2f", "window.close")), 898 iClob(appClose = newLargeIcon_LabelWidget(close_Icon, "window.close")),
898 frameless_WidgetFlag); 899 frameless_WidgetFlag);
899 setId_Widget(as_Widget(appClose), "winbar.close"); 900 setId_Widget(as_Widget(appClose), "winbar.close");
900 setFont_LabelWidget(appClose, uiContent_FontId); 901 setFont_LabelWidget(appClose, uiContent_FontId);
@@ -916,8 +917,8 @@ static void setupUserInterface_Window(iWindow *d) {
916 addChild_Widget(div, iClob(navBar)); 917 addChild_Widget(div, iClob(navBar));
917 setBackgroundColor_Widget(navBar, uiBackground_ColorId); 918 setBackgroundColor_Widget(navBar, uiBackground_ColorId);
918 setCommandHandler_Widget(navBar, handleNavBarCommands_); 919 setCommandHandler_Widget(navBar, handleNavBarCommands_);
919 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f870", 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back"); 920 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back");
920 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f872", 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward"); 921 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward");
921 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); 922 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag);
922 iLabelWidget *idMenu = makeMenuButton_LabelWidget( 923 iLabelWidget *idMenu = makeMenuButton_LabelWidget(
923 "\U0001f464", identityButtonMenuItems_, iElemCount(identityButtonMenuItems_)); 924 "\U0001f464", identityButtonMenuItems_, iElemCount(identityButtonMenuItems_));
@@ -984,7 +985,7 @@ static void setupUserInterface_Window(iWindow *d) {
984 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); 985 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag);
985 setId_Widget(addChildFlags_Widget(navBar, 986 setId_Widget(addChildFlags_Widget(navBar,
986 iClob(newIcon_LabelWidget( 987 iClob(newIcon_LabelWidget(
987 "\U0001f3e0", SDLK_h, KMOD_PRIMARY | KMOD_SHIFT, "navigate.home")), 988 home_Icon, SDLK_h, KMOD_PRIMARY | KMOD_SHIFT, "navigate.home")),
988 collapse_WidgetFlag), 989 collapse_WidgetFlag),
989 "navbar.home"); 990 "navbar.home");
990#if !defined (iHaveNativeMenus) 991#if !defined (iHaveNativeMenus)
@@ -1023,7 +1024,7 @@ static void setupUserInterface_Window(iWindow *d) {
1023 setBackgroundColor_Widget(buttons, uiBackground_ColorId); 1024 setBackgroundColor_Widget(buttons, uiBackground_ColorId);
1024 } 1025 }
1025 setId_Widget( 1026 setId_Widget(
1026 addChild_Widget(buttons, iClob(newIcon_LabelWidget("\u2795", 0, 0, "tabs.new"))), 1027 addChild_Widget(buttons, iClob(newIcon_LabelWidget(add_Icon, 0, 0, "tabs.new"))),
1027 "newtab"); 1028 "newtab");
1028 } 1029 }
1029 /* Side bars. */ { 1030 /* Side bars. */ {
@@ -1064,7 +1065,7 @@ static void setupUserInterface_Window(iWindow *d) {
1064 "find.input"); 1065 "find.input");
1065 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9f ", 'g', KMOD_PRIMARY, "find.next"))); 1066 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9f ", 'g', KMOD_PRIMARY, "find.next")));
1066 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev"))); 1067 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev")));
1067 addChild_Widget(searchBar, iClob(newIcon_LabelWidget("\u2a2f", SDLK_ESCAPE, 0, "find.close"))); 1068 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(close_Icon, SDLK_ESCAPE, 0, "find.close")));
1068 } 1069 }
1069#if defined (iPlatformAppleMobile) 1070#if defined (iPlatformAppleMobile)
1070 /* Bottom toolbar. */ 1071 /* Bottom toolbar. */
@@ -1094,7 +1095,7 @@ static void setupUserInterface_Window(iWindow *d) {
1094 const iMenuItem items[] = { 1095 const iMenuItem items[] = {
1095 { "\U0001f588 Bookmarks", 0, 0, "toolbar.showview arg:0" }, 1096 { "\U0001f588 Bookmarks", 0, 0, "toolbar.showview arg:0" },
1096 { "\U00002605 Feeds", 0, 0, "toolbar.showview arg:1" }, 1097 { "\U00002605 Feeds", 0, 0, "toolbar.showview arg:1" },
1097 { "\U0001f553 History", 0, 0, "toolbar.showview arg:2" }, 1098 { clock_Icon " History", 0, 0, "toolbar.showview arg:2" },
1098 { "\U0001f5b9 Page Outline", 0, 0, "toolbar.showview arg:4" }, 1099 { "\U0001f5b9 Page Outline", 0, 0, "toolbar.showview arg:4" },
1099 }; 1100 };
1100 iWidget *menu = makeMenu_Widget(findChild_Widget(toolBar, "toolbar.view"), 1101 iWidget *menu = makeMenu_Widget(findChild_Widget(toolBar, "toolbar.view"),
@@ -1105,12 +1106,12 @@ static void setupUserInterface_Window(iWindow *d) {
1105 updatePadding_Window_(d); 1106 updatePadding_Window_(d);
1106 iWidget *tabsMenu = makeMenu_Widget(d->root, 1107 iWidget *tabsMenu = makeMenu_Widget(d->root,
1107 (iMenuItem[]){ 1108 (iMenuItem[]){
1108 { "Close Tab", 0, 0, "tabs.close" }, 1109 { close_Icon " Close Tab", 0, 0, "tabs.close" },
1109 { "Duplicate Tab", 0, 0, "tabs.new duplicate:1" }, 1110 { copy_Icon " Duplicate Tab", 0, 0, "tabs.new duplicate:1" },
1110 { "---", 0, 0, NULL }, 1111 { "---", 0, 0, NULL },
1111 { "Close Other Tabs", 0, 0, "tabs.close toleft:1 toright:1" }, 1112 { "Close Other Tabs", 0, 0, "tabs.close toleft:1 toright:1" },
1112 { "Close Tabs To Left", 0, 0, "tabs.close toleft:1" }, 1113 { barLeftArrow_Icon " Close Tabs To Left", 0, 0, "tabs.close toleft:1" },
1113 { "Close Tabs To Right", 0, 0, "tabs.close toright:1" }, 1114 { barRightArrow_Icon " Close Tabs To Right", 0, 0, "tabs.close toright:1" },
1114 }, 1115 },
1115 6); 1116 6);
1116 setId_Widget(tabsMenu, "doctabs.menu"); 1117 setId_Widget(tabsMenu, "doctabs.menu");