コード例 #1
0
ファイル: element.go プロジェクト: ericroy/go-htmlayout
// 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")
	}
}
コード例 #2
0
ファイル: element.go プロジェクト: ericroy/go-htmlayout
// Replaces the whole set of state flags with the specified value
func (e *Element) SetStateFlags(flags uint32) {
	shouldUpdate := C.BOOL(1)
	if ret := C.HTMLayoutSetElementState(e.handle, C.UINT(flags), C.UINT(^flags), shouldUpdate); ret != HLDOM_OK {
		domPanic(ret, "Failed to set element state flags")
	}
}