void StackLayout::doRelayout()
{
	const List<DisplayItem *> &items = getItems();
	DisplayItem *inputField = items.getAt(0);
	int bottom;
	if (isItemVisible(inputField)) {
		setItemSize(inputField, getWidth(), font->getLineHeight());
		bottom = getHeight() - inputField->getHeight();
		setItemPosition(inputField, 0, bottom);
	}
	else {
		bottom = getHeight();
	}
	int i = 0;
	upperItemNr = 0;
	while (bottom > 0 && i + firstLevelVisible < stack->getLength()) {
		upperItemNr++;
		DisplayItem *item;
		if (items.getLength() <= upperItemNr) {
			item = stack->getAt(i + firstLevelVisible)->getDisplayItem(*font);
			addItem(item);
		}
		else {
			item = items.getAt(upperItemNr);
			if (item == NULL) {
				item = stack->getAt(i + firstLevelVisible)->getDisplayItem(*font);
				setItemAt(upperItemNr, item);
			}
		}
		if (item) {
			int nw = getNumberWidth(upperItemNr + firstLevelVisible);
			setItemSize(item, getWidth() - nw, -1);
			int h = item->getHeight();
			if (h < font->getLineHeight())
				h = font->getLineHeight();
			bottom -= h;
			int w = item->getWidth();
			if (w < getWidth() - nw)
				setItemPosition(item, getWidth() - w, bottom);
			else
				setItemPosition(item, nw, bottom);
		}
		else {
			bottom -= font->getLineHeight();
		}
		i++;
	}
	while (items.getLength() > upperItemNr + 1) {
		removeItemAt(upperItemNr + 1);
	}
	while (bottom > 0) {
		upperItemNr++;
		bottom -= font->getLineHeight();
	}
	upperItemScanStart = -bottom;
}
Esempio n. 2
0
void LoLEngine::updateObjectFlightPosition(FlyingObject *t) {
	if (t->objectType == 0) {
		setItemPosition(t->item, t->x, t->y, t->flyingHeight, (t->flyingHeight == 0) ? 1 : 0);
	} else if (t->objectType == 1) {
		if (t->flyingHeight == 0) {
			deleteItem(t->item);
			checkSceneUpdateNeed(calcBlockIndex(t->x, t->y));
		} else {
			setItemPosition(t->item, t->x, t->y, t->flyingHeight, 0);
		}
	}
}
Esempio n. 3
0
void LoLEngine::placeMoveLevelItem(Item itemIndex, int level, int block, int xOffs, int yOffs, int flyingHeight) {
	calcCoordinates(_itemsInPlay[itemIndex].x, _itemsInPlay[itemIndex].y, block, xOffs, yOffs);

	if (_itemsInPlay[itemIndex].block)
		removeLevelItem(itemIndex, _itemsInPlay[itemIndex].block);

	if (_currentLevel == level) {
		setItemPosition(itemIndex, _itemsInPlay[itemIndex].x, _itemsInPlay[itemIndex].y, flyingHeight, 1);
	} else {
		_itemsInPlay[itemIndex].level = level;
		_itemsInPlay[itemIndex].block = block;
		_itemsInPlay[itemIndex].flyingHeight = flyingHeight;
		_itemsInPlay[itemIndex].shpCurFrame_flg |= 0x4000;
	}
}
Esempio n. 4
0
void QgsComposerItem::setItemPosition( double x, double y, ItemPositionMode itemPoint, int page )
{
  double width = rect().width();
  double height = rect().height();
  setItemPosition( x, y, width, height, itemPoint, false, page );
}