KoFlake.h 4.22 KB
Newer Older
Thomas Zander's avatar
Thomas Zander committed
1 2
/* This file is part of the KDE project
 * Copyright (C) 2006 Thomas Zander <zander@kde.org>
Thomas Zander's avatar
Thomas Zander committed
3
 * Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
4
 * Copyright (C) 2010 Thorsten Zachmann <zachmann@kde.org>
Thomas Zander's avatar
Thomas Zander committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */
Thomas Zander's avatar
Thomas Zander committed
21 22
#ifndef KOFLAKE_H
#define KOFLAKE_H
Thomas Zander's avatar
Thomas Zander committed
23

Thomas Zander's avatar
Thomas Zander committed
24 25
#include "flake_export.h"

26
#include <QBrush>
Thomas Zander's avatar
Thomas Zander committed
27 28 29 30 31

class KoShape;
class QGradient;
class KoShapeBackground;

Thomas Zander's avatar
Thomas Zander committed
32 33 34
/**
 * Flake reference
 */
35
namespace KoFlake
36
{
Thomas Zander's avatar
Thomas Zander committed
37 38
    /// the selection type for KoSelection::selectedObjects()
    enum SelectionType {
39
        FullSelection,      ///< Create a list of all user-shapes in the selection. This excludes KoShapeGroup grouping objects that may be selected.
40 41
        StrippedSelection,  ///< Create a stripped list, without children if the container is also in the list.
        TopLevelSelection   ///< Create a list, much like the StrippedSelection, but have the KoShapeGroup instead of all of its children if one is selected.
Thomas Zander's avatar
Thomas Zander committed
42 43 44 45
    };

    /// Enum determining which handle is meant, used in KoInteractionTool
    enum SelectionHandle {
Thomas Zander's avatar
Thomas Zander committed
46 47 48 49 50 51 52 53 54
        TopMiddleHandle,    ///< The handle that is at the top - center of a selection
        TopRightHandle,     ///< The handle that is at the top - right of  a selection
        RightMiddleHandle,  ///< The handle that is at the right - center of a selection
        BottomRightHandle,  ///< The handle that is at the bottom right of a selection
        BottomMiddleHandle, ///< The handle that is at the bottom center of a selection
        BottomLeftHandle,   ///< The handle that is at the bottom left of a selection
        LeftMiddleHandle,   ///< The handle that is at the left center of a selection
        TopLeftHandle,      ///< The handle that is at the top left of a selection
        NoHandle            ///< Value to indicate no handle
Thomas Zander's avatar
Thomas Zander committed
55 56
    };

Thomas Zander's avatar
Thomas Zander committed
57 58 59 60 61 62 63 64 65 66
    /**
     * Used to change the behavior of KoShapeManager::shapeAt()
     */
    enum ShapeSelection {
        Selected,   ///< return the first selected with the highest z-ordering (i.e. on top).
        Unselected, ///< return the first unselected on top.
        NextUnselected, ///< return the first unselected directly under a selected shape, or the top most one if nothing is selected.
        ShapeOnTop  ///< return the shape highest z-ordering, regardless of selection.
    };

67 68
    /// position. See KoShape::absolutePosition()
    enum Position {
Thomas Zander's avatar
Thomas Zander committed
69
        TopLeftCorner, ///< the top left corner
Fredy Yanardi's avatar
Fredy Yanardi committed
70
        TopRightCorner, ///< the top right corner
Thomas Zander's avatar
Thomas Zander committed
71 72
        BottomLeftCorner, ///< the bottom left corner
        BottomRightCorner, ///< the bottom right corner
Jan Hambrecht's avatar
Jan Hambrecht committed
73
        CenteredPosition ///< the centred corner
74 75
    };

76 77 78 79 80
    /**
     * Used to see which style type is active
     */
    enum StyleType {
        Background, ///< the background / fill style is active
81
        Foreground  ///< the foreground / stroke style is active
82 83
    };

Thomas Zander's avatar
Thomas Zander committed
84 85
    /// clones the given gradient
    FLAKE_EXPORT QGradient *cloneGradient(const QGradient *gradient);
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

    /**
     * Convert absolute to relative position
     *
     * @param absolute absolute position
     * @param size for which the relative position needs to be calculated
     *
     * @return relative position
     */
    FLAKE_EXPORT QPointF toRelative(const QPointF &absolute, const QSizeF &size);

    /**
     * Convert relative size to absolute size
     *
     * @param relative relative position
     * @param size for which the absolute position needs to be calculated
     *
     * @return absolute position
     */
    FLAKE_EXPORT QPointF toAbsolute(const QPointF &relative, const QSizeF &size);
Laurent Montel's avatar
Laurent Montel committed
106
}
Thomas Zander's avatar
Thomas Zander committed
107 108

#endif