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
|
|
|
*/
|
|
|
|
#pragma once
|
2017-04-09 18:06:06 +00:00
|
|
|
|
2017-05-22 15:25:49 +00:00
|
|
|
#include "window/section_widget.h"
|
2017-09-16 16:53:41 +00:00
|
|
|
#include "window/section_memento.h"
|
2017-04-09 18:06:06 +00:00
|
|
|
|
|
|
|
namespace ChatHelpers {
|
|
|
|
|
|
|
|
class TabbedSelector;
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
class TabbedMemento : public Window::SectionMemento {
|
2017-04-09 18:06:06 +00:00
|
|
|
public:
|
2017-09-16 16:53:41 +00:00
|
|
|
TabbedMemento(
|
|
|
|
object_ptr<TabbedSelector> selector,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(object_ptr<TabbedSelector>)> returnMethod);
|
2017-09-20 10:23:57 +00:00
|
|
|
TabbedMemento(TabbedMemento &&other) = default;
|
|
|
|
TabbedMemento &operator=(TabbedMemento &&other) = default;
|
2017-09-16 16:53:41 +00:00
|
|
|
|
|
|
|
object_ptr<Window::SectionWidget> createWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::Controller*> controller,
|
|
|
|
Window::Column column,
|
|
|
|
const QRect &geometry) override;
|
|
|
|
|
|
|
|
~TabbedMemento();
|
|
|
|
|
|
|
|
private:
|
|
|
|
object_ptr<TabbedSelector> _selector;
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(object_ptr<TabbedSelector>)> _returnMethod;
|
2017-09-16 16:53:41 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class TabbedSection : public Window::SectionWidget {
|
|
|
|
public:
|
|
|
|
TabbedSection(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::Controller*> controller);
|
|
|
|
TabbedSection(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::Controller*> controller,
|
|
|
|
object_ptr<TabbedSelector> selector,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(object_ptr<TabbedSelector>)> returnMethod);
|
2017-04-09 18:06:06 +00:00
|
|
|
|
|
|
|
void beforeHiding();
|
|
|
|
void afterShown();
|
|
|
|
|
|
|
|
object_ptr<TabbedSelector> takeSelector();
|
|
|
|
QPointer<TabbedSelector> getSelector() const;
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
bool showInternal(
|
2017-10-03 13:05:58 +00:00
|
|
|
not_null<Window::SectionMemento*> memento,
|
|
|
|
const Window::SectionShow ¶ms) override;
|
2017-09-16 16:53:41 +00:00
|
|
|
bool forceAnimateBack() const override {
|
|
|
|
return true;
|
|
|
|
}
|
2017-05-22 15:25:49 +00:00
|
|
|
// Float player interface.
|
2017-09-16 16:53:41 +00:00
|
|
|
bool wheelEventFromFloatPlayer(QEvent *e) override;
|
|
|
|
QRect rectForFloatPlayer() const override;
|
|
|
|
|
|
|
|
~TabbedSection();
|
2017-05-22 15:25:49 +00:00
|
|
|
|
2017-04-09 18:06:06 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
void showFinishedHook() override {
|
|
|
|
afterShown();
|
|
|
|
}
|
|
|
|
|
2017-04-09 18:06:06 +00:00
|
|
|
private:
|
|
|
|
object_ptr<TabbedSelector> _selector;
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(object_ptr<TabbedSelector>)> _returnMethod;
|
2017-04-09 18:06:06 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ChatHelpers
|