void GwenParameterInterface::registerSliderFloatParameter(SliderParams& params)
{
	Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox(m_gwenInternalData->m_demoPage->GetPage());
	m_paramInternalData->m_textLabels.push_back(label);
	//m_data->m_myControls.push_back(label);
	label->SetText( params.m_name);
	label->SetPos( 10, 10 + 25 );
	label->SetWidth(110);
	label->SetPos(10,m_gwenInternalData->m_curYposition);
	m_gwenInternalData->m_curYposition+=22;

	Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( m_gwenInternalData->m_demoPage->GetPage());
	m_paramInternalData->m_sliders.push_back(pSlider);
	//m_data->m_myControls.push_back(pSlider);
	pSlider->SetPos( 10, m_gwenInternalData->m_curYposition );
	pSlider->SetSize( 100, 20 );
	pSlider->SetRange( params.m_minVal, params.m_maxVal);
	pSlider->SetNotchCount(20);//float(params.m_maxVal-params.m_minVal)/100.f);
	pSlider->SetClampToNotches( params.m_clampToNotches );
	pSlider->SetValue( *params.m_paramValuePointer);//dimensions[i] );
	char labelName[1024];
	sprintf(labelName,"%s",params.m_name);//axisNames[0]);
	MySliderEventHandler<btScalar>* handler = new MySliderEventHandler<btScalar>(labelName,label,pSlider,params.m_paramValuePointer);
	m_paramInternalData->m_sliderEventHandlers.push_back(handler);

	pSlider->onValueChanged.Add( handler, &MySliderEventHandler<btScalar>::SliderMoved );
	handler->SliderMoved(pSlider);
	float v = pSlider->GetValue();
	m_gwenInternalData->m_curYposition+=22;
}
Example #2
0
				virtual Gwen::Controls::Base* CreateInstance( Gwen::Controls::Base* parent )
				{
					Gwen::Controls::TextBox* pControl = new Gwen::Controls::TextBox( parent );
					pControl->SetSize( 100, 20 );
					pControl->SetText( "" );
					return pControl;
				}
	void	SetValue(T v)
	{
		if (v < m_pSlider->GetRangeMin())
		{
			printf("?\n");
		}

		if (v > m_pSlider->GetRangeMax())
		{
						printf("?\n");

		}
		m_pSlider->SetValue(v,true);
		(*m_targetValue) = v;
		float val = float(v);//todo: specialize on template type
		char txt[1024];
		sprintf(txt,"%s : %.3f", m_variableName,val);
		m_label->SetText(txt);

	}
Example #4
0
	GWEN_CONTROL_INLINE( TextBox, GUnit )
	{
		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( "" );
			label->SetPos( 10, 10 );
			label->onTextChanged.Add( this, &ThisClass::OnEdit );
			label->onReturnPressed.Add( this, &ThisClass::OnSubmit );

		}

		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( "Normal Everyday Label" );
			label->SetPos( 10, 10 + 25 );
		}

		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( "Select All Text On Focus" );
			label->SetPos( 10, 10 + 25 * 2 );
			label->SetSelectAllOnFocus( true );
		}

		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( L"Different Coloured Text, for some reason" );
			label->SetTextColor( Gwen::Color( 255, 0, 255, 255 ) );
			label->SetPos( 10, 10 + 25 * 3 );
		}

		{
			Gwen::Controls::TextBoxNumeric* label = new Gwen::Controls::TextBoxNumeric( this );
			label->SetText( L"2004" );
			label->SetTextColor( Gwen::Color( 255, 0, 255, 255 ) );
			label->SetPos( 10, 10 + 25 * 4 );
		}

		{
			m_Font.facename = L"Impact";
			m_Font.size = 50;

			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( L"Different Font" );
			label->SetPos( 10, 10 + 25 * 5 );
			label->SetFont( &m_Font );
			label->SetSize( 200, 55 );
		}


	}
Example #5
0
	void OnSubmit( Gwen::Controls::Base* pControl )
	{
		Gwen::Controls::TextBox* textbox = (Gwen::Controls::TextBox*) (pControl);
		UnitPrint( Utility::Format( L"Textbox Submit: [%s]\n", textbox->GetText().c_str() ) );
	}
Example #6
0
	GWEN_CONTROL_INLINE( TextBox, GUnit )
	{
		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( "" );
			label->SetPos( 10, 10 );
			label->onTextChanged.Add( this, &ThisClass::OnEdit );
			label->onReturnPressed.Add( this, &ThisClass::OnSubmit );

		}

		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( "Normal Everyday Label" );
			label->SetPos( 10, 10 + 25 );
		}

		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( "Select All Text On Focus" );
			label->SetPos( 10, 10 + 25 * 2 );
			label->SetSelectAllOnFocus( true );
		}

		{
			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( L"Different Coloured Text, for some reason" );
			label->SetTextColor( Gwen::Color( 255, 0, 255, 255 ) );
			label->SetPos( 10, 10 + 25 * 3 );
		}

		{
			Gwen::Controls::TextBoxNumeric* label = new Gwen::Controls::TextBoxNumeric( this );
			label->SetText( L"2004" );
			label->SetTextColor( Gwen::Color( 255, 0, 255, 255 ) );
			label->SetPos( 10, 10 + 25 * 4 );
		}

		{
			m_Font.facename = L"Impact";
			m_Font.size = 50;

			Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox( this );
			label->SetText( L"Different Font" );
			label->SetPos( 10, 10 + 25 * 5 );
			label->SetFont( &m_Font );
			label->SetSize( 200, 55 );
		}

		{
			Gwen::Controls::TextBoxMultiline* label = new Gwen::Controls::TextBoxMultiline( this );
			label->SetText( "I think we're losing sight of the real issue here, which is: what are we gonna call ourselves?\n\nErm, and I think it comes down to a choice between \"The League Against Salivating Monsters\" or my own personal preference, which is \"The Committee for the Liberation and Integration of Terrifying Organisms and their Rehabilitation Into Society.\" Erm, one drawback with that: the abbreviation is \"CLITORIS.\"" );
			label->SetPos( 220, 10 );
			label->SetSize( 200, 180 );
		}

	}
Example #7
0
		void OnEdit( Gwen::Controls::Base* pControl )
		{

			Gwen::Controls::TextBox* textbox = ( Gwen::Controls::TextBox* )( pControl );
			UnitPrint( Utility::Format( L"Textbox Edit: [%ls]\n", textbox->GetText().GetUnicode().c_str() ) );
		}