void ColorPicker::UpdateColorControls( Gwen::String name, Gwen::Color col, int sliderVal ) { ColorDisplay* disp = gwen_cast<ColorDisplay> ( FindChildByName( name, true ) ); disp->SetColor( col ); HorizontalSlider* slider = gwen_cast<HorizontalSlider> ( FindChildByName( name + "Slider", true ) ); slider->SetFloatValue( sliderVal ); TextBoxNumeric* box = gwen_cast<TextBoxNumeric> ( FindChildByName( name + "Box", true ) ); box->SetText( Gwen::Utility::ToString( sliderVal ) ); }
void ColorPicker::UpdateControls() { //This is a little weird, but whatever for now UpdateColorControls( "Red", Color( GetColor().r, 0, 0, 255 ), GetColor().r ); UpdateColorControls( "Green", Color( 0, GetColor().g, 0, 255 ), GetColor().g ); UpdateColorControls( "Blue", Color( 0, 0, GetColor().b, 255 ), GetColor().b ); UpdateColorControls( "Alpha", Color( 255, 255, 255, GetColor().a ), GetColor().a ); ColorDisplay* disp = gwen_cast<ColorDisplay> ( FindChildByName( "Result", true ) ); disp->SetColor( Color( GetColor().r, GetColor().g, GetColor().b, GetColor().a ) ); onColorChanged.Call( this ); }
void ColorPicker::UpdateColorControls( Gwen::String name, Gwen::Color col, int sliderVal ) { Base* el = FindChildByName( name, true ); ColorDisplay* disp = el ? el->DynamicCastColorDisplay() : 0; disp->SetColor( col ); HorizontalSlider* slider = FindChildByName( name + "Slider", true )->DynamicCastHorizontalSlider(); slider->SetValue( sliderVal ); TextBoxNumeric* box = FindChildByName( name + "Box", true )->DynamicCastTextBoxNumeric(); box->SetText( Gwen::Utility::ToString( sliderVal ) ); }