예제 #1
0
def fl_set_chart_lcolor(ptr_flobject, colr):
    """fl_set_chart_lcolor(ptr_flobject, colr)

    Changes the color of chart's label. By default, the label is drawn
    in black.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
            chart flobject
        colr : long_pos
            XForms colormap index as color

    Examples
    --------
        >>> fl_set_chart_lcolor(pchrtobj, xfdata.FL_FORESTGREEN)

    Notes
    -----
        Status: NA-UTest + Doc + NoDemo = Maybe

    """
    _fl_set_chart_lcolor = library.cfuncproto(
        library.load_so_libforms(), "fl_set_chart_lcolor",
        None, [cty.POINTER(xfdata.FL_OBJECT), xfdata.FL_COLOR],
        """void fl_set_chart_lcolor(FL_OBJECT * ob, FL_COLOR lcol)""")
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    #library.checknonfatal_allowed_value_in_list(colr, xfdata.COLOR_list)
    ul_colr = library.convert_to_FL_COLOR(colr)
    library.keep_elem_refs(ptr_flobject, colr, ul_colr)
    _fl_set_chart_lcolor(ptr_flobject, ul_colr)
예제 #2
0
def fl_set_input_color(ptr_flobject, txtcolr, curscolr):
    """fl_set_input_color(ptr_flobject, txtcolr, curscolr)

    Defines text and cursor colors to be used in input flobject.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
            input flobject
        txtcolr : long_pos
            XForms colormap index as color for text
        curscolr : long_pos
            XForms colormap index as color for cursor

    Examples
    --------
        >>> *todo*

    Notes
    -----
        Status: NA-UTest + Doc + NoDemo = Maybe

    """
    _fl_set_input_color = library.cfuncproto(
        library.load_so_libforms(),
        "fl_set_input_color",
        None,
        [cty.POINTER(xfdata.FL_OBJECT), xfdata.FL_COLOR, xfdata.FL_COLOR],
        """void fl_set_input_color(FL_OBJECT * ob, FL_COLOR textcol,
           FL_COLOR curscol)""",
    )
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    # library.checknonfatal_allowed_value_in_list(txtcolr, xfdata.COLOR_list)
    ul_txtcolr = library.convert_to_FL_COLOR(txtcolr)
    # library.checknonfatal_allowed_value_in_list(curscolr, xfdata.COLOR_list)
    ul_curscolr = library.convert_to_FL_COLOR(curscolr)
    library.keep_elem_refs(ptr_flobject, txtcolr, curscolr, ul_txtcolr, ul_curscolr)
    _fl_set_input_color(ptr_flobject, ul_txtcolr, ul_curscolr)
def fl_set_cursor_color(cursornum, fgcolr, bgcolr):
    """fl_set_cursor_color(cursornum, fgcolr, bgcolr)

    Defines foreground and background colors of a cursor.

    Parameters
    ----------
        cursornum : int
            cursor id
        fgcolr : long_pos
            foreground color to be set
        bgcolr : long_pos
            background color to be set

    Examples
    --------
        >>> fl_set_cursor_color(xfdata.FL_CROSSHAIR_CURSOR, xfdata.FL_WHITE,
                xfdata.FL_ORANGE)

    Notes
    -----
        Status: NA-UTest + Doc + Demo = OK

    """
    _fl_set_cursor_color = library.cfuncproto(
        library.load_so_libforms(), "fl_set_cursor_color",
        None, [cty.c_int, xfdata.FL_COLOR, xfdata.FL_COLOR],
        """void fl_set_cursor_color(int name, FL_COLOR fg, FL_COLOR bg)""")
    library.check_if_flinitialized()
    #library.checknonfatal_allowed_value_in_list(fgcolr, xfdata.COLOR_list)
    #library.checknonfatal_allowed_value_in_list(bgcolr, xfdata.COLOR_list)
    i_cursornum = library.convert_to_intc(cursornum)
    ul_fgcolr = library.convert_to_FL_COLOR(fgcolr)
    ul_bgcolr = library.convert_to_FL_COLOR(bgcolr)
    library.keep_elem_refs(cursornum, fgcolr, bgcolr, i_cursornum, \
            ul_fgcolr, ul_bgcolr)
    _fl_set_cursor_color(i_cursornum, ul_fgcolr, ul_bgcolr)
예제 #4
0
def fl_replace_chart_value(ptr_flobject, indx, itemval, label, colr):
    """fl_replace_chart_value(ptr_flobject, indx, itemval, label, colr)

    Replaces value of an item in the chart flobject.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
            chart flobject
        indx : int
            index position of item to be replaced. The first item is number 1
        itemval : float
            value of chart item
        label : str
            text label of chart
        colr : long_pos
            XForms colormap index as color

    Examples
    --------
        >>> fl_replace_chart_value(pchrtobj, 3, 142.0, "replaced item",
                xfdata.FL_FIREBRICK)

    Notes
    -----
        Status: NA-UTest + Doc + NoDemo = Maybe

    """
    _fl_replace_chart_value = library.cfuncproto(
        library.load_so_libforms(), "fl_replace_chart_value",
        None, [cty.POINTER(xfdata.FL_OBJECT), cty.c_int, cty.c_double,
        xfdata.STRING, xfdata.FL_COLOR],
        """void fl_replace_chart_value(FL_OBJECT * ob, int indx,
           double val, const char * str, FL_COLOR col)""")
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    i_indx = library.convert_to_intc(indx)
    f_itemval = library.convert_to_doublec(itemval)
    s_label = library.convert_to_bytestrc(label)
    ul_colr = library.convert_to_FL_COLOR(colr)
    library.keep_elem_refs(ptr_flobject, indx, itemval, label, colr, \
            i_indx, f_itemval, s_label, ul_colr)
    _fl_replace_chart_value(ptr_flobject, i_indx, f_itemval, s_label, \
            ul_colr)
예제 #5
0
def fl_insert_chart_value(ptr_flobject, indx, itemval, label, colr):
    """fl_insert_chart_value(ptr_flobject, indx, itemval, label, colr)

    Inserts a new value at a particular place in a chart flobject.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
            chart flobject
        indx : int
            index before which the new item should be inserted. The first
            item is number 1.
        itemval : float
            value of new chart item
        label : str
            text label of chart
        colr : long_pos
            XForms colormap index as color

    Examples
    --------
        >>> fl_insert_chart_value(pchrtobj, 2, 123.0, "new value",
                xfdata.FL_DEEPSKYBLUE)

    Notes
    -----
        Status: NA-UTest + Doc + Demo = OK

    """
    _fl_insert_chart_value = library.cfuncproto(
        library.load_so_libforms(), "fl_insert_chart_value",
        None, [cty.POINTER(xfdata.FL_OBJECT), cty.c_int, cty.c_double,
        xfdata.STRING, xfdata.FL_COLOR],
        """void fl_insert_chart_value(FL_OBJECT * ob, int indx,
           double val, const char * str, FL_COLOR col)""")
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    i_indx = library.convert_to_intc(indx)
    f_itemval = library.convert_to_doublec(itemval)
    s_label = library.convert_to_bytestrc(label)
    ul_colr = library.convert_to_FL_COLOR(colr)
    library.keep_elem_refs(ptr_flobject, indx, itemval, label, colr, \
            i_indx, f_itemval, s_label, ul_colr)
    _fl_insert_chart_value(ptr_flobject, i_indx, f_itemval, s_label, ul_colr)
예제 #6
0
def fl_set_nmenu_hl_text_color(ptr_flobject, colr):
    """fl_set_nmenu_hl_text_color(ptr_flobject, colr) -> oldcolr

    Defines the color of label when it is in "active" state (i.e. while the
    popup is shown). In "inactive" state this is set by fl_set_object_lcol().
    By default, this color is xfdata.FL_BLACK for nmenus that are shown as a
    button while being "active", while for normal nmenus it is the same color
    that is used items in the popup when the mouse is hovering over them.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
            nmenu flobject
        colr : long_pos
            color to be set

    Returns
    -------
        oldcolr : long_pos
            old color, or xfdata.FL_MAX_COLORS (on failure)

    Examples
    --------
        >>> *todo*

    Notes
    -----
        Status: NA-UTest + Doc + NoDemo = Maybe

    """
    _fl_set_nmenu_hl_text_color = library.cfuncproto(
        library.load_so_libforms(), "fl_set_nmenu_hl_text_color",
        xfdata.FL_COLOR, [cty.POINTER(xfdata.FL_OBJECT), xfdata.FL_COLOR],
        """FL_COLOR fl_set_nmenu_hl_text_color(FL_OBJECT * p1,
           FL_COLOR p2)""")
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    #library.checknonfatal_allowed_value_in_list(colr, xfdata.COLOR_list)
    ul_colr = library.convert_to_FL_COLOR(colr)
    library.keep_elem_refs(ptr_flobject, colr, ul_colr)
    retval = _fl_set_nmenu_hl_text_color(ptr_flobject, ul_colr)
    return retval
예제 #7
0
def fl_add_chart_value(ptr_flobject, itemval, label, colr):
    """fl_add_chart_value(ptr_flobject, itemval, label, colr)

    Adds an item to the chart flobject.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
            chart flobject
        itemval : float
            value of chart item
        label : str
            text label of chart
        colr : long_pos
            XForms colormap index as color

    Examples
    --------
        >>> fl_add_chart_value(pchrtobj, 120, "Some point", xfdata.FL_BLUE)

    Notes
    -----
        Status: NA-UTest + Doc + Demo = OK

    """
    _fl_add_chart_value = library.cfuncproto(
        library.load_so_libforms(), "fl_add_chart_value",
        None, [cty.POINTER(xfdata.FL_OBJECT), cty.c_double, xfdata.STRING,
        xfdata.FL_COLOR],
        """void fl_add_chart_value(FL_OBJECT * ob, double val,
           const char * str, FL_COLOR col)""")
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    f_itemval = library.convert_to_doublec(itemval)
    s_label = library.convert_to_bytestrc(label)
    ul_colr = library.convert_to_FL_COLOR(colr)
    library.keep_elem_refs(ptr_flobject, itemval, label, colr, f_itemval, \
            s_label, ul_colr)
    _fl_add_chart_value(ptr_flobject, f_itemval, s_label, ul_colr)
def fl_set_select_text_color(ptr_flobject, colr):
    """fl_set_select_text_color(ptr_flobject, colr) -> oldcolr

    Defines the color of the text of the currenty selected item on top
    of the select flobject.

    Parameters
    ----------
        ptr_flobject : pointer to xfdata.FL_OBJECT
            select flobject
        colr : long_pos
            XForms colormap index as new color

    Returns
    -------
        oldcolr : long_pos
            XForms colormap index as previous color

    Examples
    --------
        >>> oldcol = fl_set_select_text_color(pselobj, xfdata.FL_BLUE)

    Notes
    -----
        Status: NA-UTest + Doc + NoDemo = Maybe

    """
    _fl_set_select_text_color = library.cfuncproto(
        library.load_so_libforms(), "fl_set_select_text_color",
        xfdata.FL_COLOR, [cty.POINTER(xfdata.FL_OBJECT), xfdata.FL_COLOR],
        """FL_COLOR fl_set_select_text_color(FL_OBJECT * p1, FL_COLOR p2)""")
    library.check_if_flinitialized()
    library.verify_flobjectptr_type(ptr_flobject)
    #library.checknonfatal_allowed_value_in_list(colr, xfdata.COLOR_list)
    ul_colr = library.convert_to_FL_COLOR(colr)
    library.keep_elem_refs(ptr_flobject, colr, ul_colr)
    retval = _fl_set_select_text_color(ptr_flobject, ul_colr)
    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
예제 #10
0
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