Example #1
0
static void
sdl_update_roadbook(struct navigation *nav)
{

	using namespace CEGUI;
	extern Window* myRoot;
	
	struct navigation_list *list;	
	list=navigation_list_new(nav);

	// First, update the 'Navigation Tip' on the main window

	try {
		struct attr attr;
		item_attr_get(navigation_list_get_item(list), attr_navigation_speech, &attr);
		WindowManager::getSingleton().getWindow("Navit/Routing/Tips")->setText(attr.u.str);
	}
	catch (CEGUI::Exception& e)
	{
		fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
		printf("Missing control!...\n");
	}

	// Then, update the whole roadbook	
	try {

		/* Currently we use the 'Navit' text to display the roadbook, until Mineque design a button for that 		
		if(! WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->isVisible()){
			WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->show();
		}
		*/

		MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Roadbook"));
		mcl->resetList();

		item *item;
		struct attr attr;

		list=navigation_list_new(nav);	
		while ((item=navigation_list_get_item(list))) {
				
// 			printf("SDL : %s\n", str);
	 		mcl->addRow();
			item_attr_get(item, attr_navigation_short, &attr);
			ListboxTextItem* itemListbox = new ListboxTextItem(attr.u.str);
			itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			mcl->setItem(itemListbox, 0, mcl->getRowCount()-1);
		}
		navigation_list_destroy(list);
	}
	catch (CEGUI::Exception& e)
	{
		fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
		printf("Missing control!...\n");
	}

}
Example #2
0
void GVEvent::UpdateSuitAttrDisplay(const UIData::tagGoodAttr *pGoodAttr)
{
    //更新套装属性
    if(!pGoodAttr)
        return;
    MultiColumnList* mclbox = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("GoodsTreeFrame/GroupBoxSuitAtrr/MultiColumnList"));
    if(!mclbox)
        return;
    //清空行
    mclbox->resetList();
    for(CEGUI::uint i = 0 ; i < pGoodAttr->vecSuitAttr.size() ; ++i)
    {
        //设置每一行的值
        mclbox->addRow();
        const UIData::tagSuitAttr& suitAttr = pGoodAttr->vecSuitAttr[i];
        mclbox->setItem(new MyListItem(m_GoodsOP.GetGoodItemType(suitAttr.wType).c_str()),0,i);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(suitAttr.lValue1)),1,i);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(suitAttr.lValue2)),2,i);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(suitAttr.wSuitNum)),3,i);
    }
}
Example #3
0
void GVEvent::UpdateAddAttrDisplay(const UIData::tagGoodAttr* pGoodAttr)
{
    //更新物品附加属性显示
    if(!pGoodAttr)
        return;
    MultiColumnList* mclbox = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("GoodsTreeFrame/AddProperty/MultiColumnList"));
    if(!mclbox)
        return;
    //清空行
    mclbox->resetList();
    for(size_t size = 0 ; size < pGoodAttr->vecAddAttr.size(); ++size)
    {
        //设置每一行的值
        mclbox->addRow();
        const UIData::tagAddAttr &addAttr = pGoodAttr->vecAddAttr[size];
        mclbox->setItem(new MyListItem(m_GoodsOP.GetGoodItemType(addAttr.wType).c_str()),0,(CEGUI::uint)size);
        mclbox->setItem(new MyListItem(PropertyHelper::boolToString(addAttr.bEnable)),1,(CEGUI::uint)size);
        mclbox->setItem(new MyListItem(PropertyHelper::boolToString(addAttr.bHide)),2,(CEGUI::uint)size);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(addAttr.lValue1)),3,(CEGUI::uint)size);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(addAttr.lValue2)),4,(CEGUI::uint)size);
    }
}
Example #4
0
bool Demo6Sample::handleSetItem(const CEGUI::EventArgs& e)
{
    using namespace CEGUI;

    // get access to the widgets that contain details about the item to be modified
    MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Demo6/MainList"));
    Editbox* idbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/SetItemIDBox"));
    Editbox* rowbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/SetItemRowBox"));
    Editbox* textbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/SetItemTextBox"));

    // get ID of column to be affected
    CEGUI::uint id = atoi(idbox->getText().c_str());
    // get index of row to be affected
    CEGUI::uint row = atoi(rowbox->getText().c_str());
    // get new text for item
    String text = textbox->getText();

    // reset input boxes
    idbox->setText("");
    rowbox->setText("");
    textbox->setText("");

    // create a new ListboxTextItem using the new text string
    ListboxTextItem* item = new ListboxTextItem(text);
    // set the selection brush to be used for this item.
    item->setSelectionBrushImage(&ImagesetManager::getSingleton().getImageset("TaharezLook")->getImage("MultiListSelectionBrush"));

    // attempt to set the new item in place
    try
    {
        mcl->setItem(item, id, row);
    }
    // something went wrong, so cleanup the ListboxTextItem.
    catch (InvalidRequestException)
    {
        delete item;
    }

    // event was handled.
    return true;
}
Example #5
0
void handle_destination_change(){

	using namespace CEGUI;

 	struct search_param *search=&search_param;
	struct search_list_result *res;

	MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));


	if (SDL_dest.current_search==SRCH_COUNTRY)
	{	
		Editbox* country_edit = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox"));
		String content=country_edit->getText();

		mcl->resetList();
		dbg(0,"Starting a country search : %s\n",content.c_str());

		search->attr.type=attr_country_all;

		// FIXME the following codeblock could be shared between country, town and street search
		search->attr.u.str=(char *)content.c_str();

		search_list_search(search->sl, &search->attr, 1);
		while((res=search_list_get_result(search->sl))) {
			ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(res->country->name));
			itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");

			mcl->addRow(itemListbox,0);
		}

	} else if (SDL_dest.current_search==SRCH_TOWN)
	{	
		
		Editbox* town_edit = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox"));
		String content=town_edit->getText();


		mcl->resetList();

		if(strlen(content.c_str())<4){

		}  else {
			dbg(0,"town searching for %s\n",content.c_str());
			search->attr.type=attr_town_name;
			search->attr.u.str=(char *)content.c_str();

			search_list_search(search->sl, &search->attr, 1);
			while((res=search_list_get_result(search->sl))) {
				ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(res->town->name));
				itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");

				mcl->addRow(itemListbox,0);

				char x [256];
				sprintf(x,"%li",res->c->x);
				ListboxTextItem* xitem = new ListboxTextItem(x);
			
				char y [256];
				sprintf(y,"%li",res->c->y);
			
				ListboxTextItem* yitem = new ListboxTextItem(y);
			
				try
				{
					mcl->setItem(xitem, 3, mcl->getRowCount()-1);
					mcl->setItem(yitem, 4, mcl->getRowCount()-1);
				}
				// something went wrong, so cleanup the ListboxTextItem.
				catch (InvalidRequestException)
				{
// 					delete item;
				}
	
			}

		}


	} else if (SDL_dest.current_search==SRCH_STREET)
	{	
		Editbox* street_edit = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox"));
		
		String content=street_edit->getText();
		if(strlen(content.c_str())<1){

		}  else {
			// dbg(1,"street searching for %s\n",content.c_str());
			search->attr.type=attr_street_name;
			search->attr.u.str=(char *)content.c_str();

			mcl->resetList();

			search_list_search(search->sl, &search->attr, 1);
			while((res=search_list_get_result(search->sl))) {
				ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(res->street->name));
				itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");

				mcl->addRow(itemListbox,0);

				char x [256];
				sprintf(x,"%li",res->c->x);
				ListboxTextItem* xitem = new ListboxTextItem(x);
			
				char y [256];
				sprintf(y,"%li",res->c->y);
			
				ListboxTextItem* yitem = new ListboxTextItem(y);
			
				try
				{
					mcl->setItem(xitem, 3, mcl->getRowCount()-1);
					mcl->setItem(yitem, 4, mcl->getRowCount()-1);
				}
				// something went wrong, so cleanup the ListboxTextItem.
				catch (InvalidRequestException)
				{
// 					delete item;
				}

	
			}
			}
	}

}
Example #6
0
  UiTest(const uvec2 & )  {
    Gui::init(uvec2(100, 200));
    gameList = Fics::GameSummary::parseList(Platform::getResourceString(Resource::MISC_GAMELIST_TXT));
    try {
      WindowManager & wmgr = WindowManager::getSingleton();
      rootWindow = wmgr.createWindow("DefaultWindow", "root");
      System::getSingleton().getDefaultGUIContext().setRootWindow(rootWindow);
      rootWindow->addChild(wmgr.loadLayoutFromFile("Login.layout"));


      //rb->setSelected(tc->getTabPanePosition() == TabControl::Top);
      //rb->subscribeEvent(
      //  RadioButton::EventSelectStateChanged,
      //  Event::Subscriber(&TabControlDemo::handleTabPanePos, this));
      //    bool handleTabPanePos(const EventArgs& e)
      //dumpWindows(rootWindow);
      rootWindow->getChild("LoginWindow/Login")->
        subscribeEvent(PushButton::EventClicked, [&](const EventArgs& e) -> bool {
          return true;
        });

#if 0
      rootWindow->addChild(wmgr.loadLayoutFromFile("TabControl.layout"));
      TabControl* tc = static_cast<TabControl*>(rootWindow->getChild("TabControl"));

      //// Add some pages to tab control
      tc->addTab(wmgr.loadLayoutFromFile("TabPage1.layout"));
      tc->addTab(wmgr.loadLayoutFromFile("TabPage2.layout"));

      MultiColumnList* mcl = static_cast<MultiColumnList*>(rootWindow->getChild("TabControl/Page1/MultiColumnList"));

      //MultiColumnList* mcl = static_cast<CEGUI::MultiColumnList*>(
      //  wmgr.createWindow("TaharezLook/MultiColumnList", "WidgetPropertiesDisplay")
      //);
      //Create the properties display window
      //mcl->setSize(CEGUI::USize(cegui_reldim(0.9f), cegui_reldim(0.9f)));
      //mcl->setPosition(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim(0.05f)));
      //rootWindow->addChild(mcl);
      dumpWindows(rootWindow);



      //mcl->setShowHorzScrollbar(false);
      //mcl->setUserColumnDraggingEnabled(false);
      //mcl->setUserColumnSizingEnabled(true);

      //mcl->addColumn("Name", 0, cegui_reldim(0.45f));
      //mcl->addColumn("Type ", 1, cegui_reldim(0.25f));
      //mcl->addColumn("Value", 2, cegui_reldim(0.8f));


      //d_widgetPropertiesDisplayWindow->setSortColumnByID(0);
      //d_widgetPropertiesDisplayWindow->setSortDirection(CEGUI::ListHeaderSegment::Ascending);

      mcl->addColumn("Id", 0, cegui_reldim(0.05f));
      mcl->addColumn("Type", 1, cegui_reldim(0.07f));
      mcl->addColumn("Player (White)", 2, cegui_reldim(0.15f));
      mcl->addColumn("Rating", 3, cegui_reldim(0.07f));
      mcl->addColumn("Player (Black)", 4, cegui_reldim(0.15f));
      mcl->addColumn("Rating", 5, cegui_reldim(0.07f));
      mcl->addColumn("Private", 6, cegui_reldim(0.05f));
      mcl->addColumn("Rated", 7, cegui_reldim(0.05f));
      for (int i = 0; i < gameList.size(); ++i) {
        Fics::GameSummary & g = gameList[i];
        
        mcl->addRow();
        mcl->setItem(new ListboxTextItem(Platform::format("%d", g.id)), 0, i);
        mcl->setItem(new ListboxTextItem(g.private_ ? "Y" : "N"), 6, i);
        mcl->setItem(new ListboxTextItem(g.rated ? "Y" : "N"), 7, i);
        mcl->setItem(new ListboxTextItem(Chess::getTypeName(g.type)), 1, i);
        for (int j = 0; j < 2; ++j) {
          mcl->setItem(new ListboxTextItem(g.players[j]), 2 + (j * 2), i);
          mcl->setItem(new ListboxTextItem(Platform::format("%d", g.ratings[j])), 3 + (j * 2), i);
        }
      }
      // Add some empty rows to the MCL
      //multilineColumnList->addRow();
      //multilineColumnList->addRow();
      //multilineColumnList->addRow();
      //multilineColumnList->addRow();
      //multilineColumnList->addRow();

      //// Set first row item texts for the MCL
      //multilineColumnList->setItem(new MyListItem("Laggers World"), 0, 0);
      //multilineColumnList->setItem(new MyListItem("yourgame.some-server.com"), 1, 0);
      //multilineColumnList->setItem(new MyListItem("[colour='FFFF0000']1000ms"), 2, 0);

      //// Set second row item texts for the MCL
      //multilineColumnList->setItem(new MyListItem("Super-Server"), 0, 1);
      //multilineColumnList->setItem(new MyListItem("whizzy.fakenames.net"), 1, 1);
      //multilineColumnList->setItem(new MyListItem("[colour='FF00FF00']8ms"), 2, 1);

      //// Set third row item texts for the MCL
      //multilineColumnList->setItem(new MyListItem("Cray-Z-Eds"), 0, 2);
      //multilineColumnList->setItem(new MyListItem("crayzeds.notarealserver.co.uk"), 1, 2);
      //multilineColumnList->setItem(new MyListItem("[colour='FF00FF00']43ms"), 2, 2);

      //// Set fourth row item texts for the MCL
      //multilineColumnList->setItem(new MyListItem("Fake IPs"), 0, 3);
      //multilineColumnList->setItem(new MyListItem("123.320.42.242"), 1, 3);
      //multilineColumnList->setItem(new MyListItem("[colour='FFFFFF00']63ms"), 2, 3);

      //// Set fifth row item texts for the MCL
      //multilineColumnList->setItem(new MyListItem("Yet Another Game Server"), 0, 4);
      //multilineColumnList->setItem(new MyListItem("abc.abcdefghijklmn.org"), 1, 4);
      //multilineColumnList->setItem(new MyListItem("[colour='FFFF6600']284ms"), 2, 4);
      //FrameWindow* fWnd = static_cast<FrameWindow*>(
      //wmgr.createWindow("TaharezLook/FrameWindow", "testWindow"));
      //myRoot->addChild(fWnd);

      //FrameWindow * frame = static_cast<FrameWindow*>(rootWindow->getChild("Frame"));
      //fWnd->setPosition(UVector2(UDim(0.25f, 0.0f), UDim(0.25f, 0.0f)));
      //fWnd->setSize(USize(UDim(0.5f, 0.0f), UDim(0.5f, 0.0f)));
      //fWnd->setText("Hello World!");
#endif
    } catch (CEGUI::Exception & ex) {
      SAY(ex.getMessage().c_str());
    }
  }
Example #7
0
static void
sdl_update_roadbook(struct navigation *nav)
{

	using namespace CEGUI;

	struct map *map;
	struct map_rect *mr;

	if (! nav)
		return;
	map=navigation_get_map(nav);
	if (! map)
		return;
	mr=map_rect_new(map, NULL);
	if (! mr)
		return;

	// First, ensure the navigation tip is visible. quick workaround for when resuming a destination
	WindowManager::getSingleton().getWindow("Navit/Routing/Tips")->show();

	// update the 'Navigation Tip' on the main window
	try {
		struct attr attr;
		item_attr_get(map_rect_get_item(mr), attr_navigation_speech, &attr);
		map_rect_destroy(mr);
		mr=map_rect_new(map, NULL);
		WindowManager::getSingleton().getWindow("Navit/Routing/Tips")->setText((CEGUI::utf8*)(attr.u.str));
	}
	catch (CEGUI::Exception& e)
	{
		fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
		printf("Missing control!...\n");
	}

	// Then, update the whole roadbook	
	try {

		/* Currently we use the 'Navit' text to display the roadbook, until Mineque design a button for that 		
		if(! WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->isVisible()){
			WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->show();
		}
		*/

		MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Roadbook"));
		mcl->resetList();

		item *item;
		struct attr attr;

		while ((item=map_rect_get_item(mr))) {
	 		mcl->addRow();
			item_attr_get(item, attr_navigation_short, &attr);
			ListboxTextItem* itemListbox = new ListboxTextItem(attr.u.str);
			itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			mcl->setItem(itemListbox, 0, mcl->getRowCount()-1);
		}
		map_rect_destroy(mr);
	}
	catch (CEGUI::Exception& e)
	{
		dbg(0,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
		dbg(0,"Missing control!\n");
	}

}
Example #8
0
void CEGUISample9App::createListContent()
{
    using namespace CEGUI;

    WindowManager& winMgr = WindowManager::getSingleton();

	Combobox * cbobox = static_cast<Combobox*>(winMgr.getWindow("Demo7/Window2/Combobox"));
    // add items to the combobox list
    cbobox->addItem(new MyListItem("Combobox Item 1"));
    cbobox->addItem(new MyListItem("Combobox Item 2"));
    cbobox->addItem(new MyListItem("Combobox Item 3"));
    cbobox->addItem(new MyListItem("Combobox Item 4"));
    cbobox->addItem(new MyListItem("Combobox Item 5"));
    cbobox->addItem(new MyListItem("Combobox Item 6"));
    cbobox->addItem(new MyListItem("Combobox Item 7"));
    cbobox->addItem(new MyListItem("Combobox Item 8"));
    cbobox->addItem(new MyListItem("Combobox Item 9"));
    cbobox->addItem(new MyListItem("Combobox Item 10"));

    //
    // Multi-Column List setup
    //
    MultiColumnList* mclbox = static_cast<MultiColumnList*>(winMgr.getWindow("Demo7/Window2/MultiColumnList"));
    // Add some empty rows to the MCL
    mclbox->addRow();
    mclbox->addRow();
    mclbox->addRow();
    mclbox->addRow();
    mclbox->addRow();

    // Set first row item texts for the MCL
    mclbox->setItem(new MyListItem("Laggers World"), 0, 0);
    mclbox->setItem(new MyListItem("yourgame.some-server.com"), 1, 0);
    mclbox->setItem(new MyListItem("[colour='FFFF0000']1000ms"), 2, 0);

    // Set second row item texts for the MCL
    mclbox->setItem(new MyListItem("Super-Server"), 0, 1);
    mclbox->setItem(new MyListItem("whizzy.fakenames.net"), 1, 1);
    mclbox->setItem(new MyListItem("[colour='FF00FF00']8ms"), 2, 1);

    // Set third row item texts for the MCL
    mclbox->setItem(new MyListItem("Cray-Z-Eds"), 0, 2);
    mclbox->setItem(new MyListItem("crayzeds.notarealserver.co.uk"), 1, 2);
    mclbox->setItem(new MyListItem("[colour='FF00FF00']43ms"), 2, 2);

    // Set fourth row item texts for the MCL
    mclbox->setItem(new MyListItem("Fake IPs"), 0, 3);
    mclbox->setItem(new MyListItem("123.320.42.242"), 1, 3);
    mclbox->setItem(new MyListItem("[colour='FFFFFF00']63ms"), 2, 3);

    // Set fifth row item texts for the MCL
    mclbox->setItem(new MyListItem("Yet Another Game Server"), 0, 4);
    mclbox->setItem(new MyListItem("abc.abcdefghijklmn.org"), 1, 4);
    mclbox->setItem(new MyListItem("[colour='FFFF6600']284ms"), 2, 4);

    mclbox->setProperty("Font", "fkp-16");
}
Example #9
0
/////////////////////////////////////////////////
// zhaohang  2010/3/16
// 控件数据显示更新
void GVEvent::SetItemContentInMulList(const UIData::tagGoodAttr *pGoodAttr, CEGUI::uint RowIdx)
{
    if(pGoodAttr!=NULL)
    {
        MultiColumnList* mclbox = static_cast<MultiColumnList*>(m_wnd->getChildRecursive("GoodsTreeFrame/MultiColumnList"));
        //清空行
        mclbox->resetList();
        //设置每一行的值
        mclbox->addRow();
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwIndex)),0,RowIdx);
        mclbox->setItem(new MyListItem(pGoodAttr->strOrigName.c_str()),1,RowIdx);
        mclbox->setItem(new MyListItem(pGoodAttr->strName.c_str()),2,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::boolToString(pGoodAttr->bSave)),3,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwIconId)),4,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwGroundId)),5,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwEquipID)),6,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwValue)),7,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwSilverValue)),8,RowIdx);
        mclbox->setItem(new MyListItem(m_GoodsOP.GetGoodsType(pGoodAttr->dwType).c_str()),9,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwSound)),10,RowIdx);
        mclbox->setItem(new MyListItem(pGoodAttr->strContent.c_str()),11,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwSoundID1)),12,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::intToString(pGoodAttr->dwSoundID2)),13,RowIdx);
        mclbox->setItem(new MyListItem(PropertyHelper::boolToString(pGoodAttr->bSoundSwitch)),14,RowIdx);
    }
}