A Dialog is a list of fields which which will be displayed in a viewport and the user can edit them. Users of a Dialog initalize the list of fields, each of which must be a Dialog::Element. They then let the user edit the fields. After editing is complete, the caller iterates over the fields to see what changed. More...
#include <cursorwindow.h>
Classes | |
class | Element |
An input element in a Dialog. This is an abstract base class from which you can derive -- although there are some builtins (Ok,string, etc). The popup() function will handle some keys and some will be sent to the element's handle_key method. The draw() method may be invoked multiples times within the popup() function call. More... | |
class | Impl |
This class holds the dialog implementation data. More... | |
class | Ok |
A dialog element that does nothing -- you typically use this as the last element of dialog so that the user has one last chance after entering data in the last real field to edit his work. It has not input semantics -- except wasting time. More... | |
class | Password |
Same as String, except that the user never gets to see what he has typed in. More... | |
class | String |
A String is a dialog element that prompts the user for a character string -- providing a default value. Normal keyboard editing keys are active. The 'tab' key has special interpretation. It completes the string under the cursor. That is, if you press the tab key, the string under the cursor is treated as a partial file name fragment and you are presented with the valid completions for your selection. If there is only one valid selection, it is chosen for you automatically. More... | |
Public Types | |
enum | cmd_constant { activate, deactivate, resize } |
values that will be passed to the function call operator method. More... | |
typedef std::list< Element * > | element_list_t |
typedef element_list_t::iterator | iterator |
Public Member Functions | |
iterator | begin () |
std::string const & | completion_directory () const |
Get a reference to the 'current directory' which should be used by string elements when the user presses the tab key to activate 'tab completion' of file names. | |
Dialog (std::string title) | |
All dialogs must have a title string. | |
std::string | element_value (std::string const &name) |
Search all elements until you find the one with the specified name and return its value. If the string is not found, you get an empty string back. If you specify an invalid name, the string will be empty as well. So specify wisely... | |
iterator | end () |
void | operator() (viewport *vp, int cmd) |
Handles repaints when window sizes change. | |
Dialog & | operator+= (Element *e) |
Add elements to the dialog before poping it up. | |
bool | popup (CursorWindow *) |
Popup the dialog and let the user edit the fields. If this function returns true, the user aborted. | |
void | set_completion_directory (std::string const &s) |
Set the 'current directory' which should be observed when tab completion key strokes are interpreted by elements. This value is by default empty and. | |
void | set_first_input_field (std::string const &s) |
Set the name of the field the cursor will go on when the popup function is called. | |
~Dialog () | |
Ah, the _destructor_. Hmmm. | |
Private Attributes | |
Impl * | impl_ |
Friends | |
class | Impl |
A Dialog is a list of fields which which will be displayed in a viewport and the user can edit them. Users of a Dialog initalize the list of fields, each of which must be a Dialog::Element. They then let the user edit the fields. After editing is complete, the caller iterates over the fields to see what changed.
To allow user interaction, call 'popup()'. After the user has finished editing the last field (including, simply ok'ing its contents), the dialog automatically pops down and you can iterate over the fields.
If the user presses Esc, the dialog terminates early. The popup() function handles the user edits and returns true if the user aborts using the Esc key.
See the comments in the class Elements for a general description of a dialog's use.
Definition at line 1059 of file cursorwindow.h.
typedef std::list<Element*> element_list_t |
Definition at line 1206 of file cursorwindow.h.
typedef element_list_t::iterator iterator |
Definition at line 1207 of file cursorwindow.h.
enum cmd_constant [inherited] |
values that will be passed to the function call operator method.
activate |
means you have been activated |
deactivate |
some other viewport has taken focus |
resize |
only the size has changed |
Definition at line 793 of file cursorwindow.h.
Dialog | ( | std::string | title | ) |
All dialogs must have a title string.
Definition at line 2125 of file cursorwindow.cxx.
~Dialog | ( | ) |
Ah, the _destructor_. Hmmm.
Definition at line 2157 of file cursorwindow.cxx.
CursorWindow::Dialog::iterator begin | ( | ) |
std::string const & completion_directory | ( | ) | const |
Get a reference to the 'current directory' which should be used by string elements when the user presses the tab key to activate 'tab completion' of file names.
Definition at line 2186 of file cursorwindow.cxx.
string element_value | ( | std::string const & | name | ) |
Search all elements until you find the one with the specified name and return its value. If the string is not found, you get an empty string back. If you specify an invalid name, the string will be empty as well. So specify wisely...
Definition at line 3782 of file cursorwindow.cxx.
CursorWindow::Dialog::iterator end | ( | ) |
void operator() | ( | viewport * | vp, | |
int | cmd | |||
) | [virtual] |
Handles repaints when window sizes change.
Implements repaint_handler.
Definition at line 2986 of file cursorwindow.cxx.
CursorWindow::Dialog & operator+= | ( | Element * | e | ) |
Add elements to the dialog before poping it up.
Definition at line 2171 of file cursorwindow.cxx.
bool popup | ( | CursorWindow * | w | ) |
Popup the dialog and let the user edit the fields. If this function returns true, the user aborted.
Definition at line 2780 of file cursorwindow.cxx.
void set_completion_directory | ( | std::string const & | s | ) |
Set the 'current directory' which should be observed when tab completion key strokes are interpreted by elements. This value is by default empty and.
Definition at line 2193 of file cursorwindow.cxx.
void set_first_input_field | ( | std::string const & | s | ) |
Set the name of the field the cursor will go on when the popup function is called.
Definition at line 2089 of file cursorwindow.cxx.
friend class Impl [friend] |
Definition at line 1082 of file cursorwindow.h.
Definition at line 1087 of file cursorwindow.h.