#include <ndk++.h>
Inheritance diagram for NDK_XX::NDKDlgControl:
Public Types | |
enum | styles { framed = 0x0001, moveable = 0x0002, editable = 0x0004, tabstop = 0x0008, notify = 0x0010, hscroll = 0x0020, multisel = 0x0040, hscrollbar = 0x0100, vscrollbar = 0x0200 } |
The styles a control can have. More... | |
enum | states { unknown = 0x0000, active = 0x0001, ovrwrt = 0x0002, checked = 0x0004, visible = 0x0008 } |
The states a control can take. More... | |
Public Methods | |
NDKDlgControl (NDKDlgControl *parent, int id,int lines, int cols, int y, int x, int style=0) | |
NDKDlgControl (int id,int lines, int cols, int y, int x, int style=0) | |
styles | get_style () const |
tell me what styles this window has... | |
styles | set_styles (styles s) |
set all styles at once... | |
styles | set_style (styles s, bool on=true) |
set/unset a style bit | |
states | get_state () const |
tell me what status this window is on... | |
states | set_states (states s) |
set all states at once... | |
states | set_state (states s, bool on=true) |
set/unset a state bit | |
bool | has_frame () const |
if this style has been set... | |
bool | is_moveable () const |
the user can move this control?... | |
bool | is_editable () const |
the user can edit this control's text? | |
bool | is_visible () const |
are we visible on the list viewport? | |
int | mvwin (int y, int x) |
virtual void | set_text (const string &txt)=0 |
Usualy, a control in a dialog has some kind of text on it... | |
virtual string | get_text () const=0 |
int | get_ctrl_id () const |
The control identifier. | |
void | set_ctrl_id (int id) |
virtual void | activate () |
Maybe these should change to set_focus/unset_focus. | |
virtual void | deactivate () |
void | set_visible (bool new_state=true) |
show or hide | |
void | enable (bool t_or_f=true) |
Ignore /Stop ignoring us when user press tab. | |
bool | is_enabled () const |
can make this control the active control? | |
void | set_hscroll (bool t_or_f=true) |
Ignore /Stop ignoring us when user press tab. | |
bool | is_hscroll_set () const |
can make this control the active control? | |
void | set_multisel (bool t_or_f=true) |
Allow multiple selections. | |
bool | is_multisel () const |
can make this control the active control? | |
void | enable_notify (bool t_or_f=true) |
notify parent of changes | |
bool | notify_enabled () const |
should we notify our parent upon firing of action()? | |
void | set_overwrite (bool t_or_f=true) |
Set edit mode to overwrite or insert. | |
bool | overwrite () const |
the user current pos is overwritten or char is inserted? | |
bool | has_hscrollbar () const |
if this style has been set... | |
void | set_hscrollbar (bool t_or_f=true) |
bool | has_vscrollbar () const |
void | set_vscrollbar (bool t_or_f=true) |
void | show () |
void | hide () |
string | get_param (const string §ion_name,const string &key_name,const string &val) |
Delegation function to get the params from almost anywhere in NDK++. | |
long | get_param (const string §ion_name,const string &key_name,long val) |
Delegation function to get the params from almost anywhere in NDK++. | |
string | save_param (const string §ion_name,const string &key_name,const string &val) |
Delegation function to set the params from almost anywhere in NDK++. | |
long | save_param (const string §ion_name,const string &key_name,long val) |
Delegation function to set the params from almost anywhere in NDK++. | |
Static Public Methods | |
ofstream & | send_to_log (const string &what) |
Protected Methods | |
virtual int | driver (int key) |
virtual const BINDING_MAP * | get_binding_map () const |
Static Protected Methods | |
bool | process_message (NDKDlgControl *pTarget, int what, int ctrl_id, void *pExtra) |
const BINDING * | get_binding (const BINDING *pEntry,int what, int ctrl_id) |
Protected Attributes | |
NDKDlgControl * | pParent |
int | ctrl_id |
int | field_style |
int | field_state |
bool | on_initial_update |
we won't notify parent if true | |
Static Protected Attributes | |
const BINDING_MAP | bindingMap |
Static Private Attributes | |
const BINDING | _bindingEntries [] |
Friends | |
class | NDKDialogBox |
|
The states a control can take.
Definition at line 292 of file ndk++.h. Referenced by get_state(), NDK_XX::NDKDlgListItem::operator=(), set_state(), and set_states().
|
|
The styles a control can have.
Definition at line 279 of file ndk++.h. Referenced by get_style(), NDK_XX::NDKDlgListItem::operator=(), set_style(), and set_styles().
00279 { 00280 framed = 0x0001, ///Do we have a frame? 00281 moveable= 0x0002, ///We can be moved around? 00282 editable= 0x0004, ///Is our text editable? 00283 tabstop = 0x0008, ///Can be looped thru? 00284 notify = 0x0010, ///Do we notify our parent of events? 00285 hscroll = 0x0020, ///Can we scroll horizontally? 00286 multisel= 0x0040, ///Can select multiple items? 00287 hscrollbar= 0x0100, ///Draw horizontal scrollbar? 00288 vscrollbar= 0x0200 ///Draw vertical scrollbar? 00289 }; |
|
Definition at line 300 of file ndk++.h. References ctrl_id, field_state, field_style, has_frame(), pParent, set_visible(), and unknown.
00302 : NCursesPanel(lines,cols,parent->begy()+y,parent->begx()+x) 00303 ,pParent(parent),ctrl_id(id) 00304 ,field_style(style),field_state(unknown) 00305 { 00306 if(has_frame()){ 00307 box(); 00308 } 00309 set_visible(); 00310 } |
|
Definition at line 312 of file ndk++.h. References ctrl_id, field_state, field_style, has_frame(), pParent, set_visible(), and unknown.
00314 : NCursesPanel(lines,cols,y,x) 00315 ,pParent(0),ctrl_id(id) 00316 ,field_style(style),field_state(unknown) 00317 { 00318 if(has_frame()){ 00319 box(); 00320 } 00321 set_visible(); 00322 } |
|
Maybe these should change to set_focus/unset_focus.
Reimplemented in NDK_XX::NDKDlgLabel, NDK_XX::NDKDlgButton, and NDK_XX::NDKDlgListBox. Definition at line 368 of file ndk++.cc. References active, has_frame(), and set_state().
|
|
Reimplemented in NDK_XX::NDKDlgLabel, NDK_XX::NDKDlgButton, and NDK_XX::NDKDlgListBox. Definition at line 382 of file ndk++.cc. References active, has_frame(), and set_state().
|
|
get a chance at processing the key, before parent does Reimplemented in NDK_XX::NDKDlgLabel, NDK_XX::NDKDlgEdit, NDK_XX::NDKDlgButton, NDK_XX::NDKDlgListItem, NDK_XX::NDKDlgListBox, and NDK_XX::NDKDialogBox. Definition at line 461 of file ndk++.h.
00461 { return FALSE;}
|
|
Ignore /Stop ignoring us when user press tab.
Definition at line 376 of file ndk++.h. References set_style(), and tabstop. Referenced by NDK_XX::NDKDialogBox::add_ok_cancel(), hide(), and show().
|
|
notify parent of changes
Definition at line 394 of file ndk++.h. References notify, and set_style().
|
|
Definition at line 284 of file ndk++.cc. References NDK_XX::BINDING::ctrl_id, ctrl_id, NDK_XX::BINDING::last_ctrl_id, NDK_XX::BINDING::pfn(), and NDK_XX::BINDING::what. Referenced by process_message().
|
|
Referenced by process_message(). |
|
The control identifier.
Definition at line 365 of file ndk++.h. References ctrl_id. Referenced by NDK_XX::NDKDlgEdit::add_or_insert_char(), NDK_XX::NDKDlgListBox::move_down(), NDK_XX::NDKDlgListBox::move_up(), NDK_XX::NDKDlgListBox::on_sel_change(), and NDK_XX::NDKDlgLabel::set_text().
00365 {return ctrl_id;}; |
|
Delegation function to get the params from almost anywhere in NDK++.
Definition at line 1385 of file ndk++.h.
01386 {}; 01387 01388 NDKDlgException (const T* elem, 01389 const string &msg, 01390 int err=-1) : |
|
Delegation function to get the params from almost anywhere in NDK++.
Definition at line 1394 of file ndk++.h. References NDK_XX::NDKDlgException< T >::pElem. Referenced by TestBox::on_dlg_init().
01395 :
01396 NCursesException ("NDK++ library exception", err),
01397 pElem (0)
01398 {};
01399
|
|
tell me what status this window is on...
Definition at line 334 of file ndk++.h. References field_state, and states. Referenced by NDK_XX::NDKDlgListItemData::operator=().
00334 { return states(field_state); } |
|
tell me what styles this window has...
Definition at line 324 of file ndk++.h. References field_style, and styles. Referenced by NDK_XX::NDKDlgListItemData::operator=().
00324 { return styles(field_style); } |
|
Implemented in NDK_XX::NDKDlgLabel, NDK_XX::NDKDlgListBox, and NDK_XX::NDKDialogBox. |
|
if this style has been set...
Definition at line 343 of file ndk++.h. References field_style, and framed. Referenced by NDK_XX::NDKDlgLabel::activate(), activate(), NDK_XX::NDKDlgLabel::deactivate(), deactivate(), NDK_XX::NDKDlgChoiceBox::initialize_items(), NDK_XX::NDKDlgCheckListBox::initialize_items(), NDK_XX::NDKDlgSelectionBox::initialize_items(), NDKDlgControl(), NDK_XX::NDKDlgLabel::NDKDlgLabel(), NDK_XX::NDKDlgListBox::NDKDlgListBox(), NDK_XX::NDKDlgPushButton::set_text(), and NDK_XX::NDKDlgEdit::~NDKDlgEdit().
00343 {return ( (field_style & framed)== framed);} |
|
if this style has been set...
Definition at line 408 of file ndk++.h. References field_style, and hscrollbar.
00408 {return ( (field_style & hscrollbar)== hscrollbar);} |
|
Definition at line 411 of file ndk++.h. References field_style, and vscrollbar. Referenced by NDK_XX::NDKDlgListBox::draw_scrollbar().
00411 {return ( (field_style & vscrollbar)== vscrollbar);} |
|
Definition at line 421 of file ndk++.h. References enable(), is_visible(), and set_visible(). Referenced by NDK_XX::NDKDialogBox::~NDKDialogBox(), and NDK_XX::NDKDlgListBox::~NDKDlgListBox().
00421 { 00422 if(!is_visible()) return; 00423 NCursesPanel::hide(); 00424 set_visible(false); 00425 enable(false); 00426 } |
|
the user can edit this control's text?
Definition at line 350 of file ndk++.h. References editable, and field_style. Referenced by overwrite().
00350 { return ( (field_style & editable)==editable);} |
|
can make this control the active control?
Definition at line 379 of file ndk++.h. References field_style, and tabstop.
00379 { return ( (field_style & tabstop)==tabstop);} |
|
can make this control the active control?
Definition at line 385 of file ndk++.h. References field_style, and hscroll.
00385 { return ( (field_style & hscroll)==hscroll);} |
|
the user can move this control?...
Definition at line 347 of file ndk++.h. References field_style, and moveable. Referenced by mvwin().
00347 { return ( (field_style & moveable)==moveable);} |
|
can make this control the active control?
Definition at line 391 of file ndk++.h. References field_style, and multisel. Referenced by NDK_XX::NDKDlgListBox::check_multisel(), NDK_XX::NDKDlgListBox::get_sel_items(), and NDK_XX::NDKDlgListBox::set_sel_items().
00391 { return ( (field_style & multisel)==multisel);} |
|
are we visible on the list viewport?
Definition at line 353 of file ndk++.h. References field_state, and visible. Referenced by hide(), and show().
00353 { return ( (field_state & visible)==visible);} |
|
a control always moves inside its parent boundaries, so make this function use only relative values... Definition at line 342 of file ndk++.cc. References is_moveable(), and pParent. Referenced by NDK_XX::NDKDlgLabel::driver().
00343 { 00344 if(!is_moveable()) 00345 return E_REQUEST_DENIED; 00346 00347 int result=0; 00348 int new_x=begx()+x; 00349 int new_y=begy()+y; 00350 00351 if( new_x > pParent->begx() 00352 && new_x+ width() <= pParent->begx()+pParent->maxx() 00353 && new_y > pParent->begy() 00354 && new_y+ height() <= pParent->begy()+pParent->maxy() 00355 ){ 00356 result = NCursesPanel::mvwin(new_y,new_x); 00357 if(result==OK){ 00358 w->_begx = new_x; 00359 w->_begy = new_y; 00360 refresh(); 00361 } 00362 } 00363 return result; 00364 } |
|
should we notify our parent upon firing of action()?
Definition at line 397 of file ndk++.h. References field_style, and notify. Referenced by NDK_XX::NDKDlgEdit::add_or_insert_char(), NDK_XX::NDKDlgListBox::move_down(), NDK_XX::NDKDlgListBox::move_up(), NDK_XX::NDKDlgListBox::on_sel_change(), and NDK_XX::NDKDlgLabel::set_text().
00397 { return ( (field_style & notify)==notify);} |
|
the user current pos is overwritten or char is inserted?
Definition at line 403 of file ndk++.h. References field_state, is_editable(), and ovrwrt. Referenced by NDK_XX::NDKDlgEdit::add_or_insert_char().
00404 { return (is_editable() &&( (field_state & ovrwrt)==ovrwrt));} |
|
Definition at line 258 of file ndk++.cc. References NDK_XX::BINDING_MAP::base_map, ctrl_id, get_binding(), get_binding_map(), NDK_XX::BINDING::p_cmd_fn, NDK_XX::BINDING::p_notif_fn, and NDK_XX::BINDING_MAP::pEntries. Referenced by NDK_XX::NDKDlgEdit::add_or_insert_char(), NDK_XX::NDKDlgListBox::move_down(), NDK_XX::NDKDlgListBox::move_up(), NDK_XX::NDKDlgListBox::on_sel_change(), and NDK_XX::NDKDlgLabel::set_text().
00260 { 00261 const BINDING_MAP* binding_map; 00262 const BINDING* pEntry; 00263 00264 for (binding_map = pTarget->get_binding_map(); binding_map != 0; 00265 binding_map = binding_map->base_map) 00266 { 00267 assert(bindings_map != binding_map->base_map); 00268 00269 pEntry = get_binding(binding_map->pEntries, what, ctrl_id); 00270 if (pEntry) 00271 { 00272 if(what==0) 00273 (pTarget->*pEntry->p_cmd_fn)(); 00274 else// found it 00275 (pTarget->*pEntry->p_notif_fn)(ctrl_id); 00276 return true; 00277 } 00278 } 00279 return false; // not handled 00280 } |
|
Delegation function to set the params from almost anywhere in NDK++.
Definition at line 1403 of file ndk++.h. References NDK_XX::NDKDlgException< T >::pElem.
01404 {}; 01405 01406 virtual const char *classname() const { 01407 return typeid(pElem).name(); 01408 } |
|
Delegation function to set the params from almost anywhere in NDK++.
|
|
Definition at line 250 of file ndk++.cc. References NDK_XX::logfile().
|
|
Definition at line 366 of file ndk++.h. References ctrl_id. Referenced by NDK_XX::NDKDlgListItem::operator=().
00366 {ctrl_id=id;}; |
|
Ignore /Stop ignoring us when user press tab.
Definition at line 382 of file ndk++.h. References hscroll, and set_style().
|
|
Definition at line 409 of file ndk++.h. References hscrollbar, and set_style().
00409 { set_style(hscrollbar,t_or_f);} |
|
Allow multiple selections.
Definition at line 388 of file ndk++.h. References multisel, and set_style().
|
|
Set edit mode to overwrite or insert.
Definition at line 400 of file ndk++.h. References ovrwrt, and set_state().
|
|
set/unset a state bit
Definition at line 332 of file ndk++.cc. References field_state, and states. Referenced by activate(), deactivate(), NDK_XX::NDKDlgButton::is_default(), set_overwrite(), and set_visible().
00333 { 00334 int old_state=field_state; 00335 if (on) field_state|=s; 00336 else field_state&=~s; 00337 return states(old_state); 00338 } |
|
set all states at once...
Definition at line 322 of file ndk++.cc. References field_state, and states. Referenced by NDK_XX::NDKDlgListItem::operator=().
00323 { 00324 int old_state=field_state; 00325 field_state=s; 00326 return states(old_state); 00327 } |
|
set/unset a style bit
Definition at line 311 of file ndk++.cc. References field_style, and styles. Referenced by enable(), enable_notify(), NDK_XX::NDKDlgPushButton::NDKDlgPushButton(), set_hscroll(), set_hscrollbar(), set_multisel(), and set_vscrollbar().
00312 { 00313 int old_style=field_style; 00314 if (on) field_style|=s; 00315 else field_style&=~s; 00316 return styles(old_style); 00317 } |
|
set all styles at once...
Definition at line 301 of file ndk++.cc. References field_style, and styles. Referenced by NDK_XX::NDKDlgListItem::operator=().
00302 { 00303 int old_style=field_style; 00304 field_style=s; 00305 return styles(old_style); 00306 } |
|
Usualy, a control in a dialog has some kind of text on it...
Implemented in NDK_XX::NDKDlgLabel, NDK_XX::NDKDlgPushButton, NDK_XX::NDKDlgListItem, NDK_XX::NDKDlgListBox, and NDK_XX::NDKDialogBox. |
|
show or hide
Definition at line 373 of file ndk++.h. References set_state(), and visible. Referenced by hide(), NDKDlgControl(), and show().
|
|
Definition at line 412 of file ndk++.h. References set_style(), and vscrollbar.
00412 { set_style(vscrollbar,t_or_f);} |
|
Definition at line 414 of file ndk++.h. References enable(), is_visible(), and set_visible().
00414 { 00415 if(is_visible()) return; 00416 NCursesPanel::show(); 00417 set_visible(); 00418 enable(); 00419 } |
|
|
|
|
|
|
|
Definition at line 452 of file ndk++.h. Referenced by get_binding(), get_ctrl_id(), NDKDlgControl(), process_message(), and set_ctrl_id(). |
|
Definition at line 454 of file ndk++.h. Referenced by get_state(), is_visible(), NDKDlgControl(), overwrite(), set_state(), and set_states(). |
|
Definition at line 453 of file ndk++.h. Referenced by get_style(), has_frame(), has_hscrollbar(), has_vscrollbar(), is_editable(), is_enabled(), is_hscroll_set(), is_moveable(), is_multisel(), NDKDlgControl(), notify_enabled(), set_style(), and set_styles(). |
|
we won't notify parent if true
Definition at line 457 of file ndk++.h. Referenced by NDK_XX::NDKDlgCheckButton::NDKDlgCheckButton(), NDK_XX::NDKDlgLabel::NDKDlgLabel(), NDK_XX::NDKDlgListBox::NDKDlgListBox(), NDK_XX::NDKDlgPushButton::NDKDlgPushButton(), and NDK_XX::NDKDlgRadioButton::NDKDlgRadioButton(). |
|
Definition at line 451 of file ndk++.h. Referenced by NDK_XX::NDKDlgEdit::add_or_insert_char(), NDK_XX::NDKDlgLabel::get_text(), NDK_XX::NDKDlgListBox::move_down(), NDK_XX::NDKDlgListBox::move_up(), mvwin(), NDKDlgControl(), NDK_XX::NDKDlgListBox::on_sel_change(), and NDK_XX::NDKDlgLabel::set_text(). |