2016-10-08 18:28:43 +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-2016 John Preston, https://desktop.telegram.org
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
#include "window/window_title.h"
|
2016-10-08 18:28:43 +00:00
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
namespace Ui {
|
|
|
|
class IconButton;
|
2016-11-04 11:14:47 +00:00
|
|
|
class PlainShadow;
|
2016-11-04 08:23:50 +00:00
|
|
|
} // namespace Ui
|
2016-10-08 18:28:43 +00:00
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
namespace Window {
|
|
|
|
namespace Theme {
|
|
|
|
|
|
|
|
int DefaultPreviewTitleHeight();
|
|
|
|
void DefaultPreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth);
|
|
|
|
|
|
|
|
} // namespace Theme
|
|
|
|
} // namespace Window
|
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
namespace Platform {
|
|
|
|
|
|
|
|
class TitleWidget : public Window::TitleWidget, private base::Subscriber {
|
|
|
|
Q_OBJECT
|
2016-10-08 18:28:43 +00:00
|
|
|
|
|
|
|
public:
|
2016-11-04 08:23:50 +00:00
|
|
|
TitleWidget(QWidget *parent);
|
2016-10-08 18:28:43 +00:00
|
|
|
|
2016-11-07 15:24:28 +00:00
|
|
|
void init() override;
|
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
Window::HitTestResult hitTest(const QPoint &p) const override;
|
2016-10-08 18:28:43 +00:00
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
public slots:
|
|
|
|
void onWindowStateChanged(Qt::WindowState state = Qt::WindowNoState);
|
|
|
|
void updateControlsVisibility();
|
2016-10-08 18:28:43 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2016-11-04 08:23:50 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2016-10-08 18:28:43 +00:00
|
|
|
|
|
|
|
private:
|
2016-11-04 08:23:50 +00:00
|
|
|
void updateMaximizeRestoreButton();
|
|
|
|
void updateControlsPosition();
|
2016-10-08 18:28:43 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::IconButton> _minimize;
|
|
|
|
object_ptr<Ui::IconButton> _maximizeRestore;
|
|
|
|
object_ptr<Ui::IconButton> _close;
|
|
|
|
object_ptr<Ui::PlainShadow> _shadow;
|
2016-11-04 08:23:50 +00:00
|
|
|
|
|
|
|
bool _maximized = false;
|
2016-10-08 18:28:43 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
inline object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent) {
|
|
|
|
return object_ptr<TitleWidget>(parent);
|
2016-11-04 08:23:50 +00:00
|
|
|
}
|
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
inline int PreviewTitleHeight() {
|
|
|
|
return Window::Theme::DefaultPreviewTitleHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth) {
|
|
|
|
return Window::Theme::DefaultPreviewWindowFramePaint(preview, palette, body, outerWidth);
|
|
|
|
}
|
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
} // namespace Platform
|