File indexing completed on 2024-05-05 03:49:47

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
0004 //
0005 
0006 #ifndef MARBLE_MARBLEGRAPHICSGRIDLAYOUT_H
0007 #define MARBLE_MARBLEGRAPHICSGRIDLAYOUT_H
0008 
0009 // Marble
0010 #include "AbstractMarbleGraphicsLayout.h"
0011 #include "marble_export.h"
0012 
0013 #include <Qt> // for Qt::Alignment
0014 
0015 namespace Marble
0016 {
0017 
0018 class ScreenGraphicsItem;
0019 class MarbleGraphicsGridLayoutPrivate;
0020 
0021 class MARBLE_EXPORT MarbleGraphicsGridLayout : public AbstractMarbleGraphicsLayout
0022 {
0023  public:
0024     MarbleGraphicsGridLayout( int rows, int columns );
0025     ~MarbleGraphicsGridLayout() override;
0026 
0027     void addItem( ScreenGraphicsItem *item, int row, int column );
0028 
0029     /**
0030      * This updates the positions of all items in the layout.
0031      * Calling this will be done on every repainting, so you won't have to do it yourself.
0032      */
0033     void updatePositions( MarbleGraphicsItem *parent ) override;
0034 
0035     Qt::Alignment alignment() const;
0036 
0037     Qt::Alignment alignment( ScreenGraphicsItem *item ) const;
0038 
0039     void setAlignment( Qt::Alignment align );
0040 
0041     void setAlignment( ScreenGraphicsItem *item, Qt::Alignment );
0042 
0043     /**
0044      * Returns the spacing between the items inside the layout.
0045      */
0046     int spacing() const;
0047 
0048     /**
0049      * Set the spacing between the items inside the layout. By default the spacing is 0.
0050      */
0051     void setSpacing( int spacing );
0052 
0053  private:
0054     MarbleGraphicsGridLayoutPrivate * const d;
0055 };
0056 
0057 } // namespace Marble
0058 
0059 #endif