mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-10 08:51:12 +00:00
Fix build on Windows.
This commit is contained in:
parent
467be135d6
commit
92d48a7846
@ -192,7 +192,7 @@ public:
|
||||
max_w = avail.width();
|
||||
accumulate_max(max_w, st::windowMinWidth);
|
||||
max_h = avail.height();
|
||||
accumulate_max(max_h, st::titleHeight + st::windowMinHeight);
|
||||
accumulate_max(max_h, st::defaultWindowTitle.height + st::windowMinHeight);
|
||||
|
||||
HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0);
|
||||
HWND hwnd = _window ? _window->psHwnd() : nullptr;
|
||||
|
@ -15,10 +15,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace Platform {
|
||||
|
||||
TitleWidget::TitleWidget(QWidget *parent) : Window::TitleWidget(parent)
|
||||
, _minimize(this, st::titleButtonMinimize)
|
||||
, _maximizeRestore(this, st::titleButtonMaximize)
|
||||
, _close(this, st::titleButtonClose)
|
||||
TitleWidget::TitleWidget(QWidget *parent)
|
||||
: Window::TitleWidget(parent)
|
||||
, _st(st::defaultWindowTitle)
|
||||
, _minimize(this, _st.minimize)
|
||||
, _maximizeRestore(this, _st.maximize)
|
||||
, _close(this, _st.close)
|
||||
, _shadow(this, st::titleShadow)
|
||||
, _maximizedState(parent->window()->windowState() & Qt::WindowMaximized) {
|
||||
_minimize->setClickedCallback([this]() {
|
||||
@ -38,7 +40,7 @@ TitleWidget::TitleWidget(QWidget *parent) : Window::TitleWidget(parent)
|
||||
_close->setPointerCursor(false);
|
||||
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
resize(width(), st::titleHeight);
|
||||
resize(width(), _st.height);
|
||||
}
|
||||
|
||||
void TitleWidget::init() {
|
||||
@ -54,7 +56,7 @@ void TitleWidget::paintEvent(QPaintEvent *e) {
|
||||
_activeState = active;
|
||||
updateButtonsState();
|
||||
}
|
||||
Painter(this).fillRect(rect(), active ? st::titleBgActive : st::titleBg);
|
||||
Painter(this).fillRect(rect(), active ? _st.bgActive : _st.bg);
|
||||
}
|
||||
|
||||
void TitleWidget::updateControlsPosition() {
|
||||
@ -85,13 +87,33 @@ void TitleWidget::onWindowStateChanged(Qt::WindowState state) {
|
||||
}
|
||||
|
||||
void TitleWidget::updateButtonsState() {
|
||||
_minimize->setIconOverride(_activeState ? &st::titleButtonMinimizeIconActive : nullptr, _activeState ? &st::titleButtonMinimizeIconActiveOver : nullptr);
|
||||
_minimize->setIconOverride(_activeState
|
||||
? &_st.minimizeIconActive
|
||||
: nullptr,
|
||||
_activeState
|
||||
? &_st.minimizeIconActiveOver
|
||||
: nullptr);
|
||||
if (_maximizedState) {
|
||||
_maximizeRestore->setIconOverride(_activeState ? &st::titleButtonRestoreIconActive : &st::titleButtonRestoreIcon, _activeState ? &st::titleButtonRestoreIconActiveOver : &st::titleButtonRestoreIconOver);
|
||||
_maximizeRestore->setIconOverride(
|
||||
_activeState
|
||||
? &_st.restoreIconActive : &_st.restoreIcon,
|
||||
_activeState
|
||||
? &_st.restoreIconActiveOver
|
||||
: &_st.restoreIconOver);
|
||||
} else {
|
||||
_maximizeRestore->setIconOverride(_activeState ? &st::titleButtonMaximizeIconActive : nullptr, _activeState ? &st::titleButtonMaximizeIconActiveOver : nullptr);
|
||||
_maximizeRestore->setIconOverride(_activeState
|
||||
? &_st.maximizeIconActive
|
||||
: nullptr,
|
||||
_activeState
|
||||
? &_st.maximizeIconActiveOver
|
||||
: nullptr);
|
||||
}
|
||||
_close->setIconOverride(_activeState ? &st::titleButtonCloseIconActive : nullptr, _activeState ? &st::titleButtonCloseIconActiveOver : nullptr);
|
||||
_close->setIconOverride(_activeState
|
||||
? &_st.closeIconActive
|
||||
: nullptr,
|
||||
_activeState
|
||||
? &_st.closeIconActiveOver
|
||||
: nullptr);
|
||||
}
|
||||
|
||||
Window::HitTestResult TitleWidget::hitTest(const QPoint &p) const {
|
||||
|
@ -10,6 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/platform_window_title.h"
|
||||
#include "base/object_ptr.h"
|
||||
|
||||
namespace style {
|
||||
struct WindowTitle;
|
||||
} // namespace style
|
||||
|
||||
namespace Ui {
|
||||
class IconButton;
|
||||
class PlainShadow;
|
||||
@ -48,6 +52,7 @@ private:
|
||||
void updateButtonsState();
|
||||
void updateControlsPosition();
|
||||
|
||||
const style::WindowTitle &_st;
|
||||
object_ptr<Ui::IconButton> _minimize;
|
||||
object_ptr<Ui::IconButton> _maximizeRestore;
|
||||
object_ptr<Ui::IconButton> _close;
|
||||
|
Loading…
Reference in New Issue
Block a user