#include <ndk_demo.h>
Inheritance diagram for TabbedDlgPage2:
Public Methods | |
TabbedDlgPage2 (PropertyDialog *parent, int id, const string &title,int lines, int cols, int y=0, int x=0) | |
Protected Methods | |
void | on_dlg_init () |
void | on_clear_list () |
Called when the "Clear" button is pushed. | |
void | on_remove () |
DECLARE_BINDINGS () | |
void | on_sel_change (int id) |
void | refresh_choices () |
Protected Attributes | |
Edit * | pEdit |
SelectionBox * | pSel |
ChoiceBox * | pChoice |
CheckListBox * | pCheckList |
CheckListBox * | pCheckList2 |
|
Definition at line 284 of file ndk_demo.cc. References NDK_XX::PropertyPage::do_initial_update().
00286 :PropertyPage(parent,id,tit,lines,cols,y,x) 00287 ,pEdit(0) 00288 ,pSel(0) 00289 ,pChoice(0) 00290 ,pCheckList(0) 00291 ,pCheckList2(0) 00292 { 00293 do_initial_update(); 00294 } |
|
Reimplemented from NDK_XX::DialogBox. |
|
Called when the "Clear" button is pushed.
Definition at line 359 of file ndk_demo.cc. References NDK_XX::DialogBox::changed, NDK_XX::DialogBox::curr_child, NDK_XX::PropertyPage::on_page_change(), pSel, and NDK_XX::DialogBox::set_focus_to().
00360 { 00361 long curr = curr_child; 00362 pSel->clear(); 00363 set_focus_to(curr); 00364 changed = true; 00365 on_page_change(); 00366 } |
|
we override this to add adornments to the window Reimplemented from NDK_XX::PropertyPage. Definition at line 298 of file ndk_demo.cc. References NDK_XX::DialogBox::add_child(), NDK_XX::PropertyPage::create_buttons(), NDK_XX::DialogBox::curr_child, NDK_XX::Control::get_param(), ID_CHOICE, ID_CLEAR, ID_EDIT, ID_MULTICHECK, ID_REMOVE, ID_SELECTION, ID_SINGLE_CHECK, NDK_XX::IndexList, pCheckList, pCheckList2, pChoice, pEdit, pSel, refresh_choices(), and NDK_XX::DialogBox::set_focus_to().
00299 { 00300 string s1("Name:"); 00301 add_child(new Label(this,-1,s1,1,s1.length(),1,1)); 00302 00303 pEdit=new Edit(this,ID_EDIT,"",3,40,2,1); 00304 add_child(pEdit); 00305 // pCtrl->set_overwrite(); 00306 00307 int first = curr_child; 00308 00309 add_child(new PushButton(this,ID_CLEAR,"Clear List",5,1)); 00310 add_child(new PushButton(this,ID_REMOVE,"Remove",5,15)); 00311 // add_child(new PushButton(this,ID_TABS,"Show Tabbed Dialog",5,25)); 00312 00313 pSel = new SelectionBox(this,ID_SELECTION,"",6,10,6,1); 00314 pSel->set_vscrollbar(); 00315 pSel->add_item(get_param("selection","1","First")); 00316 pSel->add_item(get_param("selection","2","Second")); 00317 pSel->add_item(get_param("selection","3","Third")); 00318 pSel->add_item(get_param("selection","4","Fourth")); 00319 pSel->add_item(get_param("selection","5","Fifth")); 00320 pSel->add_item(get_param("selection","6","Sixth")); 00321 pSel->add_item(get_param("selection","7","Seventh")); 00322 pSel->add_item(get_param("selection","8","Eighth")); 00323 pSel->add_item(get_param("selection","9","Nineth")); 00324 add_child(pSel); 00325 00326 pChoice = new ChoiceBox(this,ID_CHOICE,"",6,10,6,12); 00327 pChoice->add_item("First"); 00328 pChoice->add_item("Last"); 00329 pChoice->add_item("Middle"); 00330 add_child(pChoice); 00331 refresh_choices(); 00332 00333 pChoice->set_cur_sel(get_param("default","4",0)); 00334 00335 pCheckList = new CheckListBox(this,ID_SINGLE_CHECK,"",6,10,6,23); 00336 // pCheckList->add_item("Check 1"); 00337 // pCheckList->add_item("Check 2"); 00338 // pCheckList->add_item("Check 3"); 00339 add_child(pCheckList); 00340 00341 pCheckList2 = new CheckListBox(this,ID_MULTICHECK,"",6,10,6,34); 00342 pCheckList2->add_item("Checkme"); 00343 pCheckList2->add_item("Me too"); 00344 pCheckList2->add_item("lemmein"); 00345 pCheckList2->set_multisel(); 00346 00347 IndexList il; 00348 il.push_back(1); 00349 il.push_back(2); 00350 pCheckList2->set_sel_items(il); 00351 add_child(pCheckList2); 00352 00353 create_buttons(); 00354 set_focus_to(pEdit); 00355 } |
|
Called when the "Remove" button is pushed. we will remove the item pointed out by the second list box, the one with First, Last and Middle radio buttons Definition at line 370 of file ndk_demo.cc. References NDK_XX::DialogBox::changed, NDK_XX::DialogBox::curr_child, NDK_XX::PropertyPage::on_page_change(), NDK_XX::DialogBox::pBtnOk, pChoice, pSel, refresh_choices(), and NDK_XX::DialogBox::set_focus_to().
00371 { 00372 long curr = curr_child; 00373 int choice_idx =pChoice->get_cur_sel(); 00374 if(choice_idx == -1) 00375 return; 00376 int sel_idx = (int)pChoice->get_item_data(choice_idx); 00377 pSel->remove_item(sel_idx); 00378 refresh_choices(); 00379 set_focus_to(curr); 00380 changed = true; 00381 on_page_change(); 00382 if(pBtnOk) 00383 pBtnOk->enable(); 00384 } |
|
Called whenever the pChoice listbox selection changes. It is binded to the LI_SEL_CHANGE event via the BINDING... macros Definition at line 399 of file ndk_demo.cc. References NDK_XX::DialogBox::changed, NDK_XX::DialogBox::curr_child, NDK_XX::PropertyPage::on_page_change(), NDK_XX::DialogBox::pBtnOk, pChoice, pEdit, pSel, and NDK_XX::DialogBox::set_focus_to().
00400 { 00401 int curr = curr_child; 00402 changed = true; 00403 on_page_change(); 00404 if(pBtnOk) 00405 pBtnOk->enable(); 00406 if(id == pChoice->get_ctrl_id()){ 00407 int choice_idx =pChoice->get_cur_sel(); 00408 int sel_idx = (int)pChoice->get_item_data(choice_idx); 00409 if(choice_idx < 0) 00410 return; 00411 pSel->set_cur_sel(sel_idx); 00412 pEdit->set_text(pSel->get_item_text(sel_idx)); 00413 } 00414 set_focus_to(curr); 00415 } |
|
If we remove something we must update the items pointed to by the pChoice items Definition at line 388 of file ndk_demo.cc. Referenced by on_dlg_init(), and on_remove().
|
|
Definition at line 152 of file ndk_demo.h. Referenced by on_dlg_init(). |
|
Definition at line 153 of file ndk_demo.h. Referenced by on_dlg_init(). |
|
Definition at line 151 of file ndk_demo.h. Referenced by on_dlg_init(), on_remove(), on_sel_change(), and refresh_choices(). |
|
Definition at line 149 of file ndk_demo.h. Referenced by on_dlg_init(), and on_sel_change(). |
|
Definition at line 150 of file ndk_demo.h. Referenced by on_clear_list(), on_dlg_init(), on_remove(), on_sel_change(), and refresh_choices(). |