Example #1
0
// 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")
	}
}
Example #2
0
// 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")
	}
}