2 * Copyright 2005 by Aaron Seigo <aseigo@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
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 General Public License for more details
14 * You should have received a copy of the GNU 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.
23 #include <QtGui/QGraphicsItem>
24 #include <QtGui/QPainterPath>
26 #include <plasma/plasma_export.h>
29 * Namespace for everything in libplasma
35 * The Constraint enumeration lists the various constraints that Plasma
36 * objects have managed for them and which they may wish to react to,
37 * for instance in Applet::constraintsUpdated
39 enum Constraint
{ NoConstraint
= 0,
40 FormFactorConstraint
= 1 /** The FormFactor for an object */,
41 LocationConstraint
= 2 /** The Location of an object */,
42 ScreenConstraint
= 4 /** Which screen an object is on */,
43 SizeConstraint
= 8 /** the size of the applet was changed */,
44 ImmutableConstraint
= 16 /** the immutability (locked) nature of the applet changed */,
45 StartupCompletedConstraint
= 32 /** application startup has completed */,
46 AllConstraints
= FormFactorConstraint
| LocationConstraint
| ScreenConstraint
| SizeConstraint
| ImmutableConstraint
48 Q_DECLARE_FLAGS(Constraints
, Constraint
)
51 * The FormFactor enumeration describes how a Plasma::Applet should arrange
52 * itself. The value is derived from the container managing the Applet
53 * (e.g. in Plasma, a Corona on the desktop or on a panel).
55 enum FormFactor
{ Planar
= 0 /**< The applet lives in a plane and has two
56 degrees of freedom to grow. Optimize for
57 desktop, laptop or tablet usage: a high
58 resolution screen 1-3 feet distant from the
60 MediaCenter
/**< As with Planar, the applet lives in a plane
61 but the interface should be optimized for
62 medium-to-high resolution screens that are
63 5-15 feet distant from the viewer. Sometimes
64 referred to as a "ten foot interface".*/,
65 Horizontal
/**< The applet is constrained vertically, but
66 can expand horizontally. */,
67 Vertical
/**< The applet is constrained horizontally, but
68 can expand vertically. */
72 * The Direction enumeration describes in which direction, relative to the
73 * Applet (and its managing container), popup menus, expanders, balloons,
74 * message boxes, arrows and other such visually associated widgets should
75 * appear in. This is usually the oposite of the Location.
77 enum Direction
{ Down
= 0 /**< Display downards */ ,
78 Up
/**< Display upwards */,
79 Left
/**< Display to the left */,
80 Right
/**< Display to the right */
84 * The Location enumeration describes where on screen an element, such as an
85 * Applet or its managing container, is positioned on the screen.
87 enum Location
{ Floating
= 0 /**< Free floating. Neither geometry or z-ordering
88 is described precisely by this value. */,
89 Desktop
/**< On the planar desktop layer, extending across
90 the full screen from edge to edge */,
91 FullScreen
/**< Full screen */,
92 TopEdge
/**< Along the top of the screen*/,
93 BottomEdge
/**< Along the bottom of the screen*/,
94 LeftEdge
/**< Along the left side of the screen */,
95 RightEdge
/**< Along the right side of the screen */
99 * The position enumeration
102 enum Position
{ LeftPositioned
/**< Positioned left */,
103 RightPositioned
/**< Positioned right */,
104 TopPositioned
/**< Positioned top */,
105 BottomPositioned
/**< Positioned bottom */,
106 CenterPositioned
/**< Positioned in the center */
112 enum FlipDirection
{ NoFlip
= 0 /**< Do not flip */,
113 HorizontalFlip
= 1 /**< Flip horizontally */,
114 VerticalFlip
= 2 /**< Flip vertically */
116 Q_DECLARE_FLAGS(Flip
, FlipDirection
)
119 * Zoom levels that Plasma is aware of...
121 enum ZoomLevel
{ DesktopZoom
= 0 /**< Normal desktop usage, plasmoids are painted normally and have full interaction */,
122 GroupZoom
/**< Plasmoids are shown as icons in visual groups; drag and drop and limited context menu interaction only */ ,
123 OverviewZoom
/**< Groups become icons themselves */
127 * Possible timing alignments
129 enum IntervalAlignment
{ NoAlignment
= 0,
134 enum ItemTypes
{ AppletType
= QGraphicsItem::UserType
+ 1,
135 LineEditType
= QGraphicsItem::UserType
+ 2
139 * The ComonentType enumeration refers to the various types of components,
140 * or plugins, supported by plasma.
142 enum ComponentType
{ AppletComponent
= 1 /**< Plasma::Applet based plugins **/,
143 DataEngineComponent
= 2 /**< Plasma::DataEngine based plugins **/,
144 RunnerComponent
= 4 /**< Plasma::AbstractRunner based plugsin **/,
145 AnimatorComponent
= 8 /**< Plasma::Animator based plugins **/,
146 ContainmentComponent
= 16 /**< Plasma::Containment based plugins **/
148 Q_DECLARE_FLAGS(ComponentTypes
, ComponentType
)
150 enum MarginEdge
{ TopMargin
= 0,
157 * @return the scaling factor (0..1) for a ZoomLevel
159 PLASMA_EXPORT qreal
scalingFactor(ZoomLevel level
);
162 * Converts a location to a direction. Handy for figuring out which way to send a popup based on
163 * location or to point arrows and other directional items.
165 * @param location the location of the container the element will appear in
166 * @reutrn the visual direction of the element should be oriented in
168 PLASMA_EXPORT Direction
locationToDirection(Location location
);
171 * Returns a nicely rounded rectanglular path for painting.
173 PLASMA_EXPORT QPainterPath
roundedRectangle(const QRectF
& rect
, qreal radius
);
175 } // Plasma namespace
177 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Constraints
)
178 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Flip
)
179 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::ComponentTypes
)
181 #endif // multiple inclusion guard