STR_VAR_MENU_LEAF Class Reference

#include <varblmen.h>

Inheritance diagram for STR_VAR_MENU_LEAF:

LEAF_MENU_NODE MENU_NODE List of all members.

Detailed Description

String Variable leaf.

Definition at line 133 of file varblmen.h.

Public Member Functions

Protected Member Functions

Protected Attributes

Private Member Functions

Private Attributes


Constructor & Destructor Documentation

STR_VAR_MENU_LEAF::STR_VAR_MENU_LEAF ( STRING_VARIABLE this_var  )  [inline]

Definition at line 154 of file varblmen.h.

References changed, FALSE, and var.

00156      : LEAF_MENU_NODE ("") {
00157       var = this_var;
00158       changed = FALSE;
00159     }


Member Function Documentation

const char* STR_VAR_MENU_LEAF::cmp_str (  )  [inline, private, virtual]

Reimplemented from MENU_NODE.

Definition at line 145 of file varblmen.h.

References STRING_VARIABLE::name_str(), and var.

00145                           {  //get ptr to name
00146       return var->name_str ();
00147     }

void STR_VAR_MENU_LEAF::event ( COMMAND_WINDOW cmd_win,
FCOORD  pt,
INT32 cmd_event_id,
char *  new_value 
) [private, virtual]

Event selection, toggle value

Implements MENU_NODE.

Definition at line 212 of file varblmen.cpp.

References MENU_NODE::box, changed, BOX::contains(), STRING_VARIABLE::info_str(), COMMAND_WINDOW::internal_prompt(), MAX_CHARS, COMMAND_WINDOW::msg(), STRING_VARIABLE::set_value(), TRUE, and var.

Referenced by pgeditor_main(), pgeditor_show_point(), and process_image_event().

00217                                {
00218   char ascii_new_value[MAX_CHARS + 1];
00219 
00220   if (box.contains (pt)) {
00221     sprintf (ascii_new_value, "%s", ((STRING) * var).string ());
00222     if (cmd_win->internal_prompt (var->info_str (), ascii_new_value)) {
00223       if (strcmp (ascii_new_value, ((STRING) * var).string ()) != 0) {
00224         var->set_value (ascii_new_value);
00225         cmd_win->msg ("Value changed");
00226         changed = TRUE;
00227         return;
00228       }
00229       else {
00230         cmd_win->msg ("Value unchanged");
00231         return;
00232       }
00233     }
00234   }
00235 }

INT8 LEAF_MENU_NODE::max_num_chars (  )  [inline, protected, virtual, inherited]

Implements MENU_NODE.

Definition at line 138 of file sbdmenu.h.

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

00138                          {  //char width reqd
00139       return (INT8) name.length ();
00140     }

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 LEAF_MENU_NODE::plotx ( WINDOW  window  )  [protected, virtual, inherited]

The real plot; positions assumed already calculated.

Implements MENU_NODE.

Reimplemented in TOGGLE_MENU_LEAF, and BOOL_VAR_MENU_LEAF.

Definition at line 52 of file sbdmenu.cpp.

References MENU_NODE::box, FALSE, BOX::left(), MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, MENU_NODE::name, BOX::plot(), STRING::string(), text2d, and BOX::top().

Referenced by BOOL_VAR_MENU_LEAF::plotx(), and TOGGLE_MENU_LEAF::plotx().

00054                             {
00055   box.plot (window);
00056 
00057   text2d (window,
00058     box.left () + MENU_TEXT_X_OFFSET,
00059     box.top () - MENU_TEXT_Y_OFFSET, name.string (), 0, FALSE);
00060 }

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

SHOULD NEVER BE CALLED.

Compiler needs it as this can't be a pure virtual function as not all classes provide it and the compiler will not let you do "new" on a class which inherits a pure virtual function which it cannot resolve into a real function.

Reimplemented in NON_LEAF_MENU_NODE, and MENU_ROOT.

Definition at line 99 of file sbdmenu.cpp.

References ABORT, MENU_NODE::box, ERRCODE::error(), NULL, and SHOULDNT_BE_CALLED.

00102                                      {
00103   SHOULDNT_BE_CALLED.error ("MENU_ROOT::recalc_bounding_box", ABORT, NULL);
00104   return box;
00105 }

void STR_VAR_MENU_LEAF::write_vars ( FILE *  fp,
BOOL8  changes_only 
) [private, virtual]

Save STRING config vars to file, option on only changed vars

Reimplemented from MENU_NODE.

Definition at line 241 of file varblmen.cpp.

References changed, STRING_VARIABLE::info_str(), STRING_VARIABLE::name_str(), and var.

00244                                     {
00245   if (!changes_only || changed) {
00246     fprintf (fp, "%-25s   %-12s   # %s\n",
00247       var->name_str (),
00248       ((STRING) * var).string (), var->info_str ());
00249   }
00250 }


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(), 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().

BOOL8 STR_VAR_MENU_LEAF::changed [private]

Definition at line 137 of file varblmen.h.

Referenced by event(), STR_VAR_MENU_LEAF(), and 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().

STRING_VARIABLE* STR_VAR_MENU_LEAF::var [private]

Definition at line 136 of file varblmen.h.

Referenced by cmp_str(), event(), STR_VAR_MENU_LEAF(), and write_vars().


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