abstract_layout_item.cpp 994 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "layout/abstract_layout_item.h"
  8. AbstractLayoutItem::AbstractLayoutItem() {
  9. }
  10. int AbstractLayoutItem::maxWidth() const {
  11. return _maxw;
  12. }
  13. int AbstractLayoutItem::minHeight() const {
  14. return _minh;
  15. }
  16. int AbstractLayoutItem::resizeGetHeight(int width) {
  17. _width = qMin(width, _maxw);
  18. _height = _minh;
  19. return _height;
  20. }
  21. int AbstractLayoutItem::width() const {
  22. return _width;
  23. }
  24. int AbstractLayoutItem::height() const {
  25. return _height;
  26. }
  27. void AbstractLayoutItem::setPosition(int position) {
  28. _position = position;
  29. }
  30. int AbstractLayoutItem::position() const {
  31. return _position;
  32. }
  33. bool AbstractLayoutItem::hasPoint(QPoint point) const {
  34. return QRect(0, 0, width(), height()).contains(point);
  35. }
  36. AbstractLayoutItem::~AbstractLayoutItem() {
  37. }