proj home

Files   Classes   Functions   Hierarchy  

menusystem Class Reference

Display a primitive menu and process users keyboard input in either immediate or deferred mode. More...

#include <menusystem.h>

Inheritance diagram for menusystem:
Collaboration diagram for menusystem:

List of all members.

Public Member Functions

void Xpush ()
 Push the current position onto the stack.
void Xpop ()
 Pop the top position of the stack making it the new position.
void fontcolorenable ()
 Turn on transparent fontcolor by writing to graphics to drawpre and drawpost.
 menusystem (menusystem *current_, menusystem *parent_, bool readmodeimmediate_, point2< GLint > const &X0_, GLint const columnchange_)
 Constructor with tree links, mode status, initial position and line height.
 menusystem (bool readmodeimmediate_, point2< GLint > const &X0_, GLint const columnchange_)
 Constructor with minimal configuration, the client can configure other items separately.
 menusystem (point2< GLint > const &X0_, GLint const columnchange_)
 ~menusystem ()
 Assumes pointers allocated from new and cleans up by calling delete.
void draw ()
 Designed to display the current menusystem.
void draw (menusystem *x)
 Temporarily make x current and draw.
void drawparent ()
 Draw the parent menu.
void drawparents ()
 Recursively draw the parents menues.
void drawparentsnested ()
 Parent menu can enable setting as submenus inherit parents menu's scope.
void read (charc ch)
 Characters are sent to this object, the processing is forwarded to reading in immediate or buffered mode.
void reset ()
 Set the current position to X0.
void clear ()
 Clears the display, returning to starting position.
void addnewline ()
 Return to the start of the next line.
void addnewline (uintc newlines)
 Add multiple blank lines.
void addfont10 (stringc &s, point2< GLint > const &X2)
 Write a 10 point string to specified position.
void addfont10 (stringc &s, uintc newlines=0)
 Write a 10 point string to the current position X.
void addfont10 (uint &index, stringc &s, uintc newlines=0)
 Write a 10 point string and have a index to it.
void addfont12 (stringc &s, point2< GLint > const &X2)
 Write a 12 point string to specified position.
void addfont12 (stringc &s, uintc newlines=0)
 Write a 12 point string to the current position X.
void addfont12 (uint &index, stringc &s, uintc newlines=0)
 Write a 12 point string and have a index to it.
void addfont10start (stringc &s, uintc newlines=0)
 The new lines call scrolldown first.
void addfont12start (stringc &s, uintc newlines=0)
 The new lines call scrolldown first.
void addfont10paragraph (stringc &s, uintc len, uintc newlines=0)
 Interpret the string as a paragraph with minimum len character width.
void addfont10paragraphstart (stringc &s, uintc len, uintc newlines=0)
 At a paragraph to the start of the display.
void addfont10blockstart (stringc &s, uintc newlines=0)
void addfont10paragraphs (stringc &s, uintc len, stringc &token="\n")
 Split the string on the token.
void scrolldown ()
 Scroll all graphics down one colum.
void scrollup ()
 Scroll all graphics up one colum.
void scroll (GLint const k)
 Scroll all graphics down for positive k.
void currentset ()
 Set this menu to be the current menu to be viewed.
void transfercontroltoroot ()
 Change the current menu to the root menu.
void transfercontroltoparent ()
 Change the current menu to the parent.
void transfercontroltosubmenu (uint k)
 Change the current menu to the k'th submenu.
void addsubmenu (menusystem *submenu)
 Add a submenu, linking it to this menu.

Public Attributes

menusystemcurrent
 The current menu selected.
menusystemparent
 The previous or parent menu.
vector< menusystem * > submenues
 The sub menues, each has been allocated from new operator.
bool readmodeimmediate
 If true the keyboard events are processed in the immediate mode, else the input is processed in the deferred mode.
gobjContainer visibleGraphics
 The menu's visible graphics.
point2< GLint > X0
 Initial Position.
point2< GLint > X
 Current Position.
GLint columnchange
 Line height change.
vector< point2< GLint > > Xstack
 Temporary for saving current position.
vector< namefont * > vItems
 Text items to be displayed.
point4< float > fontcolor
 The color that the font is drawn.

Protected Member Functions

virtual void readImmediate (charc ch)
 Redefine to perform an action on receiving the character.
virtual void readBufferedTerminationAction ()
 Optionally define a callback function for when the buffered read has completed.
void readBufferedSet (uint index)
 Set the input mode to deferred so users keys are ouput to the screen as they type.
void readBufferedString (uint index)
 Set the input mode to deferred so users keys are ouput to the screen as they type.
virtual void readBuffered (charc ch)
 Read the given character.

Protected Attributes

string readBufferedStringInit
 Redefine to store the characters until a termination character is reached. */.
uint readBufferedIndex
 Temporary: storage of index.
string readBufferedResult
 Temporary: the result of readBuffered is accumulated.


Detailed Description

Display a primitive menu and process users keyboard input in either immediate or deferred mode.

This class is a monolith by design which usually is not a good thing, having said that it was designed to be a primitive menu system that does the job. It also puts much generality in the base class so the derived classes implement the menu whereas the base gives the functionality. So it is not a standard monolith, but a deliberate/organized one.

Keyboard capture and graphics are brought together to build the menu system.

NOTES the addfont* functions always reset X.x to the starting value X0.x . So addfont("abc",0); leaves X.x at the start. The current menu needs to be set and the tree holds its own state, so link the menues, set the current menu, and push the current menu to the global graphics gobj.

  root = new menusystemtest03Main();
  ...
  menusystem * m = new menusystemtest03Config();
  root->addsubmenu(m);
  root->currentset();
  gobjpush(root);
To make a menu the client uses inheritance deriving from a menusystem and over riding the appropriate functions. For example over ride readImediate and draw. This class was designed to have the general functionality in the menusystem class. Specialized menues for input are derived, see menusystemOneShot. This class contains variables which the derived class could choose to use. For example the submenues vector allows for possible sub menus. It also lets the parent see such submenues too. The derived class writes its graphics to the visibleGraphics container.

X is the current position is not uptodate with OpenGL's raster position. So do not expect to use addfont("abc",0) and have the cursor after c, this menu system is not that sophisticated. Instead manually move the cursor X.x yourself. The menu system can also be used as a terminal without processing keys.

Example of Terminal
  menusystem * menu = 
    new menusystem(0,0,true,point2<GLint>(20,20),30);
  gobjpush(menu);

  menu->addfont10("this is a bad idea.");
Moving/linking the menu tree is done by the transfercontrol* and addsubmenu functions. Scrolling the graphics up and down is supported through scroll* functions.

Definition at line 106 of file menusystem.h.


Constructor & Destructor Documentation

menusystem::menusystem ( menusystem current_,
menusystem parent_,
bool  readmodeimmediate_,
point2< GLint > const &  X0_,
GLint const   columnchange_ 
)

Constructor with tree links, mode status, initial position and line height.

Definition at line 459 of file menusystem.cpp.

References reset().

00465   : 
00466   current(current_), 
00467   parent(parent_), 
00468   readmodeimmediate(readmodeimmediate_),
00469   visibleGraphics(true),
00470   X0(X0_), 
00471   columnchange(columnchange_),
00472   fontcolor(1.0,1.0,1.0,0.8) 
00473 {
00474   reset();
00475 }

menusystem::menusystem ( bool  readmodeimmediate_,
point2< GLint > const &  X0_,
GLint const   columnchange_ 
)

Constructor with minimal configuration, the client can configure other items separately.

Definition at line 478 of file menusystem.cpp.

References reset().

00482   : 
00483   current(0), 
00484   parent(0), 
00485   readmodeimmediate(readmodeimmediate_),
00486   visibleGraphics(true),
00487   X0(X0_), 
00488   columnchange(columnchange_), 
00489   fontcolor(1.0,1.0,1.0,0.8) 
00490 {
00491   reset();
00492 }

menusystem::menusystem ( point2< GLint > const &  X0_,
GLint const   columnchange_ 
)

Definition at line 495 of file menusystem.cpp.

References reset().

00498   : 
00499   current(0), 
00500   parent(0), 
00501   readmodeimmediate(true),
00502   visibleGraphics(true),
00503   X0(X0_), 
00504   columnchange(columnchange_), 
00505   fontcolor(1.0,1.0,1.0,0.8) 
00506 {
00507   reset();
00508 }

menusystem::~menusystem (  ) 

Assumes pointers allocated from new and cleans up by calling delete.

Definition at line 38 of file menusystem.cpp.

References submenues.

00039 {
00040   uint imax = submenues.size();
00041   for (uint i=0; i<imax; ++i)
00042   {
00043     delete submenues[i];
00044     submenues[i]=0;
00045   }
00046 }


Member Function Documentation

void menusystem::addfont10 ( uint index,
stringc s,
uintc  newlines = 0 
)

Write a 10 point string and have a index to it.

Definition at line 371 of file menusystem.cpp.

References addnewline(), gobjContainer::push(), visibleGraphics, vItems, and X.

00372 {
00373   vItems.push_back( new namefont(X,s,GLUT_BITMAP_HELVETICA_10) );
00374   index = vItems.size()-1;
00375   visibleGraphics.push( vItems[index] );
00376 
00377   addnewline(newlines);
00378 }

void menusystem::addfont10 ( stringc s,
uintc  newlines = 0 
)

Write a 10 point string to the current position X.

Definition at line 387 of file menusystem.cpp.

References addnewline(), gobjContainer::push(), visibleGraphics, vItems, and X.

00388 {
00389   vItems.push_back( new namefont(X,s,GLUT_BITMAP_HELVETICA_10) );
00390   visibleGraphics.push( vItems[vItems.size()-1] );
00391 
00392   addnewline(newlines);
00393 }

void menusystem::addfont10 ( stringc s,
point2< GLint > const &  X2 
)

void menusystem::addfont10blockstart ( stringc s,
uintc  newlines = 0 
)

Definition at line 440 of file menusystem.cpp.

References tokenizer::seq, and tokenizer::subtract().

Referenced by simplexD1tessapp01::keyboard().

00444 {
00445   scroll(newlines);
00446 
00447   tokenizer tz(s);
00448 
00449   tz.subtract("\n");
00450   vector<string> vi;
00451   for ( list<string>::reverse_iterator i = tz.seq.rbegin(); i!=tz.seq.rend(); ++i )
00452     vi.push_back(*i);
00453 
00454   for (uint i=0; i<vi.size(); ++i)
00455     addfont10start(vi[i],1);
00456 }

void menusystem::addfont10paragraph ( stringc s,
uintc  len,
uintc  newlines = 0 
)

Interpret the string as a paragraph with minimum len character width.

Definition at line 319 of file menusystem.cpp.

Referenced by menusystemtest01::keyboard().

00324 {
00325   uint slen = s.size();
00326   uint k=0;
00327   uint k2;
00328   uint k3;
00329   uint k4;
00330 
00331   for ( ; k<slen; )
00332   {
00333     k4 = k + len;
00334     // Test if at the end of the iteration.
00335     //if (slen-k <= len )
00336     if (k4 >= slen)
00337     {
00338       addfont10(s.substr(k),1); 
00339       //addnewline();
00340 
00341       //return;
00342       break;
00343     }
00344 
00345     k2 = s.find(" ",k4);
00346     if (k2==string::npos)
00347     {
00348       addfont10(s.substr(k),1); 
00349       //addnewline();
00350       //return;
00351       break; 
00352     }
00353 
00354     addfont10(s.substr(k,k2-k),1);
00355     //addnewline();
00356 
00357     k=k2;
00358 
00359     k3 = s.find_first_not_of(" ",k);
00360     if (k3==string::npos)
00361       //return;
00362       break;
00363 
00364     k = k3;
00365   }
00366 
00367   addnewline(newlines);
00368 }

void menusystem::addfont10paragraphs ( stringc s,
uintc  len,
stringc token = "\n" 
)

Split the string on the token.

Definition at line 565 of file menusystem.cpp.

References tokenizer::reset(), and tokenizer::subtract().

00570 {
00571   tokenizer tk(s);
00572   tk.subtract(token);
00573 
00574   for ( tk.reset(); !tk; ++tk)
00575     addfont10paragraph(tk(),len,0);
00576 }

void menusystem::addfont10paragraphstart ( stringc s,
uintc  len,
uintc  newlines = 0 
)

At a paragraph to the start of the display.

Definition at line 264 of file menusystem.cpp.

00269 {
00270   for (uint i=0; i<newlines; ++i)
00271     scrolldown();
00272 
00273   uint slen = s.size();
00274   uint k=0;
00275   size_t k2;
00276   uint k3;
00277   uint k4;
00278 
00279   vector<string> vi;
00280 
00281   for ( ; k<slen; )
00282   {
00283     k4 = k + len;
00284     // Test if at the end of the iteration.
00285     //if (slen-k <= len )
00286     if (k4 >= slen)
00287     {
00288       vi.push_back(s.substr(k));
00289       break;
00290     }
00291 
00292     k2 = s.find(" ",k4);
00293     if (k2==string::npos)
00294     {
00295       vi.push_back(s.substr(k));
00296       break; 
00297     }
00298 
00299     vi.push_back(s.substr(k,k2-k));
00300 
00301     k=k2;
00302 
00303     k3 = s.find_first_not_of(" ",k);
00304     if (k3==string::npos)
00305       break;
00306 
00307     k = k3;
00308   }
00309 
00310   uintc sz=vi.size();
00311   for ( uint i=0; i<sz; ++i)
00312   {
00313     addfont10start(vi[sz-i-1],1); 
00314   }
00315 }

void menusystem::addfont10start ( stringc s,
uintc  newlines = 0 
)

The new lines call scrolldown first.

Definition at line 395 of file menusystem.cpp.

References gobjContainer::push(), scrolldown(), visibleGraphics, vItems, and X0.

00396 {
00397   for (uint i=0; i<newlines; ++i)
00398     scrolldown();
00399 
00400   vItems.push_back( new namefont(X0,s,GLUT_BITMAP_HELVETICA_10) );
00401   visibleGraphics.push( vItems[vItems.size()-1] );
00402 }

void menusystem::addfont12 ( uint index,
stringc s,
uintc  newlines = 0 
)

Write a 12 point string and have a index to it.

Definition at line 404 of file menusystem.cpp.

References addnewline(), gobjContainer::push(), visibleGraphics, vItems, and X.

00405 {
00406 //cout << SHOW(X) << " " << s << endl;
00407   vItems.push_back( new namefont(X,s,GLUT_BITMAP_HELVETICA_12) );
00408   index = vItems.size()-1;
00409   visibleGraphics.push( vItems[index] );
00410 
00411   addnewline(newlines);
00412 }

void menusystem::addfont12 ( stringc s,
uintc  newlines = 0 
)

Write a 12 point string to the current position X.

Definition at line 423 of file menusystem.cpp.

References addnewline(), gobjContainer::push(), visibleGraphics, vItems, and X.

00424 {
00425 //cout << "@" << SHOW(X) << " " << s << endl;
00426   vItems.push_back( new namefont(X,s,GLUT_BITMAP_HELVETICA_12) );
00427   visibleGraphics.push( vItems[vItems.size()-1] );
00428 
00429   addnewline(newlines);
00430 }

void menusystem::addfont12 ( stringc s,
point2< GLint > const &  X2 
)

Write a 12 point string to specified position.

Definition at line 432 of file menusystem.cpp.

References gobjContainer::push(), visibleGraphics, and vItems.

Referenced by d2simplextestmenu01::d2simplextestmenu01(), menu01< T >::menu01(), maze005::menubuild(), menusystemtest01::menusystemtest01(), menusystemtest04::menusystemtest04(), cubegui::prog01(), diskinttest::test01(), and menusystemtest::test02().

00433 {
00434   vItems.push_back( new namefont(X2,s,GLUT_BITMAP_HELVETICA_12) );
00435   visibleGraphics.push( vItems[vItems.size()-1] );
00436 }

void menusystem::addfont12start ( stringc s,
uintc  newlines = 0 
)

The new lines call scrolldown first.

Definition at line 414 of file menusystem.cpp.

References gobjContainer::push(), scrolldown(), visibleGraphics, vItems, and X0.

Referenced by treeindexedD2test::test05().

00415 {
00416   for (uint i=0; i<newlines; ++i)
00417     scrolldown();
00418 
00419   vItems.push_back( new namefont(X0,s,GLUT_BITMAP_HELVETICA_12) );
00420   visibleGraphics.push( vItems[vItems.size()-1] );
00421 }

void menusystem::addnewline ( uintc  newlines  )  [inline]

Add multiple blank lines.

Definition at line 212 of file menusystem.h.

References columnchange, point2< T >::x, X, X0, and point2< T >::y.

00213     { X.x = X0.x; X.y += columnchange*newlines; }

void menusystem::addnewline (  )  [inline]

Return to the start of the next line.

Definition at line 209 of file menusystem.h.

References columnchange, point2< T >::x, X, X0, and point2< T >::y.

Referenced by addfont10(), addfont12(), d2simplextestmenu01::d2simplextestmenu01(), menu01< T >::menu01(), and diskinttest::test01().

00210     { X.x = X0.x; X.y += columnchange; }

void menusystem::addsubmenu ( menusystem submenu  ) 

Add a submenu, linking it to this menu.

Definition at line 32 of file menusystem.cpp.

References parent, and submenues.

Referenced by menusystemtest02::menusystemtest02(), menusystemtest03::menusystemtest03(), menusystemtest04::menusystemtest04(), and menusystemtest::test01().

00033 {
00034   submenues.push_back(submenu);
00035   submenu->parent = this;
00036 }

void menusystem::clear (  )  [inline]

Clears the display, returning to starting position.

Definition at line 205 of file menusystem.h.

References gobjContainer::nuke(), reset(), visibleGraphics, and vItems.

Referenced by simplexD1tessapp01::keyboard(), and menusystemtest01::keyboard().

00206     { vItems.clear(); visibleGraphics.nuke(); reset(); }

void menusystem::currentset (  )  [inline]

Set this menu to be the current menu to be viewed.

Definition at line 275 of file menusystem.h.

References current.

Referenced by menusystemtest03::menusystemtest03(), and menusystemtest04::menusystemtest04().

00275 { current=this; }

void menusystem::draw ( menusystem x  ) 

Temporarily make x current and draw.

Definition at line 56 of file menusystem.cpp.

References current, and draw().

00057 {
00058   assert(x!=0);
00059 
00060   // Save previous state.
00061   menusystem * t2 = x->current;
00062 
00063   // draw
00064   x->current = x;
00065   x->draw();
00066   x->current = t2;
00067 }

void menusystem::draw (  )  [virtual]

Designed to display the current menusystem.

Implements textoverlay.

Reimplemented in menu01< T >, menusystemOneShot, menusystemsave01, and menu01< test01obj< P, PD > >.

Definition at line 230 of file menusystem.cpp.

References current, gobjContainer::draw(), gobjContainerdeque::draw(), draw(), textoverlay::drawpost, textoverlay::drawpre, GOBJDEBUGCODE, and visibleGraphics.

Referenced by menusystemtest::display01(), draw(), drawparent(), drawparents(), and drawparentsnested().

00231 {
00232   GOBJDEBUGCODE
00233   if (this!=current)
00234   {
00235     if (current!=0)
00236     {
00237       current->draw();
00238       return;
00239     }
00240   }
00241 
00242   drawpre.draw();
00243 
00244   visibleGraphics.draw();
00245 
00246   drawpost.draw();
00247 }

void menusystem::drawparent (  ) 

Draw the parent menu.

Definition at line 48 of file menusystem.cpp.

References draw(), and parent.

Referenced by menusystemOneShot::draw().

00049 {
00050   assert(parent!=0);
00051 
00052   if (parent!=0)
00053     draw(parent);
00054 }

void menusystem::drawparents (  ) 

Recursively draw the parents menues.

Definition at line 69 of file menusystem.cpp.

References draw(), and parent.

Referenced by menusystemOneShot::draw().

00070 {
00071   deque<menusystem*> parents;
00072   menusystem * t2 = this->parent;
00073   for ( ; t2 != 0; t2 = t2->parent )
00074     parents.push_front(t2);
00075 
00076   uint sz=parents.size();
00077   for (uint i=0; i<sz; ++i)
00078     draw(parents[i]);
00079 }

void menusystem::drawparentsnested (  ) 

Parent menu can enable setting as submenus inherit parents menu's scope.

Nested menus where drawpre are nested and drawn left to right and drawpost are drawn right to left.

Definition at line 82 of file menusystem.cpp.

References assertreturn, gobjContainerdeque::draw(), draw(), textoverlay::drawpost, and parent.

Referenced by menusystemsave01::draw().

00083 {
00084   deque<menusystem*> parents;
00085   menusystem * t2 = this->parent;
00086   for ( ; t2 != 0; t2 = t2->parent )
00087     parents.push_front(t2);
00088 
00089   uint sz=parents.size();
00090 
00091   if (sz==0)
00092   {
00093     menusystem::draw();
00094     return;
00095   }
00096 
00097   for (uint i=0; i<sz; ++i)
00098   {
00099     assertreturn(parents[i]);
00100 
00101     parents[i]->drawpre.draw();
00102     parents[i]->visibleGraphics.draw();
00103   }
00104 
00105   menusystem::draw();
00106 
00107   for (uint i=0; i<sz; ++i)
00108     parents[sz-1-i]->drawpost.draw();
00109 }

void menusystem::fontcolorenable (  ) 

Turn on transparent fontcolor by writing to graphics to drawpre and drawpost.

Definition at line 249 of file menusystem.cpp.

References textoverlay::drawpost, textoverlay::drawpre, fontcolor, gobjContainerdeque::push_back(), gobjContainerdeque::push_front(), point4< T >::w, point4< T >::x, point4< T >::y, and point4< T >::z.

Referenced by menusystemtest01::menusystemtest01(), treeindexedD2test::test03(), and treeindexedD2test::test05().

00250 {
00251 // glDisable(GL_DEPTH_TEST);
00252 // Test for depth test state!
00253   drawpre.push_back(new gobjglDisable(GL_DEPTH_TEST));
00254   drawpre.push_back(new gobjglEnable(GL_BLEND));
00255   drawpre.push_back(new gobjglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA));
00256 
00257   drawpre.push_back(new gobjglColor4f(fontcolor.x,fontcolor.y,fontcolor.z,fontcolor.w));
00258 
00259   drawpost.push_front(new gobjglEnable(GL_DEPTH_TEST));
00260   drawpost.push_front(new gobjglDisable(GL_BLEND));
00261 }

void menusystem::read ( charc  ch  ) 

Characters are sent to this object, the processing is forwarded to reading in immediate or buffered mode.

Definition at line 212 of file menusystem.cpp.

References assertreturn, current, readBuffered(), readImmediate(), and readmodeimmediate.

Referenced by d2simplextest::keyboard(), test01obj< P, PD >::keyboard(), and menusystemOneShot::readImmediate().

00213 {
00214   assertreturn(current!=0);
00215 
00216   for ( ; current->current!=current; )
00217   {
00218     current = current->current;
00219     assert(current!=0);
00220   }
00221 
00222   if (current->readmodeimmediate)
00223     current->readImmediate(ch);
00224   else
00225     current->readBuffered(ch);
00226 
00227   glutPostRedisplay();
00228 }

void menusystem::readBuffered ( charc  ch  )  [protected, virtual]

Read the given character.

Default behaviour: return terminates reading, backspace supported.

Definition at line 177 of file menusystem.cpp.

References readBufferedIndex, readBufferedResult, readBufferedStringInit, readBufferedTerminationAction(), readmodeimmediate, and vItems.

Referenced by read().

00178 {
00179 //uint k = ch;
00180 //cout << "*" << k << "*" << endl; 
00181 
00182   // Return key pressed.
00183   if (ch==13)
00184   {
00185     readmodeimmediate=true;
00186     vItems[readBufferedIndex]->name = readBufferedStringInit;
00187     readBufferedTerminationAction();
00188     return;
00189   }
00190 
00191   // Backspace key pressed
00192   if (ch==8)
00193   {
00194     uint sz = readBufferedResult.size();
00195 
00196     if (sz==0)
00197       return;
00198 
00199     // sz>0
00200     readBufferedResult.erase(sz-1,1);
00201     string & s(vItems[readBufferedIndex]->name);
00202     s.erase(s.size()-1,1);
00203 
00204     return;
00205   }
00206 
00207   readBufferedResult += ch;
00208   vItems[readBufferedIndex]->name += ch;
00209 }

void menusystem::readBufferedSet ( uint  index  )  [protected]

Set the input mode to deferred so users keys are ouput to the screen as they type.

index points to a namefont in vItems. The input is appended.

Referenced by menusystemOneShot::readImmediate(), and menu01< T >::readImmediate().

void menusystem::readBufferedString ( uint  index  )  [protected]

Set the input mode to deferred so users keys are ouput to the screen as they type.

index points to a namefont in vItems. Deletes the previous string pointed to by index.

Referenced by menusystemsave01::readImmediate().

virtual void menusystem::readBufferedTerminationAction (  )  [inline, protected, virtual]

Optionally define a callback function for when the buffered read has completed.

Reimplemented in menu01< T >, menusystemOneShot, menu01< T >, menusystemsave01, menu01< test01obj< P, PD > >, and menu01< test01obj< P, PD > >.

Definition at line 305 of file menusystem.h.

Referenced by readBuffered().

00305 {};

virtual void menusystem::readImmediate ( charc  ch  )  [inline, protected, virtual]

Redefine to perform an action on receiving the character.

Reimplemented in menusystemOneShot, menusystemsave01, and menusystemtest04.

Definition at line 291 of file menusystem.h.

Referenced by read().

00291 {}

void menusystem::reset (  )  [inline]

Set the current position to X0.

Definition at line 201 of file menusystem.h.

References point2< T >::x, X, X0, and point2< T >::y.

Referenced by clear().

00202     { X.x = X0.x; X.y = X0.y; }

void menusystem::scroll ( GLint const   k  ) 

Scroll all graphics down for positive k.

Definition at line 510 of file menusystem.cpp.

References vItems.

Referenced by scrolldown(), and scrollup().

00511 {
00512   uintc imax = vItems.size();
00513   for (uint i=0; i<imax; ++i)
00514   {
00515     if (vItems[i]==0)
00516       continue;
00517 
00518     vItems[i]->X.y += k;
00519   }
00520 }

void menusystem::scrolldown (  ) 

Scroll all graphics down one colum.

Definition at line 522 of file menusystem.cpp.

References columnchange, and scroll().

Referenced by addfont10start(), addfont12start(), and simplexD1tessapp01::keyboard().

00523 {
00524   scroll(columnchange);
00525 }

void menusystem::scrollup (  ) 

Scroll all graphics up one colum.

Definition at line 527 of file menusystem.cpp.

References columnchange, and scroll().

Referenced by simplexD1tessapp01::keyboard().

00528 {
00529   scroll(-columnchange);
00530 }

void menusystem::transfercontroltoparent (  ) 

Change the current menu to the parent.

Definition at line 121 of file menusystem.cpp.

References current, and parent.

Referenced by menusystemOneShot::readBufferedTerminationAction(), and menusystemsave01::readImmediate().

00122 {
00123   assert(parent!=0);
00124   current = parent;
00125   parent->current = parent;
00126 }

void menusystem::transfercontroltoroot (  ) 

Change the current menu to the root menu.

Definition at line 111 of file menusystem.cpp.

References current, and parent.

00112 {
00113   if (parent==0)
00114     return;
00115 
00116   current = parent;
00117   for ( ; current->parent != 0; current = current->parent );
00118   current->current = current;
00119 }

void menusystem::transfercontroltosubmenu ( uint  k  ) 

Change the current menu to the k'th submenu.

Definition at line 129 of file menusystem.cpp.

References current, and submenues.

Referenced by menusystemtest04::readImmediate().

00130 {
00131   assert( k<submenues.size() );
00132 
00133   assert(submenues[k]!=0);
00134 
00135   submenues[k]->current = submenues[k];
00136   current = submenues[k];
00137 }

void menusystem::Xpop (  ) 

Pop the top position of the stack making it the new position.

Definition at line 554 of file menusystem.cpp.

References X, and Xstack.

00555 {
00556   uint sz = Xstack.size();
00557   if (sz==0)
00558     return;
00559   X = Xstack[sz-1];
00560 
00561   Xstack.pop_back();
00562 }

void menusystem::Xpush (  ) 

Push the current position onto the stack.

Definition at line 549 of file menusystem.cpp.

References X, and Xstack.

00550 {
00551   Xstack.push_back(X);
00552 }


Member Data Documentation

Line height change.

Definition at line 130 of file menusystem.h.

Referenced by addnewline(), menusystemtest04::menusystemtest04(), scrolldown(), and scrollup().

The current menu selected.

Definition at line 111 of file menusystem.h.

Referenced by currentset(), draw(), read(), transfercontroltoparent(), transfercontroltoroot(), and transfercontroltosubmenu().

The previous or parent menu.

Definition at line 113 of file menusystem.h.

Referenced by addsubmenu(), drawparent(), drawparents(), drawparentsnested(), transfercontroltoparent(), and transfercontroltoroot().

Temporary: storage of index.

Definition at line 299 of file menusystem.h.

Referenced by readBuffered().

string menusystem::readBufferedResult [protected]

Redefine to store the characters until a termination character is reached. */.

Temporary: initial string displayed as the user enters text.

Definition at line 297 of file menusystem.h.

Referenced by readBuffered().

If true the keyboard events are processed in the immediate mode, else the input is processed in the deferred mode.

Definition at line 120 of file menusystem.h.

Referenced by read(), readBuffered(), menusystemOneShot::readBufferedTerminationAction(), and menusystemOneShot::readImmediate().

The sub menues, each has been allocated from new operator.

Definition at line 115 of file menusystem.h.

Referenced by addsubmenu(), transfercontroltosubmenu(), and ~menusystem().

The menu's visible graphics.

Definition at line 123 of file menusystem.h.

Referenced by addfont10(), addfont10start(), addfont12(), addfont12start(), clear(), and draw().

Text items to be displayed.

Definition at line 140 of file menusystem.h.

Referenced by addfont10(), addfont10start(), addfont12(), addfont12start(), clear(), readBuffered(), scroll(), and menusystemsave01::update().

Current Position.

Definition at line 128 of file menusystem.h.

Referenced by addfont10(), addfont12(), addnewline(), reset(), Xpop(), and Xpush().

Initial Position.

Definition at line 126 of file menusystem.h.

Referenced by addfont10start(), addfont12start(), addnewline(), and reset().

vector< point2<GLint> > menusystem::Xstack

Temporary for saving current position.

Definition at line 133 of file menusystem.h.

Referenced by Xpop(), and Xpush().


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:05 2011 for Chelton Evans Source by  doxygen 1.5.8