def fl_set_cursor(win, cursornum): """fl_set_cursor(win, cursornum) Defines cursor for window to a specific cursor number. Parameters ---------- win : long_pos window cursornum : int cursor id (either the standard XC_* or Form-defined) Examples -------- >>> fl_set_cursor(win0, xfdata.FL_CROSSHAIR_CURSOR) Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_set_cursor = library.cfuncproto( library.load_so_libforms(), "fl_set_cursor", None, [xfdata.Window, cty.c_int], """void fl_set_cursor(Window win, int name)""") library.check_if_flinitialized() ul_win = library.convert_to_Window(win) i_cursornum = library.convert_to_intc(cursornum) library.keep_elem_refs(win, cursornum, ul_win, i_cursornum) _fl_set_cursor(ul_win, i_cursornum)
def fl_read_bitmapfile(win, fname): """fl_read_bitmapfile(win, fname) -> pixmapid, width, height, hotx, hoty Makes a bitmap from a bitmap (.xpm format) file. Parameters ---------- win : long_pos window id fname : str name of bitmap (.xbm format) file Returns ------- pixmapid : long_pos pixmap resource id width : int_pos width height : int_pos height hotx : int hotspot horizontal position hoty : int hotspot vertical position Examples -------- >>> pmap, w, h, hotx, hoty = fl_read_bitmapfile(win0, "xbmfile.xbm") API_diversion ---------- API changed from XForms, upstream is fl_read_bitmapfile(win, filename, width, height, hotx, hoty) Notes ----- Status: UnitTest + Doc + NoDemo = OK """ _fl_read_bitmapfile = library.cfuncproto( library.load_so_libforms(), "fl_read_bitmapfile", xfdata.Pixmap, [xfdata.Window, xfdata.STRING, cty.POINTER(cty.c_uint), cty.POINTER(cty.c_uint), cty.POINTER(cty.c_int), cty.POINTER(cty.c_int)], """Pixmap fl_read_bitmapfile(Window win, const char * file, unsigned int * w, unsigned int * h, int * hotx, int * hoty)""") library.check_if_flinitialized() ul_win = library.convert_to_Window(win) s_fname = library.convert_to_bytestrc(fname) i_width, ptr_width = library.make_uintc_and_pointer() i_height, ptr_height = library.make_uintc_and_pointer() i_hotx, ptr_hotx = library.make_intc_and_pointer() i_hoty, ptr_hoty = library.make_intc_and_pointer() library.keep_elem_refs(win, fname, i_width, i_height, i_hotx, i_hoty, \ ul_win, s_fname, ptr_width, ptr_height, ptr_hotx, ptr_hoty) retval = _fl_read_bitmapfile(ul_win, s_fname, ptr_width, ptr_height, \ ptr_hotx, ptr_hoty) return retval, i_width.value, i_height.value, i_hotx.value, i_hoty.value
def fl_create_from_bitmapdata(win, xbmdata, width, height): """fl_create_from_bitmapdata(win, xbmdata, width, height) -> pixmapid Makes a bitmap from bitmap contents data. Parameters ---------- win : long_pos window id xbmdata : str bitmap data used for contents width : int_pos width of bitmap in coord units height : int_pos height of bitmap in coord units Returns ------- pixmapid : long_pos created pixmap resource id Examples -------- >>> xbmdata = "\x10\x18\x1f\x20\x28x\x2f\x30\x38\x3f\x40\x48\x4f\x50" >>> pmap = fl_create_from_bitmapdata(win0, xbmdata, 20, 20) Notes ----- Status: UnitTest + Doc + NoDemo = OK """ _fl_create_from_bitmapdata = library.cfuncproto( library.load_so_libforms(), "fl_create_from_bitmapdata", xfdata.Pixmap, [xfdata.Window, xfdata.STRING, cty.c_int, cty.c_int], """Pixmap fl_create_from_bitmapdata(Window win, const char * data, int width, int height)""") library.check_if_flinitialized() ul_win = library.convert_to_Window(win) s_xbmdata = library.convert_to_bytestrc(xbmdata) i_width = library.convert_to_intc(width) i_height = library.convert_to_intc(height) library.keep_elem_refs(win, xbmdata, width, height, ul_win, \ s_xbmdata, i_width, i_height) retval = _fl_create_from_bitmapdata(ul_win, s_xbmdata, i_width, \ i_height) return retval
def fl_create_from_pixmapdata(win, xpmdata, tran): """fl_create_from_pixmapdata(win, xpmdata, tran) -> pixmapid, width, height, smask, hotx, hoty Makes a pixmap from pixmap contents data. Parameters ---------- win : long_pos window id xpmdata : str of ubytes pixmap contents data tran : long_pos XForms colormap index as color (currently not used) Returns ------- pixmapid : long_pos created pixmap resource id width : int_pos width of pixmap in coord units height : int_pos height of pixmap in coord units smask : long_pos shape mask (of an existing pixmap) used as a clipping mask to achieve transparency, 0 for no transparency. hotx : int horizontal position of center of the pixmap (useful if the pixmap is to be used as a cursor) hoty : int vertical position of center of the pixmap (useful if the pixmap is to be used as a cursor) Examples -------- >>> *todo* API_diversion ------------- API changed from XForms, upstream is fl_create_from_pixmapdata(win, xpmdata, width, height, smask, hotx, hoty, tran) Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_create_from_pixmapdata = library.cfuncproto( library.load_so_libforms(), "fl_create_from_pixmapdata", xfdata.Pixmap, [xfdata.Window, cty.POINTER(xfdata.STRING), cty.POINTER(cty.c_uint), cty.POINTER(cty.c_uint), cty.POINTER(xfdata.Pixmap), cty.POINTER(cty.c_int), cty.POINTER(cty.c_int), xfdata.FL_COLOR], """Pixmap fl_create_from_pixmapdata(Window win, char * * data, unsigned int * w, unsigned int * h, Pixmap * sm, int * hotx, int * hoty, FL_COLOR tran)""") library.check_if_flinitialized() ul_win = library.convert_to_Window(win) ptr_xpmdata = library.convert_to_ptr_stringc(xpmdata) ui_width, ptr_width = library.make_uintc_and_pointer() ui_height, ptr_height = library.make_uintc_and_pointer() ul_smask, ptr_smask = library.make_ulongc_and_pointer() i_hotx, ptr_hotx = library.make_intc_and_pointer() i_hoty, ptr_hoty = library.make_intc_and_pointer() #library.checknonfatal_allowed_value_in_list(tran, xfdata.COLOR_list) ul_tran = library.convert_to_FL_COLOR(tran) library.keep_elem_refs(win, xpmdata, ui_width, ptr_width, ui_height, \ ptr_height, ul_smask, i_hotx, i_hoty, tran, ptr_xpmdata, ul_win, \ ptr_smask, ptr_hotx, ptr_hoty, ul_tran) retval = _fl_create_from_pixmapdata(ul_win, ptr_xpmdata, ptr_width, \ ptr_height, ptr_smask, ptr_hotx, ptr_hoty, ul_tran) return retval, ui_width.value, ui_height.value, ul_smask.value, \ i_hotx.value, i_hoty.value
def fl_read_pixmapfile(win, fname, tran): """fl_read_pixmapfile(win, fname, tran) -> pixmapid, width, height, smask, hotx, hoty Makes a pixmap from a pixmap (.xpm format) file. Parameters ---------- win : long_pos window id fname : str name of pixmap (.xpm format) file tran : long_pos XForms colormap index as color Returns ------- pixmap : long_pos pixmap resource id width : int_pos width height : int_pos height smask : long_pos shapemask hotx : int hotspot horizontal position hoty : int hotspot vertical position Examples -------- >>> pmap, w, h, shapmsk, hotx, hoty = fl_read_pixmapfile(win0, "xpmfile.xpm", xfdata.FL_WHITE) API_diversion ---------- API changed from XForms, upstream is fl_read_pixmapfile(win, filename, width, height, shape_mask, hotx, hoty, tran) Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_read_pixmapfile = library.cfuncproto( library.load_so_libforms(), "fl_read_pixmapfile", xfdata.Pixmap, [xfdata.Window, xfdata.STRING, cty.POINTER(cty.c_uint), cty.POINTER(cty.c_uint), cty.POINTER(xfdata.Pixmap), cty.POINTER(cty.c_int), cty.POINTER(cty.c_int), xfdata.FL_COLOR], """Pixmap fl_read_pixmapfile(Window win, const char * file, unsigned int * w, unsigned int * h, Pixmap * shape_mask, int * hotx, int * hoty, FL_COLOR tran)""") library.check_if_flinitialized() ul_win = library.convert_to_Window(win) s_fname = library.convert_to_bytestrc(fname) #library.checknonfatal_allowed_value_in_list(tran, xfdata.COLOR_list) ul_tran = library.convert_to_FL_COLOR(tran) ui_width, ptr_width = library.make_uintc_and_pointer() ui_height, ptr_height = library.make_uintc_and_pointer() ul_shapemask, ptr_shapemask = library.make_ulongc_and_pointer() i_hotx, ptr_hotx = library.make_intc_and_pointer() i_hoty, ptr_hoty = library.make_intc_and_pointer() library.keep_elem_refs(win, fname, ui_width, ui_height, ul_shapemask, \ i_hotx, i_hoty, tran, ul_win, s_fname, ul_tran, ptr_width, \ ptr_height, ptr_shapemask, ptr_hotx, ptr_hoty) retval = _fl_read_pixmapfile(ul_win, s_fname, ptr_width, ptr_height, \ ptr_shapemask, ptr_hotx, ptr_hoty, ul_tran) return retval, ui_width.value, ui_height.value, ul_shapemask.value, \ i_hotx.value, i_hoty.value