-rw-r--r-- | libopie2/opieui/big-screen/osplitter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp index 78e919a..5d1e2cf 100644 --- a/libopie2/opieui/big-screen/osplitter.cpp +++ b/libopie2/opieui/big-screen/osplitter.cpp | |||
@@ -134,193 +134,193 @@ QString OSplitter::label()const | |||
134 | 134 | ||
135 | /** | 135 | /** |
136 | * This function sets the size change policy of the splitter. | 136 | * This function sets the size change policy of the splitter. |
137 | * If this size marked is crossed the splitter will relayout. | 137 | * If this size marked is crossed the splitter will relayout. |
138 | * Note: that depending on the set Orientation it'll either look | 138 | * Note: that depending on the set Orientation it'll either look |
139 | * at the width or height. | 139 | * at the width or height. |
140 | * Note: If you want to from side to side view to tabbed view you need | 140 | * Note: If you want to from side to side view to tabbed view you need |
141 | * to make sure that the size you supply is not smaller than the minimum | 141 | * to make sure that the size you supply is not smaller than the minimum |
142 | * size of your added widgets. Note that if you use widgets like QComboBoxes | 142 | * size of your added widgets. Note that if you use widgets like QComboBoxes |
143 | * you need to teach them to accept smaller sizes as well @see QWidget::setSizePolicy | 143 | * you need to teach them to accept smaller sizes as well @see QWidget::setSizePolicy |
144 | * | 144 | * |
145 | * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter. | 145 | * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter. |
146 | * @return void | 146 | * @return void |
147 | */ | 147 | */ |
148 | void OSplitter::setSizeChange( int width_height ) | 148 | void OSplitter::setSizeChange( int width_height ) |
149 | { | 149 | { |
150 | m_size_policy = width_height; | 150 | m_size_policy = width_height; |
151 | QSize sz(width(), height() ); | 151 | QSize sz(width(), height() ); |
152 | QResizeEvent ev(sz, sz ); | 152 | QResizeEvent ev(sz, sz ); |
153 | resizeEvent(&ev); | 153 | resizeEvent(&ev); |
154 | } | 154 | } |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * This functions allows to add another OSplitter and to share | 157 | * This functions allows to add another OSplitter and to share |
158 | * the OTabBar in small screen mode. The ownerships gets transfered. | 158 | * the OTabBar in small screen mode. The ownerships gets transfered. |
159 | * OSplitters are always added after normal widget items | 159 | * OSplitters are always added after normal widget items |
160 | */ | 160 | */ |
161 | void OSplitter::addWidget( OSplitter* split ) | 161 | void OSplitter::addWidget( OSplitter* split ) |
162 | { | 162 | { |
163 | m_splitter.append( split ); | 163 | m_splitter.append( split ); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * set tab widget | 166 | * set tab widget |
167 | */ | 167 | */ |
168 | if (m_tabWidget ) | 168 | if (m_tabWidget ) |
169 | setTabWidget( m_parentTab ); | 169 | setTabWidget( m_parentTab ); |
170 | else | 170 | else |
171 | { | 171 | { |
172 | OSplitterContainer con; | 172 | OSplitterContainer con; |
173 | con.widget =split; | 173 | con.widget =split; |
174 | addToBox( con ); | 174 | addToBox( con ); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * If in a tab it should be removed | 179 | * If in a tab it should be removed |
180 | * and if in a hbox the reparent kills it too | 180 | * and if in a hbox the reparent kills it too |
181 | */ | 181 | */ |
182 | /** | 182 | /** |
183 | * This removes the splitter again. You currently need to call this | 183 | * This removes the splitter again. You currently need to call this |
184 | * before you delete or otherwise you can get mem corruption | 184 | * before you delete or otherwise you can get mem corruption |
185 | * or other weird behaviour. | 185 | * or other weird behaviour. |
186 | * Owner ship gets transfered back to you it's current parent | 186 | * Owner ship gets transfered back to you it's current parent |
187 | * is 0 | 187 | * is 0 |
188 | */ | 188 | */ |
189 | void OSplitter::removeWidget( OSplitter* split) | 189 | void OSplitter::removeWidget( OSplitter* split) |
190 | { | 190 | { |
191 | split->setTabWidget( 0 ); | 191 | split->setTabWidget( 0 ); |
192 | split->reparent( 0, 0, QPoint(0, 0) ); | 192 | split->reparent( 0, 0, QPoint(0, 0) ); |
193 | } | 193 | } |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * Adds a widget to the Splitter. The widgets gets inserted | 196 | * Adds a widget to the Splitter. The widgets gets inserted |
197 | * at the end of either the Box or TabWidget. | 197 | * at the end of either the Box or TabWidget. |
198 | * Ownership gets transfered and the widgets gets reparented. | 198 | * Ownership gets transfered and the widgets gets reparented. |
199 | * Note: icon and label is only available on small screensizes | 199 | * Note: icon and label is only available on small screensizes |
200 | * if size is smaller than the mark | 200 | * if size is smaller than the mark |
201 | * Warning: No null checking of the widget is done. Only on debug | 201 | * Warning: No null checking of the widget is done. Only on debug |
202 | * a message will be outputtet | 202 | * a message will be outputtet |
203 | * | 203 | * |
204 | * @param wid The widget which will be added | 204 | * @param wid The widget which will be added |
205 | * @param icon The icon of the possible Tab | 205 | * @param icon The icon of the possible Tab |
206 | * @param label The label of the possible Tab | 206 | * @param label The label of the possible Tab |
207 | */ | 207 | */ |
208 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) | 208 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) |
209 | { | 209 | { |
210 | #ifdef DEBUG | 210 | #ifdef DEBUG |
211 | if (!wid ) | 211 | if (!wid ) |
212 | return; | 212 | return; |
213 | #endif | 213 | #endif |
214 | OSplitterContainer cont; | 214 | OSplitterContainer cont; |
215 | cont.widget = wid; | 215 | cont.widget = wid; |
216 | cont.icon =icon; | 216 | cont.icon =icon; |
217 | cont.name = label; | 217 | cont.name = label; |
218 | 218 | ||
219 | m_container.append( cont ); | 219 | m_container.append( cont ); |
220 | 220 | ||
221 | /* | 221 | /* |
222 | * | 222 | * |
223 | */ | 223 | */ |
224 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) | 224 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) |
225 | setTabWidget( m_parentTab ); | 225 | setTabWidget( m_parentTab ); |
226 | else | 226 | else |
227 | { | 227 | { |
228 | if (m_hbox ) | 228 | if (m_hbox ) |
229 | addToBox( cont ); | 229 | addToBox( cont ); |
230 | else | 230 | else if (m_tabWidget) |
231 | addToTab( cont ); | 231 | addToTab( cont ); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | /** | 236 | /** |
237 | * Removes the widget from the tab widgets if necessary. | 237 | * Removes the widget from the tab widgets if necessary. |
238 | * OSplitter drops ownership of this widget and the widget | 238 | * OSplitter drops ownership of this widget and the widget |
239 | * will be reparented i tto 0. | 239 | * will be reparented i tto 0. |
240 | * The widget will not be deleted. | 240 | * The widget will not be deleted. |
241 | * | 241 | * |
242 | * @param w The widget to be removed | 242 | * @param w The widget to be removed |
243 | */ | 243 | */ |
244 | void OSplitter::removeWidget( QWidget* w) | 244 | void OSplitter::removeWidget( QWidget* w) |
245 | { | 245 | { |
246 | ContainerList::Iterator it; | 246 | ContainerList::Iterator it; |
247 | for ( it = m_container.begin(); it != m_container.end(); ++it ) | 247 | for ( it = m_container.begin(); it != m_container.end(); ++it ) |
248 | if ( (*it).widget == w ) | 248 | if ( (*it).widget == w ) |
249 | break; | 249 | break; |
250 | 250 | ||
251 | if (it == m_container.end() ) | 251 | if (it == m_container.end() ) |
252 | return; | 252 | return; |
253 | 253 | ||
254 | 254 | ||
255 | /* only tab needs to be removed.. box recognizes it */ | 255 | /* only tab needs to be removed.. box recognizes it */ |
256 | if ( !m_hbox ) | 256 | if ( !m_hbox ) |
257 | removeFromTab( w ); | 257 | removeFromTab( w ); |
258 | 258 | ||
259 | 259 | ||
260 | /* Find reparent it and remove it from our list */ | 260 | /* Find reparent it and remove it from our list */ |
261 | 261 | ||
262 | w->reparent( 0, 0, QPoint(0, 0)); | 262 | w->reparent( 0, 0, QPoint(0, 0)); |
263 | it = m_container.remove( it ); | 263 | it = m_container.remove( it ); |
264 | 264 | ||
265 | } | 265 | } |
266 | 266 | ||
267 | 267 | ||
268 | /** | 268 | /** |
269 | * This method will give focus to the widget. If in a tabwidget | 269 | * This method will give focus to the widget. If in a tabwidget |
270 | * the tabbar will be changed | 270 | * the tabbar will be changed |
271 | * | 271 | * |
272 | * @param w The widget which will be set the current one | 272 | * @param w The widget which will be set the current one |
273 | */ | 273 | */ |
274 | void OSplitter::setCurrentWidget( QWidget* w) | 274 | void OSplitter::setCurrentWidget( QWidget* w) |
275 | { | 275 | { |
276 | if (m_tabWidget ) | 276 | if (m_tabWidget ) |
277 | m_tabWidget->setCurrentTab( w ); | 277 | m_tabWidget->setCurrentTab( w ); |
278 | // else | 278 | // else |
279 | // m_hbox->setFocus( w ); | 279 | // m_hbox->setFocus( w ); |
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | /** | 283 | /** |
284 | * This is an overloaded member function and only differs in the | 284 | * This is an overloaded member function and only differs in the |
285 | * argument it takes. | 285 | * argument it takes. |
286 | * Searches list of widgets for label. It'll pick the first label it finds | 286 | * Searches list of widgets for label. It'll pick the first label it finds |
287 | * | 287 | * |
288 | * @param label Label to look for. First match will be taken | 288 | * @param label Label to look for. First match will be taken |
289 | */ | 289 | */ |
290 | void OSplitter::setCurrentWidget( const QString& label ) | 290 | void OSplitter::setCurrentWidget( const QString& label ) |
291 | { | 291 | { |
292 | ContainerList::Iterator it; | 292 | ContainerList::Iterator it; |
293 | for (it = m_container.begin(); it != m_container.end(); ++it ) | 293 | for (it = m_container.begin(); it != m_container.end(); ++it ) |
294 | { | 294 | { |
295 | if ( (*it).name == label ) | 295 | if ( (*it).name == label ) |
296 | { | 296 | { |
297 | setCurrentWidget( (*it).widget ); | 297 | setCurrentWidget( (*it).widget ); |
298 | break; | 298 | break; |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | /** | 303 | /** |
304 | * This will only work when the TabWidget is active | 304 | * This will only work when the TabWidget is active |
305 | * If everything is visible this signal is kindly ignored | 305 | * If everything is visible this signal is kindly ignored |
306 | * @see OTabWidget::setCurrentTab(int) | 306 | * @see OTabWidget::setCurrentTab(int) |
307 | * | 307 | * |
308 | * @param tab The tab to make current | 308 | * @param tab The tab to make current |
309 | */ | 309 | */ |
310 | void OSplitter::setCurrentWidget( int tab ) | 310 | void OSplitter::setCurrentWidget( int tab ) |
311 | { | 311 | { |
312 | if (m_tabWidget ) | 312 | if (m_tabWidget ) |
313 | m_tabWidget->setCurrentTab( tab ); | 313 | m_tabWidget->setCurrentTab( tab ); |
314 | } | 314 | } |
315 | 315 | ||
316 | /** | 316 | /** |
317 | * return the currently activated widget if in tab widget mode | 317 | * return the currently activated widget if in tab widget mode |
318 | * or null because all widgets are visible | 318 | * or null because all widgets are visible |
319 | */ | 319 | */ |
320 | QWidget* OSplitter::currentWidget() const | 320 | QWidget* OSplitter::currentWidget() const |
321 | { | 321 | { |
322 | if (m_tabWidget) | 322 | if (m_tabWidget) |
323 | return m_tabWidget->currentWidget(); | 323 | return m_tabWidget->currentWidget(); |
324 | else if (m_parentTab ) | 324 | else if (m_parentTab ) |
325 | return m_parentTab->currentWidget(); | 325 | return m_parentTab->currentWidget(); |
326 | 326 | ||