2016-05-20 15:35:58 +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-05-20 15:35:58 +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-05-20 15:35:58 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-09-25 16:06:53 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2016-06-02 13:02:55 +00:00
|
|
|
|
2016-05-20 15:35:58 +00:00
|
|
|
namespace Profile {
|
|
|
|
|
2016-10-23 21:03:10 +00:00
|
|
|
class SectionMemento;
|
|
|
|
|
2021-07-15 11:12:38 +00:00
|
|
|
class BlockWidget : public Ui::RpWidget {
|
2016-05-20 15:35:58 +00:00
|
|
|
public:
|
|
|
|
BlockWidget(QWidget *parent, PeerData *peer, const QString &title);
|
|
|
|
|
2016-10-23 21:03:10 +00:00
|
|
|
virtual void showFinished() {
|
|
|
|
}
|
|
|
|
|
2017-08-17 08:31:24 +00:00
|
|
|
virtual void saveState(not_null<SectionMemento*> memento) {
|
2016-10-23 21:03:10 +00:00
|
|
|
}
|
2017-08-17 08:31:24 +00:00
|
|
|
virtual void restoreState(not_null<SectionMemento*> memento) {
|
2016-10-23 21:03:10 +00:00
|
|
|
}
|
|
|
|
|
2016-05-20 15:35:58 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
virtual void paintContents(Painter &p) {
|
|
|
|
}
|
|
|
|
|
2016-05-31 19:27:11 +00:00
|
|
|
// Where does the block content start (after the title).
|
|
|
|
int contentTop() const;
|
|
|
|
|
2016-05-20 15:35:58 +00:00
|
|
|
// Resizes content and counts natural widget height for the desired width.
|
2016-06-17 18:18:01 +00:00
|
|
|
int resizeGetHeight(int newWidth) override = 0;
|
2016-05-20 15:35:58 +00:00
|
|
|
|
2016-05-31 19:27:11 +00:00
|
|
|
void contentSizeUpdated() {
|
|
|
|
resizeToWidth(width());
|
|
|
|
}
|
|
|
|
|
2016-05-20 15:35:58 +00:00
|
|
|
PeerData *peer() const {
|
|
|
|
return _peer;
|
|
|
|
}
|
|
|
|
|
2016-06-17 18:18:01 +00:00
|
|
|
bool emptyTitle() const {
|
|
|
|
return _title.isEmpty();
|
|
|
|
}
|
|
|
|
|
2016-05-20 15:35:58 +00:00
|
|
|
private:
|
2016-06-17 18:18:01 +00:00
|
|
|
void paintTitle(Painter &p);
|
|
|
|
|
2016-05-20 15:35:58 +00:00
|
|
|
PeerData *_peer;
|
|
|
|
QString _title;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Profile
|