summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <an2048@gmail.com>2019-05-06 10:53:00 +0200
committerGitHub <noreply@github.com>2019-05-06 10:53:00 +0200
commit8028e67d18ca07a71cedc373720037e913789f47 (patch)
treed2df8f61d68aab1f49f1ba72070f4937701e25d0
parentMerge pull request #506 from zx2c4-forks/jd/shortcutaction (diff)
parentui: show tooltips for buttons with no text (diff)
downloadwireguard-windows-8028e67d18ca07a71cedc373720037e913789f47.tar.xz
wireguard-windows-8028e67d18ca07a71cedc373720037e913789f47.zip
Merge pull request #507 from zx2c4-forks/jd/tooltip-mixed-toolbutton
ui: show tooltips for buttons with no text
-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
}