summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2019-02-25 15:33:11 +0100
committerAlexander Neumann <alexander.neumann@picos-software.com>2019-02-25 15:33:11 +0100
commit974e1bfff1cbca225a4e52d571a5a4f9c63b1f71 (patch)
tree75e632b0a83b4bcbaac172c7439d03ff5cedba14
parentstatic: Invalidate after resize (diff)
downloadwireguard-windows-974e1bfff1cbca225a4e52d571a5a4f9c63b1f71.tar.xz
wireguard-windows-974e1bfff1cbca225a4e52d571a5a4f9c63b1f71.zip
Slider: Add ToolTipsHidden
-rw-r--r--declarative/slider.go6
-rw-r--r--slider.go16
2 files changed, 19 insertions, 3 deletions
diff --git a/declarative/slider.go b/declarative/slider.go
index 2ab4e145..719c31f6 100644
--- a/declarative/slider.go
+++ b/declarative/slider.go
@@ -50,12 +50,16 @@ type Slider struct {
MinValue int
Orientation Orientation
OnValueChanged walk.EventHandler
+ ToolTipsHidden bool
Tracking bool
Value Property
}
func (sl Slider) Create(builder *Builder) error {
- w, err := walk.NewSliderWithOrientation(builder.Parent(), walk.Orientation(sl.Orientation))
+ w, err := walk.NewSliderWithCfg(builder.Parent(), &walk.SliderCfg{
+ Orientation: walk.Orientation(sl.Orientation),
+ ToolTipsHidden: sl.ToolTipsHidden,
+ })
if err != nil {
return err
}
diff --git a/slider.go b/slider.go
index 2e35ed0c..1e096b5d 100644
--- a/slider.go
+++ b/slider.go
@@ -20,20 +20,32 @@ type Slider struct {
persistent bool
}
+type SliderCfg struct {
+ Orientation Orientation
+ ToolTipsHidden bool
+}
+
func NewSlider(parent Container) (*Slider, error) {
return NewSliderWithOrientation(parent, Horizontal)
}
func NewSliderWithOrientation(parent Container, orientation Orientation) (*Slider, error) {
+ return NewSliderWithCfg(parent, &SliderCfg{Orientation: orientation})
+}
+
+func NewSliderWithCfg(parent Container, cfg *SliderCfg) (*Slider, error) {
sl := new(Slider)
- var style uint32 = win.WS_TABSTOP | win.WS_VISIBLE | win.TBS_TOOLTIPS
- if orientation == Vertical {
+ var style uint32 = win.WS_TABSTOP | win.WS_VISIBLE
+ if cfg.Orientation == Vertical {
style |= win.TBS_VERT
sl.layoutFlags = ShrinkableVert | GrowableVert | GreedyVert
} else {
sl.layoutFlags = ShrinkableHorz | GrowableHorz | GreedyHorz
}
+ if !cfg.ToolTipsHidden {
+ style |= win.TBS_TOOLTIPS
+ }
if err := InitWidget(
sl,