File indexing completed on 2024-05-19 05:32:27

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2022 Marco Martin <mart@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "tile.h"
0013 
0014 #include <kwin_export.h>
0015 
0016 namespace KWin
0017 {
0018 
0019 class KWIN_EXPORT CustomTile : public Tile
0020 {
0021     Q_OBJECT
0022     Q_PROPERTY(KWin::Tile::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
0023 
0024 public:
0025     CustomTile(TileManager *tiling, CustomTile *parentItem = nullptr);
0026 
0027     CustomTile *createChildAt(const QRectF &relativeGeometry, LayoutDirection direction, int position);
0028 
0029     void setRelativeGeometry(const QRectF &geom) override;
0030     bool supportsResizeGravity(KWin::Gravity gravity) override;
0031 
0032     /**
0033      * move a floating tile by an amount of pixels. not supported on horizontal and vertical layouts
0034      */
0035     Q_INVOKABLE void moveByPixels(const QPointF &delta);
0036     Q_INVOKABLE void remove();
0037     Q_INVOKABLE void split(KWin::Tile::LayoutDirection newDirection);
0038 
0039     void setLayoutDirection(Tile::LayoutDirection dir);
0040     // Own direction
0041     Tile::LayoutDirection layoutDirection() const;
0042 
0043     CustomTile *nextTileAt(Qt::Edge edge) const;
0044 
0045 Q_SIGNALS:
0046     void layoutDirectionChanged(Tile::LayoutDirection direction);
0047     void layoutModified();
0048 
0049 private:
0050     Tile::LayoutDirection m_layoutDirection = LayoutDirection::Floating;
0051     bool m_geometryLock = false;
0052 };
0053 
0054 class RootTile : public CustomTile
0055 {
0056     Q_OBJECT
0057 public:
0058     RootTile(TileManager *tiling);
0059 };
0060 
0061 KWIN_EXPORT QDebug operator<<(QDebug debug, const CustomTile *tile);
0062 
0063 } // namespace KWin