1 Star 0 Fork 0

程序员锡哥/walk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
progressbar.go 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
Alexander Neumann 提交于 2015-11-12 17:51 . ProgressBar: Add MarqueeMode
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"github.com/lxn/win"
)
type ProgressBar struct {
WidgetBase
}
func NewProgressBar(parent Container) (*ProgressBar, error) {
pb := new(ProgressBar)
if err := InitWidget(
pb,
parent,
"msctls_progress32",
win.WS_VISIBLE,
0); err != nil {
return nil, err
}
return pb, nil
}
func (*ProgressBar) LayoutFlags() LayoutFlags {
return ShrinkableHorz | GrowableHorz | GreedyHorz
}
func (pb *ProgressBar) MinSizeHint() Size {
return pb.dialogBaseUnitsToPixels(Size{10, 14})
}
func (pb *ProgressBar) SizeHint() Size {
return pb.dialogBaseUnitsToPixels(Size{50, 14})
}
func (pb *ProgressBar) MinValue() int {
return int(pb.SendMessage(win.PBM_GETRANGE, 1, 0))
}
func (pb *ProgressBar) MaxValue() int {
return int(pb.SendMessage(win.PBM_GETRANGE, 0, 0))
}
func (pb *ProgressBar) SetRange(min, max int) {
pb.SendMessage(win.PBM_SETRANGE32, uintptr(min), uintptr(max))
}
func (pb *ProgressBar) Value() int {
return int(pb.SendMessage(win.PBM_GETPOS, 0, 0))
}
func (pb *ProgressBar) SetValue(value int) {
pb.SendMessage(win.PBM_SETPOS, uintptr(value), 0)
}
func (pb *ProgressBar) MarqueeMode() bool {
return pb.hasStyleBits(win.PBS_MARQUEE)
}
func (pb *ProgressBar) SetMarqueeMode(marqueeMode bool) error {
if err := pb.ensureStyleBits(win.PBS_MARQUEE, marqueeMode); err != nil {
return err
}
pb.SendMessage(win.PBM_SETMARQUEE, uintptr(win.BoolToBOOL(marqueeMode)), 0)
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/msgy/walk.git
git@gitee.com:msgy/walk.git
msgy
walk
walk
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385