コード例 #1
0
ファイル: hgegui.cpp プロジェクト: FrostHand/TiGa
	void Object::setRect(const hgeRect & rect)
	{
		hgeRect oldRect = getRect();
		windowRect = rect;
		for(Children::iterator it = children.begin(); it != children.end(); ++it)
			calculateLayout(*it);
		onSize(rect.width(), rect.height());
	}
コード例 #2
0
ファイル: catalog_view.cpp プロジェクト: peter-x/booxsdk
/// Arrange all sub widgets according to current widget size.
/// Ensure we fill the grid layout. Widget level, different from associateData,
/// associateData will update all associated data.
void CatalogView::arrangeSubWidgets()
{
    // If rows or columns changed.
    int rows = 0;
    int cols = 0;
    calculateLayout(rows, cols);

    ContentView * p = 0;
    // Always update.
    //if (paginator().rows() != rows || paginator().cols() != cols || isFixedGrid())
    {
        // Remove all widgets from layout.
        for (int i = 0; i < sub_items_.size(); ++i)
        {
            p = sub_items_.at(i);
            layout_.removeWidget(p);
            p->hide();
        }
        sub_items_.clear();
        if (isFixedGrid())
        {
            rows = paginator().rows();
            cols = paginator().cols();
        }
        paginator().setGrid(rows, cols);
        paginator().resize(rows * cols);
    }

#ifdef BUILD_WITH_TFT
    if (arrange_policy_ == COLUMN_FIRST)
    {
        addSubWidgetByColumn(rows, cols);
    }
    else
#endif
    {
        addSubWidgetByRow(rows, cols);
    }
}