NON_RADIO_MENU Class Reference

#include <sbdmenu.h>

Inheritance diagram for NON_RADIO_MENU:

NON_LEAF_MENU_NODE MENU_NODE List of all members.

Detailed Description

The root of a menu tree (Command Window).

Definition at line 332 of file sbdmenu.h.

Public Member Functions

Protected Member Functions

Protected Attributes


Constructor & Destructor Documentation

NON_RADIO_MENU::NON_RADIO_MENU ( const char *  menu_text  )  [inline]

Definition at line 335 of file sbdmenu.h.

00336                           :NON_LEAF_MENU_NODE (menu_text) {
00337     }


Member Function Documentation

void NON_RADIO_MENU::add_child ( VARIABLE_MENU_LEAF new_child  )  [inline]

Definition at line 349 of file sbdmenu.h.

References NON_LEAF_MENU_NODE::link_child().

00350                                                   {
00351       link_child(new_child); 
00352     }

void NON_RADIO_MENU::add_child ( TOGGLE_MENU_LEAF new_child  )  [inline]

Definition at line 344 of file sbdmenu.h.

References NON_LEAF_MENU_NODE::link_child().

00345                                                 {
00346       link_child(new_child); 
00347     }

void NON_RADIO_MENU::add_child ( SIMPLE_MENU_LEAF new_child  )  [inline]

Definition at line 339 of file sbdmenu.h.

References NON_LEAF_MENU_NODE::link_child().

Referenced by build_main_var_menu(), and build_menu().

00340                                                 {
00341       link_child(new_child); 
00342     }

void NON_LEAF_MENU_NODE::clear_children (  )  [inline, inherited]

Definition at line 255 of file sbdmenu.h.

References NON_LEAF_MENU_NODE::menu_list.

00255                           { 
00256       menu_list.clear ();
00257     };

virtual const char* MENU_NODE::cmp_str (  )  [inline, virtual, inherited]

Reimplemented in BOOL_VAR_MENU_LEAF, DBL_VAR_MENU_LEAF, INT_VAR_MENU_LEAF, and STR_VAR_MENU_LEAF.

Definition at line 108 of file sbdmenu.h.

References MENU_NODE::name, and STRING::string().

Referenced by menu_item_sorter().

00108                                   { 
00109       return name.string ();
00110     }

void NON_LEAF_MENU_NODE::event ( COMMAND_WINDOW cmd_win,
FCOORD  pt,
INT32 cmd_event_id,
char *  new_value 
) [protected, virtual, inherited]

Event selection; caused by user interaction.

Implements MENU_NODE.

Reimplemented in MENU_ROOT, and RADIO_MENU.

Definition at line 214 of file sbdmenu.cpp.

References MENU_NODE::box, BOX::contains(), NON_LEAF_MENU_NODE::menu_list, and UNIDENTIFIED_COMMAND.

Referenced by MENU_ROOT::event().

00219                                 {
00220   MENU_L_IT it(&menu_list); 
00221 
00222   if (box.contains (pt))
00223     for (it.mark_cycle_pt ();
00224     (*cmd_event_id == UNIDENTIFIED_COMMAND) && !it.cycled_list ();
00225     it.forward ())
00226   it.data ()->ptr->event (cmd_win, pt, cmd_event_id, new_value);
00227 }

void NON_LEAF_MENU_NODE::link_child ( MENU_NODE new_child  )  [protected, inherited]

Add a child to the end of the menu list.

Definition at line 192 of file sbdmenu.cpp.

References NON_LEAF_MENU_NODE::menu_list.

Referenced by VAR_NON_RADIO_MENU::add_child(), add_child(), MENU_ROOT::add_child(), and RADIO_MENU::add_child().

00193                                                           {
00194   MENU_L_IT it(&menu_list); 
00195 
00196   it.add_to_end (new MENU_L (new_child));
00197 }

void NON_LEAF_MENU_NODE::link_child_link ( MENU_L new_child  )  [protected, inherited]

Add a child to the end of the menu list.

Definition at line 203 of file sbdmenu.cpp.

References NON_LEAF_MENU_NODE::menu_list.

Referenced by VAR_NON_RADIO_MENU::add_child().

00204                                                             {
00205   MENU_L_IT it(&menu_list); 
00206 
00207   it.add_to_end (new_child);
00208 }

INT8 NON_LEAF_MENU_NODE::max_num_chars (  )  [protected, virtual, inherited]

Calculate the max character width of any item of this and its children.

Implements MENU_NODE.

Definition at line 233 of file sbdmenu.cpp.

References STRING::length(), NON_LEAF_MENU_NODE::menu_list, and MENU_NODE::name.

Referenced by NON_LEAF_MENU_NODE::recalc_bounding_box().

00233                                        {  //calc char width
00234   MENU_L_IT it(&menu_list); 
00235   INT8 max_so_far = 0;
00236   INT8 current_char_count = 0;
00237 
00238   max_so_far = name.length ();
00239   for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
00240     current_char_count = it.data ()->ptr->max_num_chars ();
00241     if (current_char_count > max_so_far)
00242       max_so_far = current_char_count;
00243   }
00244   return max_so_far;
00245 }

void MENU_NODE::new_label ( const char *  label  )  [inline, inherited]

Definition at line 115 of file sbdmenu.h.

References MENU_NODE::name.

Referenced by COMMAND_WINDOW::replace_menu_text().

00116                                       {
00117       name = label;
00118     }

void MENU_NODE::plot ( WINDOW  window  )  [inherited]

Initialise, then call plotx to do the real work.

This means that we can initialise plotting once only REGARDLESS of what menu subclass we start plotting.

e.g., we don't always start with a MENU_ROOT.

Definition at line 79 of file sbdmenu.cpp.

References character_height, fill_color_index, GREY, INT_SOLID, interior_style, LIGHT_GREY, perimeter_color_index, MENU_NODE::plotx(), text_color_index, TRUE, and WHITE.

Referenced by COMMAND_WINDOW::plot(), COMMAND_WINDOW::replace_menu_text(), and COMMAND_WINDOW::set_toggle().

00081                       {
00082   character_height(window, menu_char_height); 
00083   interior_style(window, INT_SOLID, TRUE); 
00084   perimeter_color_index(window, LIGHT_GREY); 
00085   text_color_index(window, WHITE); 
00086   fill_color_index(window, GREY); 
00087   plotx(window); 
00088 }

void NON_LEAF_MENU_NODE::plotx ( WINDOW  window  )  [protected, virtual, inherited]

The real plot, only called internally after initialisation.

Display the menu recursively. Positions assumed already calculated.

Implements MENU_NODE.

Reimplemented in MENU_ROOT.

Definition at line 253 of file sbdmenu.cpp.

References MENU_NODE::box, draw2d, FALSE, BOX::left(), MENU_ITEM_HEIGHT, NON_LEAF_MENU_NODE::menu_list, MENU_SEPARATOR_HEIGHT, MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, move2d, MENU_NODE::name, BOX::plot(), BOX::right(), STRING::string(), text2d, and BOX::top().

00255                                 {
00256   MENU_L_IT it(&menu_list); 
00257 
00258   box.plot (window);
00259   text2d (window,
00260     box.left () + MENU_TEXT_X_OFFSET,
00261     box.top () - MENU_TEXT_Y_OFFSET, name.string (), 0, FALSE);
00262 
00263   move2d (window,
00264     box.left (),
00265     box.top () - MENU_ITEM_HEIGHT - MENU_SEPARATOR_HEIGHT / 2);
00266   draw2d (window,
00267     box.right (),
00268     box.top () - MENU_ITEM_HEIGHT - MENU_SEPARATOR_HEIGHT / 2);
00269 
00270   for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
00271     it.data ()->ptr->plotx (window);
00272 }

BOX & NON_LEAF_MENU_NODE::recalc_bounding_box ( INT16  tl_x,
INT16  tl_y 
) [protected, virtual, inherited]

Calculate the selectable areas of the menu items and hence their display positions.

Reimplemented from MENU_NODE.

Reimplemented in MENU_ROOT.

Definition at line 279 of file sbdmenu.cpp.

References BOX::bottom(), MENU_NODE::box, BOX::left(), NON_LEAF_MENU_NODE::max_num_chars(), MENU_ITEM_HEIGHT, NON_LEAF_MENU_NODE::menu_list, MENU_SEPARATOR_HEIGHT, MENU_TEXT_X_OFFSET, and BOX::width().

00282                                               {
00283   MENU_L_IT it(&menu_list); 
00284   INT16
00285     menu_width = max_num_chars () * menu_char_width + 2 * MENU_TEXT_X_OFFSET;
00286 
00287   box = BOX (ICOORD (tl_x, tl_y - MENU_ITEM_HEIGHT - MENU_SEPARATOR_HEIGHT),
00288     ICOORD (tl_x + menu_width, tl_y));
00289 
00290   for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
00291     box += it.data ()->ptr->recalc_fixed_width_bb (box.left (),
00292       box.bottom (),
00293       box.width ());
00294   }
00295   return box;
00296 }

virtual void MENU_NODE::write_vars ( FILE *  ,
BOOL8   
) [inline, virtual, inherited]

Reimplemented in MENU_ROOT, VAR_SUB_MENU, BOOL_VAR_MENU_LEAF, DBL_VAR_MENU_LEAF, INT_VAR_MENU_LEAF, STR_VAR_MENU_LEAF, and VAR_NON_RADIO_MENU.

Definition at line 120 of file sbdmenu.h.

00122                                    {  //Changed vars only?
00123                                  //default do nothing
00124     }


Member Data Documentation

BOX MENU_NODE::box [protected, inherited]

Definition at line 77 of file sbdmenu.h.

Referenced by block_space_stat(), VAR_SUB_MENU::event(), STR_VAR_MENU_LEAF::event(), INT_VAR_MENU_LEAF::event(), DBL_VAR_MENU_LEAF::event(), BOOL_VAR_MENU_LEAF::event(), VARIABLE_MENU_LEAF::event(), TOGGLE_MENU_LEAF::event(), SIMPLE_MENU_LEAF::event(), RADIO_MENU::event(), NON_LEAF_MENU_NODE::event(), NON_LEAF_MENU_NODE::plotx(), LEAF_MENU_NODE::plotx(), re_scale_and_move_bln_word(), NON_LEAF_MENU_NODE::recalc_bounding_box(), MENU_ROOT::recalc_bounding_box(), MENU_NODE::recalc_bounding_box(), MENU_NODE::recalc_fixed_width_bb(), row_space_stat(), and show_point().

MENU_L_LIST NON_LEAF_MENU_NODE::menu_list [protected, inherited]

Definition at line 257 of file sbdmenu.h.

Referenced by RADIO_MENU::add_child(), NON_LEAF_MENU_NODE::clear_children(), RADIO_MENU::event(), NON_LEAF_MENU_NODE::event(), NON_LEAF_MENU_NODE::link_child(), NON_LEAF_MENU_NODE::link_child_link(), NON_LEAF_MENU_NODE::max_num_chars(), NON_LEAF_MENU_NODE::plotx(), MENU_ROOT::plotx(), RADIO_MENU::press_radio_button(), NON_LEAF_MENU_NODE::recalc_bounding_box(), MENU_ROOT::recalc_bounding_box(), VAR_NON_RADIO_MENU::write_vars(), and MENU_ROOT::write_vars().

STRING MENU_NODE::name [protected, inherited]

Definition at line 76 of file sbdmenu.h.

Referenced by MENU_NODE::cmp_str(), VAR_SUB_MENU::event(), VARIABLE_MENU_LEAF::event(), LEAF_MENU_NODE::max_num_chars(), NON_LEAF_MENU_NODE::max_num_chars(), MENU_NODE::MENU_NODE(), MENU_NODE::new_label(), pgeditor_read_file(), NON_LEAF_MENU_NODE::plotx(), and LEAF_MENU_NODE::plotx().


The documentation for this class was generated from the following file:
Generated on Wed Feb 28 19:49:33 2007 for Tesseract by  doxygen 1.5.1