]>
cloud.milkyroute.net Git - dolphin.git/blob - src/tagcloud/tagcloud.h
2 This file is part of the Nepomuk KDE project.
3 Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef _NEPOMUK_TAG_CLOUD_H_
21 #define _NEPOMUK_TAG_CLOUD_H_
23 #include <QtGui/QFrame>
24 #include <QtCore/QList>
26 #include <nepomuk/tag.h>
27 #include <nepomuk/nepomuk_export.h>
29 #include <Soprano/Statement>
37 class NEPOMUK_EXPORT TagCloud
: public QFrame
42 TagCloud( QWidget
* parent
= 0 );
51 int heightForWidth( int w
) const;
52 QSize
sizeHint() const;
53 QSize
minimumSizeHint() const;
55 bool zoomEnabled() const;
59 * Set the maximum used font size. The default is 0
60 * which means to calculate proper values from the KDE
63 void setMaxFontSize( int size
);
66 * Set the minimum used font size. The default is 0
67 * which means to calculate proper values from the KDE
70 void setMinFontSize( int size
);
73 * Set the maximum number of displayed tags. The default is 0
74 * which means to display all tags.
78 void setMaxNumberDisplayedTags( int n
);
81 * Allow selection of tags, i.e. enabling and disabling of tags.
83 void setSelectionEnabled( bool enabled
);
85 void setNewTagButtonEnabled( bool enabled
);
86 void setContextMenuEnabled( bool enabled
);
87 void setAlignment( Qt::Alignment alignment
);
89 void setZoomEnabled( bool zoom
);
92 * Default: SortAlpabetically
94 void setSorting( Sorting
);
97 * Will reset tags set via showTags()
102 * Set the tags to be shown in the tag cloud.
103 * If the new tag button is enabled (setEnableNewTagButton())
104 * new tags will automatically be added to the list of shown tags.
106 void showTags( const QList
<Tag
>& tags
);
108 void showResourceTags( const Resource
& resource
);
111 * Select or deselect a tag. This does only make sense
112 * if selection is enabled and \p tag is actually
115 * \sa setSelectionEnabled
117 void setTagSelected( const Tag
& tag
, bool selected
);
119 void setCustomNewTagAction( QAction
* action
);
122 void tagClicked( const Nepomuk::Tag
& tag
);
123 void tagAdded( const Nepomuk::Tag
& tag
);
124 void tagToggled( const Nepomuk::Tag
& tag
, bool enabled
);
127 void resizeEvent( QResizeEvent
* e
);
128 void paintEvent( QPaintEvent
* e
);
129 void mousePressEvent( QMouseEvent
* );
130 void mouseMoveEvent( QMouseEvent
* );
131 void leaveEvent( QEvent
* );
134 void slotStatementAdded( const Soprano::Statement
& s
);
135 void slotStatementRemoved( const Soprano::Statement
& s
);