2016-08-17 15:14:08 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-08-17 15:14:08 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-08-17 15:14:08 +00:00
|
|
|
*/
|
|
|
|
#include "settings/settings_fixed_bar.h"
|
|
|
|
|
|
|
|
#include "styles/style_settings.h"
|
2016-10-31 12:29:26 +00:00
|
|
|
#include "styles/style_boxes.h"
|
2016-08-17 15:14:08 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
FixedBar::FixedBar(QWidget *parent) : TWidget(parent) {
|
2016-10-31 12:29:26 +00:00
|
|
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
2016-08-17 15:14:08 +00:00
|
|
|
}
|
|
|
|
|
2017-02-03 20:07:26 +00:00
|
|
|
void FixedBar::setText(const QString &text) {
|
|
|
|
_text = text;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2016-08-22 17:16:21 +00:00
|
|
|
int FixedBar::resizeGetHeight(int newWidth) {
|
2016-12-13 17:07:56 +00:00
|
|
|
return st::settingsFixedBarHeight - st::boxRadius;
|
2016-08-17 15:14:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FixedBar::paintEvent(QPaintEvent *e) {
|
|
|
|
Painter p(this);
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
p.fillRect(e->rect(), st::boxBg);
|
2016-10-31 12:29:26 +00:00
|
|
|
|
2016-08-17 15:14:08 +00:00
|
|
|
p.setFont(st::settingsFixedBarFont);
|
2016-11-16 10:44:06 +00:00
|
|
|
p.setPen(st::windowFg);
|
2017-02-03 20:07:26 +00:00
|
|
|
p.drawTextLeft(st::settingsFixedBarTextPosition.x(), st::settingsFixedBarTextPosition.y() - st::boxRadius, width(), _text);
|
2016-08-17 15:14:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Settings
|