コード例 #1
0
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;



}
コード例 #2
0
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);
	}

    
	

}