-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Expand file tree
/
Copy pathtabbed_section.cpp
More file actions
80 lines (65 loc) · 1.97 KB
/
Copy pathtabbed_section.cpp
File metadata and controls
80 lines (65 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
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 "chat_helpers/tabbed_section.h"
#include "chat_helpers/tabbed_selector.h"
#include "ui/ui_utility.h"
#include "window/window_session_controller.h"
namespace ChatHelpers {
object_ptr<Window::SectionWidget> TabbedMemento::createWidget(
QWidget *parent,
not_null<Window::SessionController*> controller,
Window::Column column,
const QRect &geometry) {
auto result = object_ptr<TabbedSection>(parent, controller);
result->setGeometry(geometry);
return result;
}
TabbedSection::TabbedSection(
QWidget *parent,
not_null<Window::SessionController*> controller)
: Window::SectionWidget(parent, controller)
, _selector(controller->tabbedSelector()) {
if (Ui::InFocusChain(_selector)) {
parent->window()->setFocus();
}
_selector->setParent(this);
_selector->setRoundRadius(0);
_selector->setGeometry(rect());
_selector->showStarted();
_selector->show();
_selector->setAfterShownCallback(nullptr);
_selector->setBeforeHidingCallback(nullptr);
setAttribute(Qt::WA_OpaquePaintEvent, true);
}
void TabbedSection::beforeHiding() {
_selector->beforeHiding();
}
void TabbedSection::afterShown() {
_selector->afterShown();
}
void TabbedSection::resizeEvent(QResizeEvent *e) {
_selector->setGeometry(rect());
}
void TabbedSection::showFinishedHook() {
afterShown();
}
bool TabbedSection::showInternal(
not_null<Window::SectionMemento*> memento,
const Window::SectionShow ¶ms) {
return false;
}
bool TabbedSection::floatPlayerHandleWheelEvent(QEvent *e) {
return _selector->floatPlayerHandleWheelEvent(e);
}
QRect TabbedSection::floatPlayerAvailableRect() {
return _selector->floatPlayerAvailableRect();
}
TabbedSection::~TabbedSection() {
beforeHiding();
controller()->takeTabbedSelectorOwnershipFrom(this);
}
} // namespace ChatHelpers