Пример #1
0
void ColorPicker::CreateColorControl( Gwen::String name, int y )
{
	int colorSize = 12;

	GroupBox* colorGroup = new GroupBox( this );
	colorGroup->SetPos( 10, y );
	colorGroup->SetText( name );
	colorGroup->SetSize( 160, 35 );
	colorGroup->SetName( name + "groupbox" );

	ColorDisplay* disp = new ColorDisplay( colorGroup );
	disp->SetName(name);
	disp->SetBounds( 0 , 10, colorSize, colorSize );

	TextBoxNumeric* numeric = new TextBoxNumeric( colorGroup );
	numeric->SetName( name + "Box" );
	numeric->SetPos( 105, 7 );
	numeric->SetSize( 26, 16 );
	numeric->SetSelectAllOnFocus( true );
	numeric->onTextChanged.Add( this, &ColorPicker::NumericTyped );

	HorizontalSlider* slider = new HorizontalSlider( colorGroup );
	slider->SetPos( colorSize + 5 , 10 );
	slider->SetRange( 0, 255 );
	slider->SetSize( 80, colorSize );
	slider->SetName( name + "Slider");
	slider->onValueChanged.Add( this, &ColorPicker::SlidersMoved );
}
Пример #2
0
void ColorPicker::CreateControls()
{
	int startY = 5;
	int height = 35;
	CreateColorControl( "Red",	 startY );
	CreateColorControl( "Green", startY + height );
	CreateColorControl( "Blue",  startY + height * 2 );
	CreateColorControl( "Alpha", startY + height * 3 );
	GroupBox* finalGroup = new GroupBox( this );
	finalGroup->SetPos( 180, 40 );
	finalGroup->SetSize( 60, 60 );
	finalGroup->SetText( "Result" );
	finalGroup->SetName( "ResultGroupBox" );
	ColorDisplay* disp = new ColorDisplay( finalGroup );
	disp->SetName( "Result" );
	disp->SetBounds( 7 , 5, 32, 32 );
	disp->SetDrawCheckers( true );
	//UpdateControls();
}