Position2DAdapter::Position2DAdapter(const ::Atlas::Message::Element& element, CEGUI::Window* xWindow, CEGUI::Window* yWindow) : AdapterBase(element), mXWindow(xWindow), mYWindow(yWindow) { if (mXWindow) { addGuiEventConnection(mXWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&Position2DAdapter::window_TextChanged, this))); } if (mYWindow) { addGuiEventConnection(mYWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&Position2DAdapter::window_TextChanged, this))); } updateGui(mOriginalElement); }
TerrainModAdapter::TerrainModAdapter(const ::Atlas::Message::Element& element, CEGUI::PushButton* showButton, EmberEntity* entity, CEGUI::Combobox* posTypeCombobox, CEGUI::Combobox* modTypeCombobox, CEGUI::Editbox* heightTextbox) : AdapterBase(element), mEntity(entity), mPolygonAdapter(0), mHeightTextbox(heightTextbox), mTerrainModsBinder(modTypeCombobox), mPositioningsBinder(posTypeCombobox) { if (element.isMap()) { const ::Atlas::Message::MapType& areaData(element.asMap()); ::Atlas::Message::MapType::const_iterator I = areaData.find("shape"); if (I != areaData.end()) { mPolygonAdapter = std::auto_ptr<PolygonAdapter>(new PolygonAdapter(I->second, showButton, entity)); } else { mPolygonAdapter = std::auto_ptr<PolygonAdapter>(new PolygonAdapter(::Atlas::Message::Element(), showButton, entity)); } } else { mPolygonAdapter = std::auto_ptr<PolygonAdapter>(new PolygonAdapter(::Atlas::Message::Element(), showButton, entity)); } if (heightTextbox) { addGuiEventConnection(heightTextbox->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&TerrainModAdapter::heightTextbox_TextChanged, this))); } mTerrainModsBinder.addType("levelmod", "Level", LevelTerrainMod()); mTerrainModsBinder.addType("adjustmod", "Adjust", AdjustTerrainMod()); mPositioningsBinder.addType("height", "Fixed", FixedPositioning()); mPositioningsBinder.addType("heightoffset", "Relative", RelativePositioning()); updateGui(element); }
AreaAdapter::AreaAdapter(const ::Atlas::Message::Element& element, CEGUI::PushButton* showButton, CEGUI::Combobox* layerWindow, EmberEntity* entity) : AdapterBase(element), mLayer(0), mLayerWindow(layerWindow), mEntity(entity), mPolygonAdapter(nullptr) { if (element.isMap()) { const ::Atlas::Message::MapType& areaData(element.asMap()); ::Atlas::Message::MapType::const_iterator shapeI = areaData.find("shape"); if (shapeI != areaData.end()) { mPolygonAdapter = std::unique_ptr<PolygonAdapter>(new PolygonAdapter(shapeI->second, showButton, entity)); } else { ::Atlas::Message::MapType defaultShape; mPolygonAdapter = std::unique_ptr<PolygonAdapter>(new PolygonAdapter(getDefaultPolygon().toAtlas(), showButton, entity)); } WFMath::Polygon<2> poly; Terrain::TerrainAreaParser parser; parser.parseArea(areaData, poly, mLayer); } else { mPolygonAdapter = std::unique_ptr<PolygonAdapter>(new PolygonAdapter(getDefaultPolygon().toAtlas(), showButton, entity)); } if (mLayerWindow) { addGuiEventConnection(mLayerWindow->subscribeEvent(CEGUI::Combobox::EventListSelectionChanged, CEGUI::Event::Subscriber(&AreaAdapter::layerWindow_ListSelectionChanged, this))); } updateGui(mOriginalValue); }
SizeAdapter::SizeAdapter(const ::Atlas::Message::Element& element, CEGUI::Window* lowerXWindow, CEGUI::Window* lowerYWindow, CEGUI::Window* lowerZWindow, CEGUI::Window* upperXWindow, CEGUI::Window* upperYWindow, CEGUI::Window* upperZWindow, CEGUI::Slider* scaler, CEGUI::Window* infoWindow) : AdapterBase(element), mLowerXWindow(lowerXWindow), mLowerYWindow(lowerYWindow), mLowerZWindow(lowerZWindow), mUpperXWindow(upperXWindow), mUpperYWindow(upperYWindow), mUpperZWindow(upperZWindow), mScaler(scaler), mInfoWindow(infoWindow) { if (mLowerXWindow) { addGuiEventConnection(mLowerXWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mLowerYWindow) { addGuiEventConnection(mLowerYWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mLowerZWindow) { addGuiEventConnection(mLowerZWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mUpperXWindow) { addGuiEventConnection(mUpperXWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mUpperYWindow) { addGuiEventConnection(mUpperYWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mUpperZWindow) { addGuiEventConnection(mUpperZWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mScaler) { addGuiEventConnection(mScaler->subscribeEvent(CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber(&SizeAdapter::slider_ValueChanged, this))); } updateGui(mOriginalElement); }
NumberAdapter::NumberAdapter(const ::Atlas::Message::Element& element, CEGUI::Combobox* textWindow) : AdapterBase(element) , mTextWindow(textWindow) { if (textWindow) { addGuiEventConnection(textWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&NumberAdapter::window_TextChanged, this))); } updateGui(mOriginalValue); mTextWindow->getPushButton()->setVisible(false); }
OrientationAdapter::OrientationAdapter( const ::Atlas::Message::Element& element, CEGUI::Window* xWindow, CEGUI::Window* yWindow, CEGUI::Window* zWindow, CEGUI::Window* scalarWindow) : AdapterBase(element), mXWindow(xWindow), mYWindow(yWindow), mZWindow( zWindow), mScalarWindow(scalarWindow) { if (mXWindow) { addGuiEventConnection( mXWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber( &OrientationAdapter::window_TextChanged, this))); } if (mYWindow) { addGuiEventConnection( mYWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber( &OrientationAdapter::window_TextChanged, this))); } if (mZWindow) { addGuiEventConnection( mZWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber( &OrientationAdapter::window_TextChanged, this))); } if (mScalarWindow) { addGuiEventConnection( mScalarWindow->subscribeEvent( CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber( &OrientationAdapter::window_TextChanged, this))); } updateGui(mOriginalValue); }
PolygonAdapter::PolygonAdapter(const ::Atlas::Message::Element& element, CEGUI::PushButton* showButton, EmberEntity* entity) : AdapterBase(element), mShowButton(showButton), mPolygon(0), mPickListener(0), mPointMovement(0), mEntity(entity), mPositionProvider(0) { if (entity) { mPositionProvider = new EntityPolygonPositionProvider(*entity); } if (showButton) { addGuiEventConnection(showButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PolygonAdapter::showButton_Clicked, this))); } updateGui(mOriginalValue); }
SizeAdapter::SizeAdapter(const ::Atlas::Message::Element& element, Widgets widgets) : AdapterBase(element), mWidgets(widgets) { if (mWidgets.lowerXWindow) { addGuiEventConnection(mWidgets.lowerXWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mWidgets.lowerYWindow) { addGuiEventConnection(mWidgets.lowerYWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mWidgets.lowerZWindow) { addGuiEventConnection(mWidgets.lowerZWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mWidgets.upperXWindow) { addGuiEventConnection(mWidgets.upperXWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mWidgets.upperYWindow) { addGuiEventConnection(mWidgets.upperYWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mWidgets.upperZWindow) { addGuiEventConnection(mWidgets.upperZWindow->subscribeEvent(CEGUI::Window::EventTextChanged, CEGUI::Event::Subscriber(&SizeAdapter::window_TextChanged, this))); } if (mWidgets.scaler) { addGuiEventConnection(mWidgets.scaler->subscribeEvent(CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber(&SizeAdapter::slider_ValueChanged, this))); } addGuiEventConnection(mWidgets.editable->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged, [this]() { mWidgets.lowerXWindow->setEnabled(mWidgets.editable->isSelected()); mWidgets.lowerYWindow->setEnabled(mWidgets.editable->isSelected()); mWidgets.lowerZWindow->setEnabled(mWidgets.editable->isSelected()); mWidgets.upperXWindow->setEnabled(mWidgets.editable->isSelected()); mWidgets.upperYWindow->setEnabled(mWidgets.editable->isSelected()); mWidgets.upperZWindow->setEnabled(mWidgets.editable->isSelected()); mWidgets.scaler->setEnabled(mWidgets.editable->isSelected()); return true; })); updateGui(mOriginalValue); }