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

NDK_XX::NDKMenu Class Reference

#include <ndk++.h>

Inheritance diagram for NDK_XX::NDKMenu:

NDK_XX::NDKMenuBar NDK_XX::NDKFramedMenuBar NDK_XX::NDKSubMenu List of all members.

Public Methods

 NDKMenu (ListOfItems &items, int lines, int cols, int begin_y=0, int begin_x=0, bool framed=FALSE, bool own_items=FALSE)
 NDKMenu (int lines, int cols, int begin_y=0, int begin_x=0,bool framed=FALSE)
int get_itemwidth () const
 We use the next three to autosize menubars.

int get_itemmarklen () const
int get_spcrows () const
void setItems (ListOfItems &items)
 Hide good ol' pointers from here on...

void InitMenu (ListOfItems &items)
 Hide good ol' pointers from here on...

virtual void lefttext (int row, const char *label)
virtual void righttext (int row, const char *label)
bool is_framed () const

Static Public Methods

short count_items (NCursesMenuItem *nitems[])

Protected Methods

void link_items (ListOfItems &items)

Protected Attributes

bool have_frame

Constructor & Destructor Documentation

NDK_XX::NDKMenu::NDKMenu ListOfItems   items,
int    lines,
int    cols,
int    begin_y = 0,
int    begin_x = 0,
bool    framed = FALSE,
bool    own_items = FALSE
 

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

References link_items(), and NDK_XX::ListOfItems.

00058     : NCursesMenu(items.begin()
00059         ,lines,cols
00060         ,begin_y,begin_x
00061         ,framed,own_items),have_frame(framed) 
00062 {
00063     link_items(items);
00064 }

NDK_XX::NDKMenu::NDKMenu int    lines,
int    cols,
int    begin_y = 0,
int    begin_x = 0,
bool    framed = FALSE
 

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

00070     : NCursesMenu(lines,cols,begin_y,begin_x),have_frame(framed) 
00071 {
00072 }


Member Function Documentation

short NDK_XX::NDKMenu::count_items NCursesMenuItem *    nitems[] [inline, static]
 

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

00112                                                         {
00113         int itemCount = 0;
00114         for (int lcv=0; nitems && nitems[lcv]->name(); ++lcv){
00115             ++itemCount;
00116         }
00117         return itemCount;
00118     }

int NDK_XX::NDKMenu::get_itemmarklen   const [inline]
 

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

Referenced by NDK_XX::NDKPopUpMenu::submenux().

00107 { return menu? menu->marklen:0;} 

int NDK_XX::NDKMenu::get_itemwidth   const [inline]
 

We use the next three to autosize menubars.

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

Referenced by NDK_XX::NDKPopUpMenu::submenux().

00106 { return menu? menu->itemlen + menu->spc_cols:0;} 

int NDK_XX::NDKMenu::get_spcrows   const [inline]
 

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

00108 { return menu? menu->spc_rows:0;} 

void NDK_XX::NDKMenu::InitMenu ListOfItems   items [inline]
 

Hide good ol' pointers from here on...

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

References is_framed(), and NDK_XX::ListOfItems.

Referenced by NDK_XX::NDKMenuBar::NDKMenuBar(), and NDK_XX::NDKSubMenu::setItems().

00124                                      {
00125         NCursesMenu::InitMenu(items.begin(),is_framed(),FALSE);
00126     }

bool NDK_XX::NDKMenu::is_framed   const [inline]
 

Unfortunately, b_framed on parent is private, so we can't check it...:-(

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

References have_frame.

Referenced by InitMenu(), and NDK_XX::NDKPopUpMenu::submenux().

00138 {return have_frame;}

void NDK_XX::NDKMenu::lefttext int    row,
const char *    label
[virtual]
 

Put the label text at the left (0) in the specified row.

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

Referenced by NDK_XX::NDKMenuBar::show_text().

00090                                                 {
00091   if (label) {
00092     OnError(addstr(row, 0, label, width()));
00093   }
00094 }

void NDK_XX::NDKMenu::link_items ListOfItems   items [protected]
 

We added a link to this C++ menu object to our c++ item object. Here we loop through the items linking them to us

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

References NDK_XX::ListOfItems, and NDK_XX::NDKMenuItem::pMenu.

Referenced by NDKMenu(), and NDK_XX::NDKMenuBar::NDKMenuBar().

00077 {
00078     ListOfItems::const_iterator it;
00079     for(it = items.begin(); it !=items.end();it++){
00080         NDKMenuItem *pItem = dynamic_cast<NDKMenuItem *>(*it);
00081         if(!pItem)
00082             throw NDKDlgException<NDKMenu>(this,"No item or wrong item type"
00083                                     " in NDKMenu::link_items");
00084         pItem->pMenu = this;
00085     }
00086 }

void NDK_XX::NDKMenu::righttext int    row,
const char *    label
[virtual]
 

Put the label text to the right (ending at maxx()) in the specified row.

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

Referenced by NDK_XX::NDKMenuBar::show_text().

00098                                                  {
00099   if (label) {
00100     int x = maxx() - strlen(label);
00101     if (x<0)
00102       x=0;
00103     OnError(addstr(row, x, label, width()));
00104   }
00105 }

void NDK_XX::NDKMenu::setItems ListOfItems   items [inline]
 

Hide good ol' pointers from here on...

Reimplemented in NDK_XX::NDKSubMenu.

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

References NDK_XX::ListOfItems.

00121 {NCursesMenu::setItems(items.begin());  }


Member Data Documentation

bool NDK_XX::NDKMenu::have_frame [protected]
 

Unfortunately, b_framed on parent is private, so we can't check it...:-(

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

Referenced by is_framed().


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