libyui-qt
2.46.1
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
YQMultiSelectionBox.h
1
/*
2
Copyright (C) 2000-2012 Novell, Inc
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of the GNU Lesser General Public License as
5
published by the Free Software Foundation; either version 2.1 of the
6
License, or (at your option) version 3.0 of the License. This library
7
is distributed in the hope that it will be useful, but WITHOUT ANY
8
WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
License for more details. You should have received a copy of the GNU
11
Lesser General Public License along with this library; if not, write
12
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13
Floor, Boston, MA 02110-1301 USA
14
*/
15
16
17
/*-/
18
19
File: YQMultiSelectionBox.h
20
21
Author: Stefan Hundhammer <sh@suse.de>
22
23
/-*/
24
25
26
#ifndef YQMultiSelectionBox_h
27
#define YQMultiSelectionBox_h
28
29
#include <QFrame>
30
#include <QTreeWidget>
31
32
#include <yui/YMultiSelectionBox.h>
33
34
class
YQWidgetCaption
;
35
class
YQMultiSelectionBoxItem
;
36
37
38
class
YQMultiSelectionBox
:
public
QFrame,
public
YMultiSelectionBox
39
{
40
Q_OBJECT
41
42
public
:
43
44
/**
45
* Constructor.
46
**/
47
YQMultiSelectionBox
( YWidget * parent,
const
std::string & label );
48
49
/**
50
* Destructor.
51
**/
52
~YQMultiSelectionBox
();
53
54
/**
55
* Change the label text.
56
*
57
* Reimplemented from YSelectionWidget.
58
**/
59
virtual
void
setLabel
(
const
std::string & label );
60
61
/**
62
* Add an item.
63
*
64
* Reimplemented from YSelectionWidget.
65
**/
66
virtual
void
addItem
( YItem * item );
67
68
/**
69
* Select or deselect an item.
70
*
71
* Reimplemented from YSelectionWidget.
72
**/
73
virtual
void
selectItem
( YItem * item,
bool
selected =
true
);
74
75
/**
76
* Deselect all items.
77
*
78
* Reimplemented from YSelectionWidget.
79
**/
80
virtual
void
deselectAllItems
();
81
82
/**
83
* Delete all items.
84
*
85
* Reimplemented from YSelectionWidget.
86
**/
87
virtual
void
deleteAllItems
();
88
89
/**
90
* Return the the item that currently has the keyboard focus
91
* or 0 if no item currently has the keyboard focus.
92
*
93
* Reimplemented from YMultiSelectionBox.
94
**/
95
virtual
YItem *
currentItem
();
96
97
/**
98
* Set the keyboard focus to the specified item.
99
* 0 means clear the keyboard focus.
100
*
101
* Reimplemented from YMultiSelectionBox.
102
**/
103
virtual
void
setCurrentItem
( YItem * item );
104
105
/**
106
* Set enabled/disabled state.
107
*
108
* Reimplemented from YWidget.
109
**/
110
virtual
void
setEnabled
(
bool
enabled );
111
112
/**
113
* Preferred width of the widget.
114
*
115
* Reimplemented from YWidget.
116
**/
117
virtual
int
preferredWidth
();
118
119
/**
120
* Preferred height of the widget.
121
*
122
* Reimplemented from YWidget.
123
**/
124
virtual
int
preferredHeight
();
125
126
/**
127
* Set the new size of the widget.
128
*
129
* Reimplemented from YWidget.
130
**/
131
virtual
void
setSize
(
int
newWidth,
int
newHeight );
132
133
/**
134
* Accept the keyboard focus.
135
**/
136
virtual
bool
setKeyboardFocus
();
137
138
139
signals:
140
/**
141
* Emitted upon when an item changes its state.
142
**/
143
void
valueChanged
();
144
145
146
protected
slots:
147
/**
148
* Send SelectionChanged event if `opt(`notify) is set.
149
**/
150
void
slotSelected
();
151
152
/**
153
* Send ValueChanged event if `opt(`notify) is set.
154
**/
155
void
slotValueChanged
();
156
157
void
slotItemChanged( QTreeWidgetItem*,
int
);
158
159
protected
:
160
/**
161
* Find the counterpart of 'item'. Return 0 if there is none.
162
**/
163
YQMultiSelectionBoxItem
*
findItem
( YItem * item );
164
165
166
YQWidgetCaption
* _caption;
167
QTreeWidget * _qt_listView;
168
};
169
170
171
172
class
YQMultiSelectionBoxItem
:
public
QTreeWidgetItem
173
{
174
public
:
175
/**
176
* Constructor.
177
**/
178
YQMultiSelectionBoxItem
(
YQMultiSelectionBox
* parent,
179
QTreeWidget * listView,
180
YItem *
yItem
);
181
182
/**
183
* Destructor.
184
**/
185
virtual
~YQMultiSelectionBoxItem
() {}
186
187
/**
188
* Return the corresponding YItem.
189
**/
190
YItem *
yItem
()
const
{
return
_yItem; }
191
192
193
protected
:
194
195
//
196
// Data members
197
//
198
199
YItem * _yItem;
200
int
_serial;
201
YQMultiSelectionBox
* _multiSelectionBox;
202
203
204
/**
205
* The next serial number to use
206
**/
207
static
int
_item_count
;
208
};
209
210
#endif // YQLabel_h
src
YQMultiSelectionBox.h
Generated by
1.8.3.1