Пример #1
0
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)
	}
}
Пример #2
0
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)
	}
}
Пример #3
0
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)
	}
}
Пример #4
0
// 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()))
}
Пример #5
0
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)
}
Пример #6
0
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
}
Пример #7
0
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)}
}
Пример #8
0
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
}
Пример #9
0
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)}
}
Пример #10
0
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
}
Пример #11
0
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)
}
Пример #12
0
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)
}
Пример #13
0
// 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
}
Пример #14
0
func (this *ProgressBar) SetValue(v uint) {
	w32.SendMessage(this.hwnd, w32.PBM_SETPOS, uintptr(v), 0)
}
Пример #15
0
func (this *ProgressBar) Value() uint {
	ret := w32.SendMessage(this.hwnd, w32.PBM_GETPOS, 0, 0)
	return uint(ret)
}
Пример #16
0
func (this *ListView) SetItemCount(count int) bool {
	return w32.SendMessage(this.hwnd, w32.LVM_SETITEMCOUNT, uintptr(count), 0) != 0
}
Пример #17
0
func (this *ListView) ItemCount() int {
	return int(w32.SendMessage(this.hwnd, w32.LVM_GETITEMCOUNT, 0, 0))
}
Пример #18
0
func (this *ProgressBar) SetRange(min, max uint) {
	w32.SendMessage(this.hwnd, w32.PBM_SETRANGE32, uintptr(min), uintptr(max))
}
Пример #19
0
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
}
Пример #20
0
// 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)))
}
Пример #21
0
func (this *ControlBase) SetFont(font *Font) {
	w32.SendMessage(this.hwnd, w32.WM_SETFONT, uintptr(font.hfont), 1)
	this.font = font
}
Пример #22
0
func (this *ListView) InsertLvColumn(lvColumn *w32.LVCOLUMN, iCol int) {
	w32.SendMessage(this.hwnd, w32.LVM_INSERTCOLUMN, uintptr(iCol), uintptr(unsafe.Pointer(lvColumn)))
}
Пример #23
0
//Public methods
func (this *Edit) SetReadOnly(isReadOnly bool) {
	w32.SendMessage(this.hwnd, w32.EM_SETREADONLY, uintptr(w32.BoolToBOOL(isReadOnly)), 0)
}
Пример #24
0
func (this *ListView) SetLvItem(lvItem *w32.LVITEM) {
	w32.SendMessage(this.hwnd, w32.LVM_SETITEM, 0, uintptr(unsafe.Pointer(lvItem)))
}
Пример #25
0
func (this *ListView) SelectedCount() uint {
	return uint(w32.SendMessage(this.hwnd, w32.LVM_GETSELECTEDCOUNT, 0, 0))
}
Пример #26
0
func (this *Button) Checked() bool {
	result := w32.SendMessage(this.hwnd, w32.BM_GETCHECK, 0, 0)
	return result == w32.BST_CHECKED
}
Пример #27
0
func (this *ListView) Item(item *w32.LVITEM) bool {
	return w32.SendMessage(this.hwnd, w32.LVM_GETITEM, 0, uintptr(unsafe.Pointer(item))) == w32.TRUE
}
Пример #28
0
func (this *ListView) DeleteAllItems() bool {
	return w32.SendMessage(this.hwnd, w32.LVM_DELETEALLITEMS, 0, 0) == w32.TRUE
}