作者:hoperui
项目:gfor
func (this *ListView) EnableDoubleBuffer(enable bool) {
if enable {
w32.SendMessage(this.hwnd, w32.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, w32.LVS_EX_DOUBLEBUFFER)
} else {
w32.SendMessage(this.hwnd, w32.LVM_SETEXTENDEDLISTVIEWSTYLE, w32.LVS_EX_DOUBLEBUFFER, 0)
}
}
作者:hoperui
项目:gfor
func (this *ListView) EnableFullRowSelect(enable bool) {
if enable {
w32.SendMessage(this.hwnd, w32.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, w32.LVS_EX_FULLROWSELECT)
} else {
w32.SendMessage(this.hwnd, w32.LVM_SETEXTENDEDLISTVIEWSTYLE, w32.LVS_EX_FULLROWSELECT, 0)
}
}
作者:hoperui
项目:gfor
func (this *ListView) EnableHotTrack(enable bool) {
if enable {
w32.SendMessage(this.hwnd, w32.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, w32.LVS_EX_TRACKSELECT)
} else {
w32.SendMessage(this.hwnd, w32.LVM_SETEXTENDEDLISTVIEWSTYLE, w32.LVS_EX_TRACKSELECT, 0)
}
}
作者:hoperui
项目:gfor
// IconType: 1 - ICON_BIG; 0 - ICON_SMALL
func (this *Form) SetIcon(iconType int, icon *Icon) {
if iconType > 1 {
panic("IconType is invalid")
}
w32.SendMessage(this.hwnd, w32.WM_SETICON, uintptr(iconType), uintptr(icon.Handle()))
}
作者:foxundermoo
项目:gfor
func (this *Button) SetChecked(checked bool) {
wparam := w32.BST_CHECKED
if !checked {
wparam = w32.BST_UNCHECKED
}
w32.SendMessage(this.hwnd, w32.BM_SETCHECK, uintptr(wparam), 0)
}
作者:Nightgunner
项目:go.wd
func (this *Window) Close() error {
err := w32.SendMessage(this.hwnd, w32.WM_CLOSE, 0, 0)
if err != 0 {
return errors.New("Error closing window")
}
return nil
}
作者:hoperui
项目:gfor
func (this *ListView) ImageList(imageListType int) *ImageList {
h := w32.SendMessage(this.hwnd, w32.LVM_GETIMAGELIST, uintptr(imageListType), 0)
if h == 0 {
return nil
}
return &ImageList{w32.HIMAGELIST(h)}
}
作者:hoperui
项目:gfor
func AttachListView(parent Controller, id int) *ListView {
lv := new(ListView)
lv.attach(parent, id)
RegMsgHandler(lv)
w32.SendMessage(lv.Handle(), w32.LVM_SETUNICODEFORMAT, w32.TRUE, 0)
return lv
}
作者:hoperui
项目:gfor
func (this *ListView) SetImageList(imageList *ImageList, imageListType int) *ImageList {
h := w32.SendMessage(this.hwnd, w32.LVM_SETIMAGELIST, uintptr(imageListType), uintptr(imageList.Handle()))
if h == 0 {
return nil
}
return &ImageList{w32.HIMAGELIST(h)}
}
作者:foxundermoo
项目:gfor
func (this *ToolTip) AddTool(tool Controller, tip string) bool {
var ti w32.TOOLINFO
ti.CbSize = uint32(unsafe.Sizeof(ti))
if tool.Parent() != nil {
ti.Hwnd = tool.Parent().Handle()
}
ti.UFlags = w32.TTF_IDISHWND | w32.TTF_SUBCLASS
ti.UId = uintptr(tool.Handle())
ti.LpszText = syscall.StringToUTF16Ptr(tip)
return w32.SendMessage(this.Handle(), w32.TTM_ADDTOOL, 0, uintptr(unsafe.Pointer(&ti))) != w32.FALSE
}
作者:hoperui
项目:gfor
func (this *Form) WndProc(msg uint, wparam, lparam uintptr) uintptr {
switch msg {
case w32.WM_LBUTTONDOWN:
if this.isDragMove {
w32.ReleaseCapture()
w32.SendMessage(this.hwnd, w32.WM_NCLBUTTONDOWN, w32.HTCAPTION, 0)
}
case w32.WM_CLOSE:
w32.DestroyWindow(this.hwnd)
case w32.WM_DESTROY:
w32.PostQuitMessage(0)
}
return w32.DefWindowProc(this.hwnd, msg, wparam, lparam)
}
作者:foxundermoo
项目:gfor
func (this *Form) WndProc(msg uint, wparam, lparam uintptr) uintptr {
switch msg {
case w32.WM_LBUTTONDOWN:
if this.isDragMove {
w32.ReleaseCapture()
w32.SendMessage(this.hwnd, w32.WM_NCLBUTTONDOWN, w32.HTCAPTION, 0)
}
case w32.WM_CLOSE:
this.onClose.Fire(NewEventArg(this, nil))
return 0
case w32.WM_DESTROY:
w32.PostQuitMessage(0)
return 0
}
return w32.DefWindowProc(this.hwnd, uint32(msg), wparam, lparam)
}
作者:hoperui
项目:gfor
// mask is used to set the LVITEM.Mask for ListView.GetItem which indicates which attributes you'd like to receive
// of LVITEM.
func (this *ListView) SelectedItems(mask uint) []*w32.LVITEM {
items := make([]*w32.LVITEM, 0)
var i int = -1
for {
if i = int(w32.SendMessage(this.hwnd, w32.LVM_GETNEXTITEM, uintptr(i), uintptr(w32.LVNI_SELECTED))); i == -1 {
break
}
var item w32.LVITEM
item.Mask = mask
item.IItem = i
if this.Item(&item) {
items = append(items, &item)
}
}
return items
}
作者:foxundermoo
项目:gfor
func (this *ProgressBar) SetValue(v uint) {
w32.SendMessage(this.hwnd, w32.PBM_SETPOS, uintptr(v), 0)
}
作者:foxundermoo
项目:gfor
func (this *ProgressBar) Value() uint {
ret := w32.SendMessage(this.hwnd, w32.PBM_GETPOS, 0, 0)
return uint(ret)
}
作者:hoperui
项目:gfor
func (this *ListView) SetItemCount(count int) bool {
return w32.SendMessage(this.hwnd, w32.LVM_SETITEMCOUNT, uintptr(count), 0) != 0
}
作者:hoperui
项目:gfor
func (this *ListView) ItemCount() int {
return int(w32.SendMessage(this.hwnd, w32.LVM_GETITEMCOUNT, 0, 0))
}
作者:foxundermoo
项目:gfor
func (this *ProgressBar) SetRange(min, max uint) {
w32.SendMessage(this.hwnd, w32.PBM_SETRANGE32, uintptr(min), uintptr(max))
}
作者:foxundermoo
项目:gfor
func (this *ProgressBar) Range() (min, max uint) {
min = uint(w32.SendMessage(this.hwnd, w32.PBM_GETRANGE, uintptr(w32.BoolToBOOL(true)), 0))
max = uint(w32.SendMessage(this.hwnd, w32.PBM_GETRANGE, uintptr(w32.BoolToBOOL(false)), 0))
return
}
作者:hoperui
项目:gfor
// Changes the state of an item in a list-view control. Refer LVM_SETITEMSTATE message.
func (this *ListView) setItemState(i int, state, mask uint) {
var item w32.LVITEM
item.State, item.StateMask = state, mask
w32.SendMessage(this.hwnd, w32.LVM_SETITEMSTATE, uintptr(i), uintptr(unsafe.Pointer(&item)))
}