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

NDK_XX::Tab Class Reference

#include <ndk++.h>

Inheritance diagram for NDK_XX::Tab:

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

Public Methods

 Tab (Control *parent, int id, const string &title,int lines, int cols, int y, int x,int style=tabstop|notify|framed)
 Tab (Control *parent, int id, const string &title,int y, int x)
 ~Tab ()
int driver (int key)
int action ()
 action fired when user presses Enter

void activate ()
 Draw as active (i.e.,with bold frame).

void deactivate ()
 Draw as inactive (i.e.,with normal frame).

void show ()
 call panel's show and set our state accordingly

void hide ()
 call panel's hide and set our state accordingly

PropertyPageget_page ()
 Get the page associated with this tab.

void set_page (PropertyPage *page)
 Set the page associated with this tab.

void set_text (const string &txt)
 Usualy, a control in a dialog has some kind of text on it...


Protected Attributes

PropertyPagepPage
 The stacked dialog we manage.


Constructor & Destructor Documentation

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

Tab Constructor See parameters for class Control

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

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

02380         :Button(parent,id, title,lines,cols,y,x,style|=framed)
02381         ,pPage(0)
02382 {
02383     enable_notify(false);
02384     set_text(text);
02385     enable_notify();
02386 }

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

Tab Constructor See parameters for class Control

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

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

02393         :Button(parent,id,title,3,title.size()+3,y,x,tabstop|notify|framed)
02394         ,pPage(0)
02395 {
02396     enable_notify(false);
02397     set_text(text);
02398     enable_notify(); 
02399 }

NDK_XX::Tab::~Tab  
 

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

References pPage.

02404 {
02405     delete pPage;
02406 }


Member Function Documentation

int NDK_XX::Tab::action   [inline, virtual]
 

action fired when user presses Enter

Implements NDK_XX::Button.

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

References NDK_XX::PropertyDialog::curr_page, and NDK_XX::PropertyDialog::pages.

01973 : public Label

void NDK_XX::Tab::activate   [virtual]
 

Draw as active (i.e.,with bold frame).

Reimplemented from NDK_XX::Button.

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

References NDK_XX::Control::activate(), NDK_XX::Control::get_ctrl_id(), NDK_XX::Control::is_hidden(), NDK_XX::Control::notify_enabled(), PAGE_SELECTED, pPage, NDK_XX::Control::pParent, NDK_XX::Control::process_message(), NDK_XX::PropertyPage::refresh(), set_text(), and NDK_XX::Label::text.

Referenced by driver().

02411 {
02412     if(is_hidden())
02413         return;
02414 
02415     if(pPage){
02416         pPage->activate();
02417         pPage->refresh();
02418     }
02419     Control::activate();
02420     attron(A_BOLD);
02421     set_text(text);
02422     if(notify_enabled())
02423         process_message(pParent,PAGE_SELECTED,get_ctrl_id(),this);
02424 }

void NDK_XX::Tab::deactivate   [virtual]
 

Draw as inactive (i.e.,with normal frame).

Reimplemented from NDK_XX::Button.

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

References NDK_XX::Control::deactivate(), NDK_XX::Control::is_hidden(), pPage, set_text(), and NDK_XX::Label::text.

02429 {
02430     if(is_hidden())
02431         return;
02432     if(pPage){
02433         pPage->deactivate();
02434     }
02435     Control::deactivate();
02436     attroff(A_BOLD);
02437     set_text(text);
02438 }

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

get a chance at processing the key, before parent does

Reimplemented from NDK_XX::Button.

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

References activate(), NDK_XX::Control::clicked_inside(), FOCUS_TO_BUTTONS, KEY_ENTER, KEY_ESC, pPage, NDK_XX::Control::pParent, NDK_XX::PropertyPage::process_key(), and NDK_XX::Control::process_message().

02459 {   int val=0;
02460     switch(key) {
02461 #ifdef NCURSES_MOUSE_VERSION
02462         case KEY_MOUSE:
02463         {
02464             MEVENT  event;
02465             getmouse(&event);
02466             int ry = event.y, rx = event.x; /* screen coordinates */
02467             if (!mouse_trafo(&ry,&rx,FALSE))
02468                 return false;
02469             if(!(event.bstate & (   BUTTON1_CLICKED|
02470                                     BUTTON1_DOUBLE_CLICKED|
02471                                     BUTTON1_TRIPLE_CLICKED))
02472                     ||!pPage->clicked_inside(ry, rx)){
02473                 return false;
02474             }
02475         }
02476 #endif  /// if we got here, passthru
02477         case KEY_TAB:
02478         case KEY_DOWN:
02479         case KEY_ENTER:
02480             val = pPage->process_key(key);
02481             if(val == DialogBox::REQ_DLG_DOWN){
02482                 process_message(pParent,0,(int)FOCUS_TO_BUTTONS,0);
02483                 return TRUE;
02484             }
02485             else if(val== DialogBox::REQ_DLG_EXIT) //user pressed ESC key inside the page
02486                 return KEY_ESC;
02487             else if(key==KEY_MOUSE)
02488                 return key;
02489             else
02490                 activate();
02491             break;
02492         default:    
02493             return Button::driver(key);
02494             break;
02495     }
02496     return FALSE;
02497 }

PropertyPage* NDK_XX::Tab::get_page   [inline]
 

Get the page associated with this tab.

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

01979 {

void NDK_XX::Tab::hide   [inline, virtual]
 

call panel's hide and set our state accordingly

Reimplemented from NDK_XX::Control.

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

References NDK_XX::Label::Label(), NDK_XX::StatusBar::StatusBar(), NDK_XX::Label::text, and NDK_XX::Control::visible.

01973                 : public Label
01974 {
01975 public:
01976 

void NDK_XX::Tab::set_page PropertyPage   page [inline]
 

Set the page associated with this tab.

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

Referenced by NDK_XX::PropertyDialog::add_page().

01989 : public NCursesApplication

void NDK_XX::Tab::set_text const string &    txt [virtual]
 

Usualy, a control in a dialog has some kind of text on it...

Reimplemented from NDK_XX::Label.

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

References NDK_XX::Control::has_frame(), NDK_XX::Label::max_len(), NDK_XX::Label::pos_x, and NDK_XX::Label::text.

Referenced by activate(), deactivate(), and Tab().

02443 {
02444     int max_len = width()-pos_x-has_frame();
02445     string new_text= v.substr(0, max_len); 
02446     text = new_text;
02447     clrtoeol(); 
02448     centertext(1,text.c_str());
02449     delch(0,maxx());
02450     delch(0,maxx()-1);
02451     addch(1,maxx()-1, '\\');
02452     move(1,1);
02453     refresh();
02454 }

void NDK_XX::Tab::show   [inline, virtual]
 

call panel's show and set our state accordingly

Reimplemented from NDK_XX::Control.

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

01973                 : public Label


Member Data Documentation

PropertyPage* NDK_XX::Tab::pPage [protected]
 

The stacked dialog we manage.

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

Referenced by activate(), deactivate(), driver(), NDK_XX::PropertyPage::PropertyPage(), NDK_XX::PropertyPage::refresh(), NDK_XX::PropertyPage::~PropertyPage(), and ~Tab().


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