本文整理匯總了Golang中C.UINT函數的典型用法代碼示例。如果您正苦於以下問題:Golang UINT函數的具體用法?Golang UINT怎麽用?Golang UINT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了UINT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SortChildrenRange
// Sorts 'count' child elements starting at index 'start'. Uses comparator to define the
// order. Comparator should return -1, or 0, or 1 to indicate less, equal or greater
func (e *Element) SortChildrenRange(start, count uint, comparator func(*Element, *Element) int) {
end := start + count
arg := uintptr(unsafe.Pointer(&comparator))
if ret := C.HTMLayoutSortElements(e.handle, C.UINT(start), C.UINT(end), (*[0]byte)(unsafe.Pointer(goElementComparator)), C.LPVOID(arg)); ret != HLDOM_OK {
domPanic(ret, "Failed to sort elements")
}
}
示例2: AddHotkey
func (this *Hotkeys) AddHotkey(ModKey, Vk uint, callback Callback) int {
hotkey := new(Hotkey)
hotkey.ModKey = C.UINT(ModKey)
hotkey.Vk = C.UINT(Vk)
hotkey.Callback = callback
this.hotkeys[this.id] = hotkey
oldId := this.id
this.id++
return int(oldId)
}
示例3: SetState
// Sets the specified flag to "on" or "off" according to the value of the provided boolean
func (e *Element) SetState(flag uint32, on bool) {
addBits := uint32(0)
clearBits := uint32(0)
if on {
addBits = flag
} else {
clearBits = flag
}
shouldUpdate := C.BOOL(1)
if ret := C.HTMLayoutSetElementState(e.handle, C.UINT(addBits), C.UINT(clearBits), shouldUpdate); ret != HLDOM_OK {
domPanic(ret, "Failed to set element state flag")
}
}
示例4: Child
func (e *Element) Child(index uint) *Element {
var child C.HELEMENT
if ret := C.HTMLayoutGetNthChild(e.handle, C.UINT(index), &child); ret != HLDOM_OK {
domPanic(ret, "Failed to get child at index: ", index)
}
return NewElementFromHandle(HELEMENT(child))
}
示例5: BestwglChoosePixelFormatARB
// Let's find a suitable pixel format -- first try with antialiasing
func BestwglChoosePixelFormatARB(procs *C.wglProcs, hdc C.HDC, bitsPerPixel uint, settings *ContextSettings) C.int {
if settings.AntialiasingLevel <= 0 {
return 0
}
if procs.p_wglChoosePixelFormatARB == nil {
return 0
}
AttribIList := [...]C.int{
C.WGL_DRAW_TO_WINDOW_ARB, C.GL_TRUE,
C.WGL_SUPPORT_OPENGL_ARB, C.GL_TRUE,
C.WGL_ACCELERATION_ARB, C.WGL_FULL_ACCELERATION_ARB,
C.WGL_DOUBLE_BUFFER_ARB, C.GL_TRUE,
C.WGL_SAMPLE_BUFFERS_ARB, C.GL_TRUE, // turn on antialiasing
C.WGL_SAMPLES_ARB, C.int(settings.AntialiasingLevel),
0, 0,
}
AttribFList := []C.FLOAT{0, 0}
// Let's check how many formats are supporting our requirements
const formats_size = 128
var formats [formats_size]C.int
var nbFormats C.UINT
for settings.AntialiasingLevel > 0 {
if C.__wglChoosePixelFormatARB(procs, hdc, &AttribIList[0], &AttribFList[0], formats_size, &formats[0], &nbFormats) == C.TRUE &&
nbFormats > 0 {
break
}
nbFormats = 0 // reset this
// Decrease the antialiasing level until we find a valid one
settings.AntialiasingLevel--
AttribIList[11]--
}
bestScore := uint(1<<32 - 1)
var bestFormat C.int
for i := C.UINT(0); bestScore != 0 && i < nbFormats; i++ {
// Get the current format's attributes
attributes := C.PIXELFORMATDESCRIPTOR{
nSize: C.PIXELFORMATDESCRIPTOR_size,
nVersion: 1,
}
if C.__DescribePixelFormat(hdc, formats[i], C.PIXELFORMATDESCRIPTOR_size, &attributes) == 0 {
return 0
}
// Evaluate the current configuration
color := uint(attributes.cRedBits + attributes.cGreenBits + attributes.cBlueBits + attributes.cAlphaBits)
score := EvaluateFormat(bitsPerPixel, *settings, color, uint(attributes.cDepthBits), uint(attributes.cStencilBits), settings.AntialiasingLevel)
// Keep it if it's better than the current best
if score < bestScore {
bestScore = score
bestFormat = formats[i]
}
}
return bestFormat
}
示例6: SendEvent
// For delivering programmatic events to this element.
// Returns true if the event was handled, false otherwise
func (e *Element) SendEvent(eventCode uint, source *Element, reason uint32) bool {
var handled C.BOOL = 0
if ret := C.HTMLayoutSendEvent(e.handle, C.UINT(eventCode), source.handle, C.UINT_PTR(reason), &handled); ret != HLDOM_OK {
domPanic(ret, "Failed to send event")
}
return handled != 0
}
示例7: getRect
func (e *Element) getRect(rectTypeFlags uint32) (left, top, right, bottom int) {
r := Rect{}
if ret := C.HTMLayoutGetElementLocation(e.handle, (C.LPRECT)(unsafe.Pointer(&r)), C.UINT(rectTypeFlags)); ret != HLDOM_OK {
domPanic(ret, "Failed to get element rect")
}
return int(r.Left), int(r.Top), int(r.Right), int(r.Bottom)
}
示例8: virtualKeyCodeToSF
func virtualKeyCodeToSF(vkey C.WPARAM, flags C.LPARAM) Key {
if key, ok := keyboard_vkeys_map[C.int(vkey)]; ok {
return key
}
switch vkey {
// Check the scancode to distinguish between left and right shift
case C.VK_SHIFT:
scancode := C.UINT((flags & (0xFF << 16)) >> 16)
if scancode == lShift {
return KeyLShift
}
return KeyRShift
// Check the "extended" flag to distinguish between left and right alt
case C.VK_MENU:
if C.__HIWORD(C.DWORD(flags))&C.KF_EXTENDED != 0 {
return KeyRAlt
}
return KeyLAlt
// Check the "extended" flag to distinguish between left and right control
case C.VK_CONTROL:
if C.__HIWORD(C.DWORD(flags))&C.KF_EXTENDED != 0 {
return KeyRControl
}
return KeyLControl
}
return KeyUnknown
}
示例9: AttrByIndex
func (e *Element) AttrByIndex(index int) (string, string) {
szValue := (*C.WCHAR)(nil)
szName := (*C.CHAR)(nil)
if ret := C.HTMLayoutGetNthAttribute(e.handle, C.UINT(index), (*C.LPCSTR)(&szName), (*C.LPCWSTR)(&szValue)); ret != HLDOM_OK {
domPanic(ret, fmt.Sprintf("Failed to get attribute by index: %u", index))
}
return C.GoString((*C.char)(szName)), utf16ToString((*uint16)(szValue))
}
示例10: LoadHtml
// Load html contents into window
func LoadHtml(hwnd uint32, data []byte, baseUrl string) error {
if len(data) > 0 {
if ok := C.HTMLayoutLoadHtmlEx(C.HWND(C.HANDLE(uintptr(hwnd))), (*C.BYTE)(&data[0]),
C.UINT(len(data)), (*C.WCHAR)(stringToUtf16Ptr(baseUrl))); ok == 0 {
return errors.New("HTMLayoutLoadHtmlEx failed")
}
}
return nil
}
示例11: ProcND
func ProcND(hwnd win.HWND, msg uint, wParam uintptr, lParam uintptr) (ret int, handled bool) {
var bHandled C.BOOL
// ret = uintptr(syssciterProcND(HWND(hwnd), msg, wParam, lParam, &bHandled))
ret = int(C.SciterProcND(C.HWINDOW(unsafe.Pointer(hwnd)), C.UINT(msg), C.WPARAM(wParam), C.LPARAM(lParam), &bHandled))
if bHandled == 0 {
handled = false
} else {
handled = true
}
return
}
示例12: SelectParentLimit
// Searches up the parent chain to find the first element that matches the given selector.
// Includes the element in the search. Depth indicates how far the search should progress.
// Depth = 1 means only consider this element. Depth = 0 means search all the way up to the
// root. Any other positive value of depth limits the length of the search.
func (e *Element) SelectParentLimit(selector string, depth int) *Element {
szSelector := C.CString(selector)
defer C.free(unsafe.Pointer(szSelector))
var parent C.HELEMENT
if ret := C.HTMLayoutSelectParent(e.handle, (*C.CHAR)(szSelector), C.UINT(depth), &parent); ret != HLDOM_OK {
domPanic(ret, "Failed to select parent dom elements, selector: '", selector, "'")
}
if parent != nil {
return NewElementFromHandle(HELEMENT(parent))
}
return nil
}
示例13: CreateWindow
// rect is the display area
func CreateWindow(createFlags WindowCreationFlag, rect *Rect, delegate uintptr, delegateParam uintptr, parent C.HWINDOW) C.HWINDOW {
// set default size
if rect == nil {
rect = DefaultRect
}
// create window
hwnd := C.SciterCreateWindow(
C.UINT(createFlags),
(*C.RECT)(unsafe.Pointer(rect)),
nil,
(C.LPVOID)(delegateParam),
parent)
// in case of NULL
if int(uintptr(unsafe.Pointer(hwnd))) == 0 {
return BAD_HWINDOW
}
return hwnd
}
示例14: Update
func (e *Element) Update(restyle, restyleDeep, remeasure, remeasureDeep, render bool) {
var flags uint32
if restyle {
if restyleDeep {
flags |= RESET_STYLE_DEEP
} else {
flags |= RESET_STYLE_THIS
}
}
if remeasure {
if remeasureDeep {
flags |= MEASURE_DEEP
} else {
flags |= MEASURE_INPLACE
}
}
if render {
flags |= REDRAW_NOW
}
if ret := C.HTMLayoutUpdateElementEx(e.handle, C.UINT(flags)); ret != HLDOM_OK {
domPanic(ret, "Failed to update element")
}
}
示例15: AppendChild
func (e *Element) AppendChild(child *Element) {
count := e.ChildCount()
if ret := C.HTMLayoutInsertElement(child.handle, e.handle, C.UINT(count)); ret != HLDOM_OK {
domPanic(ret, "Failed to append child element")
}
}