A Selection object is a simpler version of a Dialog. It presents the user with a list of strings of which he/she is allowed to select exactly one -- or press the escape key to abort. To use a Selection object, do the following: More...
#include <cursorwindow.h>
Classes | |
class | Impl |
Instead of burdening the include/cursorwindow file with these messy implementation details, they are encapsulated in this nested type which is not implemented in the aforenamed header. More... | |
Public Types | |
enum | cmd_constant { activate, deactivate, resize } |
values that will be passed to the function call operator method. More... | |
typedef std::list< std::string > | rep_type |
actual implementation | |
Public Member Functions | |
void | operator() (viewport *vp, int cmd) |
Handles repaints when window sizes change. | |
void | operator+= (std::string const &s) |
bool | popup (CursorWindow *) |
Popup the Selection and let the user select an item or abort. If this function returns true, the user aborted. | |
Selection (std::string title) | |
All Selections must have a title string. | |
~Selection () | |
Ah, the _destructor_. Hmmm. | |
Public Attributes | |
rep_type | rep_ |
container of strings that will be presented to the user. They are your strings, dork with them to your hearts content. | |
std::string | selection_ |
the user's actual selection made during the popup call. Will be null if the user aborts. | |
Private Attributes | |
Impl * | impl_ |
private data not to be messedwith |
A Selection object is a simpler version of a Dialog. It presents the user with a list of strings of which he/she is allowed to select exactly one -- or press the escape key to abort. To use a Selection object, do the following:
Create your object then append strings to the selection using operator+= () then call popup() if popup returns false, the use the selection_ member as the value chosen.
To append a string, use operator+=. For example:
Selection s("Some title"); s += "line 1"; s += "line 2"; if(!s.popup(window)) { // use the s.selection_ variable }
Definition at line 1341 of file cursorwindow.h.
typedef std::list<std::string> rep_type |
actual implementation
Definition at line 1372 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.
Selection | ( | std::string | title | ) |
All Selections must have a title string.
Definition at line 3217 of file cursorwindow.cxx.
~Selection | ( | ) |
Ah, the _destructor_. Hmmm.
Definition at line 3233 of file cursorwindow.cxx.
void operator() | ( | viewport * | vp, | |
int | cmd | |||
) | [virtual] |
Handles repaints when window sizes change.
Implements repaint_handler.
Definition at line 3577 of file cursorwindow.cxx.
void operator+= | ( | std::string const & | s | ) |
< Append strings to rep_
Definition at line 1414 of file cursorwindow.h.
bool popup | ( | CursorWindow * | w | ) |
Popup the Selection and let the user select an item or abort. If this function returns true, the user aborted.
Draw the selection list in the center of the window and let the user pick one of the entries.
Definition at line 3258 of file cursorwindow.cxx.
private data not to be messedwith
Definition at line 1377 of file cursorwindow.h.
container of strings that will be presented to the user. They are your strings, dork with them to your hearts content.
Definition at line 1382 of file cursorwindow.h.
std::string selection_ |
the user's actual selection made during the popup call. Will be null if the user aborts.
Definition at line 1388 of file cursorwindow.h.