本文整理汇总了C++中Rect::GetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::GetPos方法的具体用法?C++ Rect::GetPos怎么用?C++ Rect::GetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::GetPos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintClients
void TableListedItems::PaintClients( const WidgetPainter &painter )
{
Pos p;
Dim2i d( GetWidth(), 0);
Rect client_area = GetParent()->GetClientRect(this)-GetPosition();
Rect visibile = TableWidget::GetCrossing( client_area );
p.y = RowRect( visibile.GetY1() ).GetY();
for ( int i=visibile.GetY1(); i<visibile.GetY2(); ++i )
{
d.y = GetRowHeight(i);
int last_col = GetNumColumns() -1;
Rect fa = RowRect( i );
if ( _skins.Select( GetState(i) ) )
{
_skins.SetSize( Dim2i(fa.GetW(),fa.GetH()) );
}
_skins.Paint( painter, fa.GetPos(), fa );
p.y += d.y;
}
}
示例2: AlignSize
void Widget::AlignSize ( const Rect &offsetAndSize, const Pos &placement )
{
Rect my_rect = GetBoundingRect() + GetPosition();
Rect rect = my_rect;
// align width
if ( offsetAndSize.w > 0 )
{
rect.w -= offsetAndSize.x;
rect.w /= offsetAndSize.w;
rect.w *= offsetAndSize.w;
rect.w += offsetAndSize.x;
}
// align height
if ( offsetAndSize.h > 0 )
{
rect.h -= offsetAndSize.y;
rect.h /= offsetAndSize.h;
rect.h *= offsetAndSize.h;
rect.h += offsetAndSize.y;
}
rect.x = my_rect.x + ((my_rect.w - rect.w) * placement.x / 100);
rect.y = my_rect.y + ((my_rect.h - rect.h) * placement.y / 100);
// apply new size
Resize( rect.w, rect.h );
// apply new position
SetPosition( rect.GetPos() );
}
示例3: PaintArea
void ListedTextItems::PaintArea( const Painter &painter, const Rect &area, int stateID)
{
if ( _skins.Select(stateID) )
{
int cur_w = _skins.GetWidth();
int cur_h = _skins.GetHeight();
_skins.SetSize( Dim2i( area.GetW(), area.GetH()));
_skins.Paint( painter, area.GetPos());
_skins.SetSize( Dim2i( cur_w, cur_h));
}
}
示例4: Fill
// Fills parent client-area with self
void Widget::Fill( const Rect& area, const Rect &padding )
{
Rect cr = area;
if (!cr)
{
assert( _parent && "Widget::Fill(): Impossibile due no parent");
cr = _parent->GetClientRect(this);
}
cr.x += padding.x;
cr.y += padding.y;
cr.w -= padding.w + padding.x;
cr.h -= padding.h + padding.y;
SetPosition( cr.GetPos() );
Resize( cr.GetW(), cr.GetH() );
}
示例5: Fit
void TableSystemWidget::Fit()
{
int w = GetWidth(), h=GetHeight();
int sb_width = _sb_width;
int sb_height = _sb_height;
if (_p_verti_scrollbar && _p_verti_scrollbar->Atom().IsVisible() )
{
_ResizePositive( _p_verti_scrollbar->AtomPtr(), sb_width, h-(_cs_height+sb_height) );
_p_verti_scrollbar->Atom().SetPosition ( Pos( w-sb_width, _cs_height) );
}
if (_p_horiz_scrollbar && _p_horiz_scrollbar->Atom().IsVisible() )
{
_ResizePositive( _p_horiz_scrollbar->AtomPtr(), w-sb_width, sb_height );
_p_horiz_scrollbar->Atom().SetPosition ( Pos( 0, h-sb_height ) );
}
if (_p_table_frame)
{
int frame_w = w-sb_width;
int frame_h = h-sb_height;
_p_table_frame->Fill( Rect( 0, 0, frame_w, frame_h ));
Rect c = _p_table_frame->GetClientRect( _p_caption_scroller );
_p_caption_scroller->Resize( c.GetW(), _cs_height );
_p_caption_scroller->SetPosition( c.GetPos() );
_ResizePositive( _p_table_scroller, c.GetW(), c.GetH()-_cs_height );
_p_table_scroller->SetPosition( c.GetPos() + Pos( 0, _cs_height) );
}
else
{
if (_p_caption_scroller)
{
_p_caption_scroller->Resize( w-sb_width, _cs_height );
_p_caption_scroller->SetPosition( Pos(0,0) );
}
if (_p_table_scroller)
{
_ResizePositive( _p_table_scroller, w-sb_width, h-(_cs_height+sb_height) );
_p_table_scroller->SetPosition ( Pos(0,_cs_height) );
}
}
if ( _p_top_gadget )
{
_p_top_gadget->SetPosition( Pos( w-_p_top_gadget->GetWidth(), 0) );
HubWidget::BringOnTop( _p_top_gadget );
}
if ( _p_bottom_gadget )
{
if ( sb_width && sb_height )
{
_p_bottom_gadget->SetPosition( Pos( w-sb_width, h-sb_height) );
if ( !_p_bottom_gadget->Atom().IsVisible() ) { _p_bottom_gadget->Atom().Show(); }
}
else if ( _p_bottom_gadget->Atom().IsVisible() ) { _p_bottom_gadget->Atom().Hide(); }
}
if ( _auto_cover )
{
int pri_tbl_width = _pri_tbl_width;
int pri_tbl_height= _pri_tbl_height;
int table_w = pri_tbl_width;
int table_h = pri_tbl_height;
int client_w = _p_table_scroller->GetWidth();
int client_h = _p_table_scroller->GetHeight();
// try to cover all client area by table (if table is smaller than area)
if ( client_w > table_w )
{
_p_main_table->Atom().Resize( client_w, table_h );
}
else if ( client_w < pri_tbl_width )
{
_p_main_table->Atom().Resize( pri_tbl_width, table_h );
}
table_w = _p_main_table->Atom().GetWidth();
if ( client_h > table_h )
{
_p_main_table->Atom().Resize( table_w, client_h );
}
else if ( client_h < pri_tbl_height )
{
_p_main_table->Atom().Resize( table_w, pri_tbl_height );
}
table_h = _p_main_table->Atom().GetHeight();
// right scrollbar dissappears only if top-gadget does not exist
if ( !_p_top_gadget )
{
// Check if full table would be visible if we hide both scrollbars
bool would_fit_width = client_w + sb_width >= table_w;
bool would_fit_height= client_h + sb_height >= table_h;
if ( would_fit_width && would_fit_height )
{
//.........这里部分代码省略.........