本文整理汇总了C++中ColorDisplay类的典型用法代码示例。如果您正苦于以下问题:C++ ColorDisplay类的具体用法?C++ ColorDisplay怎么用?C++ ColorDisplay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ColorDisplay类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GroupBox
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: FindChildByName
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 ) );
}
示例3: UpdateColorControls
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 );
}
示例4: FindChildByName
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 ) );
}
示例5: CreateColorControl
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();
}