inverse location<->direction enum mapping
svn path=/trunk/KDE/kdelibs/; revision=954611
This commit is contained in:
parent
3919fe141a
commit
b479428114
21
plasma.cpp
21
plasma.cpp
@ -67,6 +67,27 @@ Direction locationToDirection(Location location)
|
|||||||
return Down;
|
return Down;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Direction locationToInverseDirection(Location location)
|
||||||
|
{
|
||||||
|
switch (location) {
|
||||||
|
case Floating:
|
||||||
|
case Desktop:
|
||||||
|
case TopEdge:
|
||||||
|
case FullScreen:
|
||||||
|
//TODO: should we be smarter for floating and planer?
|
||||||
|
// perhaps we should take a QRect and/or QPos as well?
|
||||||
|
return Up;
|
||||||
|
case BottomEdge:
|
||||||
|
return Down;
|
||||||
|
case LeftEdge:
|
||||||
|
return Left;
|
||||||
|
case RightEdge:
|
||||||
|
return Right;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Up;
|
||||||
|
}
|
||||||
|
|
||||||
QGraphicsView *viewFor(const QGraphicsItem *item)
|
QGraphicsView *viewFor(const QGraphicsItem *item)
|
||||||
{
|
{
|
||||||
if (!item || !item->scene()) {
|
if (!item || !item->scene()) {
|
||||||
|
11
plasma.h
11
plasma.h
@ -261,10 +261,19 @@ PLASMA_EXPORT qreal scalingFactor(ZoomLevel level);
|
|||||||
* location or to point arrows and other directional items.
|
* location or to point arrows and other directional items.
|
||||||
*
|
*
|
||||||
* @param location the location of the container the element will appear in
|
* @param location the location of the container the element will appear in
|
||||||
* @return the visual direction of the element should be oriented in
|
* @return the visual direction the element should be oriented in
|
||||||
**/
|
**/
|
||||||
PLASMA_EXPORT Direction locationToDirection(Location location);
|
PLASMA_EXPORT Direction locationToDirection(Location location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a location to the direction facing it. Handy for figuring out which way to collapse
|
||||||
|
* a popup or to point arrows at the item itself.
|
||||||
|
*
|
||||||
|
* @param location the location of the container the element will appear in
|
||||||
|
* @return the visual direction the element should be oriented in
|
||||||
|
**/
|
||||||
|
PLASMA_EXPORT Direction locationToInverseDirection(Location location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the most appropriate QGraphicsView for the item.
|
* Returns the most appropriate QGraphicsView for the item.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user