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_get_button_mouse_buttons(ptr_flobject): """fl_get_button_mouse_buttons(ptr_flobject) -> buttons Finds out a value indicating which mouse buttons the button flobject will react to (bitwise OR of the numbers 1 for the left mouse button, 2 for the middle, 4 for the right mouse button, 8 for moving the scroll wheel up "button" and 16 for scrolling down "button"). Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT button flobject Returns ------- buttons : int_pos buttons value Examples -------- >>> moubtn = fl_get_button_mouse_buttons(pbtnobj) API_diversion ---------- API changed from XForms, upstream is fl_get_button_mouse_buttons(ptr_flobject, buttons) Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_get_button_mouse_buttons = library.cfuncproto( library.load_so_libforms(), "fl_get_button_mouse_buttons", None, [cty.POINTER(xfdata.FL_OBJECT), cty.POINTER(cty.c_uint)], """void fl_get_button_mouse_buttons(FL_OBJECT * ob, unsigned int * buttons)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) ui_buttons, ptr_buttons = library.make_uintc_and_pointer() library.keep_elem_refs(ptr_flobject, ui_buttons, ptr_buttons) _fl_get_button_mouse_buttons(ptr_flobject, ptr_buttons) return ui_buttons.value
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