/************************************************************************* Handler for selections made in the drop-list *************************************************************************/ bool Combobox::droplist_SelectionAcceptedHandler(const EventArgs& e) { // copy the text from the selected item into the edit box ListboxItem* item = ((ComboDropList*)((WindowEventArgs&)e).window)->getFirstSelectedItem(); if (item != NULL) { // Put the text from the list item into the edit box d_editbox->setText(item->getText()); // select text if it's editable, and move carat to end if (!isReadOnly()) { d_editbox->setSelection(0, item->getText().length()); d_editbox->setCaratIndex(item->getText().length()); } d_editbox->setCaratIndex(0); // fire off an event of our own WindowEventArgs args(this); onListSelectionAccepted(args); // finally, activate the edit box d_editbox->activate(); } return true; }
bool BookmarkSelect(const CEGUI::EventArgs& event) { using namespace CEGUI; dbg(0,"1\n"); MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Bookmarks/Listbox")); dbg(0,"2\n"); ListboxItem * item = mcl->getFirstSelectedItem(); if(item){ dbg(0,"item %s is at row %i\n",item->getText().c_str(),mcl->getItemRowIndex(item)); BookmarkGo(item->getText().c_str()); } WindowManager::getSingleton().getWindow("BookmarkSelection")->hide(); }
bool handleItemSelect(int r) { using namespace CEGUI; extern CEGUI::Window* myRoot; MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("DestinationWindow/Listbox")); ListboxItem * item = mcl->getItemAtGridReference(MCLGridRef(r,0)); ListboxItem * itemid = mcl->getItemAtGridReference(MCLGridRef(r,1)); ListboxItem * item_assoc = mcl->getItemAtGridReference(MCLGridRef(r,2)); Window* country_edit = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/CountryEditbox")); Window* twn_edit = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/TownEditbox")); Window* street_edit = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/StreetEditbox")); if(SDL_dest.current_search==SRCH_COUNTRY){ country_edit->setText(item->getText()); // Need to record the country here twn_edit->activate(); SDL_dest.current_search=SRCH_TOWN; myRoot->getChild("Navit/Keyboard")->getChild("Navit/Keyboard/Input")->setText(""); } else if(SDL_dest.current_search==SRCH_TOWN){ twn_edit->setText(item->getText()); // SDL_dest.town_street_assoc=atoi(item_assoc->getText().c_str()); // SDL_dest.town=atoi(itemid->getText().c_str()); // printf(" town %s , id=%lx, assoc=%li\n",item->getText().c_str(),SDL_dest.town_street_assoc,SDL_dest.town_street_assoc); ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3)); ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4)); Window* Dest_x = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/Dest_x")); Dest_x->setText(itemx->getText().c_str()); Window* Dest_y = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/Dest_y")); Dest_y->setText(itemy->getText().c_str()); mcl->resetList(); SDL_dest.current_search=SRCH_STREET; street_edit->activate(); myRoot->getChild("Navit/Keyboard")->getChild("Navit/Keyboard/Input")->setText(""); } else if(SDL_dest.current_search==SRCH_STREET){ street_edit->setText(item->getText()); myRoot->getChild("Navit/Keyboard")->hide(); ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3)); ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4)); Window* Dest_x = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/Dest_x")); Dest_x->setText(itemx->getText().c_str()); Window* Dest_y = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/Dest_y")); Dest_y->setText(itemy->getText().c_str()); mcl->resetList(); SDL_dest.current_search=SRCH_STREET; myRoot->getChild("Navit/Keyboard")->getChild("Navit/Keyboard/Input")->setText(""); /* ListboxItem * itemid = mcl->getItemAtGridReference(MCLGridRef(r,1)); int segment_id=atoi(itemid->getText().c_str()); printf("street seg id : %li\n",segment_id); extern struct container *co; struct block_info res_blk_inf; struct street_str *res_str; street_get_by_id(co->map_data, 33, segment_id,&res_blk_inf,&res_str ); struct street_coord * streetcoord; streetcoord=street_coord_get(&res_blk_inf,res_str); printf("Street coordinates : %i,%i\n",streetcoord->c->x,streetcoord->c->y); char xbuff [256]; sprintf(xbuff,"%li",streetcoord->c->x); char ybuff [256]; sprintf(ybuff,"%li",streetcoord->c->y); Window* Dest_x = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/Dest_x")); Dest_x->setText(xbuff); Window* Dest_y = static_cast<Window*>(myRoot->getChild("DestinationWindow")->getChild("DestinationWindow/Dest_y")); Dest_y->setText(ybuff); struct street_name name; // printf("street_name_get_by_id returns : %i\n",street_name_get_by_id(&name, res_blk_inf.mdata, res_str->nameid)); street_name_get_by_id(&name, res_blk_inf.mdata, res_str->nameid); // printf("name1:%s / name2%s\n",name.name1,name.name2); struct street_name_number_info num; struct street_name_info inf; SDL_dest.current_search=SRCH_NUMBER; mcl->resetList(); while (street_name_get_info(&inf, &name)) { while(street_name_get_number_info(&num,&inf)){ // printf(" House Number : %i -> %i\n",num.first,num.last); for(int i=num.first;i<=num.last;i+=2){ add_number_to_list(i,num.c->x,num.c->y); } } } */ // route_to(streetcoord->c->x,streetcoord->c->y); } else if (SDL_dest.current_search==SRCH_NUMBER){ struct coord pos; ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3)); ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4)); pos.x=atoi(itemx->getText().c_str()); pos.y=atoi(itemy->getText().c_str()); route_to(pos.x,pos.y); } return true; }
bool handleItemSelect(int r) { using namespace CEGUI; MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox")); ListboxItem * item = mcl->getItemAtGridReference(MCLGridRef(r,0)); ListboxItem * itemid = mcl->getItemAtGridReference(MCLGridRef(r,1)); ListboxItem * item_assoc = mcl->getItemAtGridReference(MCLGridRef(r,2)); Window* country_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox")); Window* twn_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox")); Window* street_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox")); if(SDL_dest.current_search==SRCH_COUNTRY){ country_edit->setText(item->getText()); twn_edit->activate(); SDL_dest.current_search=SRCH_TOWN; WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText(""); } else if(SDL_dest.current_search==SRCH_TOWN){ twn_edit->setText(item->getText()); ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3)); ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4)); Window* Dest_x = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_x")); Dest_x->setText(itemx->getText().c_str()); Window* Dest_y = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_y")); Dest_y->setText(itemy->getText().c_str()); mcl->resetList(); SDL_dest.current_search=SRCH_STREET; street_edit->activate(); WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText(""); } else if(SDL_dest.current_search==SRCH_STREET){ street_edit->setText(item->getText()); WindowManager::getSingleton().getWindow("Navit/Keyboard")->hide(); ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3)); ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4)); Window* Dest_x = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_x")); Dest_x->setText(itemx->getText().c_str()); Window* Dest_y = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_y")); Dest_y->setText(itemy->getText().c_str()); mcl->resetList(); SDL_dest.current_search=SRCH_STREET; WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText(""); } else if (SDL_dest.current_search==SRCH_NUMBER){ struct coord pos; ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3)); ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4)); pos.x=atoi(itemx->getText().c_str()); pos.y=atoi(itemy->getText().c_str()); route_to(pos.x,pos.y); } return true; }
bool ListboxNumberItem::operator > ( const ListboxItem& rhs ) const { return atoi ( d_itemText.c_str () ) > atoi ( rhs.getText ().c_str () ); }