2016-04-12 21:31:28 +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
|
|
|
|
|
|
|
|
#include "ui/twidget.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class PeerAvatarButton;
|
2016-06-07 19:59:39 +00:00
|
|
|
class RoundButton;
|
2016-04-12 21:31:28 +00:00
|
|
|
} // namespace Ui
|
|
|
|
class IconedButton;
|
|
|
|
|
|
|
|
namespace Window {
|
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
class TopBarWidget : public TWidget, private base::Subscriber {
|
2016-04-12 21:31:28 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
TopBarWidget(MainWidget *w);
|
|
|
|
|
|
|
|
void enterEvent(QEvent *e) override;
|
2016-06-17 18:18:01 +00:00
|
|
|
void enterFromChildEvent(QEvent *e, QWidget *child) override;
|
2016-04-12 21:31:28 +00:00
|
|
|
void leaveEvent(QEvent *e) override;
|
2016-06-17 18:18:01 +00:00
|
|
|
void leaveToChildEvent(QEvent *e, QWidget *child) override;
|
2016-04-12 21:31:28 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
|
|
|
void step_appearance(float64 ms, bool timer);
|
|
|
|
|
|
|
|
void startAnim();
|
|
|
|
void stopAnim();
|
|
|
|
void showAll();
|
|
|
|
void showSelected(uint32 selCount, bool canDelete = false);
|
|
|
|
|
2016-06-17 18:18:01 +00:00
|
|
|
void updateMembersShowArea();
|
|
|
|
|
2016-06-07 19:59:39 +00:00
|
|
|
Ui::RoundButton *mediaTypeButton();
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2016-06-17 18:18:01 +00:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *e) override;
|
|
|
|
|
2016-05-14 16:57:06 +00:00
|
|
|
public slots:
|
2016-04-12 21:31:28 +00:00
|
|
|
void onForwardSelection();
|
|
|
|
void onDeleteSelection();
|
|
|
|
void onClearSelection();
|
|
|
|
void onInfoClicked();
|
|
|
|
void onSearch();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void clicked();
|
|
|
|
|
|
|
|
private:
|
2016-08-27 04:49:18 +00:00
|
|
|
void updateAdaptiveLayout();
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
MainWidget *main();
|
2016-06-22 17:11:35 +00:00
|
|
|
anim::fvalue a_over = { 0. };
|
2016-04-12 21:31:28 +00:00
|
|
|
Animation _a_appearance;
|
|
|
|
|
|
|
|
PeerData *_selPeer = nullptr;
|
2016-06-22 17:11:35 +00:00
|
|
|
int _selCount = 0;
|
|
|
|
bool _canDelete = false;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2016-06-22 17:11:35 +00:00
|
|
|
bool _animating = false;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2016-06-07 19:59:39 +00:00
|
|
|
ChildWidget<Ui::RoundButton> _clearSelection;
|
2016-06-22 17:11:35 +00:00
|
|
|
ChildWidget<Ui::RoundButton> _forward, _delete;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
ChildWidget<Ui::PeerAvatarButton> _info;
|
2016-06-07 19:59:39 +00:00
|
|
|
ChildWidget<Ui::RoundButton> _mediaType;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
ChildWidget<IconedButton> _search;
|
2016-06-17 18:18:01 +00:00
|
|
|
ChildWidget<TWidget> _membersShowArea = { nullptr };
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Window
|