1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
4 //
5 
6 #ifndef MARBLE_MARBLEGRAPHICSGRIDLAYOUT_H
7 #define MARBLE_MARBLEGRAPHICSGRIDLAYOUT_H
8 
9 // Marble
10 #include "AbstractMarbleGraphicsLayout.h"
11 #include "marble_export.h"
12 
13 #include <Qt> // for Qt::Alignment
14 
15 namespace Marble
16 {
17 
18 class ScreenGraphicsItem;
19 class MarbleGraphicsGridLayoutPrivate;
20 
21 class MARBLE_EXPORT MarbleGraphicsGridLayout : public AbstractMarbleGraphicsLayout
22 {
23  public:
24     MarbleGraphicsGridLayout( int rows, int columns );
25     ~MarbleGraphicsGridLayout() override;
26 
27     void addItem( ScreenGraphicsItem *item, int row, int column );
28 
29     /**
30      * This updates the positions of all items in the layout.
31      * Calling this will be done on every repainting, so you won't have to do it yourself.
32      */
33     void updatePositions( MarbleGraphicsItem *parent ) override;
34 
35     Qt::Alignment alignment() const;
36 
37     Qt::Alignment alignment( ScreenGraphicsItem *item ) const;
38 
39     void setAlignment( Qt::Alignment align );
40 
41     void setAlignment( ScreenGraphicsItem *item, Qt::Alignment );
42 
43     /**
44      * Returns the spacing between the items inside the layout.
45      */
46     int spacing() const;
47 
48     /**
49      * Set the spacing between the items inside the layout. By default the spacing is 0.
50      */
51     void setSpacing( int spacing );
52 
53  private:
54     MarbleGraphicsGridLayoutPrivate * const d;
55 };
56 
57 } // namespace Marble
58 
59 #endif
60