void StashPanel::setHoverSlotsColor(Game::InventorySlot* _slot, Game::InventorySize* _size, MyGUI::Colour color) { bool set_all_red = false; for (int r = _slot->R; r < (_slot->R +_size->Height); r++) { for (int c = _slot->C; c < (_slot->C + _size->Width); c++) { Game::InventorySlot temp_slot(r,c); MyGUI::Widget* wg = this->getWidgetSlotByRC(r,c); if (wg != 0) wg->setColour(color); else set_all_red = true; } } if (set_all_red) { for (int r = _slot->R; r < (_slot->R +_size->Height); r++) { for (int c = _slot->C; c < (_slot->C + _size->Width); c++) { MyGUI::Widget* wg = this->getWidgetSlotByRC(r,c); if (wg != 0) wg->setColour(MyGUI::Colour::Red); } } } }
CurveEditor::CurveEditor(MyGUI::Widget* _parent) { initialiseByAttributes(this, _parent); mEditTimeEditBox->setEditReadOnly(true); mEditValueEditBox->setEditReadOnly(true); mRangeMinEditBox->eventKeyLostFocus += MyGUI::newDelegate(this, &CurveEditor::NotifyRangeLostFocus); mRangeMinEditBox->eventEditSelectAccept += MyGUI::newDelegate(this, &CurveEditor::NotifyRangeEditAccept); mRangeMaxEditBox->eventKeyLostFocus += MyGUI::newDelegate(this, &CurveEditor::NotifyRangeLostFocus); mRangeMaxEditBox->eventEditSelectAccept += MyGUI::newDelegate(this, &CurveEditor::NotifyRangeEditAccept); MyGUI::PolygonalSkin::CreateLineSets = false; MyGUI::Widget* widget = mCurveCanvasWidget->createWidget<MyGUI::Widget>("PolygonalSkin", MyGUI::IntCoord(MyGUI::IntPoint(), mCurveCanvasWidget->getSize()), MyGUI::Align::Stretch); widget->setColour(MyGUI::Colour::Red); MyGUI::ISubWidget* main = widget->getSubWidgetMain(); mCurveLines = main->castType<MyGUI::PolygonalSkin>(); MyGUI::PolygonalSkin::CreateLineSets = true; widget = mCurveCanvasWidget->createWidget<MyGUI::Widget>("PolygonalSkin", MyGUI::IntCoord(MyGUI::IntPoint(), mCurveCanvasWidget->getSize()), MyGUI::Align::Stretch); widget->setColour(MyGUI::Colour::Red); main = widget->getSubWidgetMain(); mCurveCanvas = main->castType<MyGUI::PolygonalSkin>(); widget->eventMouseButtonPressed += MyGUI::newDelegate(this, &CurveEditor::NotifyMousePressed); MyGUI::PolygonalSkin::CreateLineSets = false; mCanvasWidget = widget; mCurveCanvas->setWidth(5.0f); std::vector<MyGUI::FloatPoint> mLinePoints; mLinePoints.push_back(MyGUI::FloatPoint(0, 0)); mLinePoints.push_back(MyGUI::FloatPoint(0, 1)); mCurveCanvas->setPoints(mLinePoints); mLinePoints.clear(); mCurveCanvas->setPoints(mLinePoints); // todo fix it mCurveLines->_setColour(MyGUI::Colour(0.2f, 0.2f, 0.2f)); // default range mValueRange.x = 0; mValueRange.y = 10; mRangeMinEditBox->setCaption("0"); mRangeMaxEditBox->setCaption("10"); InitGrid(); RefreshNumbers(); MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false); if (window != nullptr) window->eventWindowButtonPressed += newDelegate(this, &CurveEditor::NotifyWindowButtonPressed); mSplineButton = mMainWidget->createWidget<MyGUI::Button>("CheckBox", MyGUI::IntCoord(15, 10, 95, 25), MyGUI::Align::Left | MyGUI::Align::Top); mSplineButton->setCaption("Use Spline"); mSplineButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CurveEditor::NotifySplineChecked); }
void DemoKeeper::createScene() { base::BaseDemoManager::createScene(); MyGUI::ResourceManager::getInstance().load("SplineSkin.xml"); const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout"); root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("PolygonalSkin usage. Drag white rectangles to move points for bezier curve."); MyGUI::VectorWidgetPtr widgets = MyGUI::LayoutManager::getInstance().loadLayout("SplineWindow.layout"); mQualityText = widgets.at(0)->findWidget("SplineText")->castType<MyGUI::TextBox>(); MyGUI::ScrollBar* qualityScroll = widgets.at(0)->findWidget("SplineQuality")->castType<MyGUI::ScrollBar>(); qualityScroll->eventScrollChangePosition += MyGUI::newDelegate(this, &DemoKeeper::notifyChangeQuality); mClient = widgets.at(0)->findWidget("SplineClient"); // create widget with skin that contain specific sub skin - PolygonalSkin MyGUI::Widget* widget = mClient->createWidget<MyGUI::Widget>("PolygonalSkin", MyGUI::IntCoord(MyGUI::IntPoint(), mClient->getSize()), MyGUI::Align::Stretch); widget->setColour(MyGUI::Colour::Red); // get main subskin MyGUI::ISubWidget* main = widget->getSubWidgetMain(); mPolygonalSkin = main->castType<MyGUI::PolygonalSkin>(); // set PolygonalSkin properties and points mPolygonalSkin->setWidth(8.0f); for (int i = 0; i < PointsCount; ++i) { point[i] = mClient->createWidget<MyGUI::Button>("Button", MyGUI::IntCoord(10 + (i + i % 2 * 3) * 40, 10 + (i + i / 2 * 3) * 40, 16, 16), MyGUI::Align::Default); point[i]->eventMouseDrag += newDelegate(this, &DemoKeeper::notifyPointMove); point[i]->eventMouseButtonPressed += newDelegate(this, &DemoKeeper::notifyPointPressed); } notifyChangeQuality(qualityScroll, 12); updateSpline(); }
void StashPanel::setAllSlotsColor(MyGUI::Colour color) { int slot_count = this->mslot_container_panelWidget->getChildCount(); for (int i = 0; i < slot_count; i++) { MyGUI::Widget* widget = this->mslot_container_panelWidget->getChildAt(i); widget->setColour(color); } }
void StashPanel::setHoverSlotsColor(const MyGUI::types::TRect<int>& _value , MyGUI::Colour color) { int slot_count = this->mslot_container_panelWidget->getChildCount(); for (int i = 0; i < slot_count; i++) { MyGUI::Widget* widget = this->mslot_container_panelWidget->getChildAt(i); MyGUI::IntRect rectangle = widget->getAbsoluteRect(); MyGUI::IntSize _size = widget->getSize(); MyGUI::IntPoint center_rectangle = MyGUI::IntPoint(rectangle.left + (_size.width / 2), rectangle.top + (_size.height / 2)); //((center_rectangle.left > _value.left) && (center_rectangle.left < _value.right) && (center_rectangle.top > _value.top) && (center_rectangle.top < _value.bottom)); if (((center_rectangle.left >= _value.left) && (center_rectangle.left < _value.right) && (center_rectangle.top >= _value.top) && (center_rectangle.top < _value.bottom))) { //en el check de arriba, algunos son con igual y otros no porque sino se seleccionan mal, o 2 de 4 o 6 de 4 ! widget->setColour(color); } } }