Exemplo n.º 1
0
	CEGUI::Window* Widget::loadMainSheet(const std::string& filename, const std::string& prefix) {
		assert(mWindowManager && "You must call init() before you can call any other methods.");
		mPrefix = prefix;
		std::string finalFileName(mGuiManager->getLayoutDir() + filename);
		try {
			mMainWindow = mWindowManager->loadLayoutFromFile(finalFileName);
		} catch (const std::exception& ex) {
			S_LOG_FAILURE("Error when loading from " << filename << "." << ex);
			throw ex;
		} catch (...) {
			S_LOG_FAILURE("Unknown error when loading from " << filename << ".");
			throw;
		}
		mMainWindow->setName(prefix);
		mOriginalWindowAlpha = mMainWindow->getAlpha();
		getMainSheet()->addChild(mMainWindow);
		BIND_CEGUI_EVENT(mMainWindow, CEGUI::FrameWindow::EventActivated, Widget::MainWindow_Activated);
		BIND_CEGUI_EVENT(mMainWindow, CEGUI::FrameWindow::EventDeactivated, Widget::MainWindow_Deactivated);
		//we want to catch all click events, so we'll listen for the mouse button down event
		BIND_CEGUI_EVENT(mMainWindow, CEGUI::Window::EventMouseButtonDown, Widget::MainWindow_MouseButtonDown);
		if (mMainWindow->isVisible()) {
			onEventFirstTimeShown();
		} else {
			//Set it up to listen for the first time the window is shown.
			BIND_CEGUI_EVENT(mMainWindow, CEGUI::Window::EventShown, Widget::MainWindow_Shown);
		}

		return mMainWindow;
	}
Exemplo n.º 2
0
void InspectWidget::buildWidget()
{


	loadMainSheet("InspectWidget.layout", "InspectWidget/");
	mMainWindow->setVisible(false);
//	mMainWindow->setAlwaysOnTop(true);

	mChildList = static_cast<CEGUI::Listbox*>(getWindow("ChildList"));
	BIND_CEGUI_EVENT(mChildList, CEGUI::Listbox::EventMouseDoubleClick, InspectWidget::ChildList_MouseDoubleClick);

	mInfo = getWindow("EntityInfo");


	mGuiManager->EventEntityAction.connect(sigc::mem_fun(*this, &InspectWidget::handleAction));
	enableCloseButton();

	if (CEGUI::PushButton* button = static_cast<CEGUI::PushButton*>(getWindow("ShowOgreBoundingBox"))) {
		BIND_CEGUI_EVENT(button, CEGUI::PushButton::EventClicked, InspectWidget::ShowOgreBoundingBox_Click);
	}

	if (CEGUI::PushButton* button = static_cast<CEGUI::PushButton*>(getWindow("ShowErisBoundingBox"))) {
		BIND_CEGUI_EVENT(button, CEGUI::PushButton::EventClicked, InspectWidget::ShowErisBoundingBox_Click);
	}

	if (CEGUI::PushButton* button = static_cast<CEGUI::PushButton*>(getWindow("ShowCollision"))) {
		BIND_CEGUI_EVENT(button, CEGUI::PushButton::EventClicked, InspectWidget::ShowCollision_Click);
	}

}
Exemplo n.º 3
0
Vector3Adapter::Vector3Adapter(CEGUI::Window *xWindow, CEGUI::Window *yWindow, CEGUI::Window *zWindow, const Ogre::Vector3& vector) :
    mVector(vector), mOriginalVector(vector), mXWindow(xWindow), mYWindow(yWindow), mZWindow(zWindow), mSelfUpdate(false)

{
  if (xWindow) {
    BIND_CEGUI_EVENT(xWindow, CEGUI::Window::EventTextChanged, Vector3Adapter::window_TextChanged);
  }
  if (yWindow) {
    BIND_CEGUI_EVENT(yWindow, CEGUI::Window::EventTextChanged, Vector3Adapter::window_TextChanged);
  }
  if (zWindow) {
    BIND_CEGUI_EVENT(zWindow, CEGUI::Window::EventTextChanged, Vector3Adapter::window_TextChanged);
  }
}
Exemplo n.º 4
0
QuaternionAdapter::QuaternionAdapter(CEGUI::Window *degreeWindow, CEGUI::Window *xWindow, CEGUI::Window *yWindow, CEGUI::Window *zWindow, const Ogre::Quaternion& quaternion)
: mQuaternion(quaternion), mOriginalQuaternion(quaternion), mVectorAdapter(xWindow, yWindow, zWindow), mDegreeWindow(degreeWindow), mSelfUpdate(false)
{
	if (degreeWindow) {
		BIND_CEGUI_EVENT(degreeWindow, CEGUI::Window::EventTextChanged, QuaternionAdapter::window_TextChanged);
	}
	mVectorAdapter.EventValueChanged.connect(sigc::mem_fun(*this, &QuaternionAdapter::vectorAdapter_ValueChanged));

}
Exemplo n.º 5
0
	void Widget::addTabbableWindow(CEGUI::Window* window)
	{
		if (!mFirstTabWindow) {
			mFirstTabWindow = window;
		}
		if (mLastTabWindow) {
			mTabOrder.insert(WindowMap::value_type(mLastTabWindow, window));
		}
		mLastTabWindow = window;
		BIND_CEGUI_EVENT(window, CEGUI::Window::EventKeyDown, Widget::TabbableWindow_KeyDown);
	}
Exemplo n.º 6
0
ListHolder::ListHolder(CEGUI::Listbox* listbox, CEGUI::Editbox* filterEditbox)
: mListbox(listbox), mFilterEditbox(filterEditbox)
{
	if (filterEditbox) {
		BIND_CEGUI_EVENT(filterEditbox, CEGUI::Window::EventTextChanged, ListHolder::filterEditbox_TextChanged );
	}
// 	BIND_CEGUI_EVENT(listbox, CEGUI::Listbox::EventListContentsChanged, ListHolder::listbox_ListContentsChanged );



}
Exemplo n.º 7
0
	void Widget::enableCloseButton()
	{
		assert(mMainWindow);
		BIND_CEGUI_EVENT(mMainWindow, CEGUI::FrameWindow::EventCloseClicked, Widget::MainWindow_CloseClick);
	}