当前位置: 首页>>代码示例>>C++>>正文


C++ Widget::getAbsoluteRect方法代码示例

本文整理汇总了C++中mygui::Widget::getAbsoluteRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Widget::getAbsoluteRect方法的具体用法?C++ Widget::getAbsoluteRect怎么用?C++ Widget::getAbsoluteRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mygui::Widget的用法示例。


在下文中一共展示了Widget::getAbsoluteRect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getWidgetSlotByScreenPosition

	MyGUI::Widget* StashPanel::getWidgetSlotByScreenPosition(const MyGUI::types::TPoint<int>&  _value)
	{
		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);
			if (widget->getAbsoluteRect().inside(_value))
			{
				MyGUI::types::TRect<int> big_rect = widget->getAbsoluteRect();
				return widget;
			}
		}
		return 0;
	}
开发者ID:Alex-G,项目名称:MuOnline,代码行数:14,代码来源:StashPanel.cpp

示例2: hitTestSlots

	bool InventoryPanel::hitTestSlots(const MyGUI::types::TRect<int>&  _value)
	{
		int slot_count = this->mslot_container_panel_2_Widget->getChildCount();
		for (int i = 0; i < slot_count; i++)
		{
			MyGUI::Widget* widget = this->mslot_container_panel_2_Widget->getChildAt(i);
			if (widget->getAbsoluteRect().intersect(_value))
				return true;
		}
		return false;
	}
开发者ID:Alex-G,项目名称:MuOnline,代码行数:11,代码来源:InventoryPanel.cpp

示例3: setHoverSlotsColor

	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);
			}
		}
	}
开发者ID:Alex-G,项目名称:MuOnline,代码行数:17,代码来源:StashPanel.cpp

示例4: getWidgetSlotByScreenPosition_modified

	MyGUI::Widget* StashPanel::getWidgetSlotByScreenPosition_modified(const MyGUI::types::TPoint<int>&  _value)
	{
		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);
			if (widget->getAbsoluteRect().inside(_value))
			{
				MyGUI::types::TRect<int> big_rect = widget->getAbsoluteRect();
				MyGUI::types::TSize<int> big_size = widget->getSize();

				/********/
				/* 1  2 */
				/* 3  4 */
				/********/

				MyGUI::types::TRect<int> rect_1;
				rect_1.set(big_rect.left, big_rect.top, big_rect.left + big_size.width / 2, big_rect.top + big_size.height / 2);

				MyGUI::types::TRect<int> rect_2;
				rect_2.set(big_rect.left + big_size.width / 2, big_rect.top, big_rect.left + big_size.width, big_rect.top + big_size.height / 2);

				MyGUI::types::TRect<int> rect_3;
				rect_3.set(big_rect.left, big_rect.top + big_size.height / 2, big_rect.left + big_size.width / 2, big_rect.top + big_size.height);

				MyGUI::types::TRect<int> rect_4;
				rect_4.set(big_rect.left + big_size.width / 2, big_rect.top + big_size.height / 2, big_rect.left + big_size.width , big_rect.top + big_size.height);

				if (rect_1.inside(_value))
				{
					//LogManager::getSingletonPtr()->logMessage("rect_1");
					return widget;
				}

				if (rect_2.inside(_value))
				{
					//LogManager::getSingletonPtr()->logMessage("rect_2");
					std::string name = widget->getName();
					std::vector<std::string> splitted = MyGUI::utility::split(name, "_");
					if (!splitted.empty())
					{
						std::string slot_num = splitted.at(3);
						std::vector<std::string> splitted_number = MyGUI::utility::split(slot_num, "x");
						if (!splitted_number.empty())
						{
							int r = StringConverter::parseInt(splitted_number.at(0));
							int c = StringConverter::parseInt(splitted_number.at(1));
							MyGUI::Widget* ret = this->getWidgetSlotByRC(r, c+1);
							return ret;
						}
					}
				}

				if (rect_3.inside(_value))
				{
					//LogManager::getSingletonPtr()->logMessage("rect_3");
					std::string name = widget->getName();
					std::vector<std::string> splitted = MyGUI::utility::split(name, "_");
					if (!splitted.empty())
					{
						std::string slot_num = splitted.at(3);
						std::vector<std::string> splitted_number = MyGUI::utility::split(slot_num, "x");
						if (!splitted_number.empty())
						{
							int r = StringConverter::parseInt(splitted_number.at(0));
							int c = StringConverter::parseInt(splitted_number.at(1));
							MyGUI::Widget* ret = this->getWidgetSlotByRC(r+1, c);
							return ret;
						}
					}
				}

				if (rect_4.inside(_value))
				{
					//LogManager::getSingletonPtr()->logMessage("rect_4");
					std::string name = widget->getName();
					std::vector<std::string> splitted = MyGUI::utility::split(name, "_");
					if (!splitted.empty())
					{
						std::string slot_num = splitted.at(3);
						std::vector<std::string> splitted_number = MyGUI::utility::split(slot_num, "x");
						if (!splitted_number.empty())
						{
							int r = StringConverter::parseInt(splitted_number.at(0));
							int c = StringConverter::parseInt(splitted_number.at(1));
							MyGUI::Widget* ret = this->getWidgetSlotByRC(r+1, c+1);
							return ret;
						}
					}
				}

				return widget; //should not return this !
			}
		}
		return 0;
	}
开发者ID:Alex-G,项目名称:MuOnline,代码行数:96,代码来源:StashPanel.cpp


注:本文中的mygui::Widget::getAbsoluteRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。