~ubuntu-branches/ubuntu/trusty/kdeplasma-addons/trusty

« back to all changes in this revision

Viewing changes to applets/lancelot/libs/lancelot/layouts/FullBorderLayout.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-05-25 09:50:14 UTC
  • mfrom: (1.1.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100525095014-6mlrm9z9bkws0zkt
Tags: 4:4.4.80-0ubuntu1
* New upstream beta release:
  - Bump kde-sc-dev-latest build-dep version to 4.4.80
  - Refresh kubuntu_04_kimpanel_disable_scim.diff
  - Update various .install files
  - Drop liblancelot0a and liblancelot-dev packages; Upstream has broken ABI
    without an .so version bump, and after discussion with Debian it was
    decided it was not worth it to ship an unstable library.
  - Add liblancelot files to plasma-widget-lancelot, adding appropriate
    Replaces: entries
* Switch to source format 3.0 (quilt):
  - Bump debhelper build-depend version to 7.3.16 or greater

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *   Copyright (C) 2007 Ivan Cukic <ivan.cukic(at)kde.org>
3
 
 *
4
 
 *   This program is free software; you can redistribute it and/or modify
5
 
 *   it under the terms of the GNU Lesser/Library General Public License version 2,
6
 
 *   or (at your option) any later version, as published by the Free
7
 
 *   Software Foundation
8
 
 *
9
 
 *   This program is distributed in the hope that it will be useful,
10
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 *   GNU Lesser/Library General Public License for more details
13
 
 *
14
 
 *   You should have received a copy of the GNU Lesser/Library General Public
15
 
 *   License along with this program; if not, write to the
16
 
 *   Free Software Foundation, Inc.,
17
 
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
 
 */
19
 
 
20
 
#ifndef LANCELOT_FULL_BORDER_LAYOUT_H
21
 
#define LANCELOT_FULL_BORDER_LAYOUT_H
22
 
 
23
 
#include <QGraphicsLayout>
24
 
 
25
 
#include <lancelot/lancelot_export.h>
26
 
 
27
 
namespace Lancelot {
28
 
 
29
 
/**
30
 
 * A modified version of Plasma::BorderLayout
31
 
 *
32
 
 * A layout which lays one item per border (left, top, bottom, right)
33
 
 * one per corner and one item in center.
34
 
 *
35
 
 * @author Ivan Cukic
36
 
 *
37
 
 */
38
 
class LANCELOT_EXPORT FullBorderLayout : public QGraphicsLayout {
39
 
public:
40
 
    /**
41
 
     * Borders enum
42
 
     */
43
 
    enum Border {
44
 
        TopBorder      = 1, /** Top border */
45
 
        BottomBorder   = 2, /** Bottom border */
46
 
        LeftBorder     = 4, /** Left border */
47
 
        RightBorder    = 8  /** Right border */
48
 
    };
49
 
 
50
 
    /**
51
 
     * Positions supported by FullBorderLayout
52
 
     */
53
 
    enum Place {
54
 
        Center      = 0,
55
 
        Top         = TopBorder,
56
 
        Bottom      = BottomBorder,
57
 
        Left        = LeftBorder,
58
 
        Right       = RightBorder,
59
 
        TopLeft     = TopBorder | LeftBorder,
60
 
        TopRight    = TopBorder | RightBorder,
61
 
        BottomLeft  = BottomBorder | LeftBorder,
62
 
        BottomRight = BottomBorder | RightBorder
63
 
    };
64
 
 
65
 
    /**
66
 
     * Creates a new Lancelot::FullBorderLayout
67
 
     * @param parent parent layout item
68
 
     */
69
 
    explicit FullBorderLayout(QGraphicsLayoutItem * parent = 0);
70
 
 
71
 
    /**
72
 
     * Destroys this Lancelot::FullBorderLayout
73
 
     */
74
 
    virtual ~FullBorderLayout();
75
 
 
76
 
    /**
77
 
     * Adds item in the center.
78
 
     * Equal to: addItem(item, Center);
79
 
     * @param item item to add
80
 
     */
81
 
    void addItem(QGraphicsLayoutItem * item);
82
 
 
83
 
    /**
84
 
     * Adds item at the specified position
85
 
     * @param item item to add
86
 
     * @param position position to which to add
87
 
     */
88
 
    void addItem(QGraphicsLayoutItem * item, Place position);
89
 
 
90
 
    /**
91
 
     * Deactivates the automatic sizing of a border widget,
92
 
     * and sets it to the specified size.
93
 
     *
94
 
     * For left and right widgets, it sets the width; while
95
 
     * for top and bottom ones, it sets the height.
96
 
     *
97
 
     * @param size size of the border
98
 
     * @param border border for which the size is being specified
99
 
     */
100
 
    void setSize(qreal size, Border border);
101
 
 
102
 
    /**
103
 
     * Activates the automatic sizing of a border widget,
104
 
     * according to it's sizeHint()
105
 
     * @param border border for which the auto size is being specified
106
 
     */
107
 
    void setAutoSize(Border border);
108
 
 
109
 
    /**
110
 
     * Returns the size of the specified border widget.
111
 
     *
112
 
     * If automatic sizing for that border widget is activated,
113
 
     * it will return a value less than zero.
114
 
     *
115
 
     * @param border border for which the size is requested
116
 
     */
117
 
    qreal size(Border border) const;
118
 
 
119
 
    L_Override void setGeometry(const QRectF & rect);
120
 
    L_Override int count() const;
121
 
    L_Override QGraphicsLayoutItem * itemAt(int i) const;
122
 
    L_Override void removeAt(int index);
123
 
    L_Override QSizeF sizeHint(Qt::SizeHint which,
124
 
            const QSizeF & constraint = QSizeF()) const;
125
 
 
126
 
private:
127
 
    class Private;
128
 
    Private * const d;
129
 
};
130
 
 
131
 
} // namespace Lancelot
132
 
 
133
 
#endif /* LANCELOT_FULL_BORDER_LAYOUT_H */
134