2023-02-14 13:27:52 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class RpWindow;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Ui::Platform {
|
|
|
|
struct SeparateTitleControls;
|
|
|
|
} // namespace Ui::Platform
|
|
|
|
|
2023-02-24 07:43:02 +00:00
|
|
|
namespace Media::View {
|
|
|
|
|
|
|
|
inline constexpr auto kMaximizedIconOpacity = 0.6;
|
|
|
|
inline constexpr auto kNormalIconOpacity = 0.9;
|
2023-02-28 13:49:18 +00:00
|
|
|
inline constexpr auto kOverBackgroundOpacity = 0.2775;
|
2023-05-09 10:31:48 +00:00
|
|
|
inline constexpr auto kStoriesNavOpacity = 0.3;
|
|
|
|
inline constexpr auto kStoriesNavOverOpacity = 0.7;
|
2023-02-28 13:49:18 +00:00
|
|
|
[[nodiscard]] QColor OverBackgroundColor();
|
2023-02-24 07:43:02 +00:00
|
|
|
|
|
|
|
} // namespace Media::View
|
|
|
|
|
2023-02-14 13:27:52 +00:00
|
|
|
namespace Platform {
|
|
|
|
|
|
|
|
class OverlayWidgetHelper {
|
|
|
|
public:
|
|
|
|
virtual ~OverlayWidgetHelper() = default;
|
|
|
|
|
|
|
|
virtual void orderWidgets() {
|
|
|
|
}
|
|
|
|
[[nodiscard]] virtual bool skipTitleHitTest(QPoint position) {
|
|
|
|
return false;
|
|
|
|
}
|
2023-02-24 07:43:02 +00:00
|
|
|
[[nodiscard]] virtual rpl::producer<> controlsActivations() {
|
|
|
|
return rpl::never<>();
|
|
|
|
}
|
2023-03-13 11:58:10 +00:00
|
|
|
[[nodiscard]] virtual rpl::producer<bool> controlsSideRightValue() {
|
|
|
|
return rpl::single(true);
|
|
|
|
}
|
2023-02-14 13:27:52 +00:00
|
|
|
virtual void beforeShow(bool fullscreen) {
|
|
|
|
}
|
|
|
|
virtual void afterShow(bool fullscreen) {
|
|
|
|
}
|
|
|
|
virtual void notifyFileDialogShown(bool shown) {
|
|
|
|
}
|
2023-02-17 09:21:19 +00:00
|
|
|
virtual void minimize(not_null<Ui::RpWindow*> window);
|
2023-02-24 07:43:02 +00:00
|
|
|
virtual void clearState() {
|
|
|
|
}
|
|
|
|
virtual void setControlsOpacity(float64 opacity) {
|
|
|
|
}
|
2023-03-09 10:13:12 +00:00
|
|
|
[[nodiscard]] virtual auto mouseEvents() const
|
|
|
|
-> rpl::producer<not_null<QMouseEvent*>> {
|
|
|
|
return rpl::never<not_null<QMouseEvent*>>();
|
|
|
|
}
|
2023-07-25 08:30:52 +00:00
|
|
|
[[nodiscard]] virtual rpl::producer<int> topNotchSkipValue() {
|
|
|
|
return rpl::single(0);
|
|
|
|
}
|
2023-02-14 13:27:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
[[nodiscard]] std::unique_ptr<OverlayWidgetHelper> CreateOverlayWidgetHelper(
|
|
|
|
not_null<Ui::RpWindow*> window,
|
|
|
|
Fn<void(bool)> maximize);
|
|
|
|
|
|
|
|
class DefaultOverlayWidgetHelper final : public OverlayWidgetHelper {
|
|
|
|
public:
|
|
|
|
DefaultOverlayWidgetHelper(
|
|
|
|
not_null<Ui::RpWindow*> window,
|
|
|
|
Fn<void(bool)> maximize);
|
|
|
|
~DefaultOverlayWidgetHelper();
|
2023-02-17 09:21:19 +00:00
|
|
|
|
2023-02-14 13:27:52 +00:00
|
|
|
void orderWidgets() override;
|
|
|
|
bool skipTitleHitTest(QPoint position) override;
|
2023-02-24 07:43:02 +00:00
|
|
|
rpl::producer<> controlsActivations() override;
|
|
|
|
void beforeShow(bool fullscreen) override;
|
|
|
|
void clearState() override;
|
|
|
|
void setControlsOpacity(float64 opacity) override;
|
2023-03-13 11:58:10 +00:00
|
|
|
rpl::producer<bool> controlsSideRightValue() override;
|
2023-03-09 10:13:12 +00:00
|
|
|
rpl::producer<not_null<QMouseEvent*>> mouseEvents() const override;
|
2023-02-17 09:21:19 +00:00
|
|
|
|
2023-02-14 13:27:52 +00:00
|
|
|
private:
|
2023-02-24 07:43:02 +00:00
|
|
|
class Buttons;
|
|
|
|
|
|
|
|
const not_null<Buttons*> _buttons;
|
2023-02-14 13:27:52 +00:00
|
|
|
const std::unique_ptr<Ui::Platform::SeparateTitleControls> _controls;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Platform
|
|
|
|
|
|
|
|
// Platform dependent implementations.
|
|
|
|
|
2023-09-15 05:51:42 +00:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
#include "platform/win/overlay_widget_win.h"
|
|
|
|
#elif defined Q_OS_MAC // Q_OS_WIN
|
2023-02-14 13:27:52 +00:00
|
|
|
#include "platform/mac/overlay_widget_mac.h"
|
2023-09-15 05:51:42 +00:00
|
|
|
#else // Q_OS_WIN || Q_OS_MAC
|
2023-02-14 13:27:52 +00:00
|
|
|
#include "platform/linux/overlay_widget_linux.h"
|
2023-09-15 05:51:42 +00:00
|
|
|
#endif // else for Q_OS_WIN || Q_OS_MAC
|