Allow SeparatePanel not to join all spaces.

This commit is contained in:
John Preston 2022-08-04 19:27:45 +03:00
parent dcb4a33eef
commit 9b5c58f92f
2 changed files with 14 additions and 7 deletions

View file

@ -89,8 +89,8 @@ PanelShow::operator bool() const {
} // namespace } // namespace
SeparatePanel::SeparatePanel(QWidget *parent) SeparatePanel::SeparatePanel(SeparatePanelArgs &&args)
: RpWidget(parent) : RpWidget(args.parent)
, _close(this, st::separatePanelClose) , _close(this, st::separatePanelClose)
, _back(this, object_ptr<Ui::IconButton>(this, st::separatePanelBack)) , _back(this, object_ptr<Ui::IconButton>(this, st::separatePanelBack))
, _body(this) , _body(this)
@ -98,7 +98,7 @@ SeparatePanel::SeparatePanel(QWidget *parent)
setMouseTracking(true); setMouseTracking(true);
setWindowIcon(QGuiApplication::windowIcon()); setWindowIcon(QGuiApplication::windowIcon());
initControls(); initControls();
initLayout(); initLayout(args);
} }
void SeparatePanel::setTitle(rpl::producer<QString> title) { void SeparatePanel::setTitle(rpl::producer<QString> title) {
@ -280,7 +280,7 @@ bool SeparatePanel::eventHook(QEvent *e) {
return RpWidget::eventHook(e); return RpWidget::eventHook(e);
} }
void SeparatePanel::initLayout() { void SeparatePanel::initLayout(const SeparatePanelArgs &args) {
setWindowFlags(Qt::WindowFlags(Qt::FramelessWindowHint) setWindowFlags(Qt::WindowFlags(Qt::FramelessWindowHint)
| Qt::WindowStaysOnTopHint | Qt::WindowStaysOnTopHint
| Qt::NoDropShadowWindowHint | Qt::NoDropShadowWindowHint
@ -296,7 +296,9 @@ void SeparatePanel::initLayout() {
Ui::ForceFullRepaint(this); Ui::ForceFullRepaint(this);
}, lifetime()); }, lifetime());
Ui::Platform::InitOnTopPanel(this); if (args.onAllSpaces) {
Ui::Platform::InitOnTopPanel(this);
}
} }
void SeparatePanel::createBorderImage() { void SeparatePanel::createBorderImage() {

View file

@ -29,9 +29,14 @@ class FlatLabel;
template <typename Widget> template <typename Widget>
class FadeWrapScaled; class FadeWrapScaled;
struct SeparatePanelArgs {
QWidget *parent = nullptr;
bool onAllSpaces = false;
};
class SeparatePanel final : public RpWidget { class SeparatePanel final : public RpWidget {
public: public:
explicit SeparatePanel(QWidget *parent = nullptr); explicit SeparatePanel(SeparatePanelArgs &&args = {});
void setTitle(rpl::producer<QString> title); void setTitle(rpl::producer<QString> title);
void setTitleHeight(int height); void setTitleHeight(int height);
@ -73,7 +78,7 @@ protected:
private: private:
void initControls(); void initControls();
void initLayout(); void initLayout(const SeparatePanelArgs &args);
void initGeometry(QSize size); void initGeometry(QSize size);
void updateGeometry(QSize size); void updateGeometry(QSize size);
void showControls(); void showControls();