ScrollBar::ScrollBar() { RString sMetricsGroup = "ScrollBar"; m_sprMiddle.Load( THEME->GetPathG(sMetricsGroup,"middle") ); this->AddChild( m_sprMiddle ); m_sprTop.Load( THEME->GetPathG(sMetricsGroup,"top") ); m_sprTop->SetVertAlign( VertAlign_Bottom ); this->AddChild( m_sprTop ); m_sprBottom.Load( THEME->GetPathG(sMetricsGroup,"bottom") ); m_sprBottom->SetVertAlign( VertAlign_Top ); this->AddChild( m_sprBottom ); m_sprScrollTickThumb.Load( THEME->GetPathG(sMetricsGroup,"TickThumb") ); this->AddChild( m_sprScrollTickThumb ); for( unsigned i=0; i<ARRAYLEN(m_sprScrollStretchThumb); i++ ) { m_sprScrollStretchThumb[i].Load( THEME->GetPathG(sMetricsGroup,"StretchThumb") ); this->AddChild( m_sprScrollStretchThumb[i] ); } SetBarHeight( 100 ); }
void MyStatusBar :: MyGetPreferredSize( float * paramWidth, float * paramHeight) { float leftOffset; float baseline; float width; float height; *paramHeight = myPrefs->GetPreferredBarHeight(); if (!StringBoundsBox( "MM",//needs some padding; &width, &height, &leftOffset, &baseline)) { throw; } *paramWidth = width; if (Text()) { if (!StringBoundsBox( Text(), &width, &height, &leftOffset, &baseline)) { throw; } *paramWidth += width; } if (TrailingText()) { if (!StringBoundsBox( TrailingText(), &width, &height, &leftOffset, &baseline)) { throw; } *paramWidth += width; } if (Label()) { if (!StringBoundsBox( Label(), &width, &height, &leftOffset, &baseline)) { throw; } *paramWidth += width; } if (TrailingLabel()) { if (!StringBoundsBox( TrailingLabel(), &width, &height, &leftOffset, &baseline)) { throw; } *paramWidth += width; } SetBarHeight(*paramHeight); *paramHeight += (height + 2); mfWidthPref = *paramWidth; mfHeightPref = *paramHeight; }//end