fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl Class Reference

#include <Fl.H>

Collaboration diagram for Fl:

List of all members.

Public Types

enum  Fl_Option {
  OPTION_ARROW_FOCUS = 0, OPTION_VISIBLE_FOCUS, OPTION_DND_TEXT, OPTION_SHOW_TOOLTIPS,
  OPTION_LAST
}

Static Public Member Functions

static void damage (int d)
static bool option (Fl_Option opt)
 FLTK library options management.
static void option (Fl_Option opt, bool val)
 Override an option while the application is running.
static int add_awake_handler_ (Fl_Awake_Handler, void *)
static int get_awake_handler_ (Fl_Awake_Handler &, void *&)
static double version ()
static int arg (int argc, char **argv, int &i)
static int args (int argc, char **argv, int &i, Fl_Args_Handler cb=0)
static void args (int argc, char **argv)
static void display (const char *)
static int visual (int)
static int gl_visual (int, int *alist=0)
static void own_colormap ()
static void get_system_colors ()
static void foreground (uchar, uchar, uchar)
static void background (uchar, uchar, uchar)
static void background2 (uchar, uchar, uchar)
static int scheme (const char *)
static const char * scheme ()
static int reload_scheme ()
static int scrollbar_size ()
static void scrollbar_size (int W)
static int wait ()
static double wait (double time)
static int check ()
static int ready ()
static int run ()
static Fl_Widgetreadqueue ()
static void add_timeout (double t, Fl_Timeout_Handler, void *=0)
static void repeat_timeout (double t, Fl_Timeout_Handler, void *=0)
static int has_timeout (Fl_Timeout_Handler, void *=0)
static void remove_timeout (Fl_Timeout_Handler, void *=0)
static void add_check (Fl_Timeout_Handler, void *=0)
static int has_check (Fl_Timeout_Handler, void *=0)
static void remove_check (Fl_Timeout_Handler, void *=0)
static void add_fd (int fd, int when, Fl_FD_Handler cb, void *=0)
static void add_fd (int fd, Fl_FD_Handler cb, void *=0)
static void remove_fd (int, int when)
static void remove_fd (int)
static void add_idle (Fl_Idle_Handler cb, void *data=0)
static int has_idle (Fl_Idle_Handler cb, void *data=0)
static void remove_idle (Fl_Idle_Handler cb, void *data=0)
static int damage ()
static void redraw ()
static void flush ()
static Fl_Windowfirst_window ()
static void first_window (Fl_Window *)
static Fl_Windownext_window (const Fl_Window *)
static Fl_Windowmodal ()
static Fl_Windowgrab ()
static void grab (Fl_Window *)
static int event ()
static int event_x ()
static int event_y ()
static int event_x_root ()
static int event_y_root ()
static int event_dx ()
static int event_dy ()
static void get_mouse (int &, int &)
static int event_clicks ()
static void event_clicks (int i)
static int event_is_click ()
static void event_is_click (int i)
static int event_button ()
static int event_state ()
static int event_state (int i)
static int event_key ()
static int event_original_key ()
static int event_key (int key)
static int get_key (int key)
static const char * event_text ()
static int event_length ()
static int compose (int &del)
static void compose_reset ()
static int event_inside (int, int, int, int)
static int event_inside (const Fl_Widget *)
static int test_shortcut (Fl_Shortcut)
static int handle (int, Fl_Window *)
static Fl_Widgetbelowmouse ()
static void belowmouse (Fl_Widget *)
static Fl_Widgetpushed ()
static void pushed (Fl_Widget *)
static Fl_Widgetfocus ()
static void focus (Fl_Widget *)
static void add_handler (Fl_Event_Handler h)
static void remove_handler (Fl_Event_Handler h)
static void copy (const char *stuff, int len, int destination=0)
static void paste (Fl_Widget &receiver, int source)
static int dnd ()
static Fl_Widgetselection_owner ()
static void selection_owner (Fl_Widget *)
static void selection (Fl_Widget &owner, const char *, int len)
static void paste (Fl_Widget &receiver)
static int x ()
static int y ()
static int w ()
static int h ()
static int screen_count ()
static void screen_xywh (int &X, int &Y, int &W, int &H)
static void screen_xywh (int &X, int &Y, int &W, int &H, int mx, int my)
static void screen_xywh (int &X, int &Y, int &W, int &H, int n)
static void screen_dpi (float &h, float &v, int n=0)
static void set_color (Fl_Color, uchar, uchar, uchar)
static void set_color (Fl_Color i, unsigned c)
static unsigned get_color (Fl_Color i)
static void get_color (Fl_Color i, uchar &red, uchar &green, uchar &blue)
static void free_color (Fl_Color i, int overlay=0)
static const char * get_font (Fl_Font)
static const char * get_font_name (Fl_Font, int *attributes=0)
static int get_font_sizes (Fl_Font, int *&sizep)
static void set_font (Fl_Font, const char *)
static void set_font (Fl_Font, Fl_Font)
static Fl_Font set_fonts (const char *=0)
static void set_labeltype (Fl_Labeltype, Fl_Label_Draw_F *, Fl_Label_Measure_F *)
static void set_labeltype (Fl_Labeltype, Fl_Labeltype from)
static Fl_Box_Draw_Fget_boxtype (Fl_Boxtype)
static void set_boxtype (Fl_Boxtype, Fl_Box_Draw_F *, uchar, uchar, uchar, uchar)
static void set_boxtype (Fl_Boxtype, Fl_Boxtype from)
static int box_dx (Fl_Boxtype)
static int box_dy (Fl_Boxtype)
static int box_dw (Fl_Boxtype)
static int box_dh (Fl_Boxtype)
static int draw_box_active ()
static void set_abort (Fl_Abort_Handler f)
static void default_atclose (Fl_Window *, void *)
static void set_atclose (Fl_Atclose_Handler f)
static int event_shift ()
static int event_ctrl ()
static int event_command ()
static int event_alt ()
static int event_buttons ()
static int event_button1 ()
static int event_button2 ()
static int event_button3 ()
static void set_idle (Fl_Old_Idle_Handler cb)
static void grab (Fl_Window &win)
static void release ()
static void visible_focus (int v)
static int visible_focus ()
static void dnd_text_ops (int v)
static int dnd_text_ops ()
static void lock ()
static void unlock ()
static void awake (void *message=0)
static int awake (Fl_Awake_Handler cb, void *message=0)
static void * thread_message ()
static void delete_widget (Fl_Widget *w)
static void do_widget_deletion ()
static void watch_widget_pointer (Fl_Widget *&w)
static void release_widget_pointer (Fl_Widget *&w)
static void clear_widget_pointer (Fl_Widget const *w)

Static Public Attributes

static int e_number
static int e_x
static int e_y
static int e_x_root
static int e_y_root
static int e_dx
static int e_dy
static int e_state
static int e_clicks
static int e_is_click
static int e_keysym
static char * e_text = ""
static int e_length
static Fl_Widgetbelowmouse_
static Fl_Widgetpushed_
static Fl_Widgetfocus_
static int damage_
static Fl_Widgetselection_owner_
static Fl_Windowmodal_
static Fl_Windowgrab_
static int compose_state = 0
static void(* idle )()
static Fl_Awake_Handlerawake_ring_
static void ** awake_data_
static int awake_ring_size_
static int awake_ring_head_
static int awake_ring_tail_
static const char * scheme_ = (const char *)0
static Fl_Imagescheme_bg_ = (Fl_Image *)0
static int e_original_keysym
static int scrollbar_size_ = 16
static const char *const help = helpmsg+13
static void(* warning )(const char *,...) = ::warning
static void(* error )(const char *,...) = ::error
static void(* fatal )(const char *,...) = ::fatal
static void(* atclose )(Fl_Window *, void *) = default_atclose

Detailed Description

The Fl is the FLTK global (static) containing state information and global methods for the current application.

Definition at line 114 of file Fl.H.


Member Enumeration Documentation

Enumerator:
OPTION_ARROW_FOCUS 

When switched on, moving the text cursor beyond the start or end of a text in a text widget will change focus to the next text widgt. When switched off, the cursor will stop at the end of the text. Pressing Tab or Ctrl-Tab will advance the keyboard focus.

OPTION_VISIBLE_FOCUS 

If visible focus is switched on, FLTK will draw a dotted rectangle inside the widget that will receive the next keystroke. If switched off, no such indicator will be drawn and keyboard navigation is disabled.

OPTION_DND_TEXT 

If text drag-and-drop is enabled, the user can select and drag text from any text widget. If disabled, no dragging is possible, however dropping text from other applications still works.

OPTION_SHOW_TOOLTIPS 

If tooltips are enabled, hovering the mouse over a widget with a tooltip text will open a little tootip window until the mouse leaves the widget. If disabled, no tooltip is shown.

OPTION_LAST 

Definition at line 147 of file Fl.H.


Member Function Documentation

int Fl::add_awake_handler_ ( Fl_Awake_Handler  func,
void *  data 
) [static]

Adds an awake handler for use in awake().

Definition at line 84 of file Fl_lock.cxx.

References awake_data_, awake_ring_, awake_ring_head_, awake_ring_size_, awake_ring_tail_, data, and func.

Referenced by awake().

void Fl::add_check ( Fl_Timeout_Handler  cb,
void *  argp = 0 
) [static]

FLTK will call this callback just before it flushes the display and waits for events. This is different than an idle callback because it is only called once, then FLTK calls the system and tells it not to return until an event happens.

This can be used by code that wants to monitor the application's state, such as to keep a display up to date. The advantage of using a check callback is that it is called only when no events are pending. If events are coming in quickly, whole blocks of them will be processed before this is called once. This can save significant time and avoid the application falling behind the events.

Sample code:

  bool state_changed; // anything that changes the display turns this on
  
  void callback(void*) {
   if (!state_changed) return;
   state_changed = false;
   do_expensive_calculation();
   widget-&gt;redraw();
  }
  
  main() {
   Fl::add_check(callback);
   return Fl::run();
  }

Definition at line 328 of file Fl.cxx.

References Check::arg, Check::cb, free_check, and Check::next.

static void Fl::add_fd ( int  fd,
int  when,
Fl_FD_Handler  cb,
void *  = 0 
) [static]

Adds file descriptor fd to listen to.

When the fd becomes ready for reading Fl::wait() will call the callback and then return. The callback is passed the fd and the arbitrary void* argument.

The second version takes a when bitfield, with the bits FL_READ, FL_WRITE, and FL_EXCEPT defined, to indicate when the callback should be done.

There can only be one callback of each type for a file descriptor. Fl::remove_fd() gets rid of all the callbacks for a given file descriptor.

Under UNIX any file descriptor can be monitored (files, devices, pipes, sockets, etc.). Due to limitations in Microsoft Windows, WIN32 applications can only monitor sockets.

Referenced by do_shell_command(), fl_add_io_callback(), and fl_open_display().

static void Fl::add_fd ( int  fd,
Fl_FD_Handler  cb,
void *  = 0 
) [static]

See void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0)

void Fl::add_idle ( Fl_Idle_Handler  cb,
void *  data = 0 
) [static]

Adds a callback function that is called every time by Fl::wait() and also makes it act as though the timeout is zero (this makes Fl::wait() return immediately, so if it is in a loop it is called repeatedly, and thus the idle fucntion is called repeatedly). The idle function can be used to get background processing done.

You can have multiple idle callbacks. To remove an idle callback use Fl::remove_idle().

Fl::wait() and Fl::check() call idle callbacks, but Fl::ready() does not.

The idle callback can call any FLTK functions, including Fl::wait(), Fl::check(), and Fl::ready().

FLTK will not recursively call the idle callback.

Definition at line 69 of file Fl_add_idle.cxx.

References idle_cb::cb, data, idle_cb::data, idle_cb::next, and set_idle().

void Fl::add_timeout ( double  t,
Fl_Timeout_Handler  cb,
void *  argp = 0 
) [static]

Adds a one-shot timeout callback. The function will be called by Fl::wait() at t seconds after this function is called. The optional void* argument is passed to the callback.

You can have multiple timeout callbacks. To remove a timeout callback use Fl::remove_timeout().

If you need more accurate, repeated timeouts, use Fl::repeat_timeout() to reschedule the subsequent timeouts.

The following code will print "TICK" each second on stdout with a fair degree of accuracy:

     void callback(void*) {
       puts("TICK");
       Fl::repeat_timeout(1.0, callback);
     }
  
     int main() {
       Fl::add_timeout(1.0, callback);
       return Fl::run();
     }

Definition at line 228 of file Fl.cxx.

References repeat_timeout().

Referenced by Fl_Tooltip::enter_area(), fl_add_timeout(), Fl_Free::Fl_Free(), glutTimerFunc(), Fl_Text_Display::handle(), Fl_Scrollbar::handle(), Fl_Repeat_Button::handle(), Fl_Counter::handle(), set_modflag(), Fl_Button::simulate_key_action(), Fl_Timer::suspended(), and Fl_Timer::value().

int Fl::arg ( int  argc,
char **  argv,
int &  i 
) [static]

Parse a single switch from argv, starting at word i. Returns the number of words eaten (1 or 2, or 0 if it is not recognized) and adds the same value to i.

This is the default argument handler used internally by Fl::args(...), but you can use this function if you prefer to step through the standard FLTK switches yourself.

All standard FLTK switches except -bg2 may be abbreviated to just one letter and case is ignored:

  • -bg color or -background color
    Sets the background color using Fl::background().
  • -bg2 color or -background2 color
    Sets the secondary background color using Fl::background2().
  • -display host:n.n
    Sets the X display to use; this option is silently ignored under WIN32 and MacOS.
  • -dnd and -nodnd
    Enables or disables drag and drop text operations using Fl::dnd_text_ops().
  • -fg color or -foreground color
    Sets the foreground color using Fl::foreground().
  • -geometry WxH+X+Y
    Sets the initial window position and size according to the standard X geometry string.
  • -kbd and -nokbd
    Enables or disables visible keyboard focus for non-text widgets using Fl::visible_focus().

If your program requires other switches in addition to the standard FLTK options, you will need to pass your own argument handler to Fl::args(int,char**,int&,Fl_Args_Handler) explicitly.

Definition at line 139 of file Fl_arg.cxx.

References Fl_Tooltip::disable(), display(), dnd_text_ops(), Fl_Tooltip::enable(), flags, i, scheme(), and visible_focus().

Referenced by args(), and fl_initialize().

void Fl::args ( int  argc,
char **  argv 
) [static]

Parse all command line switches matching standard FLTK options only.

It parses all the switches, and if any are not recognized it calls Fl::abort(Fl::help), i.e. unlike the long form, an unrecognized switch generates an error message and causes the program to exit.

Definition at line 406 of file Fl_arg.cxx.

References args(), error, and i.

int Fl::args ( int  argc,
char **  argv,
int &  i,
Fl_Args_Handler  cb = 0 
) [static]

Parse command line switches using the cb argument handler.

Returns 0 on error, or the number of words processed.

FLTK provides this as an entirely optional command line switch parser. You don't have to call it if you don't want to. Everything it can do can be done with other calls to FLTK.

To use the switch parser, call Fl::args(...) near the start of your program. This does not open the display, instead switches that need the display open are stashed into static variables. Then you must display your first window by calling window->show(argc,argv), which will do anything stored in the static variables.

Providing an argument handler callback cb lets you define your own switches. It is called with the same argc and argv, and with i set to the index of the switch to be processed. The cb handler should return zero if the switch is unrecognized, and not change i. It should return non-zero to indicate the number of words processed if the switch is recognized, i.e. 1 for just the switch, and more than 1 for the switch plus associated parameters. i should be incremented by the same amount.

The cb handler is called before any other tests, so you can also override any standard FLTK switch (this is why FLTK can use very short switches instead of the long ones all other toolkits force you to use). See Fl::arg() for descriptions of the standard switches.

On return i is set to the index of the first non-switch. This is either:

  • The first word that does not start with '-'.
  • The word '-' (used by many programs to name stdin as a file)
  • The first unrecognized switch (return value is 0).
  • argc

The return value is i unless an unrecognized switch is found, in which case it is zero. If your program takes no arguments other than switches you should produce an error if the return value is less than argc.

A usage string is displayed if Fl::args() detects an invalid argument on the command-line. You can change the message by setting the Fl::help pointer.

A very simple command line parser can be found in examples/howto-parse-args.cxx

The simpler Fl::args(int argc, char **argv) form is useful if your program does not have command line switches of its own.

Definition at line 287 of file Fl_arg.cxx.

References arg(), and i.

Referenced by args(), main(), and Fl_Window::show().

void Fl::background ( uchar  r,
uchar  g,
uchar  b 
) [static]

Changes fl_color(FL_BACKGROUND_COLOR) to the given color, and changes the gray ramp from 32 to 56 to black to white. These are the colors used as backgrounds by almost all widgets and used to draw the edges of all the boxtypes.

Definition at line 56 of file Fl_get_system_colors.cxx.

References FL_GRAY, fl_gray_ramp(), FL_GRAY_RAMP, FL_NUM_GRAY, i, and set_color().

Referenced by get_system_colors().

void Fl::background2 ( uchar  r,
uchar  g,
uchar  b 
) [static]

Changes the alternative background color. This color is used as a background by Fl_Input and other text widgets.

This call may change fl_color(FL_FOREGROUND_COLOR) if it does not provide sufficient contrast to FL_BACKGROUND2_COLOR.

Definition at line 87 of file Fl_get_system_colors.cxx.

References FL_BACKGROUND2_COLOR, fl_contrast(), FL_FOREGROUND_COLOR, get_color(), and set_color().

Referenced by get_system_colors().

int Fl::box_dy ( Fl_Boxtype  t) [static]

Returns the Y offset for the given boxtype.

These functions return the offset values necessary for a given boxtype, useful for computing the area inside a box's borders, to prevent overdrawing the borders.

For instance, in the case of a boxtype like FL_DOWN_BOX where the border width might be 2 pixels all around, the above functions would return 2, 2, 4, and 4 for box_dx, box_dy, box_dw, and box_dh respectively.

An example to compute the area inside a widget's box():

         int X = yourwidget->x() + Fl::box_dx(yourwidget->box());
         int Y = yourwidget->y() + Fl::box_dy(yourwidget->box());
         int W = yourwidget->w() - Fl::box_dw(yourwidget->box());
         int H = yourwidget->h() - Fl::box_dh(yourwidget->box());

These functions are mainly useful in the draw() code for deriving custom widgets, where one wants to avoid drawing over the widget's own border box().

Definition at line 344 of file fl_boxtype.cxx.

Referenced by Fl_Scroll::bbox(), Fl_Browser_::bbox(), Fl_Window::draw(), Fl_Value_Slider::draw(), Fl_Value_Output::draw(), Fl_Tree::draw(), Fl_Slider::draw(), Fl_Scrollbar::draw(), Fl_Roller::draw(), Fl_Progress::draw(), Fl_Pack::draw(), Fl_Menu_Bar::draw(), Fl_Input::draw(), Fl_File_Input::draw(), Fl_Dial::draw(), Flcc_ValueBox::draw(), Flcc_HueBox::draw(), Fl_Choice::draw(), Fl_Chart::draw(), Fl_Group::draw_children(), Fl_Widget::draw_focus(), Fl_Widget::draw_label(), Fl_Input_::drawtext(), Fl_Value_Slider::handle(), Fl_Slider::handle(), Fl_Input::handle(), Flcc_ValueBox::handle(), Flcc_HueBox::handle(), menuwindow::menuwindow(), Fl_Table::recalc_dimensions(), Fl_Tabs::redraw_tabs(), Fl_Text_Display::resize(), and Fl_Help_View::resize().

int Fl::check ( ) [static]

Same as Fl::wait(0). Calling this during a big calculation will keep the screen up to date and the interface responsive:

  while (!calculation_done()) {
  calculate();
  Fl::check();
  if (user_hit_abort_button()) break;
  }

The returns non-zero if any windows are displayed, and 0 if no windows are displayed (this is likely to change in future versions of FLTK).

Definition at line 574 of file Fl.cxx.

References Fl_X::first, and wait().

Referenced by fl_check_forms(), print_cb(), Fl_Paged_Device::print_window_part(), and Fl_File_Chooser::rescan_keep_filename().

static void Fl::damage ( int  d) [inline, static]

If true then flush() will do something.

Definition at line 144 of file Fl.H.

static int Fl::damage ( ) [inline, static]

If true then flush() will do something.

Definition at line 360 of file Fl.H.

Referenced by fl_wait(), and flush().

void Fl::display ( const char *  d) [static]

Sets the X display to use for all windows. Actually this just sets the environment variable $DISPLAY to the passed string, so this only works before you show() the first window or otherwise open the display, and does nothing useful under WIN32.

Definition at line 41 of file Fl_display.cxx.

References strlcat, and void().

Referenced by arg().

static void Fl::dnd_text_ops ( int  v) [inline, static]

Gets or sets whether drag and drop text operations are supported. This specifically affects whether selected text can be dragged from text fields or dragged within a text field as a cut/paste shortcut.

Definition at line 958 of file Fl.H.

static int Fl::dnd_text_ops ( ) [inline, static]

Gets or sets whether drag and drop text operations are supported. This specifically affects whether selected text can be dragged from text fields or dragged within a text field as a cut/paste shortcut.

Definition at line 965 of file Fl.H.

Referenced by arg(), Fl_Text_Display::handle(), Fl_Input::handle(), and Fl_Window::show().

int Fl::draw_box_active ( ) [static]

Determines if the current draw box is active or inactive. If inactive, the box color is changed by the inactive color.

Definition at line 64 of file fl_boxtype.cxx.

Referenced by shade_color().

void Fl::flush ( ) [static]

Causes all the windows that need it to be redrawn and graphics forced out through the pipes.

This is what wait() does before looking for events.

Note: in multi-threaded applications you should only call Fl::flush() from the main thread. If a child thread needs to trigger a redraw event, it should instead call Fl::awake() to get the main thread to process the event queue.

Definition at line 691 of file Fl.cxx.

References CGContextFlush, Fl_Widget::clear_damage(), Fl_Widget::damage(), damage(), damage_, fl_display, fl_gc, i, Fl_Widget::visible_r(), and XDestroyRegion().

Referenced by carbonTextHandler(), fl_draw(), fl_wait(), Fl_File_Chooser::show(), and wait().

void Fl::foreground ( uchar  r,
uchar  g,
uchar  b 
) [static]

Changes fl_color(FL_FOREGROUND_COLOR).

Definition at line 75 of file Fl_get_system_colors.cxx.

References FL_FOREGROUND_COLOR, and set_color().

Referenced by get_system_colors().

int Fl::get_awake_handler_ ( Fl_Awake_Handler func,
void *&  data 
) [static]

Gets the last stored awake handler for use in awake().

Definition at line 107 of file Fl_lock.cxx.

References awake_data_, awake_ring_, awake_ring_head_, awake_ring_size_, and awake_ring_tail_.

Referenced by fl_wait().

Fl_Box_Draw_F * Fl::get_boxtype ( Fl_Boxtype  t) [static]

Gets the current box drawing function for the specified box type.

Definition at line 371 of file fl_boxtype.cxx.

void Fl::get_system_colors ( ) [static]

Read the user preference colors from the system and use them to call Fl::foreground(), Fl::background(), and Fl::background2(). This is done by Fl_Window::show(argc,argv) before applying the -fg and -bg switches.

On X this reads some common values from the Xdefaults database. KDE users can set these values by running the "krdb" program, and newer versions of KDE set this automatically if you check the "apply style to other X programs" switch in their control panel.

Definition at line 231 of file Fl_get_system_colors.cxx.

References background(), background2(), first_window(), fl_bg, fl_bg2, fl_fg, fl_open_display(), foreground(), and Fl_Window::xclass().

Referenced by Fl_Window::show().

static int Fl::gl_visual ( int  ,
int *  alist = 0 
) [static]

This does the same thing as Fl::visual(int) but also requires OpenGL drawing to work. This must be done if you want to draw in normal windows with OpenGL with gl_start() and gl_end(). It may be useful to call this so your X windows use the same visual as an Fl_Gl_Window, which on some servers will reduce colormap flashing.

See Fl_Gl_Window for a list of additional values for the argument.

static void Fl::grab ( Fl_Window win) [inline, static]

See Fl_Window* grab()

Definition at line 931 of file Fl.H.

References grab().

Referenced by grab().

int Fl::has_check ( Fl_Timeout_Handler  cb,
void *  argp = 0 
) [static]

Returns 1 if the check exists and has not been called yet, 0 otherwise.

Definition at line 360 of file Fl.cxx.

References Check::arg, Check::cb, and Check::next.

int Fl::has_idle ( Fl_Idle_Handler  cb,
void *  data = 0 
) [static]

Returns true if the specified idle callback is currently installed.

Definition at line 89 of file Fl_add_idle.cxx.

References idle_cb::cb, idle_cb::data, and idle_cb::next.

int Fl::has_timeout ( Fl_Timeout_Handler  cb,
void *  argp = 0 
) [static]

Returns true if the timeout exists and has not been called yet.

Definition at line 255 of file Fl.cxx.

References Timeout::next.

bool Fl::option ( Fl_Option  opt) [static]

FLTK library options management.

This function needs to be documented in more detail. It can be used for more optional settings, such as using a native file chooser instead of the FLTK one wherever possible, disabeling tooltips, disabeling visible focus, disabeling FLTK file chooser preview, etc. .

There should be a command line option interface.

There should be an application that manages options system wide, per user, and per application.

Parameters:
optwhich option
Returns:
true or false
See also:
Fl_Option

Definition at line 1768 of file Fl.cxx.

References Fl_Preferences::get(), OPTION_ARROW_FOCUS, OPTION_DND_TEXT, OPTION_LAST, OPTION_SHOW_TOOLTIPS, OPTION_VISIBLE_FOCUS, Fl_Preferences::SYSTEM, and Fl_Preferences::USER.

Referenced by Fl_Tooltip::enable(), Fl_Tooltip::enabled(), make_global_settings_window(), and option().

void Fl::option ( Fl_Option  opt,
bool  val 
) [static]

Override an option while the application is running.

This function does not change any system or user settings.

Parameters:
optwhich option
valset to true or false
See also:
Fl_Option

Definition at line 1823 of file Fl.cxx.

References option(), OPTION_LAST, and val.

void Fl::own_colormap ( ) [static]

Makes FLTK use its own colormap. This may make FLTK display better and will reduce conflicts with other programs that want lots of colors. However the colors may flash as you move the cursor between windows.

This does nothing if the current visual is not colormapped.

Definition at line 60 of file Fl_own_colormap.cxx.

References fl_colormap, fl_display, fl_open_display(), fl_screen, fl_visual, and i.

Fl_Widget * Fl::readqueue ( ) [static]

All Fl_Widgets that don't have a callback defined use a default callback that puts a pointer to the widget in this queue, and this method reads the oldest widget out of this queue.

Definition at line 70 of file Fl_Widget.cxx.

References obj_tail, and QUEUE_SIZE.

Referenced by fl_check_forms(), fl_do_forms(), Fl_Class_Type::open(), Fl_Comment_Type::open(), Fl_DeclBlock_Type::open(), Fl_Data_Type::open(), Fl_Decl_Type::open(), Fl_CodeBlock_Type::open(), Fl_Code_Type::open(), and Fl_Function_Type::open().

int Fl::ready ( ) [static]

This is similar to Fl::check() except this does not call Fl::flush() or any callbacks, which is useful if your program is in a state where such callbacks are illegal. This returns true if Fl::check() would do anything (it will continue to return true until you call Fl::check() or Fl::wait()).

  while (!calculation_done()) {
  calculate();
  if (Fl::ready()) {
    do_expensive_cleanup();
    Fl::check();
    if (user_hit_abort_button()) break;
  }
  }

Definition at line 597 of file Fl.cxx.

References fl_ready(), and Timeout::time.

void Fl::redraw ( ) [static]

Redraws all widgets.

Definition at line 676 of file Fl.cxx.

References i.

static void Fl::release ( ) [inline, static]

Releases the current grabbed window, equals grab(0).

Deprecated:
Use Fl::grab(0) instead.
See also:
Fl_Window* grab()

Definition at line 935 of file Fl.H.

void Fl::remove_check ( Fl_Timeout_Handler  cb,
void *  argp = 0 
) [static]

Removes a check callback. It is harmless to remove a check callback that no longer exists.

Definition at line 343 of file Fl.cxx.

References Check::arg, Check::cb, free_check, and Check::next.

void Fl::remove_fd ( int  n,
int  when 
) [static]

Removes a file descriptor handler.

Definition at line 471 of file Fl_mac.cxx.

References DataReady::RemoveFD().

Referenced by fl_close_display(), fl_remove_io_callback(), and shell_pipe_cb().

void Fl::remove_fd ( int  n) [static]

Removes a file descriptor handler.

Definition at line 474 of file Fl_mac.cxx.

References DataReady::RemoveFD().

void Fl::remove_idle ( Fl_Idle_Handler  cb,
void *  data = 0 
) [static]

Removes the specified idle callback, if it is installed.

Definition at line 101 of file Fl_add_idle.cxx.

References idle_cb::cb, idle_cb::data, idle_cb::next, and set_idle().

void Fl::repeat_timeout ( double  t,
Fl_Timeout_Handler  cb,
void *  argp = 0 
) [static]

Repeats a timeout callback from the expiration of the previous timeout, allowing for more accurate timing. You may only call this method inside a timeout callback.

The following code will print "TICK" each second on stdout with a fair degree of accuracy:

     void callback(void*) {
       puts("TICK");
       Fl::repeat_timeout(1.0, callback);
     }
  
     int main() {
       Fl::add_timeout(1.0, callback);
       return Fl::run();
     }

Definition at line 233 of file Fl.cxx.

References Timeout::arg, Timeout::cb, free_timeout, free_timeout_count, Timeout::next, and Timeout::time.

Referenced by add_timeout(), and Fl_Text_Display::scroll_timer_cb().

int Fl::run ( ) [static]

As long as any windows are displayed this calls Fl::wait() repeatedly. When all the windows are closed it returns zero (supposedly it would return non-zero on any errors, but FLTK calls exit directly for these). A normal program will end main() with return Fl::run();.

Definition at line 483 of file Fl.cxx.

References Fl_X::first, FOREVER, and wait().

Referenced by main().

int Fl::scheme ( const char *  s) [static]

Gets or sets the current widget scheme. NULL will use the scheme defined in the FLTK_SCHEME environment variable or the scheme resource under X11. Otherwise, any of the following schemes can be used:

  • "none" - This is the default look-n-feel which resembles old Windows (95/98/Me/NT/2000) and old GTK/KDE

  • "plastic" - This scheme is inspired by the Aqua user interface on Mac OS X

  • "gtk+" - This scheme is inspired by the Red Hat Bluecurve theme

Definition at line 288 of file Fl_get_system_colors.cxx.

References first_window(), fl_display, fl_open_display(), key, NULL, reload_scheme(), scheme_, strlcat, and Fl_Window::xclass().

int Fl::scrollbar_size ( ) [static]

Gets the default scrollbar size used by Fl_Browser_, Fl_Help_View, Fl_Scroll, and Fl_Text_Display widgets.

Returns:
The default size for widget scrollbars, in pixels.

Definition at line 124 of file Fl.cxx.

References scrollbar_size_.

Referenced by Fl_Text_Display::Fl_Text_Display(), reload_scheme(), Fl_Tree::scrollbar_size(), and Fl_Browser_::scrollbar_width().

void Fl::scrollbar_size ( int  W) [static]

Sets the default scrollbar size that is used by the Fl_Browser_, Fl_Help_View, Fl_Scroll, and Fl_Text_Display widgets.

Parameters:
[in]WThe new default size for widget scrollbars, in pixels.

Definition at line 136 of file Fl.cxx.

References scrollbar_size_.

void Fl::set_boxtype ( Fl_Boxtype  t,
Fl_Box_Draw_F f,
uchar  a,
uchar  b,
uchar  c,
uchar  d 
) [static]

Sets the function to call to draw a specific boxtype.

Definition at line 375 of file fl_boxtype.cxx.

References b, and f.

Referenced by reload_scheme().

void Fl::set_boxtype ( Fl_Boxtype  to,
Fl_Boxtype  from 
) [static]

Copies the from boxtype.

Definition at line 385 of file fl_boxtype.cxx.

static void Fl::set_idle ( Fl_Old_Idle_Handler  cb) [inline, static]

Sets an idle callback.

Deprecated:
This method is obsolete - use the add_idle() method instead.

Definition at line 929 of file Fl.H.

Referenced by add_idle(), fl_set_idle_callback(), and remove_idle().

void Fl::set_labeltype ( Fl_Labeltype  t,
Fl_Label_Draw_F f,
Fl_Label_Measure_F m 
) [static]

Sets the functions to call to draw and measure a specific labeltype.

Definition at line 78 of file fl_labeltype.cxx.

References f, and m.

Referenced by fl_define_FL_EMBOSSED_LABEL(), fl_define_FL_ENGRAVED_LABEL(), fl_define_FL_SHADOW_LABEL(), Fl_Pixmap::label(), Fl_Multi_Label::label(), Fl_RGB_Image::label(), Fl_Image::label(), Fl_File_Icon::label(), and Fl_Bitmap::label().

static void Fl::set_labeltype ( Fl_Labeltype  ,
Fl_Labeltype  from 
) [static]

Sets the functions to call to draw and measure a specific labeltype.

double Fl::version ( ) [static]

Returns the compiled-in value of the FL_VERSION constant. This is useful for checking the version of a shared library.

Definition at line 112 of file Fl.cxx.

References FL_VERSION.

static int Fl::visible_focus ( ) [inline, static]
static void Fl::visible_focus ( int  v) [inline, static]

Gets or sets the visible keyboard focus on buttons and other non-text widgets. The default mode is to enable keyboard focus for all widgets.

Definition at line 943 of file Fl.H.

int Fl::visual ( int  flags) [static]

Selects a visual so that your graphics are drawn correctly. This is only allowed before you call show() on any windows. This does nothing if the default visual satisfies the capabilities, or if no visual satisfies the capabilities, or on systems that don't have such brain-dead notions.

Only the following combinations do anything useful:

  • Fl::visual(FL_RGB)
    Full/true color (if there are several depths FLTK chooses the largest). Do this if you use fl_draw_image for much better (non-dithered) output.
     
  • Fl::visual(FL_RGB8)
    Full color with at least 24 bits of color. FL_RGB will always pick this if available, but if not it will happily return a less-than-24 bit deep visual. This call fails if 24 bits are not available.
     
  • Fl::visual(FL_DOUBLE|FL_INDEX)
    Hardware double buffering. Call this if you are going to use Fl_Double_Window.
     
  • Fl::visual(FL_DOUBLE|FL_RGB)
  • Fl::visual(FL_DOUBLE|FL_RGB8)
    Hardware double buffering and full color.

This returns true if the system has the capabilities by default or FLTK suceeded in turing them on. Your program will still work even if this returns false (it just won't look as good).

Definition at line 127 of file Fl_visual.cxx.

References fl_colormap, fl_display, fl_open_display(), fl_screen, fl_visual, i, and num.

Referenced by fl_open_display(), and main().

int Fl::wait ( ) [static]

Waits until "something happens" and then returns. Call this repeatedly to "run" your program. You can also check what happened each time after this returns, which is quite useful for managing program state.

What this really does is call all idle callbacks, all elapsed timeouts, call Fl::flush() to get the screen to update, and then wait some time (zero if there are idle callbacks, the shortest of all pending timeouts, or infinity), for any events from the user or any Fl::add_fd() callbacks. It then handles the events and calls the callbacks and then returns.

The return value of the first form is non-zero if there are any visible windows - this may change in future versions of FLTK.

The second form waits a maximum of time seconds. It can return much sooner if something happens.

The return value is positive if an event or fd happens before the time elapsed. It is zero if nothing happens (on Win32 this will only return zero if time is zero). It is negative if an error occurs (this will happen on UNIX if a signal happens).

Definition at line 552 of file Fl.cxx.

References Fl_X::first, and FOREVER.

Referenced by check(), Fl_Tabs_Type::click_test(), do_shell_command(), Fl_Color_Chooser::fl_color_chooser(), Fl_File_Chooser::fl_dir_chooser(), fl_do_forms(), Fl_File_Chooser::fl_file_chooser(), main(), new_cb(), Fl_Class_Type::open(), Fl_Comment_Type::open(), Fl_DeclBlock_Type::open(), Fl_Data_Type::open(), Fl_Decl_Type::open(), Fl_CodeBlock_Type::open(), Fl_Code_Type::open(), Fl_Function_Type::open(), Fl_Menu_Item::pulldown(), ColorMenu::run(), run(), save_template_cb(), Fl_Native_File_Chooser::show(), and Fl_PostScript_Printer::start_job().

double Fl::wait ( double  time_to_wait) [static]

Member Data Documentation

void ** Fl::awake_data_ [static]

Definition at line 207 of file Fl.H.

Referenced by add_awake_handler_(), and get_awake_handler_().

Definition at line 206 of file Fl.H.

Referenced by add_awake_handler_(), and get_awake_handler_().

int Fl::awake_ring_head_ [static]

Definition at line 209 of file Fl.H.

Referenced by add_awake_handler_(), and get_awake_handler_().

int Fl::awake_ring_size_ [static]

Definition at line 208 of file Fl.H.

Referenced by add_awake_handler_(), and get_awake_handler_().

int Fl::awake_ring_tail_ [static]

Definition at line 210 of file Fl.H.

Referenced by add_awake_handler_(), and get_awake_handler_().

Definition at line 132 of file Fl.H.

Referenced by belowmouse().

int Fl::compose_state = 0 [static]

Definition at line 139 of file Fl.H.

Referenced by compose().

int Fl::damage_ [static]

Definition at line 135 of file Fl.H.

Referenced by flush().

int Fl::e_clicks [static]

Definition at line 127 of file Fl.H.

int Fl::e_dx [static]

Definition at line 124 of file Fl.H.

Referenced by Fl_Scrollbar::handle().

int Fl::e_dy [static]

Definition at line 125 of file Fl.H.

Referenced by fl_handle(), and Fl_Scrollbar::handle().

int Fl::e_is_click [static]

Definition at line 128 of file Fl.H.

Referenced by fl_handle().

int Fl::e_keysym [static]

Definition at line 129 of file Fl.H.

Referenced by carbonKeyboardHandler(), compose(), fl_fix_focus(), and fl_handle().

int Fl::e_length [static]
int Fl::e_original_keysym [static]

Definition at line 214 of file Fl.H.

Referenced by carbonKeyboardHandler(), and fl_handle().

int Fl::e_state [static]

Definition at line 126 of file Fl.H.

Referenced by carbonKeyboardHandler(), compose(), and fl_handle().

char * Fl::e_text = "" [static]
Fl_Widget * Fl::focus_ [static]

Definition at line 134 of file Fl.H.

Referenced by focus(), and Fl_Group::handle().

Fl_Window * Fl::grab_ [static]

Definition at line 138 of file Fl.H.

Referenced by grab().

const char *const Fl::help = helpmsg+13 [static]

Usage string displayed if Fl::args() detects an invalid argument. This may be changed to point to customized text at run-time.

Definition at line 235 of file Fl.H.

Referenced by main().

void(* Fl::idle)() [static]

The currently executing idle callback function: DO NOT USE THIS DIRECTLY!

This is now used as part of a higher level system allowing multiple idle callback functions to be called.

See also:
add_idle(), remove_idle()

Definition at line 203 of file Fl.H.

Referenced by fl_wait(), and wait().

Fl_Window * Fl::modal_ [static]

Definition at line 137 of file Fl.H.

Referenced by Fl_X::make(), and Fl_X::set_xid().

Fl_Widget * Fl::pushed_ [static]

Definition at line 133 of file Fl.H.

Referenced by handle(), and pushed().

const char * Fl::scheme_ = (const char *)0 [static]

Definition at line 211 of file Fl.H.

Referenced by Fl_Slider::draw(), Fl_Scrollbar::draw(), reload_scheme(), and scheme().

int Fl::scrollbar_size_ = 16 [static]

Definition at line 215 of file Fl.H.

Referenced by scrollbar_size().

Definition at line 136 of file Fl.H.

Referenced by selection(), and selection_owner().


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