File indexing completed on 2024-05-19 05:13:45

0001 /*
0002   SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0005 */
0006 
0007 #pragma once
0008 
0009 #include "calendarsupport_export.h"
0010 #include <QList>
0011 
0012 namespace CalendarSupport
0013 {
0014 class CALENDARSUPPORT_EXPORT CellItem
0015 {
0016 public:
0017     CellItem() = default;
0018 
0019     virtual ~CellItem() = default;
0020 
0021     void setSubCells(int v);
0022     [[nodiscard]] int subCells() const;
0023 
0024     void setSubCell(int v);
0025     [[nodiscard]] int subCell() const;
0026 
0027     virtual bool overlaps(CellItem *other) const = 0;
0028 
0029     [[nodiscard]] virtual QString label() const;
0030 
0031     /**
0032       Place item @p placeItem into stripe containing items @p cells in a
0033       way that items don't overlap.
0034       @param cells The list of other cell items to be laid out parallel to the placeItem.
0035       @param placeItem The item to be laid out.
0036 
0037       @return Placed items
0038     */
0039     static QList<CellItem *> placeItem(const QList<CellItem *> &cells, CellItem *placeItem);
0040 
0041 private:
0042     int mSubCells = 0;
0043     int mSubCell = -1;
0044 };
0045 }