2016-06-16 12:59:54 +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.
|
2016-06-16 12:59:54 +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
|
2016-06-16 12:59:54 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-02-28 10:51:00 +00:00
|
|
|
#include "platform/platform_main_window.h"
|
2019-09-26 10:20:34 +00:00
|
|
|
#include "base/platform/win/base_windows_h.h"
|
2017-08-31 16:28:58 +00:00
|
|
|
#include "base/flags.h"
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2016-10-26 16:43:13 +00:00
|
|
|
namespace Ui {
|
2016-10-01 13:15:27 +00:00
|
|
|
class PopupMenu;
|
2016-10-26 16:43:13 +00:00
|
|
|
} // namespace Ui
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
namespace Platform {
|
|
|
|
|
|
|
|
class MainWindow : public Window::MainWindow {
|
|
|
|
public:
|
2019-06-06 11:20:21 +00:00
|
|
|
explicit MainWindow(not_null<Window::Controller*> controller);
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-01-22 12:16:18 +00:00
|
|
|
void showFromTrayMenu() override;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
HWND psHwnd() const;
|
2020-07-07 13:54:39 +00:00
|
|
|
|
|
|
|
void updateWindowIcon() override;
|
2021-01-22 12:16:18 +00:00
|
|
|
bool isActiveForTrayMenu() override;
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
void psRefreshTaskbarIcon();
|
|
|
|
|
2021-01-16 12:33:09 +00:00
|
|
|
[[nodiscard]] static uint32 TaskbarCreatedMsgId();
|
2016-06-16 12:59:54 +00:00
|
|
|
static void TaskbarCreated();
|
|
|
|
|
|
|
|
// Custom shadows.
|
|
|
|
void shadowsActivate();
|
|
|
|
void shadowsDeactivate();
|
|
|
|
|
2021-01-16 12:33:09 +00:00
|
|
|
[[nodiscard]] bool hasTabletView() const;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
void psShowTrayMenu();
|
|
|
|
|
2020-08-28 16:14:19 +00:00
|
|
|
~MainWindow();
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
protected:
|
2016-11-04 11:14:47 +00:00
|
|
|
void initHook() override;
|
|
|
|
int32 screenNameChecksum(const QString &name) const override;
|
2016-11-09 08:34:38 +00:00
|
|
|
void unreadCounterChangedHook() override;
|
2016-11-04 11:14:47 +00:00
|
|
|
|
2017-01-01 16:45:20 +00:00
|
|
|
bool hasTrayIcon() const override {
|
2016-06-16 12:59:54 +00:00
|
|
|
return trayIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
QSystemTrayIcon *trayIcon = nullptr;
|
2016-10-26 16:43:13 +00:00
|
|
|
Ui::PopupMenu *trayIconMenu = nullptr;
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
void psTrayMenuUpdated();
|
|
|
|
void psSetupTrayIcon();
|
|
|
|
|
2017-01-01 16:45:20 +00:00
|
|
|
void showTrayTooltip() override;
|
|
|
|
|
2021-05-27 22:11:16 +00:00
|
|
|
void workmodeUpdated(Core::Settings::WorkMode mode) override;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
2021-08-10 12:41:25 +00:00
|
|
|
bool initGeometryFromSystem() override;
|
2021-01-16 12:33:09 +00:00
|
|
|
|
2021-02-25 15:12:51 +00:00
|
|
|
QRect computeDesktopRect() const override;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
private:
|
2021-01-16 12:33:09 +00:00
|
|
|
struct Private;
|
|
|
|
|
2020-07-24 12:15:32 +00:00
|
|
|
void setupNativeWindowFrame();
|
2016-11-09 08:34:38 +00:00
|
|
|
void updateIconCounters();
|
2020-07-24 12:15:32 +00:00
|
|
|
void validateWindowTheme(bool native, bool night);
|
2016-06-16 12:59:54 +00:00
|
|
|
void psDestroyIcons();
|
|
|
|
|
2021-01-16 12:33:09 +00:00
|
|
|
const std::unique_ptr<Private> _private;
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2020-07-24 12:15:32 +00:00
|
|
|
bool _hasActiveFrame = false;
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-01-22 12:16:18 +00:00
|
|
|
// Workarounds for activation from tray icon.
|
|
|
|
crl::time _lastDeactivateTime = 0;
|
|
|
|
rpl::lifetime _showFromTrayLifetime;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
HWND ps_hWnd = nullptr;
|
|
|
|
HICON ps_iconBig = nullptr;
|
|
|
|
HICON ps_iconSmall = nullptr;
|
|
|
|
HICON ps_iconOverlay = nullptr;
|
|
|
|
|
2021-10-08 08:19:41 +00:00
|
|
|
const std::unique_ptr<QWindow> _taskbarHiderWindow;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Platform
|