2 * This file is part of the System Preferences package
3 * Copyright (C) 2005 Benjamin C Meyer (ben+systempreferences at meyerhome dot net)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
24 #include "moduleiconitem.h"
26 #include <QListWidget>
31 * Overloaded to give a larger default size that fits with text of two lines.
33 class RowIconView
: public QListWidget
37 RowIconView( QWidget
* parent
) : QListWidget( parent
)
39 setResizeMode(Adjust
);
40 setViewMode(IconMode
);
42 setFrameShape(NoFrame
);
46 // Figure out the hight/width to have only one row
47 QSize
minimumSizeHint() const {
50 for ( QIconViewItem *item = firstItem(); item; item = item->nextItem() )
51 width += item->width();
52 width += spacing()*(count())+(margin()+frameWidth()+lineWidth()+midLineWidth())*2 ;
55 //width = count()*gridX()+frameWidth()*2;
56 width
= count()*gridSize().width()+frameWidth()*2;
59 //FIXME for ( Q3IconViewItem *item = firstItem(); item; item = item->nextItem() )
60 // if(item->height() > height)
61 // height = item->height();
62 // I honestly don't know where the 4+4 is coming from...
63 // What other spacing did I miss?
64 height
+= (/*margin()+*/frameWidth()+spacing()+lineWidth()+midLineWidth())*2+8;
67 int h = fontMetrics().height();
70 int f = 2 * frameWidth();
71 int height = ( 2*h ) + f + spacing() * 2 + 32 + lineWidth()*2 + 10;
73 return QSize( width
, height
);
81 * This widget contains the IconView's of all of the modules etc
82 * It is the basic thing that users see.
84 class ModulesView
: public QWidget
86 // To search the groups
87 friend class KcmSearch
;
91 void clearSelection();
95 void itemSelected( QListWidgetItem
* item
);
98 ModulesView( KCModuleMenu
*rootMenu
, const QString
&menuPath
, QWidget
*parent
=0 );
102 QList
<RowIconView
*> groups
;
103 KCModuleMenu
*rootMenu
;
105 KService::List categories
;
107 void createRow( const QString
&parentPath
, QBoxLayout
*layout
);
110 #endif // MODULESVIEW_H