source: trunk/include/qtoolbox.h@ 25

Last change on this file since 25 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1/****************************************************************************
2** $Id: qtoolbox.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Definition of QToolBox widget class
5**
6** Created : 961105
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the widgets module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QTOOLBOX_H
39#define QTOOLBOX_H
40
41#ifndef QT_H
42#include <qframe.h>
43#include <qiconset.h>
44#endif // QT_H
45
46#ifndef QT_NO_TOOLBOX
47
48class QToolBoxPrivate;
49class QWidgetList;
50
51class Q_EXPORT QToolBox : public QFrame
52{
53 Q_OBJECT
54 Q_PROPERTY( int currentIndex READ currentIndex WRITE setCurrentIndex )
55 Q_PROPERTY( int count READ count )
56
57public:
58 QToolBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
59 ~QToolBox();
60
61 int addItem( QWidget *item, const QString &label );
62 int addItem( QWidget *item, const QIconSet &iconSet, const QString &label );
63 int insertItem( int index, QWidget *item, const QString &label );
64 int insertItem( int index, QWidget *item, const QIconSet &iconSet, const QString &label );
65
66 int removeItem( QWidget *item );
67
68 void setItemEnabled( int index, bool enabled );
69 bool isItemEnabled( int index ) const;
70
71 void setItemLabel( int index, const QString &label );
72 QString itemLabel( int index ) const;
73
74 void setItemIconSet( int index, const QIconSet &iconSet );
75 QIconSet itemIconSet( int index ) const;
76
77 void setItemToolTip( int index, const QString &toolTip );
78 QString itemToolTip( int index ) const;
79
80 QWidget *currentItem() const;
81 void setCurrentItem( QWidget *item );
82
83 int currentIndex() const;
84 QWidget *item( int index ) const;
85 int indexOf( QWidget *item ) const;
86 int count() const;
87
88public slots:
89 void setCurrentIndex( int index );
90
91signals:
92 void currentChanged( int index );
93
94private slots:
95 void buttonClicked();
96 void itemDestroyed(QObject*);
97
98protected:
99 virtual void itemInserted( int index );
100 virtual void itemRemoved( int index );
101 void showEvent( QShowEvent *e );
102 void frameChanged();
103 void styleChange(QStyle&);
104
105private:
106 void relayout();
107
108private:
109 QToolBoxPrivate *d;
110
111};
112
113
114inline int QToolBox::addItem( QWidget *item, const QString &label )
115{ return insertItem( -1, item, QIconSet(), label ); }
116inline int QToolBox::addItem( QWidget *item, const QIconSet &iconSet,
117 const QString &label )
118{ return insertItem( -1, item, iconSet, label ); }
119inline int QToolBox::insertItem( int index, QWidget *item, const QString &label )
120{ return insertItem( index, item, QIconSet(), label ); }
121
122#endif // QT_NO_TOOLBOX
123#endif
Note: See TracBrowser for help on using the repository browser.