MythPoint MythRect::topLeft(void) const { MythPoint point; point.setX(getX()); point.setY(getY()); return point; }
MythPoint XMLParseBase::parsePoint(const QString &text, bool normalize) { MythPoint retval; QStringList values = text.split(',', QString::SkipEmptyParts); if (values.size() == 2) retval = MythPoint(values[0], values[1]); if (normalize) retval.NormPoint(); return retval; }
/** * Update Y position of the screen * All children elements will be relocated. */ void MythNotificationScreen::AdjustYPosition(void) { MythPoint point = m_position; point.setY(m_position.getY().toInt() + (GetHeight() + HGAP) * m_index); if (point == GetPosition()) return; SetPosition(point); // We need to re-run init m_refresh = true; }
bool MythUIVirtualKeyboard::Create() { if (!LoadWindowFromXML("keyboard/keyboard.xml", "keyboard", this)) return false; BuildFocusList(); loadKeyDefinitions(gCoreContext->GetLanguageAndVariant()); updateKeys(true); int screenWidth, screenHeight; float xmult, ymult; GetMythUI()->GetScreenSettings(screenWidth, xmult, screenHeight, ymult); MythRect editArea = m_parentEdit->GetArea(); MythRect area = GetArea(); MythPoint newPos; //FIXME this assumes the edit is a direct child of the parent screen MythUIType *parentScreen = NULL; parentScreen = dynamic_cast<MythUIType *>(m_parentEdit->parent()); if (parentScreen) { editArea.moveTopLeft(QPoint(editArea.x() + parentScreen->GetArea().x(), editArea.y() + parentScreen->GetArea().y())); } switch (m_preferredPos) { case VK_POSABOVEEDIT: if (editArea.y() - area.height() - 5 > 0) { newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2, editArea.y() - area.height() - 5); } else { newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2, editArea.y() + editArea.height() + 5); } break; case VK_POSTOPDIALOG: newPos = QPoint(screenWidth / 2 - area.width() / 2, 5); break; case VK_POSBOTTOMDIALOG: newPos = QPoint(screenWidth / 2 - area.width() / 2, screenHeight - 5 - area.height()); break; case VK_POSCENTERDIALOG: newPos = QPoint(screenWidth / 2 - area.width() / 2, screenHeight / 2 - area.height() / 2); break; default: // VK_POSBELOWEDIT if (editArea.y() + editArea.height() + area.height() + 5 < screenHeight) { newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2, editArea.y() + editArea.height() + 5); } else { newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2, editArea.y() - area.height() - 5); } break; } // make sure the popup doesn't go off screen if (newPos.x() < 5) newPos.setX(5); if (newPos.x() + area.width() + 5 > screenWidth) newPos.setX(screenWidth - area.width() - 5); if (newPos.y() < 5) newPos.setY(5); if (newPos.y() + area.height() + 5 > screenHeight) newPos.setY(screenHeight - area.height() - 5); SetPosition(newPos); return true; }
void MythUIAnimation::parsePosition(const QDomElement& element, QVariant& startValue, QVariant& endValue, MythUIType *parent) { MythPoint start = parsePoint(element.attribute("start", "0,0"), false); MythPoint startN = parsePoint(element.attribute("start", "0,0")); MythPoint end = parsePoint(element.attribute("end", "0,0"), false); MythPoint endN = parsePoint(element.attribute("end", "0,0")); if (start.x() == -1) startN.setX(parent->GetArea().x()); if (start.y() == -1) startN.setY(parent->GetArea().y()); if (end.x() == -1) endN.setX(parent->GetArea().x()); if (end.y() == -1) endN.setY(parent->GetArea().y()); startN.CalculatePoint(parent->GetArea()); endN.CalculatePoint(parent->GetArea()); startValue = startN.toQPoint(); endValue = endN.toQPoint(); }
void MythRect::moveTopLeft(const MythPoint &point) { moveLeft(point.getX()); moveTop(point.getY()); }