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