Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

NDK_XX::NDKPopUpMenu Class Reference

#include <ndk++.h>

Inheritance diagram for NDK_XX::NDKPopUpMenu:

NDK_XX::NDKMenuItem AnotherPopUpCmd APopUpCmd List of all members.

Public Methods

 NDKPopUpMenu (const char *text=0)
 ~NDKPopUpMenu ()
bool action ()
short submenux () const
 Autocalculated starting column for the submenu.

short submenuy () const
 Autocalculated starting row for the submenu.

int largest_name_len () const
 So we can know the right width for the submenu.


Protected Attributes

ListOfItems items
 These are passed to the submenu...

string sub_menu_label

Constructor & Destructor Documentation

NDK_XX::NDKPopUpMenu::NDKPopUpMenu const char *    text = 0 [inline]
 

Definition at line 242 of file ndk++.h.

00242 : NDKMenuItem(text){    }

NDK_XX::NDKPopUpMenu::~NDKPopUpMenu  
 

Definition at line 176 of file ndk++.cc.

References items.

00176                            { 
00177     //logfile << "Pop up\t" << name() << endl;
00178     ListOfItems::iterator it;
00179     for(it=items.begin();it!=items.end();it++){
00180         delete *it;
00181     }
00182     
00183 }  


Member Function Documentation

bool NDK_XX::NDKPopUpMenu::action  
 

Definition at line 187 of file ndk++.cc.

References items, largest_name_len(), sub_menu_label, submenux(), and submenuy().

00187                           {
00188     NDKSubMenu S(items.size()-1,largest_name_len()
00189                     ,submenuy(),submenux(),items,sub_menu_label.c_str());
00190     S();
00191     return FALSE; 
00192 }

int NDK_XX::NDKPopUpMenu::largest_name_len   const
 

So we can know the right width for the submenu.

Definition at line 225 of file ndk++.cc.

References NDK_XX::NDKMenuItem::get_curses_item().

Referenced by action().

00225                                        {
00226     unsigned MaximumNameLength = 0;
00227     ListOfItems::const_iterator it;
00228     for(it = items.begin(); it !=items.end();it++){
00229         NDKMenuItem *pItem = dynamic_cast<NDKMenuItem *>(*it);
00230         ITEM *item = pItem->get_curses_item();
00231         if (item && item->name.length > MaximumNameLength ){
00232             MaximumNameLength  = item->name.length;
00233         }
00234     }
00235     if(sub_menu_label.size() > MaximumNameLength)
00236         MaximumNameLength = sub_menu_label.size();
00237     return MaximumNameLength;
00238 }

short NDK_XX::NDKPopUpMenu::submenux   const
 

Autocalculated starting column for the submenu.

Definition at line 196 of file ndk++.cc.

References NDK_XX::NDKMenu::get_itemmarklen(), NDK_XX::NDKMenu::get_itemwidth(), NDK_XX::NDKMenuBar::get_orientation(), NDK_XX::NDKMenu::is_framed(), and NDK_XX::NDKMenuItem::pMenu.

Referenced by action().

00196                                   {
00197     // default x position: right where the itemīs label is shown 
00198     // (this works wether we have a normal curses menu 
00199     // or a menu bar with h layout
00200     short x = pMenu->begx()
00201             + pMenu->get_itemmarklen() 
00202             + pMenu->is_framed();
00203     
00204     NDKMenuBar *pParent = dynamic_cast<NDKMenuBar *>(pMenu);
00205     if(pParent && pParent->get_orientation() == 'h')
00206         x += (index() * pMenu->get_itemwidth());
00207 
00208     return x;
00209 }

short NDK_XX::NDKPopUpMenu::submenuy   const
 

Autocalculated starting row for the submenu.

Definition at line 213 of file ndk++.cc.

References NDK_XX::NDKMenuBar::get_orientation().

Referenced by action().

00213                                  {
00214     short y = pMenu->begy() + pMenu->is_framed();
00215 
00216     NDKMenuBar *pParent = dynamic_cast<NDKMenuBar *>(pMenu);
00217     if(pParent && pParent->get_orientation() == 'v'){
00218         y += index();
00219     }
00220     return y;
00221 }


Member Data Documentation

ListOfItems NDK_XX::NDKPopUpMenu::items [protected]
 

These are passed to the submenu...

Definition at line 258 of file ndk++.h.

Referenced by action(), AnotherPopUpCmd::AnotherPopUpCmd(), APopUpCmd::APopUpCmd(), and ~NDKPopUpMenu().

string NDK_XX::NDKPopUpMenu::sub_menu_label [protected]
 

Since submenu is autosized, we can pass longer (i.e. meaningful) labels to it...

Definition at line 262 of file ndk++.h.

Referenced by action(), AnotherPopUpCmd::AnotherPopUpCmd(), and APopUpCmd::APopUpCmd().


The documentation for this class was generated from the following files:
Generated on Tue Aug 27 10:49:47 2002 by doxygen1.2.17