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
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
// Custom shadows.
|
|
|
|
void shadowsActivate();
|
|
|
|
void shadowsDeactivate();
|
|
|
|
|
2021-01-16 12:33:09 +00:00
|
|
|
[[nodiscard]] bool hasTabletView() const;
|
|
|
|
|
2022-01-04 12:29:40 +00:00
|
|
|
void destroyedFromSystem();
|
|
|
|
|
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
|
|
|
|
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();
|
2023-01-09 13:12:37 +00:00
|
|
|
void updateTaskbarAndIconCounters();
|
2020-07-24 12:15:32 +00:00
|
|
|
void validateWindowTheme(bool native, bool night);
|
2022-01-04 12:29:40 +00:00
|
|
|
|
|
|
|
void forceIconRefresh();
|
|
|
|
void destroyCachedIcons();
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-01-16 12:33:09 +00:00
|
|
|
const std::unique_ptr<Private> _private;
|
2022-01-04 12:29:40 +00:00
|
|
|
const std::unique_ptr<QWindow> _taskbarHiderWindow;
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2022-01-04 12:29:40 +00:00
|
|
|
HWND _hWnd = nullptr;
|
|
|
|
HICON _iconBig = nullptr;
|
|
|
|
HICON _iconSmall = nullptr;
|
|
|
|
HICON _iconOverlay = nullptr;
|
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;
|
|
|
|
|
2022-01-04 12:29:40 +00:00
|
|
|
bool _hasActiveFrame = false;
|
2021-10-08 08:19:41 +00:00
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Platform
|