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

NDK_XX::DialogBox Class Reference

#include <ndk++.h>

Inheritance diagram for NDK_XX::DialogBox:

NDK_XX::Control NDK_XX::MessageBox NDK_XX::PropertyDialog NDK_XX::PropertyPage TestBox NDK_XX::OkCancelBox NDK_XX::YesNoBox NDK_XX::YesNoCancelBox TabbedDlgBox TabbedDlgPage1 TabbedDlgPage2 List of all members.

Public Types

enum  dlg_styles {
  info = 0x0100, warning = 0x0200, error = 0x0400, okCancel = 0x0001,
  yesNo = 0x0002, yesNoCancel = 0x0004
}
enum  Dlg_Request {
  DLG_LOW = PAD_HIGH + 1, REQ_DLG_REFRESH = DLG_LOW, REQ_DLG_PROCESSED, REQ_DLG_NEXT,
  REQ_DLG_PREV, REQ_DLG_UP, REQ_DLG_DOWN, REQ_DLG_LEFT,
  REQ_DLG_RIGHT, REQ_DLG_EXIT, DLG_HIGH = REQ_DLG_EXIT
}

Public Methods

 DialogBox (Control *parent, int id, const string &title,int lines, int cols, int y=0, int x=0,int d_style=0, int c_style=0)
 DialogBox (int id, const string &title,int lines, int cols, int y=0, int x=0,int d_style=0, int c_style=0)
 ~DialogBox ()
void add_child (Control *new_child)
 Add a control at the end of the list of this window.

void add_child (int pos, Control *new_child)
 Add a control at the given pos on the list of this window.

void add_child (Control *after, Control *new_child)
 Add a control after the given control on the list of this window.

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

virtual int do_modal ()
 The modal loop of the dialog box.

void hide ()
 Hide this window and the contained controls.

void show ()
 Show this window and the contained controls.


Static Public Attributes

NCursesPanel dlg_stdscr
 The standard screen.


Protected Methods

void show_text (const string &t, char where)
 A simple helper.

void next_control ()
 When user press TAB, give me the next child.

void prev_control ()
void find_clicked ()
 DECLARE_BINDINGS ()
virtual void on_dlg_init ()
 called at the beggining of the modal loop

virtual void on_dlg_term ()
 called at the end of the modal loop

virtual bool can_close ()
 called if user presses one of the 'exits'

virtual void on_ctrl_init (Control &ctrl)
 called when the user enters a control

virtual bool on_ctrl_term (Control &ctrl)
 called when the user leaves the control

virtual void on_cmd (int dlg_req)
 Kind of catch-all for derived windows.

virtual void create_buttons ()
 called on construction of dialog

void add_ok ()
 The next four are used by create_buttons.

void add_ok_cancel ()
void add_yes_no ()
void add_yes_no_cancel ()
virtual void set_focus_to (int child_idx)
 activate child at position child_idx

virtual void set_focus_to (Control *p_child)
 activate p_child

int driver (int key)
virtual void on_dlg_ok ()
 Vanilla implementation of exits.

virtual void on_dlg_yes ()
virtual void on_dlg_no ()
virtual void on_dlg_cancel ()
int end_dialog (int request)
virtual void lefttext (int row, const char *label)
virtual void righttext (int row, const char *label)

Static Protected Methods

int X_POS (int pos)
 space between buttons


Protected Attributes

friend Control
 Allow children to touch our stuff.

ListOfChildren children
 The controls we have.

int curr_child
 where is te focus now

string _title
int dlg_style
bool bContinueModal
 Modal loop condition.

bool changed
 So we can ask the user if she want to save.

PushButtonpBtnYes
PushButtonpBtnNo
PushButtonpBtnCancel
PushButtonpBtnOk
int user_request
 this is the result of the interaction


Static Protected Attributes

int my_w = 0
 Helpers for auto-ordering the default buttons.

int btn_w = 0
 useable width

int btns = 0
 each button width

int used_width = 0
 number of buttons

int spc = 0
 total buttons width

string lblOk = " OK "
string lblCancel = "Cancel"
string lblYes = " Yes "
string lblNo = " No "
string lblApply = " Apply"
string titDataChgd = "Data changed!"
string msgAskToSave = "Save before we exit?"

Member Enumeration Documentation

enum NDK_XX::DialogBox::Dlg_Request
 

Enumeration values:
DLG_LOW 
REQ_DLG_REFRESH 
REQ_DLG_PROCESSED 
REQ_DLG_NEXT 
REQ_DLG_PREV 
REQ_DLG_UP 
REQ_DLG_DOWN 
REQ_DLG_LEFT 
REQ_DLG_RIGHT 
REQ_DLG_EXIT 
DLG_HIGH 

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

01584          :
    DECLARE_BINDINGS();

enum NDK_XX::DialogBox::dlg_styles
 

Enumeration values:
info 
warning 
error 
okCancel 
yesNo 
yesNoCancel 

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

01584          :
    DECLARE_BINDINGS();


Constructor & Destructor Documentation

NDK_XX::DialogBox::DialogBox Control   parent,
int    id,
const string &    title,
int    lines,
int    cols,
int    y = 0,
int    x = 0,
int    d_style = 0,
int    c_style = 0
 

DialogBox Constructor

Parameters:
parent:  the parent of this window
id  a user defined const int identifying this window
title  The title for this window
lines:  height of the window
cols  width of the window
y  line where we are placed, absolute coord.
x  column where we are placed, absolute coord.
d_style  type of window (okCancel,yesNoCancel, etc.)
c_style  style indications for enabling/disabling control's capabilities

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

References _title, NDK_XX::Control::has_frame(), NDK_XX::Control::has_show_title(), and show_text().

01865     : Control(parent,id,lines,cols,y,x,c_style)
01866         ,_title(title)
01867         ,curr_child(0),
01868         dlg_style(d_style),
01869         changed(false),
01870         pBtnYes(0),
01871         pBtnNo(0),
01872         pBtnCancel(0),
01873         pBtnOk(0)
01874 {
01875     leaveok(FALSE); 
01876     if(has_frame()){    
01877         frame();
01878     }
01879     if(has_show_title()){
01880         show_text(_title,'c');
01881     }
01882 }

NDK_XX::DialogBox::DialogBox int    id,
const string &    title,
int    lines,
int    cols,
int    y = 0,
int    x = 0,
int    d_style = 0,
int    c_style = 0
 

DialogBox Constructor

Parameters:
id  a user defined const int identifying this window
title  The title for this window
lines:  height of the window
cols  width of the window
y  line where we are placed, absolute coord.
x  column where we are placed, absolute coord.
d_style  type of window (okCancel,yesNoCancel, etc.)
c_style  style indications for enabling/disabling control's capabilities

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

References _title, NDK_XX::Control::has_frame(), NDK_XX::Control::has_show_title(), and show_text().

01842     : Control(id,lines,cols,y,x,c_style)
01843         ,_title(title)
01844         ,curr_child(0),
01845         dlg_style(d_style),
01846         changed(false),
01847         pBtnYes(0),
01848         pBtnNo(0),
01849         pBtnCancel(0),
01850         pBtnOk(0)
01851 {
01852     leaveok(FALSE); 
01853     if(has_frame()){    
01854         frame();
01855     }
01856     if(has_show_title()){
01857         show_text(_title,'c');
01858     }
01859 }

NDK_XX::DialogBox::~DialogBox  
 

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

References children, and hide().

01895 { 
01896     hide();
01897     ListOfChildren::iterator it;
01898     for(it=children.begin();it!=children.end();it++){
01899         (*it)->hide();
01900         delete *it;
01901     }
01902 }


Member Function Documentation

void NDK_XX::DialogBox::add_child Control   after,
Control   new_child
 

Add a control after the given control on the list of this window.

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

References add_child(), and children.

02049 { 
02050     ListOfChildren::iterator where;
02051     for(where=children.begin();after && where!=children.end();where++){
02052         if(*where==after){
02053 //          send_to_log("After found!")<< endl;
02054             break;
02055         }
02056     }
02057     if(where==children.end())
02058         add_child(new_child);
02059     else{
02060         where++;
02061         children.insert(where,new_child);
02062     }
02063 }   

void NDK_XX::DialogBox::add_child int    pos,
Control   new_child
 

Add a control at the given pos on the list of this window.

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

References add_child(), and children.

02014 { 
02015     ListOfChildren::iterator where=children.end();
02016     if(pos >-1 && pos < children.size()){
02017         where=children.begin()+pos;
02018     }
02019     
02020     if(where==children.end())
02021         add_child(new_child);
02022     else{
02023         where++;
02024         children.insert(where,new_child);
02025     }
02026 }   

void NDK_XX::DialogBox::add_child Control   new_child [inline]
 

Add a control at the end of the list of this window.

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

Referenced by add_child(), add_ok(), add_ok_cancel(), NDK_XX::PropertyDialog::add_page(), add_yes_no(), add_yes_no_cancel(), NDK_XX::PropertyDialog::create_buttons(), TabbedDlgPage2::on_dlg_init(), TabbedDlgPage1::on_dlg_init(), and TestBox::on_dlg_init().

01636 {end_dialog(IDOK);} 

void NDK_XX::DialogBox::add_ok   [protected]
 

The next four are used by create_buttons.

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

References add_child(), children, IDOK, lblOk, pBtnOk, and set_focus_to().

Referenced by create_buttons().

02190 {
02191     pBtnOk=new PushButton(this,IDOK,lblOk, maxy()-1,(maxx()-9)/2);
02192     add_child(pBtnOk);
02193 
02194     if(!children.empty())
02195         set_focus_to(children.size()-1);
02196 }

void NDK_XX::DialogBox::add_ok_cancel   [protected]
 

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

References add_child(), btn_w, btns, NDK_XX::Control::enable(), IDCANCEL, IDOK, lblCancel, lblOk, my_w, pBtnCancel, pBtnOk, spc, used_width, and X_POS().

Referenced by create_buttons().

02200 {
02201     Control *pCtrl=0;
02202     my_w = width()-2;   ///useable width
02203     btn_w= 9;           ///each button width
02204     btns=2;             ///number of buttons
02205     used_width=btn_w*btns;  ///total buttons width          
02206     spc=2;              ///space between buttons
02207     pBtnOk=new PushButton(this,IDOK,lblOk,maxy()-1,X_POS(0));
02208     add_child(pBtnOk);
02209     pBtnOk->enable(false);
02210     pBtnCancel=new PushButton(this,IDCANCEL,lblCancel,maxy()-1,X_POS(1));
02211     add_child(pBtnCancel);
02212 }

void NDK_XX::DialogBox::add_yes_no   [protected]
 

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

References add_child(), btn_w, btns, IDNO, IDYES, lblNo, lblYes, my_w, pBtnNo, pBtnYes, spc, used_width, and X_POS().

Referenced by create_buttons().

02234 {
02235     Control *pCtrl=0;
02236     my_w = width()-2;   ///useable width
02237     btn_w= 9;           ///each button width
02238     btns=2;             ///number of buttons
02239     used_width=btn_w*btns;  ///total buttons width          
02240     spc=2;              ///space between buttons
02241     pBtnYes=new PushButton(this,IDYES,lblYes,maxy()-1,X_POS(0));
02242     add_child(pBtnYes);
02243     pBtnNo=new PushButton(this,IDNO,lblNo,maxy()-1,X_POS(1));
02244     add_child(pBtnNo);
02245 }

void NDK_XX::DialogBox::add_yes_no_cancel   [protected]
 

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

References add_child(), btn_w, btns, IDCANCEL, IDNO, IDYES, lblCancel, lblNo, lblYes, my_w, pBtnCancel, pBtnNo, pBtnYes, spc, used_width, and X_POS().

Referenced by create_buttons().

02217 {
02218     my_w = width()-2;   ///useable width
02219     btn_w= 9;           ///each button width
02220     btns=3;             ///number of buttons
02221     used_width=btn_w*btns;  ///total buttons width          
02222     spc=2;              ///space between buttons
02223     pBtnYes=new PushButton(this,IDYES,lblYes,maxy()-1,X_POS(0));
02224     add_child(pBtnYes);
02225     pBtnNo=new PushButton(this,IDNO,lblNo,maxy()-1,X_POS(1));
02226     add_child(pBtnNo);
02227     pBtnCancel=new PushButton(this,IDCANCEL,lblCancel,maxy()-1,X_POS(2));
02228     add_child(pBtnCancel);
02229 }

bool NDK_XX::DialogBox::can_close   [protected, virtual]
 

called if user presses one of the 'exits'

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

References do_modal(), IDCANCEL, IDNO, IDYES, msgAskToSave, and titDataChgd.

02128 { 
02129     int result = true;
02130     if(changed){
02131         YesNoCancelBox dlg(titDataChgd,msgAskToSave);
02132         int usr_choice = dlg.do_modal();
02133         switch(usr_choice){
02134             case IDCANCEL: result = false;
02135             case IDYES: 
02136             case IDNO:
02137             default:
02138                 break;
02139         }
02140     }
02141     refresh();
02142     return result;
02143 }

void NDK_XX::DialogBox::create_buttons   [protected, virtual]
 

called on construction of dialog

Reimplemented in NDK_XX::PropertyPage, and NDK_XX::PropertyDialog.

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

References add_ok(), add_ok_cancel(), add_yes_no(), add_yes_no_cancel(), dlg_style, okCancel, yesNo, and yesNoCancel.

Referenced by TestBox::on_dlg_init(), and NDK_XX::MessageBox::on_dlg_init().

02179 {
02180     switch((dlg_style & 0x00ff)){
02181         case okCancel:  add_ok_cancel();        break;
02182         case yesNo:     add_yes_no();           break;
02183         case yesNoCancel:add_yes_no_cancel();   break;
02184         default:        add_ok();               break;
02185     }
02186 }

NDK_XX::DialogBox::DECLARE_BINDINGS   [protected]
 

Reimplemented in NDK_XX::PropertyDialog, TestBox, and TabbedDlgPage2.

int NDK_XX::DialogBox::do_modal   [virtual]
 

The modal loop of the dialog box.

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

References bContinueModal, driver(), hide(), next_control(), on_cmd(), on_dlg_cancel(), on_dlg_init(), prev_control(), REQ_DLG_EXIT, REQ_DLG_LEFT, REQ_DLG_NEXT, REQ_DLG_PREV, REQ_DLG_RIGHT, and user_request.

Referenced by ShowTabbedDialogCmd::action(), ShowTestDialogCmd::action(), can_close(), and NDK_XX::MenuBar::driver().

01907 {
01908     on_dlg_init();
01909     bContinueModal=true;
01910     int req=REQ_DLG_EXIT;
01911     do{
01912         req=driver(getch());
01913         switch(req){
01914             case REQ_DLG_EXIT:  
01915                 on_dlg_cancel();
01916                 break;
01917 
01918             case REQ_DLG_LEFT:
01919             case REQ_DLG_PREV:  
01920                 prev_control();
01921                 break;
01922             
01923             case REQ_DLG_RIGHT:
01924             case REQ_DLG_NEXT:  
01925                 next_control(); 
01926                 break;
01927 
01928             default:            on_cmd(req);    break;
01929         }   
01930     } while( bContinueModal);
01931     hide();
01932     return user_request;
01933 }

int NDK_XX::DialogBox::driver int    key [protected, virtual]
 

get a chance at processing the key, before parent does

Reimplemented from NDK_XX::Control.

Reimplemented in NDK_XX::PropertyPage.

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

References children, CTRL, curr_child, find_clicked(), IDCANCEL, KEY_ESC, KEY_SHIFT_TAB, KEY_TAB, REQ_DLG_DOWN, REQ_DLG_EXIT, REQ_DLG_LEFT, REQ_DLG_NEXT, REQ_DLG_PREV, REQ_DLG_PROCESSED, REQ_DLG_RIGHT, REQ_DLG_UP, and user_request.

Referenced by do_modal().

01974 {
01975 
01976 #ifdef NCURSES_MOUSE_VERSION
01977         if(key == KEY_MOUSE){
01978             find_clicked();
01979         }
01980 #endif /* NCURSES_MOUSE_VERSION */
01981 
01982     int result;
01983     if(!children.empty() && curr_child > -1) {
01984         result=children[curr_child]->driver(key);
01985         switch(result){
01986             case TRUE:      return REQ_DLG_PROCESSED;
01987             case KEY_TAB:   return REQ_DLG_NEXT;
01988             case KEY_SHIFT_TAB: return REQ_DLG_PREV;
01989             case KEY_ESC: key = result;
01990             default: break;
01991         }
01992     }
01993     
01994     switch(key) {
01995         case KEY_UP:    return REQ_DLG_UP;
01996         case KEY_DOWN:  return REQ_DLG_DOWN;
01997         case KEY_LEFT:  return REQ_DLG_LEFT;
01998         case KEY_RIGHT: return REQ_DLG_RIGHT;
01999         case KEY_EXIT:
02000         case CTRL('X'):
02001         case KEY_ESC:
02002                         ///same as if user press Cancel button
02003                         user_request=IDCANCEL; 
02004                         return REQ_DLG_EXIT;
02005         case KEY_TAB +0x2f: return REQ_DLG_PREV;
02006         case KEY_TAB:   return REQ_DLG_NEXT;
02007         default: return(key);
02008     }
02009 }

int NDK_XX::DialogBox::end_dialog int    request [inline, protected]
 

Break the modal loop and give the user a chance to cleanup/serialize/whatever

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

References NDK_XX::PropertyPage::do_initial_update(), NDK_XX::Control::framed, NDK_XX::Control::notify, NDK_XX::PropertyPage::pDialog, and NDK_XX::Control::title.

01752                     :
01753             height of the window
        @param cols

void NDK_XX::DialogBox::find_clicked   [protected]
 

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

References children, NDK_XX::Control::clicked_inside(), and set_focus_to().

Referenced by driver().

02031 {
02032     MEVENT  event;
02033     getmouse(&event);
02034     int ry = event.y, rx = event.x; /* screen coordinates */
02035 
02036     if (mouse_trafo(&ry,&rx,FALSE)){
02037         if(clicked_inside(ry,rx)){
02038             for(int i=0;i<children.size();i++){
02039                 if(children[i]->clicked_inside(ry,rx))
02040                     set_focus_to(i);
02041             }
02042         }
02043     }
02044 }

string NDK_XX::DialogBox::get_text   const [inline, virtual]
 

Implements NDK_XX::Control.

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

Referenced by NDK_XX::PropertyDialog::add_page(), and TabbedDlgPage1::on_dlg_init().

01636 {end_dialog(IDOK);} 

void NDK_XX::DialogBox::hide   [virtual]
 

Hide this window and the contained controls.

Reimplemented from NDK_XX::Control.

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

References children.

Referenced by do_modal(), and ~DialogBox().

01938 {
01939     ListOfChildren::iterator it;
01940     for(it=children.begin();it!=children.end();it++){
01941         (*it)->hide();
01942     }
01943     Control::hide();
01944 }

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

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

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

Referenced by show_text().

02147                                                   {
02148   if (label) {
02149     OnError(addstr(row, 0, label, width()));
02150   }
02151 }

void NDK_XX::DialogBox::next_control   [protected]
 

When user press TAB, give me the next child.

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

References children, curr_child, on_ctrl_init(), and on_ctrl_term().

Referenced by do_modal(), and NDK_XX::PropertyPage::process_key().

02067 {
02068     if(children.size()>1 && on_ctrl_term(*(children[curr_child]))){
02069         int start_point=curr_child;
02070         for(curr_child++;start_point!=curr_child;curr_child++){
02071             if(curr_child==children.size())
02072                 curr_child=0;
02073             
02074             if(children[curr_child]->is_enabled())
02075                 break; //We found the next selectable child
02076         }
02077         on_ctrl_init(*(children[curr_child]));
02078     }
02079 }

virtual void NDK_XX::DialogBox::on_cmd int    dlg_req [inline, protected, virtual]
 

Kind of catch-all for derived windows.

Reimplemented in NDK_XX::PropertyPage.

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

References NDK_XX::Control::title, and yesNo.

Referenced by do_modal().

01718         :MessageBox(title,message,style|yesNo)
01719         {};

virtual void NDK_XX::DialogBox::on_ctrl_init Control   ctrl [inline, protected, virtual]
 

called when the user enters a control

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

Referenced by next_control(), prev_control(), and set_focus_to().

01714               : public MessageBox 

virtual bool NDK_XX::DialogBox::on_ctrl_term Control   ctrl [inline, protected, virtual]
 

called when the user leaves the control

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

References info, NDK_XX::Control::title, and NDK_XX::YesNoBox::YesNoBox().

Referenced by next_control(), prev_control(), and set_focus_to().

01714               : public MessageBox 
01715 {

virtual void NDK_XX::DialogBox::on_dlg_cancel   [inline, protected, virtual]
 

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

Referenced by do_modal().

01742 {
01743 public:
01744     /**
01745         DialogBox Constructor

virtual void NDK_XX::DialogBox::on_dlg_init   [inline, protected, virtual]
 

called at the beggining of the modal loop

Reimplemented in NDK_XX::MessageBox, NDK_XX::PropertyPage, NDK_XX::PropertyDialog, TestBox, TabbedDlgBox, TabbedDlgPage1, and TabbedDlgPage2.

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

Referenced by do_modal().

01701                  : public MessageBox 

virtual void NDK_XX::DialogBox::on_dlg_no   [inline, protected, virtual]
 

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

01741 : public DialogBox 

virtual void NDK_XX::DialogBox::on_dlg_ok   [inline, protected, virtual]
 

Vanilla implementation of exits.

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

01741 : public DialogBox 

virtual void NDK_XX::DialogBox::on_dlg_term   [inline, protected, virtual]
 

called at the end of the modal loop

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

References info, NDK_XX::MessageBox::MessageBox(), okCancel, NDK_XX::OkCancelBox::OkCancelBox(), and NDK_XX::Control::title.

01701 : public MessageBox 

virtual void NDK_XX::DialogBox::on_dlg_yes   [inline, protected, virtual]
 

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

01741 : public DialogBox 

void NDK_XX::DialogBox::prev_control   [protected]
 

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

References children, curr_child, on_ctrl_init(), and on_ctrl_term().

Referenced by do_modal(), and NDK_XX::PropertyPage::process_key().

02084 {
02085     if(children.size()>1 && on_ctrl_term(*(children[curr_child]))){
02086         int start_point=curr_child;
02087         for(curr_child--;start_point!=curr_child;curr_child--){
02088             if(curr_child<0)
02089                 curr_child=children.size()-1;
02090             
02091             if(children[curr_child]->is_enabled())
02092                 break; //We found the next selectable child
02093         }
02094         on_ctrl_init(*(children[curr_child]));
02095     }
02096 }

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

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

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

Referenced by show_text().

02155                                                    {
02156   if (label) {
02157     int x = maxx() - strlen(label);
02158     if (x<0)
02159       x=0;
02160     OnError(addstr(row, x, label, width()));
02161   }
02162 }

void NDK_XX::DialogBox::set_focus_to Control   p_child [protected, virtual]
 

activate p_child

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

References children, and set_focus_to().

02116 {
02117     for(int i=0;p_child && i<children.size();i++){
02118         if(children[i] == p_child){
02119             set_focus_to(i);
02120             break;
02121         }
02122     }
02123 }

void NDK_XX::DialogBox::set_focus_to int    child_idx [protected, virtual]
 

activate child at position child_idx

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

References children, curr_child, on_ctrl_init(), and on_ctrl_term().

Referenced by add_ok(), find_clicked(), TabbedDlgPage2::on_clear_list(), TestBox::on_clear_list(), TabbedDlgPage2::on_dlg_init(), TestBox::on_dlg_init(), NDK_XX::MessageBox::on_dlg_init(), NDK_XX::PropertyDialog::on_dlg_init(), TabbedDlgPage2::on_remove(), TestBox::on_remove(), TabbedDlgPage2::on_sel_change(), TestBox::on_sel_change(), set_focus_to(), and NDK_XX::PropertyDialog::set_selected_page().

02101 {
02102     if(children.empty()||curr_child < 0)
02103         return;
02104     if(!children[child_idx]->is_enabled())
02105         return;
02106 
02107     if(on_ctrl_term(*(children[curr_child]))){
02108         curr_child = child_idx;
02109         on_ctrl_init(*(children[curr_child]));
02110     }
02111 }

void NDK_XX::DialogBox::set_text const string &    v [inline, virtual]
 

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

Implements NDK_XX::Control.

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

References IDOK.

01636                                 {end_dialog(IDOK);} 

void NDK_XX::DialogBox::show   [virtual]
 

Show this window and the contained controls.

Reimplemented from NDK_XX::Control.

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

References children.

01949 {
01950     ListOfChildren::iterator it;
01951     for(it=children.begin();it!=children.end();it++){
01952         (*it)->show();
01953     }
01954     Control::show();
01955 }

void NDK_XX::DialogBox::show_text const string &    t,
char    where
[protected]
 

A simple helper.

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

References lefttext(), and righttext().

Referenced by DialogBox().

01960 {
01961     if (!t.empty()){
01962         switch(where){
01963             case 'l': lefttext(0,t.c_str()); break;
01964             case 'c': centertext(0,t.c_str()); break;
01965             case 'r': righttext(0,t.c_str()); break;
01966             default: centertext(0,t.c_str()); break;
01967         }
01968     }
01969 }

int NDK_XX::DialogBox::X_POS int    pos [static, protected]
 

space between buttons

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

References btn_w, btns, my_w, spc, and used_width.

Referenced by add_ok_cancel(), add_yes_no(), add_yes_no_cancel(), and NDK_XX::PropertyDialog::create_buttons().

02172 {
02173     return (((my_w-used_width)/btns)+((btn_w+spc)*pos));
02174 }


Member Data Documentation

string NDK_XX::DialogBox::_title [protected]
 

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

Referenced by DialogBox(), and NDK_XX::PopUpMenu::PopUpMenu().

bool NDK_XX::DialogBox::bContinueModal [protected]
 

Modal loop condition.

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

Referenced by do_modal(), NDK_XX::PropertyPage::on_cmd(), and NDK_XX::PropertyPage::process_key().

int NDK_XX::DialogBox::btn_w = 0 [static, protected]
 

useable width

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

Referenced by add_ok_cancel(), add_yes_no(), add_yes_no_cancel(), NDK_XX::PropertyDialog::create_buttons(), and X_POS().

int NDK_XX::DialogBox::btns = 0 [static, protected]
 

each button width

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

Referenced by add_ok_cancel(), add_yes_no(), add_yes_no_cancel(), NDK_XX::PropertyDialog::create_buttons(), and X_POS().

bool NDK_XX::DialogBox::changed [protected]
 

So we can ask the user if she want to save.

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

Referenced by NDK_XX::PropertyDialog::cancel_to_close(), TabbedDlgPage2::on_clear_list(), TabbedDlgPage2::on_remove(), TabbedDlgPage2::on_sel_change(), and TestBox::on_sel_change().

ListOfChildren NDK_XX::DialogBox::children [protected]
 

The controls we have.

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

Referenced by add_child(), add_ok(), driver(), find_clicked(), hide(), NDK_XX::SubMenu::move_right(), next_control(), prev_control(), set_focus_to(), show(), and ~DialogBox().

friend NDK_XX::DialogBox::Control [protected]
 

Allow children to touch our stuff.

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

int NDK_XX::DialogBox::curr_child [protected]
 

where is te focus now

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

Referenced by driver(), next_control(), TabbedDlgPage2::on_clear_list(), TestBox::on_clear_list(), TabbedDlgPage2::on_dlg_init(), TestBox::on_dlg_init(), TabbedDlgPage2::on_remove(), TestBox::on_remove(), TabbedDlgPage2::on_sel_change(), TestBox::on_sel_change(), prev_control(), and set_focus_to().

NCursesPanel NDK_XX::DialogBox::dlg_stdscr [static]
 

The standard screen.

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

int NDK_XX::DialogBox::dlg_style [protected]
 

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

Referenced by create_buttons().

string NDK_XX::DialogBox::lblApply = " Apply" [static, protected]
 

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

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

string NDK_XX::DialogBox::lblCancel = "Cancel" [static, protected]
 

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

Referenced by add_ok_cancel(), add_yes_no_cancel(), and NDK_XX::PropertyDialog::create_buttons().

string NDK_XX::DialogBox::lblNo = " No " [static, protected]
 

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

Referenced by add_yes_no(), and add_yes_no_cancel().

string NDK_XX::DialogBox::lblOk = " OK " [static, protected]
 

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

Referenced by add_ok(), add_ok_cancel(), and NDK_XX::PropertyDialog::create_buttons().

string NDK_XX::DialogBox::lblYes = " Yes " [static, protected]
 

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

Referenced by add_yes_no(), and add_yes_no_cancel().

string NDK_XX::DialogBox::msgAskToSave = "Save before we exit?" [static, protected]
 

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

Referenced by can_close().

int NDK_XX::DialogBox::my_w = 0 [static, protected]
 

Helpers for auto-ordering the default buttons.

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

Referenced by add_ok_cancel(), add_yes_no(), add_yes_no_cancel(), NDK_XX::PropertyDialog::create_buttons(), and X_POS().

PushButton* NDK_XX::DialogBox::pBtnCancel [protected]
 

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

Referenced by add_ok_cancel(), add_yes_no_cancel(), NDK_XX::PropertyDialog::cancel_to_close(), NDK_XX::PropertyDialog::create_buttons(), NDK_XX::MessageBox::on_dlg_init(), and NDK_XX::PropertyDialog::on_dlg_init().

PushButton* NDK_XX::DialogBox::pBtnNo [protected]
 

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

Referenced by add_yes_no(), add_yes_no_cancel(), and NDK_XX::MessageBox::on_dlg_init().

PushButton* NDK_XX::DialogBox::pBtnOk [protected]
 

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

Referenced by add_ok(), add_ok_cancel(), NDK_XX::PropertyDialog::cancel_to_close(), NDK_XX::PropertyDialog::create_buttons(), TabbedDlgPage2::on_remove(), TestBox::on_remove(), TabbedDlgPage2::on_sel_change(), and TestBox::on_sel_change().

PushButton* NDK_XX::DialogBox::pBtnYes [protected]
 

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

Referenced by add_yes_no(), and add_yes_no_cancel().

int NDK_XX::DialogBox::spc = 0 [static, protected]
 

total buttons width

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

Referenced by add_ok_cancel(), add_yes_no(), add_yes_no_cancel(), NDK_XX::PropertyDialog::create_buttons(), and X_POS().

string NDK_XX::DialogBox::titDataChgd = "Data changed!" [static, protected]
 

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

Referenced by can_close().

int NDK_XX::DialogBox::used_width = 0 [static, protected]
 

number of buttons

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

Referenced by add_ok_cancel(), add_yes_no(), add_yes_no_cancel(), NDK_XX::PropertyDialog::create_buttons(), and X_POS().

int NDK_XX::DialogBox::user_request [protected]
 

this is the result of the interaction

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

Referenced by do_modal(), and driver().


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