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

NDK_XX::MenuItem Class Reference

#include <ndk++.h>

Inheritance diagram for NDK_XX::MenuItem:

NDK_XX::ListItem NDK_XX::Button NDK_XX::Label NDK_XX::Control List of all members.

Public Methods

 MenuItem (Control *parent, int id, const string &title,int lines, int cols, int y, int x,int style=tabstop|notify)
 MenuItem (Control *parent, int id, const string &title,int y, int x)
int driver (int key)

Public Attributes

MenuItemDatapData

Constructor & Destructor Documentation

NDK_XX::MenuItem::MenuItem Control   parent,
int    id,
const string &    title,
int    lines,
int    cols,
int    y,
int    x,
int    style = tabstop|notify
 

MenuItem Constructor See parameters for class Control

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

References NDK_XX::Control::enable_notify(), NDK_XX::ListItem::set_text(), and NDK_XX::Label::text.

01580         :ListItem(parent,id,title,lines,cols,y,x,style)
01581 {
01582     enable_notify(false);
01583     set_text(text);
01584     enable_notify();
01585 }

NDK_XX::MenuItem::MenuItem Control   parent,
int    id,
const string &    title,
int    y,
int    x
 

MenuItem Constructor See parameters for class Control

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

References NDK_XX::Control::enable_notify(), NDK_XX::ListItem::set_text(), and NDK_XX::Label::text.

01592     :ListItem(parent,id,title,1,title.size()+4,y,x,tabstop|notify)
01593 {
01594     enable_notify(false);
01595     set_text(text);
01596     enable_notify();
01597 }


Member Function Documentation

int NDK_XX::MenuItem::driver int    key [virtual]
 

get a chance at processing the key, before parent does

Reimplemented from NDK_XX::ListItem.

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

References NDK_XX::MenuItemData::action(), KEY_ENTER, and pData.

Referenced by NDK_XX::MenuBar::execute_current_item().

01602 {
01603     int result =false;
01604     switch(key){
01605         case KEY_ENTER:
01606             result = pData->action();
01607             break;
01608 #ifdef NCURSES_MOUSE_VERSION
01609         case KEY_MOUSE:
01610         {
01611             MEVENT  event;
01612             getmouse(&event);
01613             if ((event.bstate & (BUTTON1_CLICKED|BUTTON1_DOUBLE_CLICKED|BUTTON1_TRIPLE_CLICKED))
01614             && wenclose(w,event.y, event.x))
01615             {   // we react only if the click was in the userwin, that means
01616                 // inside the menu display area or at the decoration window.
01617                 result = pData->action();
01618             }
01619             break;
01620         }
01621 #endif /* NCURSES_MOUSE_VERSION */
01622         default:
01623             result = false;
01624             break;
01625     }
01626     return result;
01627 }


Member Data Documentation

MenuItemData* NDK_XX::MenuItem::pData
 

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

Referenced by driver().


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