Exemple #1
0
func (w *Window) LockSize(lock bool) {
	prevStyle := int(w32.GetWindowLongPtr(w.hwnd, w32.GWL_STYLE))
	if lock {
		prevStyle &= ^(w32.WS_MAXIMIZEBOX | w32.WS_SIZEBOX)
	} else {
		prevStyle |= w32.WS_MAXIMIZEBOX | w32.WS_SIZEBOX
	}
	w32.SetWindowLongPtr(w.hwnd, w32.GWL_STYLE, uintptr(prevStyle))
}
Exemple #2
0
func (this *W32Control) init(className string, parent Controller, exstyle, style uint) {
	this.hwnd = CreateWindow(className, parent, exstyle, style)
	if this.hwnd == 0 {
		panic("cannot create window for " + className)
	}
	this.isMouseLeft = true
	this.originalWndProc = w32.SetWindowLongPtr(this.hwnd, w32.GWLP_WNDPROC, GeneralWndprocCallBack)
	this.ControlBase.init(parent)
}
Exemple #3
0
func ToggleExStyle(hwnd w32.HWND, b bool, style int) {
	originalStyle := int(w32.GetWindowLongPtr(hwnd, w32.GWL_EXSTYLE))
	if originalStyle != 0 {
		if b {
			originalStyle |= style
		} else {
			originalStyle ^= style
		}
		w32.SetWindowLongPtr(hwnd, w32.GWL_EXSTYLE, uintptr(originalStyle))
	}
}
Exemple #4
0
func (this *W32Control) attach(parent Controller, dlgItemID int) {
	if parent == nil {
		panic("parent cannot be nil")
	}

	if this.hwnd = w32.GetDlgItem(parent.Handle(), dlgItemID); this.hwnd == 0 {
		panic("hwnd cannot be nil")
	}

	this.isMouseLeft = true
	this.originalWndProc = w32.SetWindowLongPtr(this.hwnd, w32.GWLP_WNDPROC, GeneralWndprocCallBack)
	this.ControlBase.init(parent)
}