Warning: That file was not part of the compilation database. It may have many parsing errors.

1//
2// This file is part of the Marble Virtual Globe.
3//
4// This program is free software licensed under the GNU LGPL. You can
5// find a copy of this license in LICENSE.txt in the top directory of
6// the source code.
7//
8// Copyright 2008 Torsten Rahn <tackat@kde.org>
9// Copyright 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com>
10//
11
12#ifndef MARBLE_ABSTRACTFLOATITEM_H
13#define MARBLE_ABSTRACTFLOATITEM_H
14
15#include <QPointF>
16#include <QSizeF>
17#include <QString>
18#include <Qt>
19
20#include <QPen>
21#include <QFont>
22#include <QContextMenuEvent>
23#include <QHelpEvent>
24#include <QWidget>
25
26#include "RenderPlugin.h"
27#include "FrameGraphicsItem.h"
28#include "marble_export.h"
29
30
31class QMenu;
32
33namespace Marble
34{
35
36class AbstractFloatItemPrivate;
37
38/**
39 * @brief The abstract class for float item plugins
40 *
41 * Float Item is a variant of Marble render plugins
42 * It keeps floating on top of the map at a given screen position
43 *
44 * Good examples are Overview Map, License
45 *
46 */
47
48class MARBLE_EXPORT AbstractFloatItem : public RenderPlugin, public FrameGraphicsItem
49{
50 Q_OBJECT
51
52 public:
53 explicit AbstractFloatItem( const MarbleModel *marbleModel,
54 const QPointF &point = QPointF( 10.0, 10.0 ),
55 const QSizeF &size = QSizeF( 150.0, 50.0 ) );
56 virtual ~AbstractFloatItem();
57
58 virtual QHash<QString,QVariant> settings() const;
59 virtual void setSettings(const QHash<QString, QVariant> &settings);
60
61 virtual RenderType renderType() const;
62
63 /**
64 * @brief current pen for rendering
65 * @return pen
66 */
67 QPen pen() const;
68
69 /**
70 * @brief setting current pen for rendering
71 * @param pen
72 */
73 void setPen( const QPen &pen );
74
75 /**
76 * @brief current font for rendering
77 * @return font
78 */
79 QFont font() const;
80
81 /**
82 * @brief setting current font for rendering
83 * @param font
84 */
85 void setFont( const QFont &font );
86
87 bool render( GeoPainter *painter, ViewportParams *viewport,
88 const QString& renderPos = "FLOAT_ITEM", GeoSceneLayer * layer = 0 );
89 virtual QString renderPolicy() const;
90
91 virtual QStringList renderPosition() const;
92
93 /**
94 * @brief Set visibility of the float item
95 *
96 * Float items can be visible or invisible.
97 * It's possible to check visibility with @see visible
98 *
99 * @param visible visibility of the item
100 */
101 void setVisible( bool visible );
102
103 /**
104 * @brief Check visibility of the float item
105 *
106 * Float items can be visible or invisible.
107 * It's possible to set visibility with @see setVisible
108 *
109 * @return visible or not
110 */
111 bool visible() const;
112
113 /**
114 * @brief Check is position locked
115 *
116 * Float Item position can be locked. If it is,
117 * the item can't be moved with the cursor (in the UI)
118 *
119 * To set it use @see setPositionLocked
120 *
121 * @return position locked or not
122 */
123 bool positionLocked() const;
124
125 public Q_SLOTS:
126 /**
127 * @brief Set is position locked
128 * @param lock is locked?
129 *
130 * Float Item position can be locked. If it is,
131 * item can't be moved with cursor (in UI)
132 *
133 * To check it use @see positionLocked
134 *
135 */
136 void setPositionLocked( bool lock );
137
138 /**
139 * @brief Show the item
140 *
141 * If the item was hidden this function will show it
142 *
143 */
144 void show();
145
146 /**
147 * @brief Hide the item
148 *
149 * If the item was shown this function will hide it
150 *
151 */
152 void hide();
153
154 protected:
155 virtual bool eventFilter( QObject *object, QEvent *e );
156 virtual void contextMenuEvent ( QWidget *w, QContextMenuEvent *e );
157 virtual void toolTipEvent( QHelpEvent *e );
158 virtual void changeViewport( ViewportParams *viewport );
159 QMenu* contextMenu();
160
161 private:
162 Q_DISABLE_COPY( AbstractFloatItem )
163 AbstractFloatItemPrivate * const d;
164};
165
166}
167
168#endif
169

Warning: That file was not part of the compilation database. It may have many parsing errors.