blob: ef7fee2482d3e56bd9fab9a7d8fd6615a28067dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef MFREESTYLELAYOUTPOLICY_H
#define MFREESTYLELAYOUTPOLICY_H
#include "mabstractlayoutpolicy.h"
#include "mlayout.h"
class MFreestyleLayoutPolicyPrivate;
/*!
* \class MFreestyleLayoutPolicy
* \brief Freestyle layout policy.
*
* This policy arranges the items as much as possible according to the user's
* wishes but avoids any overlap. The height is computed as needed.
*
* The following example adds items to the freestyle layout policy in a circle shape:
*
* \dontinclude mfreestylelayoutpolicy/mfreestylelayoutpolicy.cpp
* \skip Create a MLayout
* \until }
*
* The result, with appropriate CSS styling, looks like:
* \image html mfreestylelayoutpolicy.jpg
*
* \sa \link layout-mfreestylelayoutpolicy MFreestyleLayoutPolicy Example \endlink
*/
class M_EXPORT MFreestyleLayoutPolicy : public MAbstractLayoutPolicy
{
public:
/*!
* \brief Constructs a freestyle layout policy
*/
explicit MFreestyleLayoutPolicy(MLayout *layout);
/*!
* \brief Destroys the freestyle layout policy.
*/
virtual ~MFreestyleLayoutPolicy();
/*!
* \brief Add an item to the top left hand corner in the freestyle layout.
*
* If the new item overlaps any existing items, the existing items will be
* moved out of the way.
*
* The item will be given its preferredSize.
* @param item The item to add.
*/
virtual void addItem(QGraphicsLayoutItem *item);
/*!
* \brief Add an item at a specific geometry in the freestyle layout.
*
* If the new item overlaps any existing items, the existing items will be
* moved out of the way.
*
* @param item The item to add.
* @param geom The geometry where to add the item.
*/
void addItemAtGeometry(QGraphicsLayoutItem *item, const QRectF &geom);
/*! \brief Move an item to the given geometry.
*
* The given @a item will be animated to the given geometry, if possible,
* moving any overlapping items out of the way, if possible.
*/
void moveItemTo(QGraphicsLayoutItem *item, const QRectF &geom);
/*! \reimp */
virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
virtual void removeAt(int index);
/*! \reimp_end */
protected:
virtual void relayout();
private:
Q_DECLARE_PRIVATE(MFreestyleLayoutPolicy)
Q_DISABLE_COPY(MFreestyleLayoutPolicy)
};
#endif // Header Guard
|