summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-05 19:58:40 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-05 20:00:35 +0200
commit23449c21450e29069df2fb953f9424eeb32e87fc (patch)
tree514c095b9fd68853c09edfbfe71e967663d6ec85
parentUpdate example manifest files for multi monitor hidpi (diff)
downloadwireguard-windows-23449c21450e29069df2fb953f9424eeb32e87fc.tar.xz
wireguard-windows-23449c21450e29069df2fb953f9424eeb32e87fc.zip
ui: show tooltips for buttons with no text
This allows tooltips to explain what a button does in a mixed text and image bar. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--toolbar.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/toolbar.go b/toolbar.go
index 82570646..4664f363 100644
--- a/toolbar.go
+++ b/toolbar.go
@@ -329,7 +329,7 @@ func (tb *ToolBar) initButtonForAction(action *Action, state, style *byte, image
*style |= win.BTNS_GROUP
}
- if tb.buttonStyle != ToolBarButtonImageOnly {
+ if tb.buttonStyle != ToolBarButtonImageOnly && len(action.text) > 0 {
*style |= win.BTNS_SHOWTEXT
}
@@ -358,7 +358,11 @@ func (tb *ToolBar) initButtonForAction(action *Action, state, style *byte, image
actionText = action.Text()
}
- *text = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(actionText)))
+ if len(actionText) != 0 {
+ *text = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(actionText)))
+ } else if len(action.toolTip) != 0 {
+ *text = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(action.toolTip)))
+ }
return
}