edelib: FLTK widgets and functions

edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

Classes | Enumerations | Functions
FLTK widgets and functions

## Classes
class | ExpandableGroup
| A group with applied layout on childs. More...
class | FontInfo
| Base structure for storing font information; used by FontCache. More...
class | FontCache
| Allow readable font names and cache their access. More...
class | MessageBox
| Standard dialog. More...
class | SevenSeg
| Digital number widget. More...
class | Theme
| Theming engine for widgets. More...
class | ThemeLoader
| Themes loader. More...
class | Window
| Window class. More...

## Enumerations
enum | MessageBoxType { MSGBOX_PLAIN = 0, MSGBOX_INPUT, MSGBOX_INPUT_SECRET }
| Type of MessageBox dialog. More...
enum | MessageBoxButtonType { MSGBOX_BUTTON_PLAIN = 0, MSGBOX_BUTTON_RETURN }
| Type of added button to MessageBox class. More...
enum | MessageBoxIconType { MSGBOX_ICON_TYPE_INFO = 0, MSGBOX_ICON_TYPE_ALERT, MSGBOX_ICON_TYPE_QUESTION, MSGBOX_ICON_TYPE_INPUT, MSGBOX_ICON_TYPE_PASSWORD }
| Type of the icon in message box. More...
enum | WindowComponents { WIN_INIT_NONE = (1 << 1), WIN_INIT_ICON_THEME = (1 << 2), WIN_INIT_IMAGES = (1 << 3), WIN_INIT_ALL = (WIN_INIT_ICON_THEME | WIN_INIT_IMAGES) }
| Components used to be loaded with the window. More...

## Functions
bool | font_cache_find (const char *face, Fl_Font &f, int &s, Fl_Font df=FL_HELVETICA, int ds=12)
int | font_chooser (const char *name, const char *family, int &retsize, const char *default_name=0, int default_size=0)
String | icon_chooser (const char *dir)
String | icon_chooser (IconSizes sz, IconContext ctx=ICON_CONTEXT_ANY, bool always_full_path=false, bool *outside_theme_ret=((void *) 0))
void | clear_dialog_icons (void)
void | window_xid_create (Fl_Window *win, void(*before_map_func)(Fl_Window *)=((void *) 0), int background_pixel=-1)
void | window_center_on_screen (Fl_Window *win)

## Detailed Description

## Enumeration Type Documentation

enum MessageBoxButtonType

Type of added button to MessageBox class.

Enumerator
MSGBOX_BUTTON_PLAIN | Ordinary button (Fl_Button)
MSGBOX_BUTTON_RETURN | Button with 'enter' shortcut (Fl_Return_Button)

enum MessageBoxIconType

Type of the icon in message box.

Enumerator
MSGBOX_ICON_TYPE_INFO | Info-like icon.
MSGBOX_ICON_TYPE_ALERT | Alert-like icon.
MSGBOX_ICON_TYPE_QUESTION | Question-like icon.
MSGBOX_ICON_TYPE_INPUT | Input-like icon.
MSGBOX_ICON_TYPE_PASSWORD | Password-like icon.

enum MessageBoxType

Type of MessageBox dialog.

Enumerator
MSGBOX_PLAIN | Plain dialog.
MSGBOX_INPUT | Dialog with input field.
MSGBOX_INPUT_SECRET | Dialog with secret input field.

enum WindowComponents

Components used to be loaded with the window.

Enumerator
WIN_INIT_NONE | Do not load anything except XSETTINGS code.
WIN_INIT_ICON_THEME | Load IconTheme code.
WIN_INIT_IMAGES | Call fl_register_images.
WIN_INIT_ALL | Load above.

## Function Documentation

void edelib::clear_dialog_icons | ( | void |  | ) |

Clear icon names used by IconTheme.

Deprecated:
  with MessageBox::clear_themed_icons()

bool edelib::font_cache_find | ( | const char * | face,
|  | Fl_Font & | f,
|  | int & | s,
|  | Fl_Font | df = `FL_HELVETICA`,
|  | int | ds = `12`
| ) |  |

Function that will initialize FontCache object, load database from standard cache directory and find given font name. If fails, it will set default values.

Referenced by FontCache::~FontCache().

int edelib::font_chooser | ( | const char * | name,
|  | const char * | family,
|  | int & | retsize,
|  | const char * | default_name = `0`,
|  | int | default_size = `0`
| ) |  |

font_chooser() is a dialog for choosing fonts. After this function was called, it will display a dialog with available fonts and their sizes and will wait untill user choose an action.

If user canceled it (or it was closed) it will return -1 and retsize will be set to -1.

Note that dialog returns (besides font size), integer value for font name, so it can be directly used by FLTK. Returned value is not valuable for end user (e.g. when you want to display it in some dialog), so you must use Fl::get_font_name((Fl_Font)returned_value, 0) to obtain stringized name (e.g. helvetica, courier, etc.)

Returns
  font name as integer, known to FLTK

Parameters

  name | is titlebar
  family | is family of fonts (like ISO8859-1). If given NULL, it will use ISO8859-1; if given -* will get all fonts with any encoding as long as they have normal X font names with dashes in them; if given * will get every font that exists.
  retsize | if not NULL will return selected font size
  default_name | if not NULL will select given font name
  default_size | if greater than 0 will select font size

String edelib::icon_chooser | ( | const char * | dir | ) |

icon_chooser() is a dialog containing a list of visible icons so user can choose desired one. Given directory will be scanned for known image/icon types and those will be shown.

If given path does not exists, or directory is not readable, empty dialog will be shown.

Note
  icon_chooser() will skip those icons who's size is greater than 128 pixels, width or height.

Returns
  full path to choosed icon, or empty string if directory is inaccessible, or pressed Cancel

Parameters

  dir | a path to directory that contains icons

String edelib::icon_chooser | ( | IconSizes | sz,
|  | IconContext | ctx = `ICON_CONTEXT_ANY`,
|  | bool | always_full_path = `false`,
|  | bool * | outside_theme_ret = `((void *) 0)`
| ) |  |

Load dialog with icons from currently loaded icon theme. This function will assume IconTheme::init(...) was previously called and (if not) it will show empty dialog. If user select icon inside icon theme, returned value will be icon name base: only file name without folder prefix and extension.

However, if user select icon outside icon theme, it will return full path. This is because IconTheme loader can also load icons if was given full path to icon file.

Returns
  full path to choosed icon or empty string if theme was not loaded or pressed Cancel

Parameters

  sz | is icon size
  ctx | is icon context
  always_full_path | if set, icons will not be stripped
  outside_theme_ret | if variable was given, returns true if icon was selected inside or outside icon theme

void edelib::window_center_on_screen | ( | Fl_Window * | win | ) |

Center window on screen. It will take current window width and height and, including screen size, calculate correct position and set window on it. The best way is to call this function before window show().

void edelib::window_xid_create | ( | Fl_Window * | win,
|  | void(*)(Fl_Window *) | before_map_func = `((void *) 0)`,
|  | int | background_pixel = `-1`
| ) |  |

This function is intended to be used inside inherited show() member (from Fl_Window familly) and do the same job as Fl_X::make_xid(). The main difference is that it will call before_map_func() (if given) before window is actually mapped.

This is usefull for cases when window data must exists (when FLTK creates them) so some properties can be set before mapping on the screen (actually these properties can be set after window was mapped but many window managers, panels, etc. will not be notified correctly and will not use them; of course not all properies must be set before window was mapped, but for those that must, this function is intended).

In short, if you have not clue what I was talking about, then you don't need this function at all ;-).