2015-04-02 10:33:19 +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.
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2015-04-02 10:33:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "layerwidget.h"
|
|
|
|
|
2015-10-11 08:37:24 +00:00
|
|
|
class BlueTitleShadow : public TWidget {
|
|
|
|
public:
|
|
|
|
BlueTitleShadow(QWidget *parent) : TWidget(parent) {
|
|
|
|
}
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
};
|
|
|
|
|
|
|
|
class BlueTitleClose : public Button {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
BlueTitleClose(QWidget *parent);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onStateChange(int oldState, ButtonStateChangeSource source);
|
|
|
|
|
|
|
|
private:
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_over(float64 ms, bool timer);
|
2015-10-11 08:37:24 +00:00
|
|
|
anim::cvalue a_iconFg;
|
|
|
|
Animation _a_over;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
class AbstractBox : public LayerWidget {
|
2015-04-02 10:33:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-10-03 10:09:09 +00:00
|
|
|
AbstractBox(int32 w = st::boxWideWidth);
|
2016-08-16 16:53:10 +00:00
|
|
|
void parentResized() override;
|
|
|
|
void showDone() override {
|
|
|
|
showAll();
|
|
|
|
}
|
2015-10-11 08:37:24 +00:00
|
|
|
|
|
|
|
void setBlueTitle(bool blue);
|
|
|
|
void raiseShadow();
|
2016-04-21 17:57:29 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
public slots:
|
|
|
|
void onClose();
|
|
|
|
|
|
|
|
protected:
|
2016-08-16 16:53:10 +00:00
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
|
|
|
void prepare();
|
|
|
|
bool paint(QPainter &p);
|
2015-10-11 08:37:24 +00:00
|
|
|
void paintTitle(Painter &p, const QString &title, const QString &additional = QString());
|
2015-04-02 10:33:19 +00:00
|
|
|
void setMaxHeight(int32 maxHeight);
|
|
|
|
void resizeMaxHeight(int32 newWidth, int32 maxHeight);
|
|
|
|
|
|
|
|
virtual void closePressed() {
|
|
|
|
}
|
|
|
|
virtual void showAll() {
|
2015-10-11 08:37:24 +00:00
|
|
|
if (_blueClose) _blueClose->show();
|
|
|
|
if (_blueShadow) _blueShadow->show();
|
2015-04-02 10:33:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
int32 _maxHeight;
|
|
|
|
int32 countHeight() const;
|
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
bool _closed;
|
2015-10-11 08:37:24 +00:00
|
|
|
|
|
|
|
bool _blueTitle;
|
|
|
|
BlueTitleClose *_blueClose;
|
|
|
|
BlueTitleShadow *_blueShadow;
|
2016-08-16 16:53:10 +00:00
|
|
|
|
2015-10-11 08:37:24 +00:00
|
|
|
};
|
|
|
|
|
2015-10-17 08:31:48 +00:00
|
|
|
class ScrollableBoxShadow : public PlainShadow {
|
2015-10-11 08:37:24 +00:00
|
|
|
public:
|
2015-10-17 08:31:48 +00:00
|
|
|
ScrollableBoxShadow(QWidget *parent) : PlainShadow(parent, st::boxScrollShadowBg) {
|
2015-10-11 08:37:24 +00:00
|
|
|
}
|
2015-04-02 10:33:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ScrollableBox : public AbstractBox {
|
|
|
|
public:
|
2016-09-06 12:28:37 +00:00
|
|
|
ScrollableBox(const style::flatScroll &scroll, int w = st::boxWideWidth);
|
2016-04-21 17:57:29 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
protected:
|
2016-09-06 12:28:37 +00:00
|
|
|
void init(QWidget *inner, int bottomSkip = st::boxScrollSkip, int topSkip = st::boxTitleHeight);
|
|
|
|
void initOwned(QWidget *inner, int bottomSkip = st::boxScrollSkip, int topSkip = st::boxTitleHeight);
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-09-06 12:28:37 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2016-09-06 12:28:37 +00:00
|
|
|
ScrollArea *scrollArea() {
|
|
|
|
return _scroll;
|
|
|
|
}
|
2015-04-02 10:33:19 +00:00
|
|
|
|
|
|
|
private:
|
2016-09-06 12:28:37 +00:00
|
|
|
ChildWidget<ScrollArea> _scroll;
|
2015-04-02 10:33:19 +00:00
|
|
|
int32 _topSkip, _bottomSkip;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class ItemListBox : public ScrollableBox {
|
|
|
|
public:
|
2015-10-11 08:37:24 +00:00
|
|
|
ItemListBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth);
|
|
|
|
|
|
|
|
};
|
2015-04-02 10:33:19 +00:00
|
|
|
|
2015-10-11 08:37:24 +00:00
|
|
|
enum CreatingGroupType {
|
|
|
|
CreatingGroupNone,
|
|
|
|
CreatingGroupGroup,
|
|
|
|
CreatingGroupChannel,
|
2015-10-03 10:09:09 +00:00
|
|
|
};
|