Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
/*
|
|
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
|
|
*/
|
|
#include "info/userpic/info_userpic_emoji_builder_layer.h"
|
|
|
|
#include "styles/style_info.h"
|
|
#include "styles/style_info_userpic_builder.h"
|
|
#include "styles/style_layers.h"
|
|
|
|
namespace UserpicBuilder {
|
|
|
|
LayerWidget::LayerWidget()
|
|
: _corners(Ui::PrepareCornerPixmaps(st::boxRadius, st::boxDividerBg)) {
|
|
}
|
|
|
|
void LayerWidget::setContent(not_null<Ui::RpWidget*> content) {
|
|
_content = content;
|
|
}
|
|
|
|
void LayerWidget::parentResized() {
|
|
Expects(_content != nullptr);
|
|
const auto parentSize = parentWidget()->size();
|
|
const auto currentHeight = resizeGetHeight(0);
|
|
const auto currentWidth = _content->width();
|
|
resizeToWidth(currentWidth);
|
|
moveToLeft(
|
|
(parentSize.width() - currentWidth) / 2,
|
|
(parentSize.height() - currentHeight) / 2);
|
|
}
|
|
|
|
bool LayerWidget::closeByOutsideClick() const {
|
|
return false;
|
|
}
|
|
|
|
int LayerWidget::resizeGetHeight(int newWidth) {
|
|
Expects(_content != nullptr);
|
|
_content->resizeToWidth(st::infoDesiredWidth);
|
|
return st::userpicBuilderEmojiLayerMinHeight;
|
|
}
|
|
|
|
void LayerWidget::paintEvent(QPaintEvent *e) {
|
|
auto p = QPainter(this);
|
|
|
|
Ui::FillRoundRect(p, rect(), st::boxDividerBg, _corners);
|
|
}
|
|
|
|
} // namespace UserpicBuilder
|