static void expand P3C(fn_type *, expansion, const_string, start, const_string, end) { string value; unsigned len = end - start + 1; string var = xmalloc (len + 1); strncpy (var, start, len); var[len] = 0; if (expanding_p (var)) { WARNING1 ("kpathsea: variable `%s' references itself (eventually)", var); } else { #if 1 /* The mktex.c replacement for shell scripts needs a more sophisticated lookup for variables */ value = getval(var); #else /* Check for an environment variable. */ value = getenv (var); #endif /* If no envvar, check the config files. */ if (!value) value = kpse_cnf_get (var); if (value) { expanding (var, true); value = mktex_var_expand (value); expanding (var, false); fn_grow (expansion, value, strlen (value)); free (value); } free (var); } }
QRect QLayout::alignmentRect( const QRect &r ) const { QSize s = sizeHint(); int a = alignment(); if ( expanding() & QSizePolicy::Horizontal || !(a & HorAlign ) ) { s.setWidth( r.width() ); } if ( expanding() & QSizePolicy::Vertical || !(a & VerAlign )) { s.setHeight( r.height() ); } else if ( hasHeightForWidth() ) { s.setHeight( QMIN( s.height(), heightForWidth(s.width()) ) ); } int x = r.x(); int y = r.y(); if ( a & Qt::AlignRight ) x = x + ( r.width() - s.width() ); else if ( !(a & Qt::AlignLeft) ) x = x + ( r.width() - s.width() ) / 2; if ( a & Qt::AlignBottom ) y = y + ( r.height() - s.height() ); else if ( !(a & Qt::AlignTop) ) y = y + ( r.height() - s.height() ) / 2; return QRect( x, y, s.width(), s.height() ); }
void QwtDynGridLayout::stretchGrid(const QRect &rect, uint numCols, QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const { if ( numCols == 0 || isEmpty() ) return; bool expandH, expandV; #if QT_VERSION >= 0x040000 expandH = expandingDirections() & Qt::Horizontal; expandV = expandingDirections() & Qt::Vertical; #else expandH = expanding() & QSizePolicy::Horizontally; expandV = expanding() & QSizePolicy::Vertically; #endif if ( expandH ) { int xDelta = rect.width() - 2 * margin() - (numCols - 1) * spacing(); for ( int col = 0; col < (int)numCols; col++ ) xDelta -= colWidth[col]; if ( xDelta > 0 ) { for ( int col = 0; col < (int)numCols; col++ ) { const int space = xDelta / (numCols - col); colWidth[col] += space; xDelta -= space; } } } if ( expandV ) { uint numRows = itemCount() / numCols; if ( itemCount() % numCols ) numRows++; int yDelta = rect.height() - 2 * margin() - (numRows - 1) * spacing(); for ( int row = 0; row < (int)numRows; row++ ) yDelta -= rowHeight[row]; if ( yDelta > 0 ) { for ( int row = 0; row < (int)numRows; row++ ) { const int space = yDelta / (numRows - row); rowHeight[row] += space; yDelta -= space; } } } }
int QTabBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 8) qt_static_metacall(this, _c, _id, _a); _id -= 8; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Shape*>(_v) = shape(); break; case 1: *reinterpret_cast< int*>(_v) = currentIndex(); break; case 2: *reinterpret_cast< int*>(_v) = count(); break; case 3: *reinterpret_cast< bool*>(_v) = drawBase(); break; case 4: *reinterpret_cast< QSize*>(_v) = iconSize(); break; case 5: *reinterpret_cast< Qt::TextElideMode*>(_v) = elideMode(); break; case 6: *reinterpret_cast< bool*>(_v) = usesScrollButtons(); break; case 7: *reinterpret_cast< bool*>(_v) = tabsClosable(); break; case 8: *reinterpret_cast< SelectionBehavior*>(_v) = selectionBehaviorOnRemove(); break; case 9: *reinterpret_cast< bool*>(_v) = expanding(); break; case 10: *reinterpret_cast< bool*>(_v) = isMovable(); break; case 11: *reinterpret_cast< bool*>(_v) = documentMode(); break; } _id -= 12; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setShape(*reinterpret_cast< Shape*>(_v)); break; case 1: setCurrentIndex(*reinterpret_cast< int*>(_v)); break; case 3: setDrawBase(*reinterpret_cast< bool*>(_v)); break; case 4: setIconSize(*reinterpret_cast< QSize*>(_v)); break; case 5: setElideMode(*reinterpret_cast< Qt::TextElideMode*>(_v)); break; case 6: setUsesScrollButtons(*reinterpret_cast< bool*>(_v)); break; case 7: setTabsClosable(*reinterpret_cast< bool*>(_v)); break; case 8: setSelectionBehaviorOnRemove(*reinterpret_cast< SelectionBehavior*>(_v)); break; case 9: setExpanding(*reinterpret_cast< bool*>(_v)); break; case 10: setMovable(*reinterpret_cast< bool*>(_v)); break; case 11: setDocumentMode(*reinterpret_cast< bool*>(_v)); break; } _id -= 12; } else if (_c == QMetaObject::ResetProperty) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 12; } #endif // QT_NO_PROPERTIES return _id; }
void TreeCtrlTestCase::CollapseExpandEvents() { m_tree->CollapseAll(); EventCounter collapsed(m_tree, wxEVT_TREE_ITEM_COLLAPSED); EventCounter collapsing(m_tree, wxEVT_TREE_ITEM_COLLAPSING); EventCounter expanded(m_tree, wxEVT_TREE_ITEM_EXPANDED); EventCounter expanding(m_tree, wxEVT_TREE_ITEM_EXPANDING); wxUIActionSimulator sim; wxRect pos; m_tree->GetBoundingRect(m_root, pos, true); // We move in slightly so we are not on the edge wxPoint point = m_tree->ClientToScreen(pos.GetPosition()) + wxPoint(4, 4); sim.MouseMove(point); wxYield(); sim.MouseDblClick(); wxYield(); CPPUNIT_ASSERT_EQUAL(1, expanding.GetCount()); CPPUNIT_ASSERT_EQUAL(1, expanded.GetCount()); sim.MouseDblClick(); wxYield(); CPPUNIT_ASSERT_EQUAL(1, collapsing.GetCount()); CPPUNIT_ASSERT_EQUAL(1, collapsed.GetCount()); }
static boolean expand (kpathsea kpse, fn_type *expansion, const_string start, const_string end) { boolean ret = false; const_string value; unsigned len = end - start + 1; string var = (string)xmalloc (len + 1); strncpy (var, start, len); var[len] = 0; if (expanding_p (kpse, var)) { WARNING1 ("kpathsea: variable `%s' references itself (eventually)", var); } else { string vtry = concat3 (var, "_", kpse->program_name); /* Check for an environment variable. */ value = getenv (vtry); free (vtry); if (!value || !*value) value = getenv (var); /* If no envvar, check the config files. */ if (!value || !*value) value = kpathsea_cnf_get (kpse, var); if (value) { string tmp; ret = true; expanding (kpse, var, true); tmp = kpathsea_expand (kpse, value); expanding (kpse, var, false); fn_grow (expansion, tmp, strlen (tmp)); free (tmp); } } free (var); return ret; }
uint numCols) const #else QList<QRect> QwtDynGridLayout::layoutItems(const QRect &rect, uint numCols) const #endif { #if QT_VERSION < 0x040000 QValueList<QRect> itemGeometries; #else QList<QRect> itemGeometries; #endif if ( numCols == 0 || isEmpty() ) return itemGeometries; uint numRows = itemCount() / numCols; if ( numRows % itemCount() ) numRows++; QwtArray<int> rowHeight(numRows); QwtArray<int> colWidth(numCols); layoutGrid(numCols, rowHeight, colWidth); bool expandH, expandV; #if QT_VERSION >= 0x040000 expandH = expandingDirections() & Qt::Horizontal; expandV = expandingDirections() & Qt::Vertical; #else expandH = expanding() & QSizePolicy::Horizontally; expandV = expanding() & QSizePolicy::Vertically; #endif if ( expandH || expandV ) stretchGrid(rect, numCols, rowHeight, colWidth); QwtDynGridLayout *that = (QwtDynGridLayout *)this; const int maxCols = d_data->maxCols; that->d_data->maxCols = numCols; const QRect alignedRect = alignmentRect(rect); that->d_data->maxCols = maxCols; const int xOffset = expandH ? 0 : alignedRect.x(); const int yOffset = expandV ? 0 : alignedRect.y(); QwtArray<int> colX(numCols); QwtArray<int> rowY(numRows); const int xySpace = spacing(); rowY[0] = yOffset + margin(); for ( int r = 1; r < (int)numRows; r++ ) rowY[r] = rowY[r-1] + rowHeight[r-1] + xySpace; colX[0] = xOffset + margin(); for ( int c = 1; c < (int)numCols; c++ ) colX[c] = colX[c-1] + colWidth[c-1] + xySpace; const int itemCount = d_data->itemList.size(); for ( int i = 0; i < itemCount; i++ ) { const int row = i / numCols; const int col = i % numCols; QRect itemGeometry(colX[col], rowY[row], colWidth[col], rowHeight[row]); itemGeometries.append(itemGeometry); } return itemGeometries; }