4 Copyright (c) 2007 Michael D. Stemle, Jr. <manchicken@notsosoft.net>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
23 #ifndef KICONGROUPPAGE_H
25 #define KICONGROUPPAGE_H
40 VBox contains two rows: title and HBOX (maybe a third for a line?
41 HBOX contains columns of VBOXes
42 Those VBoxes contain two rows: icon and title
44 +---------------Box-----------------+
46 | +-------------Box---------------+ |
48 | | +-----------Box-------------+ | |
50 | | | +--QLabel--+ +--QLabel--+ | | |
52 | | | | ICON | | ICON | | | |
53 | | | | LABEL | | LABEL | | | |
55 | | | +----------+ +----------+ | | |
57 | | +---------------------------+ | |
59 | +-------------------------------+ |
61 +-----------------------------------+
68 * A page of group icons
70 class KIconGroupPage
: public QFrame
{
74 * Property for the page name
76 Q_PROPERTY(QString m_pageName READ pageName WRITE setPageName
);
81 * Constructor for KIconGroupPage
83 * @param parent The parent widget for the page..
85 explicit KIconGroupPage(QWidget
* parent
= 0);
90 * Append a group to the page
92 * @param title The title of the group
93 * @returns A constant pointer to the group that was added.
95 void appendGroup(QString name
);
98 * Append an icon to a group
100 * @param group The group name to append the icon to
101 * @param icon The icon to use
102 * @param label The label to use with the icon
103 * @returns A constant pointer to the item that was added.
105 const KIconGroupItem
* appendIconToGroup(const QString
& name
,
107 const QString
& label
);
112 * @param name The name to assign.
114 void setPageName(QString name
) { m_pageName
= name
; };
119 * @return Returns the page name
121 QString
pageName() const { return m_pageName
; };
128 QMap
<QString
, KIconGroupRow
*> m_rows
;
129 QBoxLayout
* m_layout
;
134 * The row of icon groups
136 class KIconGroupRow
: public QBoxLayout
{
140 * Property for the icon group name
142 Q_PROPERTY(QString m_groupName READ groupName WRITE setGroupName
);
147 * Constructor for KIconGroupRow
149 * @param parent The parent to stick the KIconGroupRow widget into.
151 explicit KIconGroupRow(QWidget
* parent
= 0);
154 * Constructor for KIconGroupRow
156 * @param parent The parent to stick the KIconGroupRow widget into.
157 * @param name The name for the icon group row.
159 explicit KIconGroupRow(QString
& name
, QWidget
* parent
= 0);
169 * @param icon The icon to add
170 * @param label The label to add
171 * @returns A constant pointer to the item that was just added.
173 const KIconGroupItem
* appendIcon( const QIcon
& icon
, const QString
& label
);
178 * @param name The name to assign
180 void setGroupName(QString name
) { m_groupName
= name
; };
185 * @return The group name.
187 QString
groupName() const { return m_groupName
; };
193 QList
<KIconGroupItem
*> m_icons
;
200 * @notes This is the low-level icon class for the icon groups.
202 class KIconGroupItem
: public QLabel
{
208 * A single icon in the group.
209 * @param parent The parent widget
210 * @param icon The icon to display
211 * @param label The label to display for the icon.
213 explicit KIconGroupItem(QWidget
* parent
, const QIcon
& icon
, const QString
& label
);
216 * Set the parent widget
218 * @param parent The parent widget to set
220 void setParent(QWidget
* parent
);
225 * @param icon The icon to add to the group item
227 void setIcon(const QIcon
& icon
);
232 * @return Returns the currently set icon object
234 const QIcon
& icon() { return m_icon
; };
239 * @param label The label to set
241 void setLabel(const QString
& label
);
246 const QString
& label() { return m_text
; };
252 Q_DISABLE_COPY(KIconGroupItem
);
258 #endif // KICONGROUPPAGE_H