FLTK 1.4.0
Loading...
Searching...
No Matches
Fl_Scheme Class Reference

Static Public Member Functions

static int add_scheme_name (const char *name)
 Add a scheme name to the list of known schemes.
 
static const char ** names ()
 Return a list of all known scheme names.
 
static int num_schemes ()
 Return the number of currently registered schemes.
 

Member Function Documentation

◆ add_scheme_name()

int Fl_Scheme::add_scheme_name ( const char *  name)
static

Add a scheme name to the list of known schemes.

This method is public in FLTK 1.4.0 because derived classes of Fl_Scheme are not yet implemented. Thus, users implementing their own schemes can use this method to add the scheme name to the list of known schemes which is for instance used in Fl_Scheme::names().

Note
Attention! In a future version, when subclasses of Fl_Scheme will be implemented, this method will either be replaced by another protected method or it will no longer do anything (kept only for ABI reasons).

The new scheme name must consist of valid ASCII characters as described below:

  • lowercase letters 'a' - 'z'
  • numbers '0' - '9'
  • any character in "$+_." (w/o the quotes).

The name must not be longer than 12 ASCII characters (bytes). The new scheme name is added to the end of the unordered list.

Note
Call this method only once for each scheme name. If the returned value is <= 0 you should check the scheme name.

The given scheme name is copied and may be freed directly after the call to add_scheme_name().

Parameters
[in]nameNew scheme name
Returns
The new number of schemes if the name was successfully added. This is the same as the index of the scheme + 1.
Return values
0Scheme name already exists
-1Invalid character(s) in name
-2The name is too long
Since
1.4.0

◆ names()

const char ** Fl_Scheme::names ( )
static

Return a list of all known scheme names.

This list is only valid until a new scheme is added or one is removed. It is possible that scheme names are appended to the list during the runtime of the program but schemes can't be removed.

Getting the list of known schemes can be useful to populate a menu of scheme choices to let the user select a scheme. You should process the names immediately and you should never store a pointer to the list or any individual name for later reference because the location of the list can be changed (reallocated) when schemes are added.

The list of scheme names is nul-terminated.

Note
Currently (in FLTK 1.4.0) schemes can only be added to the list and not removed from the list. This may change in a later version.
Returns
List of currently known scheme names.

◆ num_schemes()

static int Fl_Scheme::num_schemes ( )
inlinestatic

Return the number of currently registered schemes.

Returns
Number of registered schemes.

The documentation for this class was generated from the following files: