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)) }
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) }
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)) } }
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) }