Beispiel #1
0
	void Control::AdviceWidget(MyGUI::Widget* _widget)
	{
		std::string command = _widget->getUserString("CommandClick");
		if (!command.empty())
			_widget->eventMouseButtonClick += MyGUI::newDelegate(this, &Control::notifyMouseButtonClick);

		MyGUI::TabControl* tab = _widget->castType<MyGUI::TabControl>(false);
		if (tab != nullptr)
		{
			if (tab->getItemCount() != 0 && tab->getItemAt(0)->getUserString("CommandActivate") != "")
				tab->eventTabChangeSelect += MyGUI::newDelegate(this, &Control::notifyTabChangeSelect);
		}

		MyGUI::Window* window = _widget->castType<MyGUI::Window>(false);
		if (window != nullptr && window->getUserString("CommandClose") != "")
			window->eventWindowButtonPressed += MyGUI::newDelegate(this, &Control::notifyWindowButtonPressed);

		command = _widget->getUserString("CommandAccept");
		if (!command.empty())
		{
			MyGUI::EditBox* edit = _widget->castType<MyGUI::EditBox>(false);
			if (edit != nullptr)
				edit->eventEditSelectAccept += MyGUI::newDelegate(this, &Control::notifyEditSelectAccept);
		}
	}