예제 #1
0
void GwenParameterInterface::registerButtonParameter(ButtonParams& params)
{
	
	Gwen::Controls::Button* button = new Gwen::Controls::Button(m_gwenInternalData->m_demoPage->GetPage());
	MyButtonEventHandler* handler = new MyButtonEventHandler(params.m_callback,params.m_buttonId,params.m_userPointer);
	button->SetText(params.m_name);
	button->onPress.Add( handler, &MyButtonEventHandler::onButtonPress );
    button->SetIsToggle(params.m_isTrigger);
    
	m_paramInternalData->m_buttons.push_back(button);
	m_paramInternalData->m_buttonEventHandlers.push_back(handler);

	button->SetPos( 5, m_gwenInternalData->m_curYposition );
	button->SetWidth(220);
	
	m_gwenInternalData->m_curYposition+=22;

}
예제 #2
0
void	GwenUserInterface::registerToggleButton(int buttonId, const char* name)
{
	assert(m_data);
	assert(m_data->m_demoPage);

	Gwen::Controls::Button* but = new Gwen::Controls::Button(m_data->m_demoPage->GetPage());
	
	///some heuristic to find the button location
	int ypos = m_data->m_handlers.size()*20;
	but->SetPos(10, ypos );
	but->SetWidth( 100 );
	//but->SetBounds( 200, 30, 300, 200 );
	
	MyButtonHander* handler = new MyButtonHander(m_data, buttonId);
	m_data->m_handlers.push_back(handler);
	but->onToggle.Add(handler, &MyButtonHander::onButtonA);
	but->SetIsToggle(true);
	but->SetToggleState(false);
	but->SetText(name);

}