2017-04-08 15:20:12 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
|
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|
|
|
*/
|
|
|
|
#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,
|
|
|
|
base::lambda<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;
|
|
|
|
base::lambda<void(object_ptr<TabbedSelector>)> _returnMethod;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
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,
|
|
|
|
base::lambda<void(object_ptr<TabbedSelector>)> returnMethod);
|
2017-04-09 18:06:06 +00:00
|
|
|
|
|
|
|
void beforeHiding();
|
|
|
|
void afterShown();
|
|
|
|
void setCancelledCallback(base::lambda<void()> callback) {
|
|
|
|
_cancelledCallback = std::move(callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
base::lambda<void()> _cancelledCallback;
|
2017-09-16 16:53:41 +00:00
|
|
|
base::lambda<void(object_ptr<TabbedSelector>)> _returnMethod;
|
2017-04-09 18:06:06 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ChatHelpers
|