void onSelect( Gwen::Controls::Base* pControl )
	{
		Gwen::Controls::ComboBox* but = (Gwen::Controls::ComboBox*) pControl;

		Gwen::String str = Gwen::Utility::UnicodeToString(	but->GetSelectedItem()->GetText());

		if (m_callback)
			(*m_callback)(m_buttonId,str.c_str(),m_userPointer);
	}
Esempio n. 2
0
void	GwenUserInterface::registerComboBox(int comboboxId, int numItems, const char** items)
{
	Gwen::Controls::ComboBox* combobox = new Gwen::Controls::ComboBox(m_data->m_demoPage->GetPage());
	MyComboBoxHander* handler = new MyComboBoxHander(m_data, comboboxId);
	m_data->m_handlers.push_back(handler);
	
	combobox->onSelection.Add(handler,&MyComboBoxHander::onSelect);
	int ypos = m_data->m_handlers.size()*20;
	combobox->SetPos(10, ypos );
	combobox->SetWidth( 100 );
	//box->SetPos(120,130);
	for (int i=0;i<numItems;i++)
		combobox->AddItem(Gwen::Utility::StringToUnicode(items[i]));
	
	
}
void	GwenUserInterface::registerComboBox2(int comboboxId, int numItems, const char** items, int startItem)
{
	Gwen::Controls::ComboBox* combobox = new Gwen::Controls::ComboBox(m_data->m_demoPage->GetPage());
	MyComboBoxHander* handler = new MyComboBoxHander(m_data, comboboxId);
	m_data->m_handlers.push_back(handler);

	combobox->onSelection.Add(handler,&MyComboBoxHander::onSelect);
	int ypos = m_data->m_curYposition;
	combobox->SetPos(10, ypos );
	combobox->SetWidth( 100 );
	//box->SetPos(120,130);
	for (int i=0;i<numItems;i++)
	{
		Gwen::Controls::MenuItem* item = combobox->AddItem(Gwen::Utility::StringToUnicode(items[i]));
		if (i==startItem)
			combobox->OnItemSelected(item);
	}

	m_data->m_curYposition+=22;



}
void GwenParameterInterface::registerComboBox(ComboBoxParams& params)
{
	Gwen::Controls::ComboBox* combobox = new Gwen::Controls::ComboBox(m_gwenInternalData->m_demoPage->GetPage());
	m_paramInternalData->m_comboBoxes.push_back(combobox);
	MyComboBoxHander2* handler = new MyComboBoxHander2(m_gwenInternalData, params.m_comboboxId,params.m_callback, params.m_userPointer);
	m_gwenInternalData->m_handlers.push_back(handler);

	combobox->onSelection.Add(handler,&MyComboBoxHander2::onSelect);
	int ypos = m_gwenInternalData->m_curYposition;
	m_gwenInternalData->m_curYposition+=22;
	combobox->SetPos(5, ypos );
	combobox->SetWidth( 220 );
	//box->SetPos(120,130);
	for (int i=0;i<params.m_numItems;i++)
	{
		Gwen::Controls::MenuItem* item = combobox->AddItem(Gwen::Utility::StringToUnicode(params.m_items[i]));
		if (i==params.m_startItem)
			combobox->OnItemSelected(item);
	}

    
	

}
Esempio n. 5
0
		void Generate()
		{
			// Generate title
			{
				std::string title;
				if (entities.size() > 1)
				{
					title = boost::lexical_cast<std::string>(entities.size()) + " entities";
				}
				else if (!entities.empty())
				{
					auto front = entities.front();
					if (front->GetName().empty())
						title = "Unnamed";
					else
						title = front->GetName();
					if (front->IsPseudoEntity())
						title += " Pseudo-Entity";
					else
						title += " - ID: " + boost::lexical_cast<std::string>(front->GetID());

					entity_inspector->SetEntity(front);
				}
				if (!title.empty())
					window->SetTitle(Gwen::Utility::Format(L"Properties: %s", title));
			}

			inspector_group->AddFooter();

			inspector_group->DoneAddingEntities();

			// Set entities
			for (auto entity : entities)
			{
				entitySelector->AddItem(Gwen::Utility::StringToUnicode(entity->GetName()));
			}
		}
Esempio n. 6
0
	GWEN_CONTROL_INLINE( ComboBox, GUnit )
	{

		{
			Gwen::Controls::ComboBox* combo = new Gwen::Controls::ComboBox( this );
			combo->SetPos( 50, 50 );
			combo->SetWidth( 200 );


			combo->AddItem( L"Option One", "one" );
			combo->AddItem( L"Number Two", "two" );
			combo->AddItem( L"Door Three", "three" );
			combo->AddItem( L"Four Legs", "four" );
			combo->AddItem( L"Five Birds", "five" );

			combo->onSelection.Add( this, &ComboBox::OnComboSelect );
		}

		{
			// Empty..
			Gwen::Controls::ComboBox* combo = new Gwen::Controls::ComboBox( this );
			combo->SetPos( 50, 80 );
			combo->SetWidth( 200 );
		}

		{
			// Empty..
			Gwen::Controls::ComboBox* combo = new Gwen::Controls::ComboBox( this );
			combo->SetPos( 50, 110 );
			combo->SetWidth( 200 );

			for (int i=0; i<500; i++ )
				combo->AddItem( L"Lots Of Options" );
		}

	}
Esempio n. 7
0
	void OnComboSelect( Gwen::Controls::Base* pControl )
	{
		Gwen::Controls::ComboBox* combo = (Gwen::Controls::ComboBox*)pControl;

		UnitPrint( Utility::Format( L"Combo Changed: %s", combo->GetSelectedItem()->GetText().c_str() ) );
	}
Esempio n. 8
0
		virtual Gwen::Controls::Base* CreateInstance( Gwen::Controls::Base* parent )
		{
			Gwen::Controls::ComboBox* pControl = new Gwen::Controls::ComboBox( parent );
			pControl->SetSize( 100, 20 );
			return pControl;
		}