/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "ui/wrap/wrap.h" namespace Ui { template class PaddingWrap; template <> class PaddingWrap : public Wrap { using Parent = Wrap; public: PaddingWrap( QWidget *parent, object_ptr &&child, const style::margins &padding); style::margins padding() const { return _padding; } void setPadding(const style::margins &padding); int naturalWidth() const override; protected: int resizeGetHeight(int newWidth) override; void wrappedSizeUpdated(QSize size) override; private: style::margins _padding; }; template class PaddingWrap : public Wrap> { using Parent = Wrap>; public: PaddingWrap( QWidget *parent, object_ptr &&child, const style::margins &padding) : Parent(parent, std::move(child), padding) { } }; template class CenterWrap; template <> class CenterWrap : public Wrap { using Parent = Wrap; public: CenterWrap( QWidget *parent, object_ptr &&child); int naturalWidth() const override; protected: int resizeGetHeight(int newWidth) override; void wrappedSizeUpdated(QSize size) override; private: void updateWrappedPosition(int forWidth); }; template class CenterWrap : public Wrap> { using Parent = Wrap>; public: CenterWrap( QWidget *parent, object_ptr &&child) : Parent(parent, std::move(child)) { } }; class FixedHeightWidget : public RpWidget { public: explicit FixedHeightWidget(QWidget *parent, int height = 0) : RpWidget(parent) { resize(width(), height); } }; inline object_ptr CreateSkipWidget( QWidget *parent, int skip) { return object_ptr( parent, skip); } } // namespace Ui