2017-04-08 15:20:12 +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.
|
2017-04-08 15:20:12 +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
|
2017-04-08 15:20:12 +00:00
|
|
|
*/
|
|
|
|
#include "chat_helpers/tabbed_section.h"
|
|
|
|
|
2017-04-09 18:06:06 +00:00
|
|
|
#include "chat_helpers/tabbed_selector.h"
|
2019-08-16 12:44:20 +00:00
|
|
|
#include "window/window_session_controller.h"
|
|
|
|
#include "styles/style_chat_helpers.h"
|
2017-04-09 18:06:06 +00:00
|
|
|
|
|
|
|
namespace ChatHelpers {
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
object_ptr<Window::SectionWidget> TabbedMemento::createWidget(
|
|
|
|
QWidget *parent,
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2017-09-16 16:53:41 +00:00
|
|
|
Window::Column column,
|
|
|
|
const QRect &geometry) {
|
2019-08-16 12:44:20 +00:00
|
|
|
auto result = object_ptr<TabbedSection>(parent, controller);
|
2017-11-12 09:54:18 +00:00
|
|
|
result->setGeometry(geometry);
|
2019-11-12 15:15:34 +00:00
|
|
|
return result;
|
2017-09-16 16:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TabbedSection::TabbedSection(
|
|
|
|
QWidget *parent,
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller)
|
2017-09-16 16:53:41 +00:00
|
|
|
: Window::SectionWidget(parent, controller)
|
2019-08-16 12:44:20 +00:00
|
|
|
, _selector(controller->tabbedSelector()) {
|
2017-04-09 18:06:06 +00:00
|
|
|
_selector->setParent(this);
|
|
|
|
_selector->setRoundRadius(0);
|
|
|
|
_selector->setGeometry(rect());
|
|
|
|
_selector->showStarted();
|
|
|
|
_selector->show();
|
2018-11-21 18:14:48 +00:00
|
|
|
_selector->setAfterShownCallback(nullptr);
|
|
|
|
_selector->setBeforeHidingCallback(nullptr);
|
2017-04-09 18:06:06 +00:00
|
|
|
|
|
|
|
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabbedSection::beforeHiding() {
|
|
|
|
_selector->beforeHiding();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabbedSection::afterShown() {
|
|
|
|
_selector->afterShown();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabbedSection::resizeEvent(QResizeEvent *e) {
|
|
|
|
_selector->setGeometry(rect());
|
|
|
|
}
|
|
|
|
|
2019-12-09 06:37:02 +00:00
|
|
|
void TabbedSection::showFinishedHook() {
|
|
|
|
afterShown();
|
|
|
|
}
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
bool TabbedSection::showInternal(
|
2017-10-03 13:05:58 +00:00
|
|
|
not_null<Window::SectionMemento*> memento,
|
|
|
|
const Window::SectionShow ¶ms) {
|
2017-09-16 16:53:41 +00:00
|
|
|
return false;
|
2017-04-09 18:06:06 +00:00
|
|
|
}
|
|
|
|
|
2020-06-25 14:17:37 +00:00
|
|
|
bool TabbedSection::floatPlayerHandleWheelEvent(QEvent *e) {
|
|
|
|
return _selector->floatPlayerHandleWheelEvent(e);
|
2017-05-22 15:25:49 +00:00
|
|
|
}
|
|
|
|
|
2020-06-25 14:17:37 +00:00
|
|
|
QRect TabbedSection::floatPlayerAvailableRect() {
|
|
|
|
return _selector->floatPlayerAvailableRect();
|
2017-05-22 15:25:49 +00:00
|
|
|
}
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
TabbedSection::~TabbedSection() {
|
|
|
|
beforeHiding();
|
2019-08-16 12:44:20 +00:00
|
|
|
controller()->takeTabbedSelectorOwnershipFrom(this);
|
2017-09-16 16:53:41 +00:00
|
|
|
}
|
|
|
|
|
2017-04-09 18:06:06 +00:00
|
|
|
} // namespace ChatHelpers
|