Beispiel #1
0
void WidgetDemo::initialiseWidgetInspector(CEGUI::Window* container)
{
    WindowManager& winMgr = WindowManager::getSingleton();

    //Add a tabcontrol serving as WidgetInspector, allowing to switch between events+widgets and the properties display
    TabControl* tabControl = static_cast<TabControl*>(winMgr.createWindow("TaharezLook/TabControl", "WidgetDemoWidgetInspector"));
    container->addChild(tabControl);
    tabControl->setSize(CEGUI::USize(cegui_reldim(0.55f), cegui_reldim(0.96f)));
    tabControl->setPosition(CEGUI::UVector2(cegui_reldim(0.02f), cegui_reldim(0.02f)));

    //Create the respective windows containing the displays
    CEGUI::Window* widgetMainInspectionContainer = winMgr.createWindow("DefaultWindow", "WidgetInspectionContainer");
    CEGUI::Window* widgetPropertiesInspectionContainer = winMgr.createWindow("DefaultWindow", "WidgetPropertiesInspectionContainer");


    //Add the pages to the tab control
    widgetMainInspectionContainer->setText("Widget Inspector");
    tabControl->addTab(widgetMainInspectionContainer);
    widgetPropertiesInspectionContainer->setText("Widget Properties");
    tabControl->addTab(widgetPropertiesInspectionContainer);

    //Create properties window
    initialiseWidgetPropertiesDisplayWindow(widgetPropertiesInspectionContainer);

    //Create the widget display windows
    initialiseWidgetDisplayWindow();
    widgetMainInspectionContainer->addChild(d_widgetDisplayWindow);

    initialiseWidgetsEventsLog();
    widgetMainInspectionContainer->addChild(d_widgetsEventsLog);

    initialiseEventLights(widgetMainInspectionContainer);
}
Beispiel #2
0
  bool handleAddTab(const EventArgs&)
  {
    Window* root = d_guiContext->getRootWindow();

    // Check if the window exists
    if (root->isChild("Frame/TabControl"))
    {
      TabControl* tc = static_cast<TabControl*>(root->getChild(
        "Frame/TabControl"));

      // Add some tab buttons once
      for (int num = 3; num <= 16; num++)
      {
        std::stringstream pgname;
        pgname << "Page" << num;

        if (root->isChild(String("Frame/TabControl/") + pgname.str().c_str()))
          // Next
          continue;

        Window* pg = 0;

        pg = WindowManager::getSingleton().loadLayoutFromFile("TabPage.layout");
        CEGUI_TRY
        {
          pg = WindowManager::getSingleton().loadLayoutFromFile("TabPage.layout");
          pg->setName(String(pgname.str().c_str()));
        }
          CEGUI_CATCH(CEGUI::Exception&)
        {
          Logger::getSingleton().logEvent("Some error occured while adding a tabpage. Please see the logfile.");
          break;
        }

        // This window has just been created while loading the layout
        if (pg->isChild("Text"))
        {
          Window* txt = pg->getChild("Text");
          txt->setText(PageText[num - 3]);

          pg->setText(pgname.str().c_str());
          tc->addTab(pg);

          refreshPageList();
          break;
        }
      }
Beispiel #3
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());
    }
  }
Beispiel #4
0
  // method to initialse the samples windows and events.
  bool initialise(CEGUI::GUIContext* guiContext)
  {
    d_guiContext = guiContext;
    d_usedFiles = CEGUI::String(__FILE__);

    // load font and setup default if not loaded via scheme
    Font& defaultFont = FontManager::getSingleton().createFromFile("DejaVuSans-12.font");
    // Set default font for the gui context
    guiContext->setDefaultFont(&defaultFont);

    // we will use of the WindowManager.
    WindowManager& winMgr = WindowManager::getSingleton();

    // load scheme and set up defaults
    SchemeManager::getSingleton().createFromFile(SKIN ".scheme");
    d_guiContext->getMouseCursor().setDefaultImage(SKIN "/MouseArrow");

    // load an image to use as a background
    if (!ImageManager::getSingleton().isDefined("SpaceBackgroundImage"))
      ImageManager::getSingleton().addFromImageFile("SpaceBackgroundImage", "SpaceBackground.jpg");

    // here we will use a StaticImage as the root, then we can use it to place a background image
    Window* background = winMgr.createWindow(SKIN "/StaticImage");
    // set area rectangle
    background->setArea(URect(cegui_reldim(0), cegui_reldim(0),
      cegui_reldim(1), cegui_reldim(1)));
    // disable frame and standard background
    background->setProperty("FrameEnabled", "false");
    background->setProperty("BackgroundEnabled", "false");
    // set the background image
    background->setProperty("Image", "SpaceBackgroundImage");
    // install this as the root GUI sheet
    d_guiContext->setRootWindow(background);

    // set tooltip styles (by default there is none)
    d_guiContext->setDefaultTooltipType(SKIN "/Tooltip");

    // load some demo windows and attach to the background 'root'
    background->addChild(winMgr.loadLayoutFromFile("TabControlDemo.layout"));

    TabControl* tc = static_cast<TabControl*>(background->getChild("Frame/TabControl"));

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

    WindowManager::getSingleton().DEBUG_dumpWindowNames("asd");

    static_cast<PushButton*>(
      background->getChild("Frame/TabControl/Page1/AddTab"))->subscribeEvent(
      PushButton::EventClicked,
      Event::Subscriber(&TabControlDemo::handleAddTab, this));

    // Click to visit this tab
    static_cast<PushButton*>(
      background->getChild("Frame/TabControl/Page1/Go"))->subscribeEvent(
      PushButton::EventClicked,
      Event::Subscriber(&TabControlDemo::handleGoto, this));

    // Click to make this tab button visible (when scrolling is required)
    static_cast<PushButton*>(
      background->getChild("Frame/TabControl/Page1/Show"))->subscribeEvent(
      PushButton::EventClicked,
      Event::Subscriber(&TabControlDemo::handleShow, this));

    static_cast<PushButton*>(
      background->getChild("Frame/TabControl/Page1/Del"))->subscribeEvent(
      PushButton::EventClicked,
      Event::Subscriber(&TabControlDemo::handleDel, this));

    RadioButton* rb = static_cast<RadioButton*>(
      background->getChild("Frame/TabControl/Page1/TabPaneTop"));
    rb->setSelected(tc->getTabPanePosition() == TabControl::Top);
    rb->subscribeEvent(
      RadioButton::EventSelectStateChanged,
      Event::Subscriber(&TabControlDemo::handleTabPanePos, this));

    rb = static_cast<RadioButton*>(
      background->getChild("Frame/TabControl/Page1/TabPaneBottom"));
    rb->setSelected(tc->getTabPanePosition() == TabControl::Bottom);
    rb->subscribeEvent(
      RadioButton::EventSelectStateChanged,
      Event::Subscriber(&TabControlDemo::handleTabPanePos, this));

    Scrollbar* sb = static_cast<Scrollbar*>(
      background->getChild("Frame/TabControl/Page1/TabHeight"));
    sb->setScrollPosition(tc->getTabHeight().d_offset);
    sb->subscribeEvent(
      Scrollbar::EventScrollPositionChanged,
      Event::Subscriber(&TabControlDemo::handleTabHeight, this));

    sb = static_cast<Scrollbar*>(
      background->getChild("Frame/TabControl/Page1/TabPadding"));
    sb->setScrollPosition(tc->getTabTextPadding().d_offset);
    sb->subscribeEvent(
      Scrollbar::EventScrollPositionChanged,
      Event::Subscriber(&TabControlDemo::handleTabPadding, this));

    refreshPageList();

    // From now on, we don't rely on the exceptions anymore, but perform nice (and recommended) checks
    // ourselves.

    return true;
  }
Beispiel #5
0
void GuiConfig::Build(ZProtoGUI *pGUI)
{
	mGUI = (ZProtoGUI*)pGUI;
	root = mGUI->root;
	mFontArial8 = mGUI->mFontArial8;
	mFontArial24 = mGUI->mFontArial24;


	// Create a FrameWindow in the TaharezLook style, and name it 'Demo Window'
	mCondigWindow = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Config Window");
	mCondigWindow->setTitleBarEnabled(false);
	mCondigWindow->setCloseButtonEnabled(false);
	mCondigWindow->setSizingEnabled(false);
	root->addChildWindow(mCondigWindow);
	mCondigWindow->setAlpha(0.6f);
	mCondigWindow ->hide();
	mCondigWindow->setSizingEnabled(false);


	FrameWindow* wnd1 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage0");
	wnd1->setTitleBarEnabled(false);
	wnd1->setFrameEnabled(false);//>setTitleBarEnabled(false);
	wnd1->setCloseButtonEnabled(false);
	wnd1->setText(GLoc->GetString("PLAYER").c_str());


	FrameWindow* wnd2 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage1");
	wnd2->setTitleBarEnabled(false);
	wnd2->setFrameEnabled(false);//>setTitleBarEnabled(false);
	wnd2->setCloseButtonEnabled(false);
	wnd2->setText(GLoc->GetString("Controls").c_str());


	FrameWindow* wnd3 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage2");
	wnd3->setTitleBarEnabled(false);
	wnd3->setCloseButtonEnabled(false);
	wnd3->setText(GLoc->GetString("Graphics").c_str());
	wnd3->setFrameEnabled(false);//

	FrameWindow* wnd4 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage3");
	wnd4->setTitleBarEnabled(false);
	wnd4->setFrameEnabled(false);//>setTitleBarEnabled(false);
	wnd4->setCloseButtonEnabled(false);
	wnd4->setText(GLoc->GetString("SOUND").c_str());
	//wnd->addChildWindow (winMgr.loadWindowLayout ("TabControlDemo.layout", "TabControlDemo/"));

	TabControl *tc = (TabControl *)winMgr.createWindow("TaharezLook/TabControl", "Config/Tabs");

	mCondigWindow->setPosition(UVector2(cegui_reldim(0.f), cegui_reldim( 0.f)));
	mCondigWindow->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 0.9f)));
	tc->setArea(UVector2(cegui_reldim(0.1f), cegui_reldim( 0.05f)), UVector2(cegui_reldim(0.9f), cegui_reldim( 0.85f)) );



	// Add some pages to tab control
	tc->addTab (wnd1);
	tc->addTab (wnd2);
	tc->addTab (wnd3);
	tc->addTab (wnd4);

	tc->setTabHeight(UDim (0.06f, 0.13f));
	tc->setTabTextPadding(UDim (0.06f, 0.1f));


	mCondigWindow->addChildWindow(tc);

	mCondigWindow->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0.15f)));
	mCondigWindow->setSize(UVector2(cegui_reldim(1.1f), cegui_reldim( 0.70f)));
	mCondigWindow->setAlpha(0.88f);


	wnd1->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd1->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	wnd2->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd2->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	wnd3->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd3->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	wnd4->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd4->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	// controls


	for (int allCtrl = 0;allCtrl<sizeof(aCtrlList)/sizeof(CTRLEntry); allCtrl++)
	{
		static const float interligne = 0.06f*1.6f;
		static const float intersize = 0.05f*1.4f;
		tstring numb;
		numb.Printf("%d", allCtrl);

		Window* txtlib = winMgr.createWindow("TaharezLook/StaticText", String(aCtrlList[allCtrl].mName)+String("CtrlLib")+String(numb.c_str()));

		txtlib->setText(GLoc->GetString(aCtrlList[allCtrl].mName).c_str());
		txtlib->setProperty("FrameEnabled", "false");
		txtlib->setProperty("BackgroundEnabled", "false");
		//txtlib->setHorizontalAlignment(HA_CENTRE);
		txtlib->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.01f + interligne*allCtrl)));
		txtlib->setSize(UVector2(cegui_reldim(0.19f), cegui_reldim( intersize )));

		wnd2->addChildWindow(txtlib);



		PushButton* txtBut = (PushButton*)winMgr.createWindow("TaharezLook/Button", String(aCtrlList[allCtrl].mName)+String("CtrlBut")+String(numb.c_str()));
		txtBut->setPosition(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.01f + interligne*allCtrl)));
		txtBut->setSize(UVector2(cegui_reldim(0.50f), cegui_reldim( intersize )));

		SetBindedControlString(allCtrl, txtBut);


		//txtBut->setText("A or PAD Button 1");
		txtBut->setHorizontalAlignment(HA_CENTRE);

		wnd2->addChildWindow(txtBut);

		txtBut->subscribeEvent ( PushButton::EventClicked,
			Event::Subscriber (&GuiConfig::handleConfigControlsBut, this));

		txtBut->setID(allCtrl);
		aCtrlList[allCtrl].mWindow = (Window*)txtBut;

	}
	// -- PLAYER

	Editbox* playerName = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "CONFIGPLAYERNAME"));
	wnd1->addChildWindow(playerName);
	playerName->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f)));
	playerName->setSize(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.08f)));
	//playerName->setValidationString("*");
	playerName->setText(GConfig->GetPlayerName());

	Window* txtlib = winMgr.createWindow("TaharezLook/StaticText", "CONFIGPLAYERNAMESTATIC");

	txtlib->setText(GLoc->GetString("PLAYERNAME").c_str());
	txtlib->setProperty("FrameEnabled", "false");
	txtlib->setProperty("BackgroundEnabled", "false");
	txtlib->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f)));
	txtlib->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));

	wnd1->addChildWindow(txtlib);



	// --

	// -- SOUND

	Scrollbar* sfxslider = static_cast<Scrollbar*>(winMgr.createWindow("TaharezLook/HorizontalScrollbar", "SFXVOLUME"));
	sfxslider->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f)));
	sfxslider->setSize(UVector2(cegui_reldim(0.6f), cegui_reldim( 0.08f)));
	sfxslider->setDocumentSize (100);
	sfxslider->subscribeEvent ( Scrollbar::EventScrollPositionChanged, Event::Subscriber (&GuiConfig::handleSFXVolChanged, this));
	sfxslider->setScrollPosition(float(GConfig->GetQuality("SFXVOLUME")));
	wnd4->addChildWindow(sfxslider);


	Window* txtlibsfx = winMgr.createWindow("TaharezLook/StaticText", "SFXVOLUMESTATIC");
	txtlibsfx->setText(GLoc->GetString("SFXVOLUME").c_str());
	txtlibsfx->setProperty("FrameEnabled", "false");
	txtlibsfx->setProperty("BackgroundEnabled", "false");
	txtlibsfx->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f)));
	txtlibsfx->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd4->addChildWindow(txtlibsfx);



	Scrollbar* musicslider = static_cast<Scrollbar*>(winMgr.createWindow("TaharezLook/HorizontalScrollbar", "MUSICVOLUME"));
	musicslider->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.15f)));
	musicslider->setSize(UVector2(cegui_reldim(0.6f), cegui_reldim( 0.08f)));
	musicslider->setDocumentSize (100);
	musicslider->subscribeEvent ( Scrollbar::EventScrollPositionChanged, Event::Subscriber (&GuiConfig::handleMusicVolChanged, this));
	musicslider->setScrollPosition(float(GConfig->GetQuality("MUSICVOLUME")));
	wnd4->addChildWindow(musicslider);


	Window* txtlibmusic = winMgr.createWindow("TaharezLook/StaticText", "MUSICVOLUMESTATIC");
	txtlibmusic->setText(GLoc->GetString("MUSICVOLUME").c_str());
	txtlibmusic->setProperty("FrameEnabled", "false");
	txtlibmusic->setProperty("BackgroundEnabled", "false");
	txtlibmusic->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.15f)));
	txtlibmusic->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd4->addChildWindow(txtlibmusic);


    Checkbox* checkMusic = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKMUSIC"));
    wnd4->addChildWindow(checkMusic);
	checkMusic->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.25f)));
	checkMusic->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkMusic->setText(GLoc->GetString("CHKMUSIC").c_str());
	checkMusic->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleChkMusicChanged, this));
	checkMusic->setSelected (GConfig->IsEnable("CHKMUSIC"));

	// --

	// -- VIDEO


    Combobox* cbresolution = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "RESOLUTION"));
    wnd3->addChildWindow(cbresolution);
    cbresolution->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f)));
    cbresolution->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.75f)));
	cbresolution->setReadOnly(true);

	Window* txtres = winMgr.createWindow("TaharezLook/StaticText", "RESOLUTIONTXT");
	txtres->setText(GLoc->GetString("RESOLUTION").c_str());
	txtres->setProperty("FrameEnabled", "false");
	txtres->setProperty("BackgroundEnabled", "false");
	txtres->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f)));
	txtres->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd3->addChildWindow(txtres);


	int optWidth = GConfig->GetQuality("Width");
	int optHeight = GConfig->GetQuality("Height");

	int awidth = -1, aheight = -1;
	int avresolutions = 0;
	for (unsigned int rs = 0;rs<GDD->GetNbPossibleResolutions(); rs++)
	{
		char tmps[512];
		int width, height;
		GDD->GetResolution(rs, width, height);
		if ((awidth != width) || (aheight != height))
		{
			awidth = width;
			aheight = height;

			mResolutions.push_back(resval_t(width, height));
			snprintf(tmps, 512, "%d x %d", width, height);
			cbresolution->addItem (new ListboxTextItem(tmps));

			if ((width == optWidth)&&(height == optHeight))
				CEGUICBSel(cbresolution, avresolutions);

			avresolutions++;
		}
	}



	// --

    Checkbox* checkFS = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKBFS"));
    wnd3->addChildWindow(checkFS);
	checkFS->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.15f)));
	checkFS->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkFS->setText(GLoc->GetString("FULLSCREEN").c_str());
	//checkFS->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleFSChanged, this));
	checkFS->setSelected (GConfig->IsEnable("CHKBFS"));


    Checkbox* checkVSync = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKBVSYNC"));
    wnd3->addChildWindow(checkVSync);
	checkVSync->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.75f)));
	checkVSync->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkVSync->setText(GLoc->GetString("VSYNC").c_str());
	//checkVSync->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleVSYNCChanged, this));
	checkVSync->setSelected (GConfig->IsEnable("CHKBVSYNC"));

	// --

    Combobox* cbshad = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "SHADOWQUALITY"));
    wnd3->addChildWindow(cbshad);
    cbshad->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.25f)));
    cbshad->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f)));
	cbshad->setReadOnly(true);

	Window* txtshad = winMgr.createWindow("TaharezLook/StaticText", "SHADOWQUALITYTXT");
	txtshad->setText(GLoc->GetString("SHADOWQUALITY").c_str());
	txtshad->setProperty("FrameEnabled", "false");
	txtshad->setProperty("BackgroundEnabled", "false");
	txtshad->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.25f)));
	txtshad->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd3->addChildWindow(txtshad);

	cbshad->addItem (new ListboxTextItem(GLoc->GetString("DISABLED").c_str()));
	cbshad->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str()));
	cbshad->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str()));
	cbshad->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str()));

	cbshad->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleShadowQualityChanged, this));
	CEGUICBSel(cbshad, GConfig->GetQuality("SHADOWQUALITY"));
	// --

    Combobox* cbrefl = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "REFLECTIONQUALITY"));
    wnd3->addChildWindow(cbrefl);
    cbrefl->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.35f)));
    cbrefl->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f)));
	cbrefl->setReadOnly(true);

	Window* txtrefl = winMgr.createWindow("TaharezLook/StaticText", "REFLECTIONQUALITYTXT");
	txtrefl->setText(GLoc->GetString("REFLECTIONQUALITY").c_str());
	txtrefl->setProperty("FrameEnabled", "false");
	txtrefl->setProperty("BackgroundEnabled", "false");
	txtrefl->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.35f)));
	txtrefl->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd3->addChildWindow(txtrefl);

	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("DISABLED").c_str()));
	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str()));
	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str()));
	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str()));
	cbrefl->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleReflectionQualityChanged, this));
	CEGUICBSel(cbrefl, GConfig->GetQuality("REFLECTIONQUALITY"));
	// --
    Combobox* cbwater = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "WATERQUALITY"));
    wnd3->addChildWindow(cbwater);
    cbwater->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.45f)));
    cbwater->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f)));
	cbwater->setReadOnly(true);

	Window* txtwater = winMgr.createWindow("TaharezLook/StaticText", "WATERQUALITYTXT");
	txtwater->setText(GLoc->GetString("WATERQUALITY").c_str());
	txtwater->setProperty("FrameEnabled", "false");
	txtwater->setProperty("BackgroundEnabled", "false");
	txtwater->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.45f)));
	txtwater->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd3->addChildWindow(txtwater);

	cbwater->addItem (new ListboxTextItem(GLoc->GetString("LOW").c_str()));
	cbwater->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str()));
	cbwater->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str()));
	cbwater->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str()));
	cbwater->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleWaterQualityChanged, this));
	CEGUICBSel(cbwater, GConfig->GetQuality("WATERQUALITY"));
	// --

    Checkbox* checkDOF = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKDOF"));
    wnd3->addChildWindow(checkDOF);
	checkDOF->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.55f)));
	checkDOF->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkDOF->setText(GLoc->GetString("DEPTHOFFIELD").c_str());
	checkDOF->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleDOFChanged, this));
	checkDOF->setSelected (GConfig->IsEnable("CHKDOF"));

    Checkbox* checkMBLUR = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKMBLUR"));
    wnd3->addChildWindow(checkMBLUR);
	checkMBLUR->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.65f)));
	checkMBLUR->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkMBLUR->setText(GLoc->GetString("MOTIONBLUR").c_str());
	checkMBLUR->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleMBLURChanged, this));
	checkMBLUR->setSelected (GConfig->IsEnable("CHKMBLUR"));
/*
	Resolution

	Enable FullScreen

	shadows quality (disabled, medium, high, ultrahigh)
	0, 1024, 2048, 4096
	reflection quality (disabled, low, medium, high)
	0, 256, 512, 1024
	water quality (low, medium, high, ultra high)

	enable Depth of field
	enable motion blur

	*/

	// --
	PushButton* btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "configOK"));
	mCondigWindow->addChildWindow(btn);
	btn->setPosition(UVector2(cegui_reldim(0.77f), cegui_reldim( 0.90f)));
	btn->setSize(UVector2(cegui_reldim(0.20f), cegui_reldim( 0.065f)));
	btn->setText("OK");
	btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GuiConfig::HandleConfigOK, this));

}
Beispiel #6
0
/*************************************************************************ech
Sample specific initialisation goes here.
*************************************************************************/
bool MenuNavigationSample::initialise(CEGUI::GUIContext* gui_context)
{
    using namespace CEGUI;

    d_usedFiles = CEGUI::String(__FILE__);

    SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
    gui_context->getCursor().setDefaultImage("TaharezLook/MouseArrow");

    WindowManager& win_mgr = WindowManager::getSingleton();
    d_root = win_mgr.loadLayoutFromFile("MenuNavigationSample.layout");

    FontManager::FontList loadedFonts = FontManager::getSingleton().createFromFile("DejaVuSans-12.font");
    Font* defaultFont = loadedFonts.empty() ? 0 : loadedFonts.front();
    gui_context->setDefaultFont(defaultFont);

    gui_context->setRootWindow(d_root);

    MatrixNavigationStrategy* d_matrixNavigationStrategy = new MatrixNavigationStrategy();
    d_matrixWindowNavigator = new WindowNavigator(createMatrixNavigationMappings(),
        d_matrixNavigationStrategy);
    gui_context->setWindowNavigator(d_matrixWindowNavigator);

    LinearNavigationStrategy* d_linearNavigatorStrategy = new LinearNavigationStrategy();
    d_linearWindowNavigator = new WindowNavigator(createLinearNavigationMappings(),
        d_linearNavigatorStrategy);

    TabControl* tabControl = static_cast<TabControl*>(d_root->getChild("FrameWindow/TabControl"));
    tabControl->subscribeEvent(TabControl::EventSelectionChanged,
        Event::Subscriber(&MenuNavigationSample::handleTabSelectionChanged, this));

    Window* page1Window = win_mgr.loadLayoutFromFile("MenuNavigationSampleTabPage1.layout");
    d_logWidget1 = page1Window->getChild("StaticText");
    d_logWidget1->setText("OK");

    // 4 rows
    d_matrixNavigationStrategy->d_windows.resize(4);
    for (int i = 1; i <= 16; ++i)
    {
        std::ostringstream os;
        os << "Button" << i;

        PushButton* button = static_cast<PushButton*>(page1Window->getChild(os.str()));
        button->subscribeEvent(PushButton::EventClicked,
            Event::Subscriber(&MenuNavigationSample::handleNumberButtonClicked, this));

        d_matrixNavigationStrategy->d_windows.at((i - 1) % 4).push_back(button);
    }

    tabControl->addTab(page1Window);

    Window* page2Window = win_mgr.loadLayoutFromFile("MenuNavigationSampleTabPage2.layout");
    d_logWidget2 = page2Window->getChild("StaticText");
    d_logWidget2->setText("OK");

    Window* selectButton = page2Window->getChild("SelectButton");
    selectButton->subscribeEvent(PushButton::EventClicked,
        Event::Subscriber(&MenuNavigationSample::handleSelectButtonClicked, this));

    tabControl->addTab(page2Window);

    d_classesList = static_cast<ListWidget*>(page2Window->getChild("ClassesList"));
    d_classesList->setMultiSelectEnabled(true);
    initialiseClasses(d_classesList);

    d_linearNavigatorStrategy->d_windows.push_back(d_classesList);
    d_linearNavigatorStrategy->d_windows.push_back(selectButton);

    return true;
}