diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-02 17:56:43 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-02 18:22:07 +0200 |
commit | 2cec6cde13d5aa62245d704df877d5ce3840cf02 (patch) | |
tree | f6ba2391be43e623ceba905272f8dcd3ee1f3694 /ui/tunnelspage.go | |
parent | service: lock OS thread before making inheritable handles (diff) | |
download | wireguard-windows-2cec6cde13d5aa62245d704df877d5ce3840cf02.tar.xz wireguard-windows-2cec6cde13d5aa62245d704df877d5ce3840cf02.zip |
ui: add labels and keyboard shortcuts
Diffstat (limited to '')
-rw-r--r-- | ui/tunnelspage.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go index 33b2c03e..aecd2ac1 100644 --- a/ui/tunnelspage.go +++ b/ui/tunnelspage.go @@ -67,7 +67,7 @@ func NewTunnelsPage() (*TunnelsPage, error) { hlayout.SetMargins(walk.Margins{}) toolBarContainer.SetLayout(hlayout) - tunnelsToolBar, _ := walk.NewToolBarWithOrientationAndButtonStyle(toolBarContainer, walk.Horizontal, walk.ToolBarButtonImageOnly) + tunnelsToolBar, _ := walk.NewToolBarWithOrientationAndButtonStyle(toolBarContainer, walk.Horizontal, walk.ToolBarButtonImageBeforeText) imageSize := walk.Size{tp.DPI() / 6, tp.DPI() / 6} // Dividing by six is the same as dividing by 96 and multiplying by 16. TODO: Use dynamic DPI imageList, _ := walk.NewImageList(imageSize, walk.RGB(255, 255, 255)) tunnelsToolBar.SetImageList(imageList) @@ -76,16 +76,19 @@ func NewTunnelsPage() (*TunnelsPage, error) { tp.AddDisposable(addMenu) importAction := walk.NewAction() importAction.SetText("Import tunnel(s) from file...") + importAction.SetShortcut(walk.Shortcut{walk.ModControl, walk.KeyO}) importAction.Triggered().Attach(tp.onImport) addAction := walk.NewAction() addAction.SetText("Add empty tunnel") + addAction.SetShortcut(walk.Shortcut{walk.ModControl, walk.KeyN}) addAction.Triggered().Attach(tp.onAddTunnel) - addMenu.Actions().Add(addAction) addMenu.Actions().Add(importAction) + addMenu.Actions().Add(addAction) addMenuAction := walk.NewMenuAction(addMenu) addMenuActionIcon, _ := walk.NewIconFromResourceWithSize("add.ico", imageSize) addMenuActionImage, _ := walk.NewBitmapFromIcon(addMenuActionIcon, imageSize) addMenuAction.SetImage(addMenuActionImage) + addMenuAction.SetText("Add Tunnel") addMenuAction.SetToolTip(importAction.Text()) addMenuAction.Triggered().Attach(tp.onImport) tunnelsToolBar.Actions().Add(addMenuAction) @@ -96,6 +99,7 @@ func NewTunnelsPage() (*TunnelsPage, error) { deleteActionIcon, _ := walk.NewIconFromResourceWithSize("delete.ico", imageSize) deleteActionImage, _ := walk.NewBitmapFromIcon(deleteActionIcon, imageSize) deleteAction.SetImage(deleteActionImage) + deleteAction.SetShortcut(walk.Shortcut{0, walk.KeyDelete}) deleteAction.SetToolTip("Remove selected tunnel(s)") deleteAction.Triggered().Attach(tp.onDelete) tunnelsToolBar.Actions().Add(deleteAction) |