2020-10-12 15:05:54 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
2020-10-20 18:31:47 +00:00
|
|
|
|
2020-10-12 15:05:54 +00:00
|
|
|
#include "ui/wrap/slide_wrap.h"
|
2020-10-20 18:31:47 +00:00
|
|
|
#include "base/object_ptr.h"
|
2020-10-12 15:05:54 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
|
|
|
struct MessageBarContent;
|
|
|
|
class MessageBar;
|
|
|
|
class IconButton;
|
|
|
|
class PlainShadow;
|
2020-10-20 18:31:47 +00:00
|
|
|
class RpWidget;
|
2020-10-12 15:05:54 +00:00
|
|
|
|
|
|
|
class PinnedBar final {
|
|
|
|
public:
|
|
|
|
PinnedBar(
|
|
|
|
not_null<QWidget*> parent,
|
2020-10-20 18:31:47 +00:00
|
|
|
rpl::producer<Ui::MessageBarContent> content);
|
2020-10-12 15:05:54 +00:00
|
|
|
~PinnedBar();
|
|
|
|
|
|
|
|
void show();
|
|
|
|
void hide();
|
|
|
|
void raise();
|
2020-10-13 07:16:16 +00:00
|
|
|
void finishAnimating();
|
|
|
|
|
|
|
|
void setShadowGeometryPostprocess(Fn<QRect(QRect)> postprocess);
|
2020-10-12 15:05:54 +00:00
|
|
|
|
2020-10-20 18:31:47 +00:00
|
|
|
void setRightButton(object_ptr<Ui::RpWidget> button);
|
|
|
|
|
2020-10-12 15:05:54 +00:00
|
|
|
void move(int x, int y);
|
|
|
|
void resizeToWidth(int width);
|
|
|
|
[[nodiscard]] int height() const;
|
|
|
|
[[nodiscard]] rpl::producer<int> heightValue() const;
|
|
|
|
[[nodiscard]] rpl::producer<> barClicks() const;
|
|
|
|
|
|
|
|
[[nodiscard]] rpl::lifetime &lifetime() {
|
|
|
|
return _wrap.lifetime();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void createControls();
|
2020-10-13 07:16:16 +00:00
|
|
|
void updateShadowGeometry(QRect wrapGeometry);
|
2020-10-20 18:31:47 +00:00
|
|
|
void updateControlsGeometry(QRect wrapGeometry);
|
2020-10-12 15:05:54 +00:00
|
|
|
|
|
|
|
Ui::SlideWrap<> _wrap;
|
|
|
|
std::unique_ptr<Ui::MessageBar> _bar;
|
2020-10-20 18:31:47 +00:00
|
|
|
object_ptr<Ui::RpWidget> _rightButton = { nullptr };
|
2020-10-12 15:05:54 +00:00
|
|
|
std::unique_ptr<Ui::PlainShadow> _shadow;
|
|
|
|
rpl::event_stream<> _barClicks;
|
2020-10-13 07:16:16 +00:00
|
|
|
Fn<QRect(QRect)> _shadowGeometryPostprocess;
|
2020-10-12 15:05:54 +00:00
|
|
|
bool _shouldBeShown = false;
|
|
|
|
bool _forceHidden = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Ui
|