本文整理汇总了Golang中github.com/lxn/win.GetWindowLong函数的典型用法代码示例。如果您正苦于以下问题:Golang GetWindowLong函数的具体用法?Golang GetWindowLong怎么用?Golang GetWindowLong使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetWindowLong函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ColumnsSizable
// ColumnsSizable returns if the user can change column widths by dragging
// dividers in the header.
func (tv *TableView) ColumnsSizable() bool {
headerHWnd := win.HWND(tv.SendMessage(win.LVM_GETHEADER, 0, 0))
style := win.GetWindowLong(headerHWnd, win.GWL_STYLE)
return style&win.HDS_NOSIZING == 0
}
示例2: SingleItemSelection
// SingleItemSelection returns if only a single item can be selected at once.
//
// By default multiple items can be selected at once.
func (tv *TableView) SingleItemSelection() bool {
style := uint(win.GetWindowLong(tv.hWnd, win.GWL_STYLE))
if style == 0 {
lastError("GetWindowLong")
return false
}
return style&win.LVS_SINGLESEL > 0
}
示例3: LayoutFlags
func (tb *ToolBar) LayoutFlags() LayoutFlags {
style := win.GetWindowLong(tb.hWnd, win.GWL_STYLE)
if style&win.CCS_VERT > 0 {
return ShrinkableVert | GrowableVert | GreedyVert
}
// FIXME: Since reimplementation of BoxLayout we must return 0 here,
// otherwise the ToolBar contained in MainWindow will eat half the space.
return 0 //ShrinkableHorz | GrowableHorz
}
示例4: CaseMode
func (le *LineEdit) CaseMode() CaseMode {
style := uint32(win.GetWindowLong(le.hWnd, win.GWL_STYLE))
if style&win.ES_UPPERCASE != 0 {
return CaseModeUpper
} else if style&win.ES_LOWERCASE != 0 {
return CaseModeLower
} else {
return CaseModeMixed
}
}
示例5: setAndClearStyleBits
func (wb *WindowBase) setAndClearStyleBits(set, clear uint32) error {
style := uint32(win.GetWindowLong(wb.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
if newStyle := style&^clear | set; newStyle != style {
win.SetLastError(0)
if win.SetWindowLong(wb.hWnd, win.GWL_STYLE, int32(newStyle)) == 0 {
return lastError("SetWindowLong")
}
}
return nil
}
示例6: firstFocusableDescendantCallback
func firstFocusableDescendantCallback(hwnd win.HWND, lParam uintptr) uintptr {
widget := windowFromHandle(hwnd)
if widget == nil || !widget.Visible() || !widget.Enabled() {
return 1
}
style := uint(win.GetWindowLong(hwnd, win.GWL_STYLE))
// FIXME: Ugly workaround for NumberEdit
_, isTextSelectable := widget.(textSelectable)
if style&win.WS_TABSTOP > 0 || isTextSelectable {
hwndPtr := (*win.HWND)(unsafe.Pointer(lParam))
*hwndPtr = hwnd
return 0
}
return 1
}
示例7: SetColumnsSizable
// SetColumnsSizable sets if the user can change column widths by dragging
// dividers in the header.
func (tv *TableView) SetColumnsSizable(b bool) error {
headerHWnd := win.HWND(tv.SendMessage(win.LVM_GETHEADER, 0, 0))
style := win.GetWindowLong(headerHWnd, win.GWL_STYLE)
if b {
style &^= win.HDS_NOSIZING
} else {
style |= win.HDS_NOSIZING
}
if 0 == win.SetWindowLong(headerHWnd, win.GWL_STYLE, style) {
return lastError("SetWindowLong(GWL_STYLE)")
}
tv.columnsSizableChangedPublisher.Publish()
return nil
}
示例8: removePage
func (tw *TabWidget) removePage(page *TabPage) (err error) {
page.SetVisible(false)
style := uint32(win.GetWindowLong(page.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
style &^= win.WS_CHILD
style |= win.WS_POPUP
win.SetLastError(0)
if win.SetWindowLong(page.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
page.tabWidget = nil
return page.SetParent(nil)
}
示例9: onInsertedPage
func (tw *TabWidget) onInsertedPage(index int, page *TabPage) (err error) {
item := tw.tcitemFromPage(page)
if idx := int(win.SendMessage(tw.hWndTab, win.TCM_INSERTITEM, uintptr(index), uintptr(unsafe.Pointer(item)))); idx == -1 {
return newError("SendMessage(TCM_INSERTITEM) failed")
}
page.SetVisible(false)
style := uint32(win.GetWindowLong(page.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
style |= win.WS_CHILD
style &^= win.WS_POPUP
win.SetLastError(0)
if win.SetWindowLong(page.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
if win.SetParent(page.hWnd, tw.hWnd) == 0 {
return lastError("SetParent")
}
if tw.pages.Len() == 1 {
page.SetVisible(true)
tw.SetCurrentIndex(0)
}
tw.resizePages()
page.tabWidget = tw
page.applyFont(tw.Font())
return
}
示例10: SetParent
// SetParent sets the parent of the WidgetBase and adds the WidgetBase to the
// Children list of the Container.
func (wb *WidgetBase) SetParent(parent Container) (err error) {
if parent == wb.parent {
return nil
}
style := uint32(win.GetWindowLong(wb.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
if parent == nil {
style &^= win.WS_CHILD
style |= win.WS_POPUP
if win.SetParent(wb.hWnd, 0) == 0 {
return lastError("SetParent")
}
win.SetLastError(0)
if win.SetWindowLong(wb.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
} else {
style |= win.WS_CHILD
style &^= win.WS_POPUP
win.SetLastError(0)
if win.SetWindowLong(wb.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
if win.SetParent(wb.hWnd, parent.Handle()) == 0 {
return lastError("SetParent")
}
}
b := wb.Bounds()
if !win.SetWindowPos(
wb.hWnd,
win.HWND_BOTTOM,
int32(b.X),
int32(b.Y),
int32(b.Width),
int32(b.Height),
win.SWP_FRAMECHANGED) {
return lastError("SetWindowPos")
}
oldParent := wb.parent
wb.parent = parent
var oldChildren, newChildren *WidgetList
if oldParent != nil {
oldChildren = oldParent.Children()
}
if parent != nil {
newChildren = parent.Children()
}
if newChildren == oldChildren {
return nil
}
widget := wb.window.(Widget)
if oldChildren != nil {
oldChildren.Remove(widget)
}
if newChildren != nil && !newChildren.containsHandle(wb.hWnd) {
newChildren.Add(widget)
}
return nil
}
示例11: Fullscreen
func (mw *MainWindow) Fullscreen() bool {
return win.GetWindowLong(mw.hWnd, win.GWL_STYLE)&win.WS_OVERLAPPEDWINDOW == 0
}
示例12: hasStyleBits
func (wb *WindowBase) hasStyleBits(bits uint) bool {
style := uint(win.GetWindowLong(wb.hWnd, win.GWL_STYLE))
return style&bits == bits
}