summaryrefslogtreecommitdiff
path: root/libopie2/opieui/otabinfo.h
Unidiff
Diffstat (limited to 'libopie2/opieui/otabinfo.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otabinfo.h140
1 files changed, 140 insertions, 0 deletions
diff --git a/libopie2/opieui/otabinfo.h b/libopie2/opieui/otabinfo.h
new file mode 100644
index 0000000..4a6ce14
--- a/dev/null
+++ b/libopie2/opieui/otabinfo.h
@@ -0,0 +1,140 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29
30*/
31
32#ifndef OTABINFO_H
33#define OTABINFO_H
34
35/* QT */
36#include <qlist.h>
37#include <qstring.h>
38
39class QWidget;
40
41namespace Opie
42{
43
44/**
45 * @class OTabInfo
46 * @brief The OTabInfo class is used internally by OTabWidget to keep track
47 * of widgets added to the control.
48 *
49 * OTabInfo provides the following information about a widget added to an
50 * OTabWidget control:
51 *
52 * ID - integer tab bar ID
53 * Control - QWidget pointer to child widget
54 * Label - QString text label for OTabWidget selection control
55 * Icon - QString name of icon file
56 */
57class OTabInfo
58{
59public:
60 /**
61 * @fn OTabInfo()
62 * @brief Object constructor.
63 *
64 * @param parent Pointer to parent of this control.
65 * @param name Name of control.
66 * @param s Style of widget selection control.
67 * @param p Position of the widget selection control.
68 */
69 OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {}
70
71 /**
72 * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label )
73 * @brief Object constructor.
74 *
75 * @param id TabBar identifier for widget.
76 * @param control QWidget pointer to widget.
77 * @param icon QString name of icon file.
78 * @param label QString text label for OTabWidget selection control.
79 */
80 OTabInfo( int id, QWidget *control, const QString &icon, const QString &label )
81 : i( id ), c( control ), p( icon ), l( label ) {}
82
83 /**
84 * @fn id()const
85 * @brief Returns TabBar ID.
86 */
87 int id() const { return i; }
88
89 /**
90 * @fn label()const
91 * @brief Returns text label for widget.
92 */
93 const QString &label() const { return l; }
94
95 /**
96 * @fn setLabel( const QString &label )
97 * @brief Set label for tab.
98 *
99 * @param label QString text label for OTabWidget selection control.
100 */
101 void setLabel( const QString &label ) { l = label; }
102
103 /**
104 * @fn control()const
105 * @brief Returns pointer to widget.
106 */
107 QWidget *control() const { return c; }
108
109 /**
110 * @fn icon()const
111 * @brief Returns name of icon file.
112 */
113 const QString &icon() const { return p; }
114
115 /**
116 * @fn setIcon( const QString &icon )
117 * @brief Set icon for tab.
118 *
119 * @param icon QString name of icon file.
120 */
121 void setIcon( const QString &icon ) { p = icon; }
122
123private:
124 int i;
125 QWidget *c;
126 QString p;
127 QString l;
128 class Private;
129 Private *d;
130};
131
132/**
133 * @class OTabInfoList
134 * @brief A list of OTabInfo objects used by OTabWidget.
135 */
136typedef QList<OTabInfo> OTabInfoList;
137
138};
139
140#endif