示例#1
0
void Widget::Align( int inner_alignment)
{
    Rect client_area = GetParent()->GetClientRect( this);
    Rect bound = GetBoundingRect() + GetPosition();
    bound.Align( client_area, Rect::Alignment( inner_alignment));
    SetBoundingRect( bound);
}
 void WidgetTableWidget::UpdateTableImpl()
 {
     SettlerMap::Iterator iter = _settlers.Begin();
     for (; !!iter; ++iter)
     {
         Rect clientrect = ClientRect( iter.Key().x, iter.Key().y );
         Rect boundrect  = iter.Value()._settler->GetBoundingRect();
         Rect area = boundrect.Align( clientrect, iter.Value()._alignment ) ;
         Widget *p_child = iter.Value()._settler;
         DirtyLock guard_dirty(p_child);
         p_child->SetPosition( Pos( area.GetX(), area.GetY() ) );
     }
     SetDimensions( GetWidth(), GetHeight() );
 }
示例#3
0
文件: window.cpp 项目: drodin/Crimson
void Window::VideoModeChange( void ) {
  Rect pos = *this;

  pos.Align( *view );
  pos.Clip( *view );
  if ( flags & WIN_CENTER ) pos.Center( *view );

  if ( (pos.w != w) || (pos.h != h) ) {
    SetSize( pos.x, pos.y, pos.w, pos.h );
    Draw();
  } else {
    x = pos.x;
    y = pos.y;
  }
}