RADIO_MENU Class Reference

#include <sbdmenu.h>

Inheritance diagram for RADIO_MENU:

NON_LEAF_MENU_NODE MENU_NODE List of all members.

Detailed Description

The root of a radio sub menu (Command Window).

Definition at line 360 of file sbdmenu.h.

Public Member Functions

Protected Member Functions

Protected Attributes

Private Member Functions

Private Attributes


Constructor & Destructor Documentation

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

Definition at line 372 of file sbdmenu.h.

00373                           :NON_LEAF_MENU_NODE (menu_text) {
00374     }


Member Function Documentation

void RADIO_MENU::add_child ( RADIO_MENU_LEAF new_child  ) 

Add a radio button.

Definition at line 310 of file sbdmenu.cpp.

References NON_LEAF_MENU_NODE::link_child(), NON_LEAF_MENU_NODE::menu_list, on_button, and TRUE.

Referenced by build_menu(), and extend_menu().

00311                                                        {  //item to add
00312   if (menu_list.empty ()) {      //Init 1st choice ON
00313     on_button = new_child;
00314     new_child->state = TRUE;
00315   }
00316   link_child(new_child); 
00317 }

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 RADIO_MENU::event ( COMMAND_WINDOW cmd_win,
FCOORD  pt,
INT32 cmd_event_id,
char *  new_value 
) [private, virtual]

Event selection.

Reimplemented from NON_LEAF_MENU_NODE.

Definition at line 323 of file sbdmenu.cpp.

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

00328                         {
00329   MENU_L_IT it(&menu_list); 
00330 
00331   if (box.contains (pt)) {
00332     if (!on_button->box.contains (pt)) {
00333       for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
00334         it.data ()->ptr->event (cmd_win, pt, cmd_event_id, new_value);
00335         if (*cmd_event_id != UNIDENTIFIED_COMMAND) {
00336           on_button->state = FALSE;
00337           on_button = (RADIO_MENU_LEAF *) it.data ()->ptr;
00338           break;
00339         }
00340       }
00341     }
00342   }
00343 }

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(), NON_RADIO_MENU::add_child(), MENU_ROOT::add_child(), and 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 }

void RADIO_MENU::press_radio_button ( RADIO_MENU_LEAF button  ) 

Change the selected button in a radio menu.

Definition at line 349 of file sbdmenu.cpp.

References ABORT, ERRCODE::error(), FALSE, NON_LEAF_MENU_NODE::menu_list, NOT_SUBMENU_NODE, NULL, on_button, and TRUE.

Referenced by COMMAND_WINDOW::press_radio_button().

00351                                      {
00352   MENU_L_IT it(&menu_list); 
00353 
00354   if (button != on_button) {
00355     for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
00356       if (it.data ()->ptr == button)
00357         break;
00358     }
00359 
00360     if (it.cycled_list ())       //couldnt find it
00361       NOT_SUBMENU_NODE.error ("MENU::press_radio_button", ABORT, NULL);
00362 
00363     on_button->state = FALSE;
00364     button->state = TRUE;
00365     on_button = button;
00366   }
00367 }

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(), 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 add_child(), NON_LEAF_MENU_NODE::clear_children(), 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(), 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().

RADIO_MENU_LEAF* RADIO_MENU::on_button [private]

Definition at line 363 of file sbdmenu.h.

Referenced by add_child(), event(), and press_radio_button().


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