Beispiel #1
0
/***********************************************************
add a tab to the chat
***********************************************************/
void ChatBox::AddTab(const std::string & tabName)
{
    CEGUI::TabControl *tc = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow ("Chat/TabControl"));

	CEGUI::FrameWindow* fWnd = static_cast<CEGUI::FrameWindow *>(CEGUI::WindowManager::getSingleton().createWindow( "DefaultGUISheet", "Chat/Tab_"+tabName ));
	fWnd->setProperty("Text", (const unsigned char *)tabName.c_str());


	CEGUI::Listbox* txt = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().createWindow( "TaharezLook/Listbox", "Chat/Tab_"+tabName+"/editMulti" ));
	txt->setProperty("UnifiedMaxSize", "{{1,0},{1,0}}");
	txt->setProperty("UnifiedAreaRect", "{{0,0},{0,1},{1,0},{1,0}}");
	txt->setProperty("ForceVertScrollbar", "True");
	fWnd->addChildWindow(txt);
	tc->addTab (fWnd);

   //txt->subscribeEvent(CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber (&ChatBox::HandleEnterKey, this));
}
Beispiel #2
0
void ConsoleBox::init(PropertyBagInterface* _params)
{
  TypeTable* table = _params->getTypeTable();
  console = table->getValue<ConsoleInterface*>("console", nullptr);
  std::string consoleName = table->getValue<std::string>("name", getName());
  setName(consoleName + "Console");
  assert(console);
  
  CEGUI::TabControl* tabControl = table->getValue<CEGUI::TabControl*>("tabControl", nullptr);
  assert(tabControl);
  window = tabControl->getTabContentsAtIndex(0)->clone(getName()); /// FIXME don't know another way to do this
  window->setText(consoleName);
  tabControl->addTab(window);
  window->setUserData(this);
  console->getTextOutputHandle()->registerListener(this, outputPrint);
  console->getTextInputHandle()->registerListener(this, inputPrint);
  console->getErrorHandle()->registerListener(this, errorPrint);
}