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

NDK_XX::PopUpMenu Class Reference

#include <ndk++.h>

Inheritance diagram for NDK_XX::PopUpMenu:

NDK_XX::MenuItemData NDK_XX::ListItemData AnotherPopUpCmd APopUpCmd List of all members.

Public Methods

 PopUpMenu (const string &text)
 ~PopUpMenu ()
int action ()
int largest_name_len () const

Protected Attributes

string sub_menu_label
 So we can know the right width for the submenu.

ListItems items
SubMenuS
int cur_sel

Constructor & Destructor Documentation

NDK_XX::PopUpMenu::PopUpMenu const string &    text [inline]
 

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

References NDK_XX::DialogBox::_title.

01529 {return _title;}

NDK_XX::PopUpMenu::~PopUpMenu  
 

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

References S.

01827 {
01828     delete S;
01829 //  ListItems::iterator d;
01830 //  for(d=items.begin();d!=items.end();d++){
01831 //      delete *d;
01832 //  }
01833 }


Member Function Documentation

int NDK_XX::PopUpMenu::action   [virtual]
 

Reimplemented from NDK_XX::MenuItemData.

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

References NDK_XX::MenuBar::add_item(), cur_sel, NDK_XX::MenuBar::execute(), NDK_XX::ListBox::get_cur_pos(), items, NDK_XX::MenuBar::items_owner(), largest_name_len(), NDK_XX::MenuItemData::pMenuItem, S, NDK_XX::ListBox::set_cur_pos(), and sub_menu_label.

01787 {
01788     int result = false;
01789     S = new SubMenu(-1,sub_menu_label
01790                 ,items.size(),largest_name_len()
01791                 ,pMenuItem->begy(),pMenuItem->begx(),'v');
01792     S->items_owner(false);
01793     ListItems::iterator it;
01794     for(it=items.begin();it!=items.end();it++){
01795         S->add_item((MenuItemData *)*it);
01796     }
01797     S->set_cur_pos(cur_sel);
01798     result = S->execute();
01799     cur_sel = S->get_cur_pos();
01800     refresh();
01801     delete S;
01802 
01803     return false;
01804 }

int NDK_XX::PopUpMenu::largest_name_len   const
 

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

Referenced by action().

01808                                     {
01809     unsigned MaximumNameLength = 0;
01810     ListItems::const_iterator it;
01811     for(it = items.begin(); it !=items.end();it++){
01812         string name((*it)->get_text());
01813         
01814         if (name.size() > MaximumNameLength ){
01815             MaximumNameLength  = name.size();
01816         }
01817     }
01818     if(sub_menu_label.size() > MaximumNameLength)
01819         MaximumNameLength = sub_menu_label.size();
01820     return MaximumNameLength;
01821 }


Member Data Documentation

int NDK_XX::PopUpMenu::cur_sel [protected]
 

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

Referenced by action(), NDK_XX::MenuBar::move_down(), and NDK_XX::MenuBar::move_right().

ListItems NDK_XX::PopUpMenu::items [protected]
 

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

Referenced by action(), AnotherPopUpCmd::AnotherPopUpCmd(), APopUpCmd::APopUpCmd(), and NDK_XX::MenuBar::move_left().

SubMenu* NDK_XX::PopUpMenu::S [protected]
 

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

Referenced by action(), NDK_XX::MenuBar::move_down(), NDK_XX::MenuBar::move_left(), and ~PopUpMenu().

string NDK_XX::PopUpMenu::sub_menu_label [protected]
 

So we can know the right width for the submenu.

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

Referenced by action(), AnotherPopUpCmd::AnotherPopUpCmd(), APopUpCmd::APopUpCmd(), and NDK_XX::MenuBar::move_left().


The documentation for this class was generated from the following files:
Generated on Thu Oct 10 16:02:21 2002 by doxygen1.2.17