diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-05 19:58:40 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-05 20:00:35 +0200 |
commit | 23449c21450e29069df2fb953f9424eeb32e87fc (patch) | |
tree | 514c095b9fd68853c09edfbfe71e967663d6ec85 | |
parent | Update example manifest files for multi monitor hidpi (diff) | |
download | wireguard-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.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 } |