#!/usr/bin/env python3
# -*- coding: utf-8 -*-

""" xforms-python's functions to manage goodies flobjects.
"""

#    Copyright (C) 2009-2012  Luca Lazzaroni "LukenShiro"
#    e-mail: <lukenshiro@ngi.it>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Lesser General Public License as
#    published by the Free Software Foundation, version 2.1 of the License,
#    or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#    GNU Lesser General Public License for more details.
#
#    You should have received a copy of the GNU LGPL along with this
#    program. If not, see <http://www.gnu.org/licenses/>.
#
#    See CREDITS file to read acknowledgements and thanks to XForms,
#    ctypes and other developers.

# originally generated by 'h2xml+gccxml' and 'xml2py'
# then heavily reordered and reworked

# ########################################### #
# Interface to XForms shared-object libraries #
# ########################################### #


import ctypes as cty
from xformslib import library
from xformslib import xfdata
from xformslib import flbasic


######################
# forms.h (goodies.h)
######################

# Resources and misc. goodie routines

def fl_set_goodies_font(style, size):
    """fl_set_goodies_font(style, size)

    Changes the font used in all messages.

    Parameters
    ----------
        style : int
            goodies style. Values (from xfdata.py) FL_NORMAL_STYLE (Helvetica
            normal text), FL_BOLD_STYLE (Helvetica boldface text),
            FL_ITALIC_STYLE (Helvetica italic text), FL_BOLDITALIC_STYLE
            (Helvetica boldface and italic text), FL_FIXED_STYLE (Courier
            fixed width, good for tables), FL_FIXEDBOLD_STYLE (Courier bold
            fixed text), FL_FIXEDITALIC_STYLE (Courier italic fixed text),
            FL_FIXEDBOLDITALIC_STYLE (Courier boldface and italic fixed text),
            FL_TIMES_STYLE (Times-Roman like normal font), FL_TIMESBOLD_STYLE
            (Times-Roman like boldface text), FL_TIMESITALIC_STYLE (Times-Roman
            like italic text), FL_TIMESBOLDITALIC_STYLE (Times-Roman like
            boldface and italic text), FL_MISC_STYLE (Charter normal text),
            FL_MISCBOLD_STYLE (Charter boldface text), FL_MISCITALIC_STYLE
            (Charter italic text), FL_SYMBOL_STYLE (Symbol text),
            FL_SHADOW_STYLE (Text casting a shadow, modifier mask),
            FL_ENGRAVED_STYLE (Text engraved into the form, modifier mask),
            FL_EMBOSSED_STYLE (Text standing out, modifier mask). Bitwise OR
            with any of modifiers is allowed.
        size : int
            goodies size. Values (from xfdata.py) FL_TINY_SIZE (8 points font),
            FL_SMALL_SIZE or FL_DEFAULT_SIZE (10 points font, default),
            FL_NORMAL_SIZE (12 points font), FL_MEDIUM_SIZE (14 points font),
            FL_LARGE_SIZE (18 points font), FL_HUGE_SIZE (24 points font), or
            other numeric odd or even value

    Examples
    --------
        >>> fl_set_goodies_font(xfdata.FL_BOLD_STYLE, xfdata.FL_MEDIUM_SIZE)

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

    """
    _fl_set_goodies_font = library.cfuncproto(
        library.load_so_libforms(), "fl_set_goodies_font",
        None, [cty.c_int, cty.c_int],
        """void fl_set_goodies_font(int style, int size)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(style, xfdata.TEXTSTYLE_list)
    i_style = library.convert_to_intc(style)
    i_size = library.convert_to_intc(size)
    library.keep_elem_refs(style, size, i_style, i_size)
    _fl_set_goodies_font(i_style, i_size)


# messages and questions

def fl_show_message(msgtxt1, msgtxt2, msgtxt3):
    """fl_show_message(msgtxt1, msgtxt2, msgtxt3)

    Shows a simple form with three lines of text and a button labeled OK on
    it. The mouse pointer is on the button.

    Parameters
    ----------
        msgtxt1 : str
            first message to show
        msgtxt2 : str
            second message to show
        msgtxt3 : str
            third message to show

    Examples
    --------
        >>> fl_show_message("first message", "second message",
                "third message")

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

    """
    _fl_show_message = library.cfuncproto(
        library.load_so_libforms(), "fl_show_message",
        None, [xfdata.STRING, xfdata.STRING, xfdata.STRING],
        """void fl_show_message(const char * p1, const char * p2,
           const char * p3)""")
    library.check_if_flinitialized()
    s_msgtxt1 = library.convert_to_bytestrc(msgtxt1)
    s_msgtxt2 = library.convert_to_bytestrc(msgtxt2)
    s_msgtxt3 = library.convert_to_bytestrc(msgtxt3)
    library.keep_elem_refs(msgtxt1, msgtxt2, msgtxt3, s_msgtxt1, \
            s_msgtxt2, s_msgtxt3)
    _fl_show_message(s_msgtxt1, s_msgtxt2, s_msgtxt3)


def fl_show_messages(msgtxt):
    """fl_show_messages(msgtxt)

    Shows a message. You can use it with a single line or when you know the
    message in advance. To get multi-line messages use embedded newlines. It
    blocks execution and does not return immediately (but idle callback and
    asynchronous IO continue being run and checked). Execution continues when
    the OK button is pressed or <Return> is hit or when the message form is
    removed from the screen by fl_hide_message().

    Parameters
    ----------
        msgtxt : str
            message to show

    Examples
    --------
        >>> fl_show_messages("Some messages")

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

    """
    _fl_show_messages = library.cfuncproto(
        library.load_so_libforms(), "fl_show_messages",
        None, [xfdata.STRING],
        """void fl_show_messages(const char * p1)""")
    library.check_if_flinitialized()
    s_msgtxt = library.convert_to_bytestrc(msgtxt)
    library.keep_elem_refs(msgtxt, s_msgtxt)
    _fl_show_messages(s_msgtxt)


def fl_show_msg(fmttxt):
    """fl_show_msg(fmttxt)

    Shows a formatted text message. The string resulting from expansion
    of the format string using the remaining arguments can have arbitrary
    length and embedded newline characters, producing line breaks. The size
    of the message box gets set in a way that the whole text fits into it.
    It blocks execution and does not return immediately (but idle callback
    and asynchronous IO continue being run and checked). Execution continues
    when the OK button is pressed or <Return> is hit or when the message
    form is removed from the screen by fl_hide_message().

    Parameters
    ----------
        fmttxt : str
            the message to show. You can use format parameters (e.g. %s,
            %d, %i, %f, %c, %e, %E, %x, %X, %o, %g, %G, %u, %%), too.

    Examples
    --------
        >>> fl_show_msg("formatted text %s %d" % (mystr, myval))

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

    """
    _fl_show_msg = library.cfuncproto(
        library.load_so_libforms(), "fl_show_msg",
        None, [xfdata.STRING],
        """void fl_show_msg(const char * p1)""")
    library.check_if_flinitialized()
    s_fmttxt = library.convert_to_bytestrc(fmttxt)
    library.keep_elem_refs(fmttxt, s_fmttxt)
    _fl_show_msg(s_fmttxt)


def fl_hide_message():
    """fl_hide_message()

    Hides an already shown text message.

    Examples
    --------
        >>> fl_hide_message()

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

    """
    _fl_hide_message = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_message",
        None, [],
        """void fl_hide_message()""")
    library.check_if_flinitialized()
    _fl_hide_message()


fl_hide_msg = fl_hide_message
fl_hide_messages = fl_hide_message


def fl_show_question(questmsg, defbtn):
    """fl_show_question(questmsg, defbtn) -> pushedbtn

    Shows a message (with possible embedded newlines in it) with a Yes and a
    No button. It returns whether the user pushed the Yes button. The user
    can also press the <Y> key to mean Yes and the <N> key to mean No.

    Parameters
    ----------
        questmsg : str
            text of question message to show
        defbtn : int
            which button the mouse pointer should be on. Values 1 (for Yes) or
            0 (for No) and any other value causes the form to be shown so the
            mouse pointer is at the center of the form.

    Returns
    -------
        pushedbtn : int
            1 (if Yes button pushed), or 0 otherwise

    Examples
    --------
        >>> qresp = fl_show_question("My question?", 1)

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

    """
    _fl_show_question = library.cfuncproto(
        library.load_so_libforms(), "fl_show_question",
        cty.c_int, [xfdata.STRING, cty.c_int],
        """int fl_show_question(const char * p1, int p2)""")
    library.check_if_flinitialized()
    s_questmsg = library.convert_to_bytestrc(questmsg)
    i_defbtn = library.convert_to_intc(defbtn)
    library.keep_elem_refs(questmsg, defbtn, s_questmsg, i_defbtn)
    retval = _fl_show_question(s_questmsg, i_defbtn)
    return retval


def fl_hide_question():
    """fl_hide_question()

    Hides an already shown question message.

    Examples
    --------
        >>> fl_hide_question()

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

    """
    _fl_hide_question = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_question",
        None, [],
        """void fl_hide_question()""")
    library.check_if_flinitialized()
    _fl_hide_question()


def fl_show_alert(title, msgtxt1, msgtxt2, centered):
    """fl_show_alert(title, msgtxt1, msgtxt2, centered)

    Shows an alert message, with an added alert icon (!). The first string
    is shown bold-faced.

    Parameters
    ----------
        title : str
            title of alert
        msgtxt1 : str
            first message text
        msgtxt2 : str
            other message text
        centered : int
            if alert has to be displayed centered on the screen or not. Values
            1 (if centered) or 0 (not centered)

    Examples
    --------
        >>> fl_show_alert("My title", "first text", "second text", 1)

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

    """
    _fl_show_alert = library.cfuncproto(
        library.load_so_libforms(), "fl_show_alert",
        None, [xfdata.STRING, xfdata.STRING, xfdata.STRING, cty.c_int],
        """void fl_show_alert(const char * p1, const char * p2,
           const char * p3, int p4)""")
    library.check_if_flinitialized()
    s_title = library.convert_to_bytestrc(title)
    s_msgtxt1 = library.convert_to_bytestrc(msgtxt1)
    s_msgtxt2 = library.convert_to_bytestrc(msgtxt2)
    i_centered = library.convert_to_intc(centered)
    library.keep_elem_refs(title, msgtxt1, msgtxt2, centered, s_title, \
            s_msgtxt1, s_msgtxt2, i_centered)
    _fl_show_alert(s_title, s_msgtxt1, s_msgtxt2, i_centered)


def fl_show_alert2(centered, fmttxt):
    """fl_show_alert2(centered, fmttxt)

    Shows a formatted alert message. The string resulting from expansion
    of the format string using the rest of the arguments can have arbitrary
    length and the first embedded form-feed character (backslash-f) is used
    as the separator between the title string and the message of the alert
    box. Embedded newline characters produce lines break.

    Parameters
    ----------
        centered : int
            if alert has to be displayed centered on the screen or not.
            Values 1 (if centered) or 0 (not centered)
        fmttxt : str
            formatted message text (with format parameters, e.g. %s, %d,
            %i, %f, %c, %e, %E, %x, %X, %o, %g, %G, %u, %%)

    Examples
    --------
        >>> fl_show_alert2(1, "formatted text %s %d" % (mystr, myval))

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

    """
    _fl_show_alert2 = library.cfuncproto(
        library.load_so_libforms(), "fl_show_alert2",
        None, [cty.c_int, xfdata.STRING],
        """void fl_show_alert2(int c, const char * fmt)""")
    library.check_if_flinitialized()
    i_centered = library.convert_to_intc(centered)
    s_fmttxt = library.convert_to_bytestrc(fmttxt)
    library.keep_elem_refs(centered, fmttxt, i_centered, s_fmttxt)
    _fl_show_alert2(i_centered, s_fmttxt)


def fl_hide_alert():
    """fl_hide_alert()

    Hides a previously shown alert message.

    Examples
    --------
        >>> fl_hide_alert()

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

    """
    _fl_hide_alert = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_alert",
        None, [],
        """void fl_hide_alert()""")
    library.check_if_flinitialized()
    _fl_hide_alert()


def fl_show_input(msgtxt, defstr):
    """fl_show_input(msgtxt, defstr) -> text

    Finds out some text from user, showing a default text. It has an OK and
    a Cancel buttons.

    Parameters
    ----------
        msgtxt : str
            text used to ask for input
        defstr : str
            default user answer to show

    Returns
    -------
        text : str
            text inserted by user

    Examples
    --------
        >>> inpstr = fl_show_input("Insert number of eggs: ", "Zero")

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

    """
    _fl_show_input = library.cfuncproto(
        library.load_so_libforms(), "fl_show_input",
        xfdata.STRING, [xfdata.STRING, xfdata.STRING],
        """const char * fl_show_input(const char * p1, const char * p2)""")
    library.check_if_flinitialized()
    s_msgtxt = library.convert_to_bytestrc(msgtxt)
    s_defstr = library.convert_to_bytestrc(defstr)
    library.keep_elem_refs(msgtxt, defstr, s_msgtxt, s_defstr)
    retval = _fl_show_input(s_msgtxt, s_defstr)
    if isinstance(retval, bytes):
        return retval.decode('utf-8')
    else:       # str
        return retval


def fl_hide_input():
    """fl_hide_input()

    Hides a previously shown input goodie.

    Examples
    --------
        >>> fl_hide_input()

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

    """
    _fl_hide_input = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_input",
        None, [],
        """void fl_hide_input()""")
    library.check_if_flinitialized()
    _fl_hide_input()


def fl_show_simple_input(msgtxt, defstr):
    """fl_show_simple_input(msgtxt, defstr) -> text

    Asks the user for textual input. It has an OK button only.

    Parameters
    ----------
        msgtxt : str
            message used to ask for input
        defstr : str
            default user answer in input

    Returns
    -------
        text : str
            text inserted by user

    Examples
    --------
        >>> inpstr = fl_show_simple_input("Insert name and surname:",
                "John Doe")

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

    """
    _fl_show_simple_input = library.cfuncproto(
        library.load_so_libforms(), "fl_show_simple_input",
        xfdata.STRING, [xfdata.STRING, xfdata.STRING],
        """const char * fl_show_simple_input(const char * p1,
           const char * p2)""")
    library.check_if_flinitialized()
    s_msgtxt = library.convert_to_bytestrc(msgtxt)
    s_defstr = library.convert_to_bytestrc(defstr)
    library.keep_elem_refs(msgtxt, defstr, s_msgtxt, s_defstr)
    retval = _fl_show_simple_input(s_msgtxt, s_defstr)
    if isinstance(retval, bytes):
        return retval.decode('utf-8')
    else:       # str
        return retval


def fl_show_colormap(oldcolr):
    """fl_show_colormap(oldcolr) -> colr

    Shows a colormap color selector from which the user can select a color. The
    user can decide not to change this color by pressing the Cancel button in
    the form. In a number of applications the user has to select a color from
    the colormap. For this a goody has been created. It shows the first 64
    entries of the colormap. The user can scroll through the colormap to see
    more entries. Once the user presses the mouse one of the entries the
    corresponding index is returned and the colormap is removed from screen.

    Parameters
    ----------
        oldcolr : int
            XForms colormap index as current default color

    Returns
    -------
        colr : int
            XForms colormap index as selected color, or default one (if cancel
            pressed)

    Examples
    --------
        >>> idxcolr = fl_show_colormap(xfdata.FL_YELLOWGREEN)

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

    """
    _fl_show_colormap = library.cfuncproto(
        library.load_so_libforms(), "fl_show_colormap",
        cty.c_int, [cty.c_int],
        """int fl_show_colormap(int p1)""")
    library.check_if_flinitialized()
    i_oldcolr = library.convert_to_intc(oldcolr)
    library.keep_elem_refs(oldcolr, i_oldcolr)
    retval = _fl_show_colormap(i_oldcolr)
    return retval


# choices

def fl_show_choices(msgtxt, numbtns, btn1txt, btn2txt, btn3txt, defcho):
    """fl_show_choices(msgtxt, numbtns, btn1txt, btn2txt, btn3txt, defcho)
    -> btnnum

    Shows a message, as a single string with possible embedded newlines, with
    one, two or three buttons. The user can also press the <1>, <2> or <3> key
    to indicate the first, second or third button.

    Parameters
    ----------
        msgtxt : str
            message text
        numbtns : int
            number of buttons
        btn1txt : str
            label of first button from the left
        btn2txt : str
            label of second button from the left
        btn3txt : str
            label of first button from the right
        defcho : int
            default choice (1, 2 or 3)

    Returns
    -------
        btnnum : int
            number of the button pressed (1, 2 or 3)

    Examples
    --------
        >>> pressbtn = fl_show_choices("some message", 3, "1st", "2nd",
                "3rd", 1)

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

    """
    _fl_show_choices = library.cfuncproto(
        library.load_so_libforms(), "fl_show_choices",
        cty.c_int, [xfdata.STRING, cty.c_int, xfdata.STRING, xfdata.STRING,
        xfdata.STRING, cty.c_int],
        """int fl_show_choices(const char * p1, int p2,
           const char * p3, const char * p4, const char * p5, int p6)""")
    library.check_if_flinitialized()
    s_msgtxt = library.convert_to_bytestrc(msgtxt)
    i_numbtns = library.convert_to_intc(numbtns)
    s_btn1txt = library.convert_to_bytestrc(btn1txt)
    s_btn2txt = library.convert_to_bytestrc(btn2txt)
    s_btn3txt = library.convert_to_bytestrc(btn3txt)
    i_defcho = library.convert_to_intc(defcho)
    library.keep_elem_refs(msgtxt, numbtns, btn1txt, btn2txt, btn3txt, \
            defcho, s_msgtxt, i_numbtns, s_btn1txt, s_btn2txt, s_btn3txt, \
            i_defcho)
    retval = _fl_show_choices(s_msgtxt, i_numbtns, s_btn1txt, s_btn2txt, \
            s_btn3txt, i_defcho)
    return retval


def fl_show_choice(msg1txt, msg2txt, msg3txt, numbtns, btn1txt, btn2txt,
        btn3txt, defcho):
    """fl_show_choice(msg1txt, msg2txt, msg3txt, numbtns, btn1txt, btn2txt,
    btn3txt, defcho) -> btnnum

    Shows a message, up to three lines, with one, two or three buttons. The
    user can also press the <1>, <2> or <3> key to indicate the first, second
    or third button.

    Parameters
    ----------
        msg1txt : str
            first message text
        msg2txt : str
            second message text
        msg3txt : str
            third message text
        numbtns : int
            number of buttons
        btn1txt : str
            label of first button from the left
        btn2txt : str
            label of second button from the left
        btn3txt : str
            label of first button from the right
        defcho : int
            default choice (1, 2 or 3)

    Returns
    -------
        btnnum : int
            number of the button pressed (1, 2 or 3)

    Examples
    --------
        >>> pressbtn = fl_show_choices("some message", "some other",
                "the end", 3, "1st", "2nd", "3rd", 1)

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

    """
    _fl_show_choice = library.cfuncproto(
        library.load_so_libforms(), "fl_show_choice",
        cty.c_int, [xfdata.STRING, xfdata.STRING, xfdata.STRING, cty.c_int,
        xfdata.STRING, xfdata.STRING, xfdata.STRING, cty.c_int],
        """int fl_show_choice(const char * p1, const char * p2,
           const char * p3, int p4, const char * p5, const char * p6,
           const char * p7, int p8)""")
    library.check_if_flinitialized()
    s_msg1txt = library.convert_to_bytestrc(msg1txt)
    s_msg2txt = library.convert_to_bytestrc(msg2txt)
    s_msg3txt = library.convert_to_bytestrc(msg3txt)
    i_numbtns = library.convert_to_intc(numbtns)
    s_btn1txt = library.convert_to_bytestrc(btn1txt)
    s_btn2txt = library.convert_to_bytestrc(btn2txt)
    s_btn3txt = library.convert_to_bytestrc(btn3txt)
    i_defcho = library.convert_to_intc(defcho)
    library.keep_elem_refs(msg1txt, msg2txt, msg3txt, numbtns, btn1txt, \
            btn2txt, btn3txt, defcho, s_msg1txt, s_msg2txt, s_msg3txt, \
            i_numbtns, s_btn1txt, s_btn2txt, s_btn3txt, i_defcho)
    retval = _fl_show_choice(s_msg1txt, s_msg2txt, s_msg3txt, i_numbtns, \
            s_btn1txt, s_btn2txt, s_btn3txt, i_defcho)
    return retval


def fl_hide_choice():
    """fl_hide_choice()

    Hides the choice message.

    Examples
    --------
        >>> fl_hide_choice()

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

    """
    _fl_hide_choice = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_choice",
        None, [],
        """void fl_hide_choice()""")
    library.check_if_flinitialized()
    _fl_hide_choice()


def fl_set_choices_shortcut(sctext1, sctext2, sctext3):
    """fl_set_choices_shortcut(sctext1, sctext2, sctext3)

    Defines more mnemonic hotkeys as shortcut text for choices.

    Parameters
    ----------
        sctext1 : str
            shortcut to bind to first button
        sctext2 : str
            shortcut to bind to second button
        sctext3 : str
            shortcut to bind to third button

    Examples
    --------
        >>> fl_set_choices_shortcut("a", "B", "^C")

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

    """
    _fl_set_choices_shortcut = library.cfuncproto(
        library.load_so_libforms(), "fl_set_choices_shortcut",
        None, [xfdata.STRING, xfdata.STRING, xfdata.STRING],
        """void fl_set_choices_shortcut(const char * p1, const char * p2,
           const char * p3)""")
    library.check_if_flinitialized()
    s_sctext1 = library.convert_to_bytestrc(sctext1)
    s_sctext2 = library.convert_to_bytestrc(sctext2)
    s_sctext3 = library.convert_to_bytestrc(sctext3)
    library.keep_elem_refs(sctext1, sctext2, sctext3, s_sctext1, s_sctext2, \
            s_sctext3)
    _fl_set_choices_shortcut(s_sctext1, s_sctext2, s_sctext3)


fl_set_choice_shortcut = fl_set_choices_shortcut


# one liner

def fl_show_oneliner(text, xpos, ypos):
    """fl_show_oneliner(text, xpos, ypos)

    Shows a one-line message that can only be removed programmatically.
    Multi-line message is possible by embedding the newline character in text.

    Parameters
    ----------
        text : str
            oneliner message text
        xpos : int
            horizontal position (relative to root window)
        ypos : int
            vertical position (relative to root window)

    Examples
    --------
        >>> fl_show_oneliner("Button to close window", 134, 155)

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

    """
    _fl_show_oneliner = library.cfuncproto(
        library.load_so_libforms(), "fl_show_oneliner",
        None, [xfdata.STRING, xfdata.FL_Coord, xfdata.FL_Coord],
        """void fl_show_oneliner(const char * p1, FL_Coord p2,
           FL_Coord p3)""")
    library.check_if_flinitialized()
    s_text = library.convert_to_bytestrc(text)
    i_xpos = library.convert_to_FL_Coord(xpos)
    i_ypos = library.convert_to_FL_Coord(ypos)
    library.keep_elem_refs(text, s_text, xpos, i_xpos, ypos, i_ypos)
    _fl_show_oneliner(s_text, i_xpos, i_ypos)


def fl_hide_oneliner():
    """fl_hide_oneliner()

    Hides the oneliner message previously shown.

    Examples
    --------
        >>> fl_hide_oneliner()

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

    """
    _fl_hide_oneliner = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_oneliner",
        None, [],
        """void fl_hide_oneliner()""")
    library.check_if_flinitialized()
    _fl_hide_oneliner()


def fl_set_oneliner_font(style, size):
    """fl_set_oneliner_font(style, size)

    Defines font style and size to use in a oneliner message.

    Parameters
    ----------
        style : int
            label style. Values (from xfdata.py) FL_NORMAL_STYLE (Helvetica
            normal text), FL_BOLD_STYLE (Helvetica boldface text),
            FL_ITALIC_STYLE (Helvetica italic text), FL_BOLDITALIC_STYLE
            (Helvetica boldface and italic text), FL_FIXED_STYLE (Courier
            fixed width, good for tables), FL_FIXEDBOLD_STYLE (Courier bold
            fixed text), FL_FIXEDITALIC_STYLE (Courier italic fixed text),
            FL_FIXEDBOLDITALIC_STYLE (Courier boldface and italic fixed text),
            FL_TIMES_STYLE (Times-Roman like normal font), FL_TIMESBOLD_STYLE
            (Times-Roman like boldface text), FL_TIMESITALIC_STYLE (Times-Roman
            like italic text), FL_TIMESBOLDITALIC_STYLE (Times-Roman like
            boldface and italic text), FL_MISC_STYLE (Charter normal text),
            FL_MISCBOLD_STYLE (Charter boldface text), FL_MISCITALIC_STYLE
            (Charter italic text), FL_SYMBOL_STYLE (Symbol text),
            FL_SHADOW_STYLE (Text casting a shadow, modifier mask),
            FL_ENGRAVED_STYLE (Text engraved into the form, modifier mask),
            FL_EMBOSSED_STYLE (Text standing out, modifier mask). Bitwise OR
            with any of modifiers is allowed.
        size : int
            label size. Values (from xfdata.py) FL_TINY_SIZE (8 points font),
            FL_SMALL_SIZE or FL_DEFAULT_SIZE (10 points font, default),
            FL_NORMAL_SIZE (12 points font), FL_MEDIUM_SIZE (14 points font),
            FL_LARGE_SIZE (18 points font), FL_HUGE_SIZE (24 points font), or
            other numeric odd or even value

    Examples
    --------
        >>> fl_set_oneliner_font(xfdata.FL_BOLD_STYLE, xfdata.FL_NORMAL_SIZE)

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

    """
    _fl_set_oneliner_font = library.cfuncproto(
        library.load_so_libforms(), "fl_set_oneliner_font",
        None, [cty.c_int, cty.c_int],
        """void fl_set_oneliner_font(int p1, int p2)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(style, xfdata.TEXTSTYLE_list)
    i_style = library.convert_to_intc(style)
    i_size = library.convert_to_intc(size)
    library.keep_elem_refs(style, size, i_style, i_size)
    _fl_set_oneliner_font(i_style, i_size)


def fl_set_oneliner_color(fgcolr, bgcolr):
    """fl_set_oneliner_color(fgcolr, bgcolr)

    Defines color to use with oneliner message. By default, the background
    of the message is yellow and the text black.

    Parameters
    ----------
        fgcolr : long_pos
            XForms colormap index as color for oneliner foreground
        bgcolr : long_pos
            XForms colormap index as color for oneliner background

    Examples
    --------
        >>> fl_set_oneliner_color(xfdata.FL_RED, xfdata.FL_YELLOW)

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

    """
    _fl_set_oneliner_color = library.cfuncproto(
        library.load_so_libforms(), "fl_set_oneliner_color",
        None, [xfdata.FL_COLOR, xfdata.FL_COLOR],
        """void fl_set_oneliner_color(FL_COLOR p1, FL_COLOR p2)""")
    library.check_if_flinitialized()
    #library.checknonfatal_allowed_value_in_list(fgcolr, xfdata.COLOR_list)
    ul_fgcolr = library.convert_to_FL_COLOR(fgcolr)
    #library.checknonfatal_allowed_value_in_list(bgcolr, xfdata.COLOR_list)
    ul_bgcolr = library.convert_to_FL_COLOR(bgcolr)
    library.keep_elem_refs(fgcolr, bgcolr, ul_fgcolr, ul_bgcolr)
    _fl_set_oneliner_color(ul_fgcolr, ul_bgcolr)


def fl_set_tooltip_font(style, size):
    """fl_set_tooltip_font(style, size)

    Defines the font style and size of the tooltip.

    Parameters
    ----------
        style : int
            label style. Values (from xfdata.py) FL_NORMAL_STYLE (Helvetica
            normal text), FL_BOLD_STYLE (Helvetica boldface text),
            FL_ITALIC_STYLE (Helvetica italic text), FL_BOLDITALIC_STYLE
            (Helvetica boldface and italic text), FL_FIXED_STYLE (Courier
            fixed width, good for tables), FL_FIXEDBOLD_STYLE (Courier bold
            fixed text), FL_FIXEDITALIC_STYLE (Courier italic fixed text),
            FL_FIXEDBOLDITALIC_STYLE (Courier boldface and italic fixed text),
            FL_TIMES_STYLE (Times-Roman like normal font), FL_TIMESBOLD_STYLE
            (Times-Roman like boldface text), FL_TIMESITALIC_STYLE (Times-Roman
            like italic text), FL_TIMESBOLDITALIC_STYLE (Times-Roman like
            boldface and italic text), FL_MISC_STYLE (Charter normal text),
            FL_MISCBOLD_STYLE (Charter boldface text), FL_MISCITALIC_STYLE
            (Charter italic text),
            FL_SYMBOL_STYLE (Symbol text), FL_SHADOW_STYLE (Text casting a
            shadow, modifier mask), FL_ENGRAVED_STYLE (Text engraved into the
            form, modifier mask), FL_EMBOSSED_STYLE (Text standing out,
            modifier mask). Bitwise OR with any of modifiers is allowed.
        size : int
            label size. Values (from xfdata.py) FL_TINY_SIZE (8 points font),
            FL_SMALL_SIZE or FL_DEFAULT_SIZE (10 points font, default),
            FL_NORMAL_SIZE (12 points font), FL_MEDIUM_SIZE (14 points font),
            FL_LARGE_SIZE (18 points font),FL_HUGE_SIZE (24 points font), or
            other numeric odd or even value

    Examples
    --------
        >>> fl_set_tooltip_font(xfdata.FL_SHADOW_STYLE,
                xfdata.FL_DEFAULT_SIZE)

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

    """
    _fl_set_tooltip_font = library.cfuncproto(
        library.load_so_libforms(), "fl_set_tooltip_font",
        None, [cty.c_int, cty.c_int],
        """void fl_set_tooltip_font(int p1, int p2)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(style, xfdata.TEXTSTYLE_list)
    i_style = library.convert_to_intc(style)
    i_size = library.convert_to_intc(size)
    library.keep_elem_refs(style, size, i_style, i_size)
    _fl_set_tooltip_font(i_style, i_size)


def fl_set_tooltip_color(fgcolr, bgcolr):
    """fl_set_tooltip_color(fgcolr, bgcolr)

    Defines the foreground and the background colors of the tooltip.

    Parameters
    ----------
        fgcolr : long_pos
            XForms colormap index as foreground color
        bgcolr : long_pos
            XForms colormap index as background color

    Examples
    --------
        >>> fl_set_tooltip_color(xfdata.FL_BLUE, xfdata.FL_VIOLET)

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

    """
    _fl_set_tooltip_color = library.cfuncproto(
        library.load_so_libforms(), "fl_set_tooltip_color",
        None, [xfdata.FL_COLOR, xfdata.FL_COLOR],
        """void fl_set_tooltip_color(FL_COLOR p1, FL_COLOR p2)""")
    library.check_if_flinitialized()
    #library.checknonfatal_allowed_value_in_list(fgcolr, xfdata.COLOR_list)
    ul_fgcolr = library.convert_to_FL_COLOR(fgcolr)
    #library.checknonfatal_allowed_value_in_list(bgcolr, xfdata.COLOR_list)
    ul_bgcolr = library.convert_to_FL_COLOR(bgcolr)
    library.keep_elem_refs(fgcolr, bgcolr, ul_fgcolr, ul_bgcolr)
    _fl_set_tooltip_color(ul_fgcolr, ul_bgcolr)


def fl_set_tooltip_boxtype(boxtype):
    """fl_set_tooltip_boxtype(boxtype)

    Defines the boxtype of the tooltip.

    Parameters
    ----------
        boxtype : int
            type of the box to be added. Values (from xfdata.py) FL_NO_BOX
            (No box at all, it is transparent, just a label), FL_UP_BOX (A
            box that comes out of the screen), FL_DOWN_BOX (A box that goes
            down into the screen), FL_BORDER_BOX (A flat box with a border),
            FL_SHADOW_BOX (A flat box with a shadow), FL_FRAME_BOX (A flat
            box with an engraved frame), FL_ROUNDED_BOX (A rounded box),
            FL_EMBOSSED_BOX (A flat box with an embossed frame), FL_FLAT_BOX
            (A flat box without a border, normally invisible unless given a
            different color than the surroundings), FL_RFLAT_BOX (A rounded
            box without a border, normally invisible unless given a different
            color than the surroundings), FL_RSHADOW_BOX (A rounded box with
            a shadow)), FL_OVAL_BOX (A box shaped like an ellipse),
            FL_ROUNDED3D_UPBOX (A rounded box coming out of the screen),
            FL_ROUNDED3D_DOWNBOX (A rounded box going into the screen),
            FL_OVAL3D_UPBOX (An oval box coming out of the screen),
            FL_OVAL3D_DOWNBOX (An oval box going into the screen),
            FL_OVAL3D_FRAMEBOX (An oval box with an engraved frame),
            FL_OVAL3D_EMBOSSEDBOX (An oval box with an embossed frame)

    Examples
    --------
        >>> fl_set_tooltip_boxtype(xfdata.FL_OVAL3D_DOWNBOX)

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

    """
    _fl_set_tooltip_boxtype = library.cfuncproto(
        library.load_so_libforms(), "fl_set_tooltip_boxtype",
        None, [cty.c_int],
        """void fl_set_tooltip_boxtype(int p1)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(boxtype, xfdata.BOXTYPE_list)
    i_boxtype = library.convert_to_intc(boxtype)
    library.keep_elem_refs(boxtype, i_boxtype)
    _fl_set_tooltip_boxtype(i_boxtype)


def fl_set_tooltip_lalign(align):
    """fl_set_tooltip_lalign(align)

    Defines the alignment of the tooltip.

    Parameters
    ----------
        align : int
            alignment of tooltip. Values (from xfdata.py) FL_ALIGN_CENTER (In
            the middle of the box, inside it), FL_ALIGN_TOP (To the top of
            the box, outside it), FL_ALIGN_BOTTOM (To the bottom of the box,
            outside it), FL_ALIGN_LEFT (To the left of the box, outside it),
            FL_ALIGN_RIGHT (To the right of the box, outside it),
            FL_ALIGN_LEFT_TOP (To the left and top of the box, outside it),
            FL_ALIGN_RIGHT_TOP (To the right and top of the box, outside it),
            FL_ALIGN_LEFT_BOTTOM (To the left and bottom of the box, outside
            it), FL_ALIGN_RIGHT_BOTTOM (To the right and bottom of the box,
            outside it), FL_ALIGN_INSIDE (places the text inside the box),
            FL_ALIGN_VERT (not functional yet). Bitwise OR with FL_ALIGN_INSIDE
            is allowed.

    Examples
    --------
        >>> fl_set_tooltip_lalign(xfdata.FL_ALIGN_RIGHT_TOP)

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

    """
    _fl_set_tooltip_lalign = library.cfuncproto(
        library.load_so_libforms(), "fl_set_tooltip_lalign",
        None, [cty.c_int],
        """void fl_set_tooltip_lalign(int p1)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(align, xfdata.ALIGN_list)
    i_align = library.convert_to_intc(align)
    library.keep_elem_refs(align, i_align)
    _fl_set_tooltip_lalign(i_align)


def fl_exe_command(cmdtxt, block):
    """fl_exe_command(cmdtxt, block) -> status

    Forks a new process that runs specified command.

    Parameters
    ----------
        cmdtxt : str
            a shell command line
        block : int
            blocking flag indicating if the function should wait for the
            child process to finish or not. Values non-zero (for waiting)
            or 0 (do not wait).

    Returns
    -------
        status : long
            exit status

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

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

    """
    _fl_exe_command = library.cfuncproto(
        library.load_so_libforms(), "fl_exe_command",
        cty.c_long, [xfdata.STRING, cty.c_int],
        """long int fl_exe_command(const char * p1, int p2)""")
    library.check_if_flinitialized()
    s_cmdtxt = library.convert_to_bytestrc(cmdtxt)
    i_block = library.convert_to_intc(block)
    library.keep_elem_refs(cmdtxt, block, s_cmdtxt, i_block)
    retval = _fl_exe_command(s_cmdtxt, i_block)
    return retval


fl_open_command = fl_exe_command


def fl_end_command(pid):
    """fl_end_command(pid) -> status

    Suspends the current process and waits until the child process is
    completed.

    Parameters
    ----------
        pid : long
            process id returned by fl_exe_command()

    Returns
    -------
        status : long
            exit status of child process, or -1 (if an error has occurred)

    Examples
    --------
        >>> fl_end_command(1488)

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

    """
    _fl_end_command = library.cfuncproto(
        library.load_so_libforms(), "fl_end_command",
        cty.c_int, [cty.c_long],
        """int fl_end_command(long int p1)""")
    library.check_if_flinitialized()
    l_pid = library.convert_to_longc(pid)
    library.keep_elem_refs(pid, l_pid)
    retval = _fl_end_command(l_pid)
    return retval


fl_close_command = fl_end_command


def fl_check_command(pid):
    """fl_check_command(pid) -> status

    Polls the status of a child process.

    Parameters
    ----------
        pid : long
            process id returned by fl_exe_command()

    Returns
    -------
        status : int
            0 (if the child process is finished), or 1 (if the child process
            still exists, running or stopped), or -1 (if an error has
            occurred inside the function)

    Examples
    --------
        >>> fl_check_command(1488)

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

    """
    _fl_check_command = library.cfuncproto(
        library.load_so_libforms(), "fl_check_command",
        cty.c_int, [cty.c_long],
        """int fl_check_command(long int p1)""")
    library.check_if_flinitialized()
    l_pid = library.convert_to_longc(pid)
    library.keep_elem_refs(pid, l_pid)
    retval = _fl_check_command(l_pid)
    return retval


def fl_popen(cmdtxt, opntype):
    """fl_popen(cmdtxt, opntype) -> ptr_file

    Executes the command in a child process, and logs the stderr messages
    into the command log. If opntype is "w", stdout will also be logged
    into the command browser.

    Parameters
    ----------
        cmdtxt : str
            existing filename to execute
        opntype : str
            type of opening. Values 'w' (write mode) or 'r' (read mode)

    Returns
    -------
        ptr_file : pointer to xfdata.FILE
            file opened

    Examples
    --------
        >>> pfile = fl_popen("/usr/bin/somecommand", "r")

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

    """
    _fl_popen = library.cfuncproto(
        library.load_so_libforms(), "fl_popen",
        cty.POINTER(xfdata.FILE), [xfdata.STRING, xfdata.STRING],
        """FILE * fl_popen(const char * p1, const char * p2)""")
    library.check_if_flinitialized()
    s_cmdtxt = library.convert_to_bytestrc(cmdtxt)
    s_opntype = library.convert_to_bytestrc(opntype)
    library.keep_elem_refs(cmdtxt, opntype, s_cmdtxt, s_opntype)
    retval = _fl_popen(s_cmdtxt, s_opntype)
    return retval


def fl_pclose(ptr_file):
    """fl_pclose(ptr_file) -> result

    Cleans up the child process executed.

    Parameters
    ----------
        ptr_file : pointer to xfdata.FILE
            opened file stream returned by fl_popen()

    Returns
    -------
        result : int
            non-zero, or -1 (on failure)

    Examples
    --------
        >>> if fl_pclose(pfile) == -1:
        >>> ... <something>

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

    """
    _fl_pclose = library.cfuncproto(
        library.load_so_libforms(), "fl_pclose",
        cty.c_int, [cty.POINTER(xfdata.FILE)],
        """int fl_pclose(FILE * p1)""")
    library.check_if_flinitialized()
    library.verify_otherclassptr_type(ptr_file, cty.POINTER(xfdata.FILE))
    library.keep_elem_refs(ptr_file)
    retval = _fl_pclose(ptr_file)
    return retval


def fl_end_all_command():
    """fl_end_all_command() -> status

    Waits for all the child processes initiated by fl_exe_command()
    to complete.

    Returns
    -------
        status : int
            exit status of the last child process

    Examples
    --------
        >>> fl_end_all_command()

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

    """
    _fl_end_all_command = library.cfuncproto(
        library.load_so_libforms(), "fl_end_all_command",
        cty.c_int, [],
        """int fl_end_all_command()""")
    retval = _fl_end_all_command()
    return retval


def fl_show_command_log(border):
    """fl_show_command_log(border)

    Shows the log of the command output.

    Parameters
    ----------
        border : int
            window manager decoration. Values (from xfdata.py)
           - FL_FULLBORDER (normal, draws full border with title),
           - FL_TRANSIENT (draws borders with possibly less decoration,
             depends on the window managers behaviour. You might not be
             able to iconify a form under some WMs),
           - FL_NOBORDER (Draw no border at all. You cannot iconify a
             form with no borders)

    Examples
    --------
        >>> fl_show_command_log(xfdata.FL_FULLBORDER)

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

    """
    _fl_show_command_log = library.cfuncproto(
        library.load_so_libforms(), "fl_show_command_log",
        None, [cty.c_int],
        """void fl_show_command_log(int p1)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(border, \
            xfdata.DECORATION_list)
    i_border = library.convert_to_intc(border)
    library.keep_elem_refs(border, i_border)
    _fl_show_command_log(i_border)


def fl_hide_command_log():
    """fl_hide_command_log()

    Hides the log of the command output.

    Examples
    --------
        >>> fl_hide_command_log()

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

    """
    _fl_hide_command_log = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_command_log",
        None, [],
        """void fl_hide_command_log()""")
    library.check_if_flinitialized()
    _fl_hide_command_log()


def fl_clear_command_log():
    """fl_clear_command_log()

    Clears the command browser and the logging output displayed within it.

    Examples
    --------
        >>> fl_clear_command_log()

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

    """
    _fl_clear_command_log = library.cfuncproto(
        library.load_so_libforms(), "fl_clear_command_log",
        None, [],
        """void fl_clear_command_log()""")
    library.check_if_flinitialized()
    _fl_clear_command_log()


def fl_addto_command_log(txtstr):
    """fl_addto_command_log(txtstr)

    Adds arbitrary text to the command browser.

    Parameters
    ----------
        txtstr : str
            text line to be added (with possible embedded newlines)

    Examples
    --------
        >>> fl_addto_command_log("Another line to add to command log")

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

    """
    _fl_addto_command_log = library.cfuncproto(
        library.load_so_libforms(), "fl_addto_command_log",
        None, [xfdata.STRING],
        """void fl_addto_command_log(const char * p1)""")
    library.check_if_flinitialized()
    s_txtstr = library.convert_to_bytestrc(txtstr)
    library.keep_elem_refs(txtstr, s_txtstr)
    _fl_addto_command_log(s_txtstr)


def fl_set_command_log_position(xpos, ypos):
    """fl_set_command_log_position(xpos, ypos)

    Changes the default placement of the command log.

    Parameters
    ----------
        xpos : int
            horizontal position (upper-left corner)
        ypos : int
            vertical position (upper-left corner)

    Examples
    --------
        >>> fl_set_command_log_position(174, 288)

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

    """
    _fl_set_command_log_position = library.cfuncproto(
        library.load_so_libforms(), "fl_set_command_log_position",
        None, [cty.c_int, cty.c_int],
        """void fl_set_command_log_position(int p1, int p2)""")
    library.check_if_flinitialized()
    i_xpos = library.convert_to_intc(xpos)
    i_ypos = library.convert_to_intc(ypos)
    library.keep_elem_refs(xpos, ypos, i_xpos, i_ypos)
    _fl_set_command_log_position(i_xpos, i_ypos)


def fl_get_command_log_fdstruct():
    """fl_get_command_log_fdstruct() -> ptr_cmdlog

    Finds out the GUI structure of the command browser. From the information
    returned, the application program can change various attributes of the
    command browser and its associated flobjects. Note however, that you
    should not hide/show the form or free any member of the returned
    structure.

    Returns
    -------
        ptr_cmdlog : pointer to xfdata.FD_CMDLOG
            command log browser class instance

    Examples
    --------
        >>> pcmdlogbr = fl_get_command_log_fdstruct()

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

    """
    _fl_get_command_log_fdstruct = library.cfuncproto(
        library.load_so_libforms(), "fl_get_command_log_fdstruct",
        cty.POINTER(xfdata.FD_CMDLOG), [],
        """FD_CMDLOG * fl_get_command_log_fdstruct()""")
    library.check_if_flinitialized()
    retval = _fl_get_command_log_fdstruct()
    return retval


# file selector

def fl_use_fselector(fselnum):
    """fl_use_fselector(fselnum) -> oldfselnum

    Defines the currently active file selector.

    Parameters
    ----------
        fselnum : int
            fselector number to use. Values between 0 and
            xfdata.FL_MAX_FSELECTOR - 1

    Returns
    -------
        oldfselnum : int
            old file selector number

    Examples
    --------
        >>> oldfsel = fl_use_fselector(1)

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

    """
    _fl_use_fselector = library.cfuncproto(
        library.load_so_libforms(), "fl_use_fselector",
        cty.c_int, [cty.c_int],
        """int fl_use_fselector(int p1)""")
    library.check_if_flinitialized()
    i_fselnum = library.convert_to_intc(fselnum)
    library.keep_elem_refs(fselnum, i_fselnum)
    retval = _fl_use_fselector(i_fselnum)
    return retval


def fl_show_fselector(msgtxt, dirname, pattern, deftxt):
    """fl_show_fselector(msgtxt, dirname, pattern, deftxt) -> text

    Show a file selector, providing an easy and interactive way to let
    the user select files.

    Parameters
    ----------
        msgtxt : str
            message text
        dirname : str
            directory name
        pattern : str
            any kind of regular expression, e.g. "[a-f]*c" which would list all
            files starting with a letter between a and f and ending with c.
        deftxt : str
            default file name

    Returns
    -------
        text : str
            fselector text, or None (if the Cancel button is pressed)

    Examples
    --------
        >>> fstxt = fl_show_fselector("Choose file:", "/home/userdir",
                "*.*", "")

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

    """
    _fl_show_fselector = library.cfuncproto(
        library.load_so_libforms(), "fl_show_fselector",
        xfdata.STRING, [xfdata.STRING, xfdata.STRING, xfdata.STRING,
        xfdata.STRING],
        """const char * fl_show_fselector(const char * p1,
           const char * p2, const char * p3, const char * p4)""")
    library.check_if_flinitialized()
    s_msgtxt = library.convert_to_bytestrc(msgtxt)
    s_dirname = library.convert_to_bytestrc(dirname)
    s_pattern = library.convert_to_bytestrc(pattern)
    s_deftxt = library.convert_to_bytestrc(deftxt)
    library.keep_elem_refs(msgtxt, dirname, pattern, deftxt, s_msgtxt,
            s_dirname, s_pattern, s_deftxt)
    retval = _fl_show_fselector(s_msgtxt, s_dirname, s_pattern, s_deftxt)
    if isinstance(retval, bytes):
        return retval.decode('utf-8')
    else:       # str/None
        return retval


fl_show_file_selector = fl_show_fselector


def fl_set_fselector_fontsize(size):
    """fl_set_fselector_fontsize(size)

    Changes the font size of a file selector.

    Parameters
    ----------
        size : int
            label size. Values (from xfdata.py) FL_TINY_SIZE (8 points font),
            FL_SMALL_SIZE or FL_DEFAULT_SIZE (10 points font, default),
            FL_NORMAL_SIZE (12 points font), FL_MEDIUM_SIZE (14 points font),
            FL_LARGE_SIZE (18 points font), FL_HUGE_SIZE (24 points font), or
            other numeric odd or even value

    Examples
    --------
        >>> fl_set_fselector_fontsize(xfdata.TINY_SIZE)

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

    """
    _fl_set_fselector_fontsize = library.cfuncproto(
        library.load_so_libforms(), "fl_set_fselector_fontsize",
        None, [cty.c_int],
        """void fl_set_fselector_fontsize(int p1)""")
    library.check_if_flinitialized()
    i_size = library.convert_to_intc(size)
    library.keep_elem_refs(size, i_size)
    _fl_set_fselector_fontsize(i_size)


def fl_set_fselector_fontstyle(style):
    """fl_set_fselector_fontstyle(style)

    Changes the font style of a file selector.

    Parameters
    ----------
        style : int
            label style. Values (from xfdata.py) FL_NORMAL_STYLE (Helvetica
            normal text), FL_BOLD_STYLE (Helvetica boldface text),
            FL_ITALIC_STYLE (Helvetica italic text), FL_BOLDITALIC_STYLE
            (Helvetica boldface and italic text), FL_FIXED_STYLE (Courier
            fixed width, good for tables), FL_FIXEDBOLD_STYLE (Courier bold
            fixed text), FL_FIXEDITALIC_STYLE (Courier italic fixed text),
            FL_FIXEDBOLDITALIC_STYLE (Courier boldface and italic fixed text),
            FL_TIMES_STYLE (Times-Roman like normal font), FL_TIMESBOLD_STYLE
            (Times-Roman like boldface text), FL_TIMESITALIC_STYLE (Times-Roman
            like italic text), FL_TIMESBOLDITALIC_STYLE (Times-Roman like
            boldface and italic text), FL_MISC_STYLE (Charter normal text),
            FL_MISCBOLD_STYLE (Charter boldface text), FL_MISCITALIC_STYLE
            (Charter italic text), FL_SYMBOL_STYLE (Symbol text),
            FL_SHADOW_STYLE (Text casting a shadow, modifier mask),
            FL_ENGRAVED_STYLE (Text engraved into the form, modifier mask),
            FL_EMBOSSED_STYLE (Text standing out, modifier mask). Bitwise OR
            with any of modifiers is allowed.

    Examples
    --------
        >>> fl_set_fselector_fontstyle(xfdata.FL_SHADOW_STYLE)

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

    """
    _fl_set_fselector_fontstyle = library.cfuncproto(
        library.load_so_libforms(), "fl_set_fselector_fontstyle",
        None, [cty.c_int],
        """void fl_set_fselector_fontstyle(int p1)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(style, xfdata.TEXTSTYLE_list)
    i_style = library.convert_to_intc(style)
    library.keep_elem_refs(style, i_style)
    _fl_set_fselector_fontstyle(i_style)


def fl_set_fselector_placement(place):
    """fl_set_fselector_placement(place)

    Defines the placement of the file selector. By default it is centered
    on the screen (from xfdata.py, FL_PLACE_CENTER|FL_FREE_SIZE).

    Parameters
    ----------
        place : int
            where to place it. Values (from xfdata.py) FL_PLACE_FREE,
            FL_PLACE_MOUSE, FL_PLACE_CENTER, FL_PLACE_POSITION, FL_PLACE_SIZE,
            FL_PLACE_GEOMETRY, FL_PLACE_ASPECT, FL_PLACE_FULLSCREEN,
            FL_PLACE_HOTSPOT, FL_PLACE_ICONIC, FL_FREE_SIZE,
            FL_PLACE_FREE_CENTER, FL_PLACE_CENTERFREE,
            FL_PLACE_MOUSE|FL_FREE_SIZE, FL_PLACE_FULLSCREEN|FL_FREE_SIZE,
            FL_PLACE_HOTSPOT|FL_FREE_SIZE

    Examples
    --------
        >>> fl_set_fselector_placement(xfdata.FL_PLACE_HOTSPOT)

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

    """
    _fl_set_fselector_placement = library.cfuncproto(
        library.load_so_libforms(), "fl_set_fselector_placement",
        None, [cty.c_int],
        """void fl_set_fselector_placement(int p1)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(place, xfdata.PLACE_list)
    i_place = library.convert_to_intc(place)
    library.keep_elem_refs(place, i_place)
    _fl_set_fselector_placement(i_place)


def fl_set_fselector_border(border):
    """fl_set_fselector_border(border)

    Changes the border of file selector. By default it is displayed with
    transient property set.

    Parameters
    ----------
        border : int
            window manager decoration. Values (from xfdata.py)
            - FL_FULLBORDER (normal, draw full border with title),
            - FL_TRANSIENT (draws borders with possibly less decoration,
              depends on the window managers behaviour. You might not be able
              to iconify a form under some WMs),
            FL_NOBORDER is ignored.

    Examples
    --------
        >>> fl_set_fselector_border(xfdata.FL_FULLBORDER)

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

    """
    _fl_set_fselector_border = library.cfuncproto(
        library.load_so_libforms(), "fl_set_fselector_border",
        None, [cty.c_int],
        """void fl_set_fselector_border(int p1)""")
    library.check_if_flinitialized()
    library.checkfatal_allowed_value_in_list(border, xfdata.DECORATION_list)
    i_border = library.convert_to_intc(border)
    library.keep_elem_refs(border, i_border)
    _fl_set_fselector_border(i_border)


def fl_set_fselector_transient(yesno):
    """fl_set_fselector_transient(yesno)

    Defines the property of file selector as transient or fullborder.

    Parameters
    ----------
        yesno : int
            flag if transient or not. Values 1 (transient) or 0 (full border)

    Examples
    --------
        >>> fl_set_fselector_transient(0)

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

    """
    if yesno:
        argval = xfdata.FL_TRANSIENT
    else:
        argval = xfdata.FL_FULLBORDER
    fl_set_fselector_border(argval)


def fl_set_fselector_callback(pyfn_FSCB, userdata):
    """fl_set_fselector_callback(pyfn_FSCB, userdata)

    Defines a callback routine so that whenever the user double clicks on a
    filename, instead of returning the filename, this routine is invoked with
    the filename as the argument. The behavior of the file selector is
    slightly different when a callback is present. Without the callback, a
    file selector is always modal. Please note that when a file selector has
    a callback installed the field for manually entering a file name is not
    shown.

    Parameters
    ----------
        pyfn_FSCB : python function callback, returning (unused) value
            name referring to function([str]fname, [pointer to void]pvdata)
            -> [int]num
        userdata : any type (e.g. None, int, str, etc..)
            user data to be passed to function; invoked callback has to take
            care of type check and re-cast from ptr_void to chosen type using
            appropriate xfstruct.fls_convert_ptrvoid_to_*() function

    Examples
    --------
        >>> def fsel_cb(fname, pvdata):
        >>> ... <something>
        >>> ... return UnusedVal
        >>> fl_set_fselector_callback(fsel_cb, None)

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

    """
    #FL_FSCB = cty.CFUNCTYPE(cty.c_int, xfdata.STRING, cty.c_void_p)
    _fl_set_fselector_callback = library.cfuncproto(
        library.load_so_libforms(), "fl_set_fselector_callback",
        None, [xfdata.FL_FSCB, cty.c_void_p],
        """void fl_set_fselector_callback(FL_FSCB p1, void * p2)""")
    library.check_if_flinitialized()
    library.verify_function_type(pyfn_FSCB)
    cfn_FSCB = xfdata.FL_FSCB(pyfn_FSCB)
    ptr_vdata = library.convert_userdata_to_ptrvoid(userdata)
    library.keep_cfunc_refs(cfn_FSCB, pyfn_FSCB)
    library.keep_elem_refs(userdata, ptr_vdata)
    _fl_set_fselector_callback(cfn_FSCB, ptr_vdata)


fl_set_fselector_cb = fl_set_fselector_callback


def fl_get_filename():
    """fl_get_filename() -> fname

    Finds out the file name (without the path) after the user changed it.

    Returns
    -------
        fname : str
            name of file (fname)

    Examples
    --------
        >>> newfname = fl_get_filename()

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

    """
    _fl_get_filename = library.cfuncproto(
        library.load_so_libforms(), "fl_get_filename",
        xfdata.STRING, [],
        """const char * fl_get_filename()""")
    library.check_if_flinitialized()
    retval = _fl_get_filename()
    if isinstance(retval, bytes):
        return retval.decode('utf-8')
    else:       # str
        return retval


def fl_get_directory():
    """fl_get_directory() -> dirname

    Finds out the directory name after the user changed it.

    Returns
    -------
        dirname : str
            name of directory

    Examples
    --------
        >>> newdname = fl_get_directory()

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

    """
    _fl_get_directory = library.cfuncproto(
        library.load_so_libforms(), "fl_get_directory",
        xfdata.STRING, [],
        """const char * fl_get_directory()""")
    retval = _fl_get_directory()
    if isinstance(retval, bytes):
        return retval.decode('utf-8')
    else:       # str
        return retval


def fl_get_pattern():
    """fl_get_pattern() -> pattern

    Finds out the pattern after the user changed it.

    Returns
    -------
        pattern : str
            pattern text

    Examples
    --------
        >>> ptrntxt = fl_get_pattern()

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

    """
    _fl_get_pattern = library.cfuncproto(
        library.load_so_libforms(), "fl_get_pattern",
        xfdata.STRING, [],
        """const char * fl_get_pattern()""")
    library.check_if_flinitialized()
    retval = _fl_get_pattern()
    if isinstance(retval, bytes):
        return retval.decode('utf-8')
    else:       # str
        return retval


def fl_set_directory(dirname):
    """fl_set_directory(dirname) -> result

    Defines programmatically new value for the default directory.

    Parameters
    ----------
        dirname : str
            name of directory to be set

    Returns
    -------
        result : int
            0 on success, or 1 (on failure)

    Examples
    --------
        >>> sth = fl_set_directory("/home/userdir/myotherdir")

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

    """
    _fl_set_directory = library.cfuncproto(
        library.load_so_libforms(), "fl_set_directory",
        cty.c_int, [xfdata.STRING],
        """int fl_set_directory(const char * p1)""")
    library.check_if_flinitialized()
    s_dirname = library.convert_to_bytestrc(dirname)
    library.keep_elem_refs(dirname, s_dirname)
    retval = _fl_set_directory(s_dirname)
    return retval


def fl_set_pattern(pattern):
    """fl_set_pattern(pattern)

    Defines programmatically a new value for the default pattern.

    Parameters
    ----------
        pattern : str
            text to be used for pattern

    Examples
    --------
        >>> fl_set_pattern("*.txt")

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

    """
    _fl_set_pattern = library.cfuncproto(
        library.load_so_libforms(), "fl_set_pattern",
        None, [xfdata.STRING],
        """void fl_set_pattern(const char * p1)""")
    library.check_if_flinitialized()
    s_pattern = library.convert_to_bytestrc(pattern)
    library.keep_elem_refs(pattern, s_pattern)
    _fl_set_pattern(s_pattern)


def fl_refresh_fselector():
    """fl_refresh_fselector()

    Refreshes the file selector, re-scanning the current directory and
    listing all entries in it.

    Examples
    --------
        >>> fl_refresh_fselector()

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

    """
    _fl_refresh_fselector = library.cfuncproto(
        library.load_so_libforms(), "fl_refresh_fselector",
        None, [],
        """void fl_refresh_fselector()""")
    library.check_if_flinitialized()
    _fl_refresh_fselector()


def fl_add_fselector_appbutton(label, pyfn_fselappbtn, userdata):
    """fl_add_fselector_appbutton(label, pyfn_fselappbtn, userdata)

    Adds an application specific button from file selector and a callback
    routine for it.

    Parameters
    ----------
        label : str
            text of label
        pyfn_fselappbtn : python function, no return
            name referring to function([pointer to void]pvdata)
            Function to handle application specific button callback
        userdata : any type (e.g. None, int, str, etc..)
            user data to be passed to function; invoked callback has to take
            care of type check and re-cast from ptr_void to chosen type using
            appropriate xfstruct.fls_convert_ptrvoid_to_*() function

    Examples
    --------
        >>> def fsbtn_cb(pvdata):
        >>> ... <something>
        >>> fl_add_fselector_appbutton("SomeButton", fsbtn_cb, None)

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

    """
    cfunc_none_voidp = cty.CFUNCTYPE(None, cty.c_void_p)
    _fl_add_fselector_appbutton = library.cfuncproto(
        library.load_so_libforms(), "fl_add_fselector_appbutton",
        None, [xfdata.STRING, cfunc_none_voidp, cty.c_void_p],
        """void fl_add_fselector_appbutton(const char * p1,
           const char * p2, void * p3)""")
    library.check_if_flinitialized()
    s_label = library.convert_to_bytestrc(label)
    library.verify_function_type(pyfn_fselappbtn)
    cfn_fselappbtn = cfunc_none_voidp(pyfn_fselappbtn)
    ptr_vdata = library.convert_userdata_to_ptrvoid(userdata)
    library.keep_cfunc_refs(cfn_fselappbtn, pyfn_fselappbtn)
    library.keep_elem_refs(label, userdata, s_label, ptr_vdata)
    _fl_add_fselector_appbutton(s_label, cfn_fselappbtn, ptr_vdata)


def fl_remove_fselector_appbutton(label):
    """fl_remove_fselector_appbutton(label)

    Removes an application specific button from file selector.

    Parameters
    ----------
        label : str
            text of label

    Examples
    --------
        >>> fl_remove_selector_appbutton("SomeButton")

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

    """
    _fl_remove_fselector_appbutton = library.cfuncproto(
        library.load_so_libforms(), "fl_remove_fselector_appbutton",
        None, [xfdata.STRING],
        """void fl_remove_fselector_appbutton(const char * p1)""")
    library.check_if_flinitialized()
    s_label = library.convert_to_bytestrc(label)
    library.keep_elem_refs(label, s_label)
    _fl_remove_fselector_appbutton(s_label)


def fl_disable_fselector_cache(yesno):
    """fl_disable_fselector_cache(yesno)

    Disables or enables file selector caching.

    Parameters
    ----------
        yesno : int
            flag to enable/disable caching. Values 0 (enabled) or 1 (disabled)

    Examples
    --------
        >>> fl_disable_fselector_cache(1)

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

    """
    _fl_disable_fselector_cache = library.cfuncproto(
        library.load_so_libforms(), "fl_disable_fselector_cache",
        None, [cty.c_int],
        """void fl_disable_fselector_cache(int p1)""")
    library.check_if_flinitialized()
    i_yesno = library.convert_to_intc(yesno)
    library.keep_elem_refs(yesno, i_yesno)
    _fl_disable_fselector_cache(i_yesno)


def fl_invalidate_fselector_cache():
    """fl_invalidate_fselector_cache()

    Forces an update of file selector caching programmatically. It forces it
    only once, and on the directory that is to be browsed.

    Examples
    --------
        >>> fl_invalidate_fselector_cache()

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

    """
    _fl_invalidate_fselector_cache = library.cfuncproto(
        library.load_so_libforms(), "fl_invalidate_fselector_cache",
        None, [],
        """void fl_invalidate_fselector_cache()""")
    library.check_if_flinitialized()
    _fl_invalidate_fselector_cache()


def fl_get_fselector_form():
    """fl_get_fselector_form() -> ptr_flform

    Finds out the form of file selector.

    Returns
    -------
        ptr_flform : pointer to xfdata.FL_FORM
            fselector form

    Examples
    --------
        >>> pform = fl_get_fselector_form()

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

    """
    _fl_get_fselector_form = library.cfuncproto(
        library.load_so_libforms(), "fl_get_fselector_form",
        cty.POINTER(xfdata.FL_FORM), [],
        """FL_FORM * fl_get_fselector_form()""")
    library.check_if_flinitialized()
    retval = _fl_get_fselector_form()
    return retval


def fl_get_fselector_fdstruct():
    """fl_get_fselector_fdstruct() -> ptr_fdselector

    Finds out xfdata.FD_FSELECTOR class instance, allowing direct
    access to the individual flobjects of a file selector.

    Returns
    -------
        ptr_fdselector : pointer to xfdata.FD_FSELECTOR
            file selector class instance

    Examples
    --------
        >>> fdfsel = fl_get_fselector_fdstruct()

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

    """
    _fl_get_fselector_fdstruct = library.cfuncproto(
        library.load_so_libforms(), "fl_get_fselector_fdstruct",
        cty.POINTER(xfdata.FD_FSELECTOR), [],
        """FD_FSELECTOR * fl_get_fselector_fdstruct()""")
    library.check_if_flinitialized()
    retval = _fl_get_fselector_fdstruct()
    return retval


def fl_hide_fselector():
    """fl_hide_fselector()

    Hides a file selector.

    Examples
    --------
        >>> fl_hide_fselector()

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

    """
    _fl_hide_fselector = library.cfuncproto(
        library.load_so_libforms(), "fl_hide_fselector",
        None, [],
        """void fl_hide_fselector()""")
    library.check_if_flinitialized()
    _fl_hide_fselector()


def fl_set_fselector_filetype_marker(dirmrkr, fifomrkr, sockmrkr, cdevmrkr,
        bdevmrkr):
    """fl_set_fselector_filetype_marker(dirmrkr, fifomrkr, sockmrkr, cdevmrkr,
    bdevmrkr)

    Changes the prefix used to mark special files in the directories and files
    listing browser.

    Parameters
    ----------
        dirmrkr : int or char
            marker for directories. By default 'D' is used.
        fifomrkr : int or char
            marker for pipes and FIFOs. By default 'p' is used.
        sockmrkr : int or char
            marker for sockets. By default 's' is used.
        cdevmrkr : int or char
            marker for character device files. By default 'c' is used.
        bdevmrkr : int or char
            marker for block device files. By default 'b' is used.

    Examples
    --------
        >>> fl_set_fselector_filetype_marker('d', 'P', 'S', 'V', 'b')

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

    """
    _fl_set_fselector_filetype_marker = library.cfuncproto(
        library.load_so_libforms(), "fl_set_fselector_filetype_marker",
        None, [cty.c_int, cty.c_int, cty.c_int, cty.c_int, cty.c_int],
        """void fl_set_fselector_filetype_marker(int p1, int p2, int p3,
           int p4, int p5)""")
    library.check_if_flinitialized()
    if isinstance(dirmrkr, str):
        # workaround to let a character as int argument
        odirmrkr = ord(dirmrkr)
    else:
        odirmrkr = dirmrkr
    i_dirmrkr = library.convert_to_intc(odirmrkr)
    if isinstance(fifomrkr, str):
        # workaround to let a character as int argument
        ofifomrkr = ord(fifomrkr)
    else:
        ofifomrkr = fifomrkr
    i_fifomrkr = library.convert_to_intc(ofifomrkr)
    if isinstance(sockmrkr, str):
        # workaround to let a character as int argument
        osockmrkr = ord(sockmrkr)
    else:
        osockmrkr = sockmrkr
    i_sockmrkr = library.convert_to_intc(osockmrkr)
    if isinstance(cdevmrkr, str):
        # workaround to let a character as int argument
        ocdevmrkr = ord(cdevmrkr)
    else:
        ocdevmrkr = cdevmrkr
    i_cdevmrkr = library.convert_to_intc(ocdevmrkr)
    if isinstance(bdevmrkr, str):
        # workaround to let a character as int argument
        obdevmrkr = ord(bdevmrkr)
    else:
        obdevmrkr = bdevmrkr
    i_bdevmrkr = library.convert_to_intc(obdevmrkr)
    library.keep_elem_refs(dirmrkr, fifomrkr, sockmrkr, cdevmrkr, bdevmrkr, \
            i_dirmrkr, i_fifomrkr, i_sockmrkr, i_cdevmrkr, i_bdevmrkr)
    _fl_set_fselector_filetype_marker(i_dirmrkr, i_fifomrkr, i_sockmrkr, \
            i_cdevmrkr, i_bdevmrkr)


def fl_set_fselector_title(title):
    """fl_set_fselector_title(title)

    Defines the title of a file selector.

    Parameters
    ----------
        title : str
            title to be set

    Examples
    --------
        >>> fl_set_fselector_title("My own title of F.S.")

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

    """
    flbasic.fl_set_form_title(fl_get_fselector_form(), title)


def fl_goodies_atclose(ptr_flform, userdata):
    """fl_goodies_atclose(ptr_flform, userdata) -> unused

    Passes specific userdata to goodie when it is closed?

    Parameters
    ----------
        ptr_flform : pointer to xfdata.FL_FORM
            form
        userdata : any type (e.g. None, int, str, etc..)
            user data to be passed to function; invoked callback has to take
            care of type check and re-cast from ptr_void to chosen type using
            appropriate xfstruct.fls_convert_ptrvoid_to_*() function

    Returns
    -------
        unused : int
            unused value (xfdata.FL_IGNORE)

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

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

    """
    _fl_goodies_atclose = library.cfuncproto(
        library.load_so_libforms(), "fl_goodies_atclose",
        cty.c_int, [cty.POINTER(xfdata.FL_FORM), cty.c_void_p],
        """int fl_goodies_atclose(FL_FORM * p1, void * p2)""")
    library.check_if_flinitialized()
    library.verify_flformptr_type(ptr_flform)
    ptr_vdata = library.convert_userdata_to_ptrvoid(userdata)
    library.keep_elem_refs(ptr_flform, userdata, ptr_vdata)
    retval = _fl_goodies_atclose(ptr_flform, ptr_vdata)
    return retval

