#include <ndk++.h>
Inheritance diagram for NDK_XX::Control:
Public Types | |
enum | styles { framed = 0x0001, moveable = 0x0002, editable = 0x0004, tabstop = 0x0008, notify = 0x0010, hscroll = 0x0020, multisel = 0x0040, hscrollbar = 0x0100, vscrollbar = 0x0200, title = 0x0400, hidden = 0x0800 } |
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 | |
Control (Control *parent, int id,int lines, int cols, int y, int x, int style=0) | |
Control (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 () |
Draw as active (i.e.,with bold frame). | |
virtual void | deactivate () |
Draw as inactive (i.e.,with normal frame). | |
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) |
bool | has_show_title () const |
Should we write the title of this control? | |
void | set_show_title (bool t_or_f=true) |
void | use_arrow_as_tab (bool t_or_f=true) |
if set, when user presses key left or right, move to next/previous control | |
bool | arrow_is_tab () |
bool | is_hidden () const |
void | set_hidden (bool t_or_f=true) |
virtual void | show () |
call panel's show and set our state accordingly | |
virtual void | hide () |
call panel's hide and set our state accordingly | |
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++. | |
virtual bool | clicked_inside (int y, int x) const |
Static Public Methods | |
ofstream & | send_to_log (const string &what) |
Protected Methods | |
virtual int | driver (int key) |
virtual int | move_left () |
virtual int | move_right () |
virtual const BINDING_MAP * | get_binding_map () const |
Static Protected Methods | |
bool | process_message (Control *pTarget, int what, int ctrl_id, void *pExtra) |
const BINDING * | get_binding (const BINDING *pEntry,int what, int ctrl_id) |
Helper to find a binding for what corresponding to ctrl_id. | |
Protected Attributes | |
Control * | pParent |
int | ctrl_id |
int | field_style |
int | field_state |
bool | arrow_as_tab |
Static Protected Attributes | |
const BINDING_MAP | bindingMap |
Static Private Attributes | |
const BINDING | _bindingEntries [] |
Friends | |
class | DialogBox |
|
The states a control can take.
Definition at line 82 of file ndk++.h. Referenced by get_state(), NDK_XX::ListItem::operator=(), set_state(), and set_states().
|
|
The styles a control can have.
Definition at line 67 of file ndk++.h. Referenced by get_style(), NDK_XX::MessageBox::on_dlg_init(), NDK_XX::ListItem::operator=(), set_style(), and set_styles().
00067 { 00068 framed = 0x0001, ///Do we have a frame? 00069 moveable= 0x0002, ///We can be moved around? 00070 editable= 0x0004, ///Is our text editable? 00071 tabstop = 0x0008, ///Can be looped thru? 00072 notify = 0x0010, ///Do we notify our parent of events? 00073 hscroll = 0x0020, ///Can we scroll horizontally? 00074 multisel= 0x0040, ///Can select multiple items? 00075 hscrollbar= 0x0100, ///Draw horizontal scrollbar? 00076 vscrollbar= 0x0200, ///Draw vertical scrollbar? 00077 title = 0x0400, ///Show title of this control? 00078 hidden = 0x0800 ///Should we be seen in a window? 00079 }; |
|
Control Constructor
Definition at line 107 of file ndk++.h. References arrow_as_tab, ctrl_id, field_state, field_style, has_frame(), pParent, set_visible(), and unknown.
00109 : NCursesPanel(lines,cols,parent->begy()+y,parent->begx()+x) 00110 ,pParent(parent),ctrl_id(id) 00111 ,field_style(style),field_state(unknown) 00112 ,arrow_as_tab(true) 00113 { 00114 if(has_frame()){ 00115 box(); 00116 } 00117 set_visible(); 00118 } |
|
Control Constructor
Definition at line 135 of file ndk++.h. References arrow_as_tab, ctrl_id, field_state, field_style, has_frame(), pParent, set_visible(), and unknown.
00137 : NCursesPanel(lines,cols,y,x) 00138 ,pParent(0),ctrl_id(id) 00139 ,field_style(style),field_state(unknown) 00140 ,arrow_as_tab(true) 00141 { 00142 if(has_frame()){ 00143 box(); 00144 } 00145 set_visible(); 00146 } |
|
Draw as active (i.e.,with bold frame).
Reimplemented in NDK_XX::Label, NDK_XX::Button, NDK_XX::ListBox, and NDK_XX::Tab. Definition at line 203 of file ndk++.cc. References active, has_frame(), is_hidden(), and set_state(). Referenced by NDK_XX::Tab::activate().
|
|
Definition at line 246 of file ndk++.h. References arrow_as_tab. Referenced by move_left(), and move_right().
00246 {return arrow_as_tab;} |
|
No descriptions Definition at line 301 of file ndk++.h. Referenced by NDK_XX::Tab::driver(), NDK_XX::Button::driver(), NDK_XX::DialogBox::find_clicked(), NDK_XX::MenuBar::find_clicked(), and NDK_XX::PropertyPage::on_cmd().
00301 {
00302 return ( begy() <= y &&
00303 begx() <= x &&
00304 (begx() + maxx()) >= x &&
00305 (begy() + maxy()) >= y
00306 );
00307 }
|
|
Draw as inactive (i.e.,with normal frame).
Reimplemented in NDK_XX::Label, NDK_XX::Button, NDK_XX::ListBox, and NDK_XX::Tab. Definition at line 219 of file ndk++.cc. References active, has_frame(), is_hidden(), and set_state(). Referenced by NDK_XX::Tab::deactivate().
|
|
get a chance at processing the key, before parent does Reimplemented in NDK_XX::Edit, NDK_XX::Button, NDK_XX::PropDlgPushButton, NDK_XX::ListItem, NDK_XX::MenuItem, NDK_XX::ListBox, NDK_XX::MenuBar, NDK_XX::DialogBox, NDK_XX::PropertyPage, and NDK_XX::Tab. Definition at line 296 of file ndk++.cc. References move_left(), and move_right().
00297 { 00298 switch(key) { 00299 case KEY_RIGHT: 00300 return move_right(); 00301 case KEY_LEFT: 00302 return move_left(); 00303 default: break; 00304 } 00305 return FALSE; 00306 } |
|
Ignore /Stop ignoring us when user press tab.
Definition at line 202 of file ndk++.h. References set_style(), and tabstop. Referenced by NDK_XX::DialogBox::add_ok_cancel(), NDK_XX::PropertyDialog::cancel_to_close(), NDK_XX::PropertyDialog::create_buttons(), hide(), and show().
|
|
notify parent of changes
Definition at line 220 of file ndk++.h. References notify, and set_style(). Referenced by NDK_XX::CheckButton::CheckButton(), NDK_XX::EditDate::EditDate(), NDK_XX::Label::Label(), NDK_XX::ListBox::ListBox(), NDK_XX::MenuItem::MenuItem(), NDK_XX::PushButton::PushButton(), NDK_XX::RadioButton::RadioButton(), and NDK_XX::Tab::Tab().
|
|
Helper to find a binding for what corresponding to ctrl_id.
Definition at line 96 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 189 of file ndk++.h. References ctrl_id. Referenced by NDK_XX::Tab::activate(), NDK_XX::Edit::add_or_insert_char(), NDK_XX::PropertyDialog::add_page(), NDK_XX::Edit::edit(), NDK_XX::ListBox::move_down(), NDK_XX::ListBox::move_up(), NDK_XX::OkCancelBox::OkCancelBox(), NDK_XX::ListBox::on_sel_change(), and NDK_XX::Label::set_text().
00189 {return ctrl_id;}; |
|
Delegation function to get the params from almost anywhere in NDK++.
|
|
Delegation function to get the params from almost anywhere in NDK++.
Definition at line 2170 of file ndk++.h. Referenced by NDK_XX::MenuBar::driver(), TabbedDlgPage2::on_dlg_init(), and TestBox::on_dlg_init(). |
|
tell me what status this window is on...
Definition at line 158 of file ndk++.h. References field_state, and states. Referenced by NDK_XX::ListItemData::operator=().
00158 { return states(field_state); } |
|
tell me what styles this window has...
Definition at line 148 of file ndk++.h. References field_style, and styles. Referenced by NDK_XX::ListItemData::operator=().
00148 { return styles(field_style); } |
|
Implemented in NDK_XX::Label, NDK_XX::ListBox, and NDK_XX::DialogBox. |
|
if this style has been set...
Definition at line 167 of file ndk++.h. References field_style, and framed. Referenced by NDK_XX::Label::activate(), activate(), Control(), NDK_XX::Label::deactivate(), deactivate(), NDK_XX::DialogBox::DialogBox(), NDK_XX::MenuBar::get_next_item_y(), NDK_XX::ChoiceBox::initialize_items(), NDK_XX::CheckListBox::initialize_items(), NDK_XX::SelectionBox::initialize_items(), NDK_XX::Label::Label(), NDK_XX::ListBox::ListBox(), NDK_XX::Tab::set_text(), NDK_XX::PushButton::set_text(), and NDK_XX::Edit::~Edit().
00167 {return ( (field_style & framed)== framed);} |
|
if this style has been set...
Definition at line 234 of file ndk++.h. References field_style, and hscrollbar.
00234 {return ( (field_style & hscrollbar)== hscrollbar);} |
|
Should we write the title of this control?
Definition at line 241 of file ndk++.h. References field_style, and title. Referenced by NDK_XX::DialogBox::DialogBox().
00241 {return ( (field_style & title)== title);} |
|
Definition at line 237 of file ndk++.h. References field_style, and vscrollbar. Referenced by NDK_XX::ListBox::draw_scrollbar().
00237 {return ( (field_style & vscrollbar)== vscrollbar);} |
|
call panel's hide and set our state accordingly
Reimplemented in NDK_XX::ListBox, NDK_XX::DialogBox, and NDK_XX::Tab. Definition at line 272 of file ndk++.h. References enable(), is_visible(), and set_visible(). Referenced by set_hidden().
00272 { 00273 if(!is_visible()) return; 00274 NCursesPanel::hide(); 00275 set_visible(false); 00276 enable(false); 00277 } |
|
the user can edit this control's text?
Definition at line 174 of file ndk++.h. References editable, and field_style. Referenced by overwrite().
00174 { return ( (field_style & editable)==editable);} |
|
can make this control the active control?
Definition at line 205 of file ndk++.h. References field_style, and tabstop.
00205 { return ( (field_style & tabstop)==tabstop);} |
|
Should this control be shown at all? NOT same as visible/invisible, which is used to post/unpost a control under user actions. i.e.: we have two controls going to the same place, but we will show one and hide the other under some circumstances. Definition at line 253 of file ndk++.h. References field_style, and hidden. Referenced by NDK_XX::Tab::activate(), NDK_XX::Label::activate(), activate(), NDK_XX::Tab::deactivate(), NDK_XX::Label::deactivate(), deactivate(), and show().
00253 {return ( (field_style & hidden)== hidden);} |
|
can make this control the active control?
Definition at line 211 of file ndk++.h. References field_style, and hscroll.
00211 { return ( (field_style & hscroll)==hscroll);} |
|
the user can move this control?...
Definition at line 171 of file ndk++.h. References field_style, and moveable. Referenced by mvwin().
00171 { return ( (field_style & moveable)==moveable);} |
|
can make this control the active control?
Definition at line 217 of file ndk++.h. References field_style, and multisel. Referenced by NDK_XX::ListBox::check_multisel(), NDK_XX::ListBox::get_cur_sel(), NDK_XX::ListBox::get_sel_items(), NDK_XX::ListBox::move_down(), NDK_XX::ListBox::move_up(), NDK_XX::ListBox::remove_item(), and NDK_XX::ListBox::set_sel_items().
00217 { return ( (field_style & multisel)==multisel);} |
|
are we visible on the list viewport?
Definition at line 177 of file ndk++.h. References field_state, and visible. Referenced by hide(), and show().
00177 { return ( (field_state & visible)==visible);} |
|
move_left and move_right: if arrow_is_tab == true, they return false, so the owner can process KEY_LEFT and KEY_RIGHT, and properly move to previous or next control. Reimplemented in NDK_XX::Edit, NDK_XX::MenuBar, and NDK_XX::SubMenu. Definition at line 181 of file ndk++.cc. References arrow_is_tab(). Referenced by NDK_XX::ListBox::driver(), and driver().
00182 { 00183 int result = false; 00184 if(!arrow_is_tab()) 00185 result = true; 00186 beep(); 00187 return result; 00188 } |
|
Reimplemented in NDK_XX::Edit, NDK_XX::MenuBar, and NDK_XX::SubMenu. Definition at line 192 of file ndk++.cc. References arrow_is_tab(). Referenced by NDK_XX::ListBox::driver(), and driver().
00193 { 00194 int result=false; 00195 if(!arrow_is_tab()) 00196 result = true; 00197 beep(); 00198 return result; 00199 } |
|
a control always moves inside its parent boundaries, so make this function use only relative values... Definition at line 154 of file ndk++.cc. References is_moveable(), and pParent. Referenced by NDK_XX::PropertyDialog::reorder_pages().
00155 { 00156 if(!is_moveable()) 00157 return E_REQUEST_DENIED; 00158 00159 int result=0; 00160 int new_x=begx()+x; 00161 int new_y=begy()+y; 00162 00163 if( new_x > pParent->begx() 00164 && new_x+ width() <= pParent->begx()+pParent->maxx() 00165 && new_y > pParent->begy() 00166 && new_y+ height() <= pParent->begy()+pParent->maxy() 00167 ){ 00168 result = NCursesPanel::mvwin(new_y,new_x); 00169 if(result==OK){ 00170 w->_begx = new_x; 00171 w->_begy = new_y; 00172 refresh(); 00173 } 00174 } 00175 return result; 00176 } |
|
should we notify our parent upon firing of action()?
Definition at line 223 of file ndk++.h. References field_style, and notify. Referenced by NDK_XX::Tab::activate(), NDK_XX::Edit::add_or_insert_char(), NDK_XX::Edit::edit(), NDK_XX::ListBox::move_down(), NDK_XX::ListBox::move_up(), NDK_XX::OkCancelBox::OkCancelBox(), NDK_XX::ListBox::on_sel_change(), and NDK_XX::Label::set_text().
00223 { return ( (field_style & notify)==notify);} |
|
the user current pos is overwritten or char is inserted?
Definition at line 229 of file ndk++.h. References field_state, is_editable(), and ovrwrt. Referenced by NDK_XX::Edit::add_or_insert_char().
00230 { return (is_editable() &&( (field_state & ovrwrt)==ovrwrt));} |
|
this method starts with pTarget and clibs it way thru the inheritance tree searching for a handler for what corresponding to ctrl_id Definition at line 68 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::Tab::activate(), NDK_XX::Edit::add_or_insert_char(), NDK_XX::Tab::driver(), NDK_XX::Edit::edit(), NDK_XX::ListBox::move_down(), NDK_XX::ListBox::move_up(), NDK_XX::OkCancelBox::OkCancelBox(), NDK_XX::ListBox::on_sel_change(), and NDK_XX::Label::set_text().
00070 { 00071 if(!pTarget) 00072 return false; 00073 const BINDING_MAP* binding_map; 00074 const BINDING* pEntry; 00075 00076 for (binding_map = pTarget->get_binding_map(); binding_map != 0; 00077 binding_map = binding_map->base_map) 00078 { 00079 assert(bindings_map != binding_map->base_map); 00080 00081 pEntry = get_binding(binding_map->pEntries, what, ctrl_id); 00082 if (pEntry) 00083 { 00084 if(what==0) 00085 (pTarget->*pEntry->p_cmd_fn)(); 00086 else// found it 00087 (pTarget->*pEntry->p_notif_fn)(ctrl_id); 00088 return true; 00089 } 00090 } 00091 return false; // not handled 00092 } |
|
Delegation function to set the params from almost anywhere in NDK++.
|
|
Delegation function to set the params from almost anywhere in NDK++.
|
|
Definition at line 60 of file ndk++.cc. References NDK_XX::logfile().
|
|
Definition at line 190 of file ndk++.h. References ctrl_id. Referenced by NDK_XX::ListItem::operator=().
00190 {ctrl_id=id;}; |
|
Definition at line 254 of file ndk++.h. References hidden, hide(), and set_style().
|
|
Ignore /Stop ignoring us when user press tab.
Definition at line 208 of file ndk++.h. References hscroll, and set_style().
|
|
Definition at line 235 of file ndk++.h. References hscrollbar, and set_style().
00235 { set_style(hscrollbar,t_or_f);} |
|
Allow multiple selections.
Definition at line 214 of file ndk++.h. References multisel, and set_style().
|
|
Set edit mode to overwrite or insert.
Definition at line 226 of file ndk++.h. References ovrwrt, and set_state(). Referenced by NDK_XX::EditDate::EditDate().
|
|
Definition at line 242 of file ndk++.h. References set_style(), and title.
|
|
set/unset a state bit
Definition at line 144 of file ndk++.cc. References field_state, and states. Referenced by activate(), deactivate(), set_overwrite(), and set_visible().
00145 { 00146 int old_state=field_state; 00147 if (on) field_state|=s; 00148 else field_state&=~s; 00149 return states(old_state); 00150 } |
|
set all states at once...
Definition at line 134 of file ndk++.cc. References field_state, and states. Referenced by NDK_XX::ListItem::operator=().
00135 { 00136 int old_state=field_state; 00137 field_state=s; 00138 return states(old_state); 00139 } |
|
set/unset a style bit
Definition at line 123 of file ndk++.cc. References field_style, and styles. Referenced by enable(), enable_notify(), NDK_XX::MessageBox::on_dlg_init(), NDK_XX::PushButton::PushButton(), set_hidden(), set_hscroll(), set_hscrollbar(), set_multisel(), set_show_title(), and set_vscrollbar().
00124 { 00125 int old_style=field_style; 00126 if (on) field_style|=s; 00127 else field_style&=~s; 00128 return styles(old_style); 00129 } |
|
set all styles at once...
Definition at line 113 of file ndk++.cc. References field_style, and styles. Referenced by NDK_XX::ListItem::operator=().
00114 { 00115 int old_style=field_style; 00116 field_style=s; 00117 return styles(old_style); 00118 } |
|
Usualy, a control in a dialog has some kind of text on it...
Implemented in NDK_XX::Label, NDK_XX::PushButton, NDK_XX::ListItem, NDK_XX::ListBox, NDK_XX::DialogBox, and NDK_XX::Tab. |
|
show or hide
Definition at line 199 of file ndk++.h. References set_state(), and visible. Referenced by Control(), hide(), and show().
|
|
Definition at line 238 of file ndk++.h. References set_style(), and vscrollbar.
00238 { set_style(vscrollbar,t_or_f);} |
|
call panel's show and set our state accordingly
Reimplemented in NDK_XX::ListBox, NDK_XX::DialogBox, and NDK_XX::Tab. Definition at line 263 of file ndk++.h. References enable(), is_hidden(), is_visible(), and set_visible().
00263 { 00264 if(is_hidden()) return; 00265 if(is_visible()) return; 00266 NCursesPanel::show(); 00267 set_visible(); 00268 enable(); 00269 } |
|
if set, when user presses key left or right, move to next/previous control
Definition at line 245 of file ndk++.h. References arrow_as_tab.
00245 {arrow_as_tab=t_or_f;} |
|
|
|
|
|
User can choose if using the arrows at left or right edges yields the same effect as pressing TAB/SHIFT-TAB default: TRUE; Definition at line 319 of file ndk++.h. Referenced by arrow_is_tab(), Control(), and use_arrow_as_tab(). |
|
|
|
Definition at line 311 of file ndk++.h. Referenced by Control(), get_binding(), get_ctrl_id(), process_message(), and set_ctrl_id(). |
|
Definition at line 313 of file ndk++.h. Referenced by Control(), get_state(), is_visible(), overwrite(), set_state(), and set_states(). |
|
Definition at line 312 of file ndk++.h. Referenced by Control(), get_style(), has_frame(), has_hscrollbar(), has_show_title(), has_vscrollbar(), is_editable(), is_enabled(), is_hidden(), is_hscroll_set(), is_moveable(), is_multisel(), notify_enabled(), set_style(), and set_styles(). |
|
Definition at line 310 of file ndk++.h. Referenced by NDK_XX::Tab::activate(), NDK_XX::Edit::add_or_insert_char(), Control(), NDK_XX::PropDlgPushButton::driver(), NDK_XX::Tab::driver(), NDK_XX::Edit::edit(), NDK_XX::EditDouble::EditDouble(), NDK_XX::ListBox::move_down(), NDK_XX::ListBox::move_up(), mvwin(), NDK_XX::OkCancelBox::OkCancelBox(), NDK_XX::ListBox::on_sel_change(), and NDK_XX::Label::set_text(). |