void PropFrame::addProp( char const* name , void* value , int sizeValue , int numSet , int const valueSet[] , char const* strSet[] , unsigned flag ) { IntPropChioce* chioce = new IntPropChioce( UI_INT_PROP_CHIOCE , calcWidgetPos() , getWidgetSize() , this ); chioce->init( numSet , valueSet , strSet ); chioce->setData( value , sizeValue ); addPorpWidget( name , chioce ); }
/************************************************************** *** ** EmptyWidget --- Constructor *** ***************************************************************/ void EmptyWidget::doPaint( bool eraseBackground, const wxRect* ) { int w, h; getWidgetSize( &w, &h ); painter->setPen( *wxRED ); painter->drawLine( 0, 0, w, h ); painter->drawLine( 0, h, w, 0 ); }
void PropFrame::onRender() { BaseClass::onRender(); Vec2i pos = getWorldPos(); int i = 0; for( PropInfoVec::iterator iter= mPorps.begin() , itEnd = mPorps.end(); iter != itEnd ; ++iter ) { PropInfo& data = *iter; getRenderSystem()->drawText( data.name , pos + Vec2i( 5 , TopSideHeight + 5 + i * ( getWidgetSize().y + 5 ) + getWidgetSize().y / 2 ) , TEXT_SIDE_LEFT ); ++i; } }
void PropFrame::addPropData(char const* name , PropData const& data , unsigned flag) { switch ( data.getType() ) { case PROP_VEC3F: if ( flag & CPF_COLOR ) { //TODO } else { FixString< 128 > fullName; fullName = name; fullName += ".X"; addProp( fullName , data.cast< Vec3f >().x , flag ); fullName = name; fullName += ".Y"; addProp( fullName , data.cast< Vec3f >().y , flag ); fullName = name; fullName += ".Y"; addProp( fullName , data.cast< Vec3f >().z , flag ); } break; case PROP_VEC2F: { FixString< 128 > fullName; fullName = name; fullName += ".X"; addProp( fullName , data.cast< Vec2f >().x , flag ); fullName = name; fullName += ".Y"; addProp( fullName , data.cast< Vec2f >().y , flag ); } break; case PROP_BOOL: { int valueSet[] = { 1 , 0 }; char const* strSet[] = { "True" , "False" }; addEnumProp( name , data.cast< bool >() , 2 , valueSet , strSet ); } break; default: { PorpTextCtrl* textCtrl = new PorpTextCtrl( UI_PROP_TEXTCTRL , calcWidgetPos() , getWidgetSize() , this ); textCtrl->setData( data ); addPorpWidget( name , textCtrl ); } } }
Vec2i PropFrame::calcWidgetPos() { int x = getSize().x - ( getWidgetSize().x + 5 ); int y = TopSideHeight + 5 + mPorps.size() * ( getWidgetSize().y + 5 ); return Vec2i( x , y ); }