Element Class Reference

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...

#include <cursorwindow.h>

Inheritance diagram for Element:
Inheritance graph
[legend]
Collaboration diagram for Element:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void draw_input_area (viewport *v, bool highlighted)=0
 Draw the input area of this field in the specified viewport. The cursor will already be positioned for you. Do not draw more than 'input_width_' characters. If the highlighted flag is passed in, the field is active, otherwise it is not.
 Element (std::string const &name, std::string const &label, int width=0)
virtual void handle_key (viewport *v, int key)=0
 Interpret keys passed to this field by popup() as the user wants to make changes. Only some keys get to the field -- data keys, and left and right arrow keys for example, but not up and down or paging keys.
virtual ~Element ()

Public Attributes

int input_width_
std::string label_
std::string name_
std::string value_

Protected Attributes

Dialogdialog_

Friends

class Dialog

Detailed Description

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.

        
          To add Elements to a dialog, do this:
         
            Dialog d("title");
         
              d += new ElementType(initializer);
              d += new ElementType(initializer);
              d += new ElementType(initializer);
         
          To allow user's to edit, then do this:
         
              if(! d.popup() )
              {
                iterate over the elements in d and extract the
                names and updated values for your use.  use begin(),
                and end() to get iterators to the elements
              }

The popup() function draws the labels and the dialog title. The element is responsible for drawing its input area -- but not violate the input_width_ which may not be the same as what is specified during the element's construction.

the popup() function handles keyboard input and distributes some keys to the element's handle_key function: data keys and left and right arrows but no other keys -- except key_dc.

Definition at line 1126 of file cursorwindow.h.


Constructor & Destructor Documentation

Element ( std::string const &  name,
std::string const &  label,
int  width = 0 
)

Definition at line 1178 of file cursorwindow.h.

virtual ~Element (  )  [virtual]

Definition at line 1186 of file cursorwindow.h.


Member Function Documentation

virtual void draw_input_area ( viewport v,
bool  highlighted 
) [pure virtual]

Draw the input area of this field in the specified viewport. The cursor will already be positioned for you. Do not draw more than 'input_width_' characters. If the highlighted flag is passed in, the field is active, otherwise it is not.

Implemented in Ok, and String.

Here is the caller graph for this function:

virtual void handle_key ( viewport v,
int  key 
) [pure virtual]

Interpret keys passed to this field by popup() as the user wants to make changes. Only some keys get to the field -- data keys, and left and right arrow keys for example, but not up and down or paging keys.

Implemented in Ok, and String.


Friends And Related Function Documentation

friend class Dialog [friend]

Definition at line 1169 of file cursorwindow.h.


Member Data Documentation

Dialog* dialog_ [protected]

Definition at line 1166 of file cursorwindow.h.

Definition at line 1176 of file cursorwindow.h.

std::string label_

Definition at line 1174 of file cursorwindow.h.

std::string name_

Definition at line 1173 of file cursorwindow.h.

std::string value_

Definition at line 1175 of file cursorwindow.h.


The documentation for this class was generated from the following file:
Generated on Wed Feb 29 22:53:35 2012 for CXXUtilities by  doxygen 1.6.3