Changeset View
Changeset View
Standalone View
Standalone View
abstract_client.cpp
Show First 20 Lines • Show All 2003 Lines • ▼ Show 20 Line(s) | 2003 | { | |||
---|---|---|---|---|---|
2004 | return true; | 2004 | return true; | ||
2005 | } | 2005 | } | ||
2006 | 2006 | | |||
2007 | QMargins AbstractClient::frameMargins() const | 2007 | QMargins AbstractClient::frameMargins() const | ||
2008 | { | 2008 | { | ||
2009 | return QMargins(borderLeft(), borderTop(), borderRight(), borderBottom()); | 2009 | return QMargins(borderLeft(), borderTop(), borderRight(), borderBottom()); | ||
2010 | } | 2010 | } | ||
2011 | 2011 | | |||
2012 | QPoint AbstractClient::framePosToClientPos(const QPoint &point) const | ||||
2013 | { | ||||
2014 | return point + QPoint(borderLeft(), borderTop()); | ||||
2015 | } | ||||
2016 | | ||||
2017 | QPoint AbstractClient::clientPosToFramePos(const QPoint &point) const | ||||
2018 | { | ||||
2019 | return point - QPoint(borderLeft(), borderTop()); | ||||
2020 | } | ||||
2021 | | ||||
2022 | QSize AbstractClient::frameSizeToClientSize(const QSize &size) const | ||||
2023 | { | ||||
2024 | const int width = size.width() - borderLeft() - borderRight(); | ||||
2025 | const int height = size.height() - borderTop() - borderBottom(); | ||||
2026 | return QSize(width, height); | ||||
2027 | } | ||||
2028 | | ||||
2029 | QSize AbstractClient::clientSizeToFrameSize(const QSize &size) const | ||||
2030 | { | ||||
2031 | const int width = size.width() + borderLeft() + borderRight(); | ||||
2032 | const int height = size.height() + borderTop() + borderBottom(); | ||||
2033 | return QSize(width, height); | ||||
2034 | } | ||||
2035 | | ||||
2036 | QRect AbstractClient::frameRectToClientRect(const QRect &rect) const | ||||
2037 | { | ||||
2038 | const QPoint position = framePosToClientPos(rect.topLeft()); | ||||
2039 | const QSize size = frameSizeToClientSize(rect.size()); | ||||
2040 | return QRect(position, size); | ||||
2041 | } | ||||
2042 | | ||||
2043 | QRect AbstractClient::clientRectToFrameRect(const QRect &rect) const | ||||
2044 | { | ||||
2045 | const QPoint position = clientPosToFramePos(rect.topLeft()); | ||||
2046 | const QSize size = clientSizeToFrameSize(rect.size()); | ||||
2047 | return QRect(position, size); | ||||
2048 | } | ||||
2049 | | ||||
2012 | } | 2050 | } |