Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Fl_Dialog Class Reference

The Fl_Dialog is standard dialog window for eFLTK. More...

#include <Fl_Dialog.h>

Inheritance diagram for Fl_Dialog:

Fl_Window Fl_Widget Fl_Data_Dialog Fl_File_Chooser List of all members.

Public Types

enum  ButtonTypes {
  BTN_OK = 1, BTN_CANCEL = 2, BTN_YES = 4, BTN_NO = 8,
  BTN_RETRY = 16, BTN_REFRESH = 32, BTN_CONFIRM = 64, BTN_IGNORE = 128,
  BTN_HELP = 256
}
 Button ID's for Fl_Dialog. More...


Public Methods

 Fl_Dialog (int w, int h, const char *label=0, Fl_Data_Source *ds=0)
 Constructs empty dialog with give size. More...

 ~Fl_Dialog ()
 Destroys dialog, frees resources.

virtual bool load_data (Fl_Data_Source *ds=0)
 Load dialog widget values from datasource. More...

virtual bool save_data (Fl_Data_Source *ds=0)
 Save dialog widget values to datasource. More...

const Fl_Variant & operator[] (const char *field_name) const
 This function is designed to access the values in widgets that have field_name() defined, after the save_data() is successfully called and dialog is closed. More...

Fl_Variant & operator[] (const char *field_name)
 This function is designed to access the values in widgets that have field_name() defined, after the save_data() is successfully called and dialog is closed. More...

int show_modal ()
 Show dialog as application modal window. More...

void submit (int button_id)
 This function emulates user button click. More...

void buttons (int buttons_mask, int default_button)
 Set buttons to dialog, For OK and CANCEL it is: buttons(Fl_Dialog::BTN_OK | Fl_Dialog::BTN_CANCEL, Fl_Dialog::BTN_OK);
Default button has double border.
More...


void enable_button (int button_id, bool enable=true)
 Enable or disable buttons in dialog. More...

void clear_buttons ()
 Removes all buttons from dialog button group.

void user_button (int button_id, Fl_String label, Fl_Pixmap *pixmap=NULL)
 Adds user-defined button to the dialog. More...

Fl_Scroll * new_scroll (const char *label)
 Add new scrollable page to dialog. More...

Fl_Group * new_page (const char *label)
 Same as new_scroll(const char *label). More...

Fl_Group * new_group (const char *label)
 Add new NON-scrollable page to dialog. More...

virtual int handle (int event)
 Internal handle. More...


Protected Methods

Fl_Widget * find_widget (const char *field_name) const
 Returns widget for given field_name, returns NULL if not found.


Static Protected Methods

void buttons_callback (Fl_Button *btn, long id)
 Internal callback for default dialog buttons.


Protected Attributes

Fl_Tabs * m_tabs

Detailed Description

The Fl_Dialog is standard dialog window for eFLTK.

Idea is to provide standard look and feel for all dialogs in application.

Definition at line 40 of file Fl_Dialog.h.


Member Enumeration Documentation

enum Fl_Dialog::ButtonTypes
 

Button ID's for Fl_Dialog.

Enumeration values:
BTN_OK  Ok button.
BTN_CANCEL  Cancel button.
BTN_YES  Yes button.
BTN_NO  No button.
BTN_RETRY  Retry button.
BTN_REFRESH  Refresh button.
BTN_CONFIRM  Confirm button.
BTN_IGNORE  Ignore button.
BTN_HELP  Help button.

Definition at line 57 of file Fl_Dialog.h.


Constructor & Destructor Documentation

Fl_Dialog::Fl_Dialog (  int    w,
int    h,
const char *    label = 0,
Fl_Data_Source *    ds = 0
) 
 

Constructs empty dialog with give size.

Parameters:
label  caption of dialog window
ds  pointer to external datasource, if NULL default is used.


Member Function Documentation

void Fl_Dialog::buttons (  int    buttons_mask,
int    default_button
) 
 

Set buttons to dialog, For OK and CANCEL it is: buttons(Fl_Dialog::BTN_OK | Fl_Dialog::BTN_CANCEL, Fl_Dialog::BTN_OK);
Default button has double border.

Parameters:
buttons_mask  bitmask for buttons
default_button  for dialog

void Fl_Dialog::enable_button (  int    button_id,
bool    enable = true
) 
 

Enable or disable buttons in dialog.

Note:
If button is disabled, user cannot click it!
Parameters:
button_id  for button to enable/disable e.g. Fl_Dialog::BTN_OK
enable  whether button should be activated or de-activated

virtual int Fl_Dialog::handle (  int    event )  [virtual]
 

Internal handle.

See also:
Fl_Widget::handle(int event)

Reimplemented from Fl_Window.

Reimplemented in Fl_File_Chooser.

virtual bool Fl_Dialog::load_data (  Fl_Data_Source *    ds = 0 )  [virtual]
 

Load dialog widget values from datasource.

Parameters:
ds  as external datasource. If ds is NULL, dialog default datasource is used.
See also:
Fl_Widget::load_data(Fl_Data_Source *ds=0) , Fl_Group::load_data(Fl_Data_Source *ds=0)

Reimplemented from Fl_Widget.

Fl_Group* Fl_Dialog::new_group (  const char *    label ) 
 

Add new NON-scrollable page to dialog.

Returns new group.

Parameters:
label  for tab

Fl_Group* Fl_Dialog::new_page (  const char *    label )  [inline]
 

Same as new_scroll(const char *label).

See also:
new_scroll(const char *label)

Definition at line 171 of file Fl_Dialog.h.

Fl_Scroll* Fl_Dialog::new_scroll (  const char *    label ) 
 

Add new scrollable page to dialog.

Returns new scroll group.

Parameters:
label  for tab

Fl_Variant& Fl_Dialog::operator[] (  const char *    field_name ) 
 

This function is designed to access the values in widgets that have field_name() defined, after the save_data() is successfully called and dialog is closed.

Returns:
Fl_Variant for field_name.
See also:
test/dialog.cpp

const Fl_Variant& Fl_Dialog::operator[] (  const char *    field_name )  const
 

This function is designed to access the values in widgets that have field_name() defined, after the save_data() is successfully called and dialog is closed.

Returns:
Fl_Variant for field_name.
See also:
test/dialog.cpp

virtual bool Fl_Dialog::save_data (  Fl_Data_Source *    ds = 0 )  [virtual]
 

Save dialog widget values to datasource.

This function is called from 'Ok' button callback. If return value is true (data saved) the dialog will be closed.

Parameters:
ds  as external datasource. If ds is NULL, dialog default datasource is used.
See also:
Fl_Widget::save_data(Fl_Data_Source *ds=0) , Fl_Group::save_data(Fl_Data_Source *ds=0)

Reimplemented from Fl_Widget.

Reimplemented in Fl_File_Chooser.

int Fl_Dialog::show_modal (    ) 
 

Show dialog as application modal window.

Returns:
ID of button pressed

void Fl_Dialog::submit (  int    button_id ) 
 

This function emulates user button click.

It is 100% same to click CANCEL button in dialog or call submit(Fl_Dialog::BTN_CANCEL);

Parameters:
button_id  for button to submit e.g. Fl_Dialog::BTN_OK

void Fl_Dialog::user_button (  int    button_id,
Fl_String    label,
Fl_Pixmap *    pixmap = NULL
) 
 

Adds user-defined button to the dialog.

The size of the pixmap should be 20x20 or less to conform with the existing dialog buttons and the rest of the system. The id of the button must be greater than BTN_HELP, and unique in the button list for the dialog. If any of these conditions is violated - the exception is thrown. This enforces the dialogs in the system to more or less standard.


The documentation for this class was generated from the following file:
Generated on Thu Jul 31 15:33:47 2003 for eFLTK by doxygen1.2.15