summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otabwidget.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index 01747e1..ae396b9 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -1,112 +1,114 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 3
4 Copyright (c) 2002, 2005 Dan Williams <drw@handhelds.org> 4 Copyright (c) 2002, 2005 Dan Williams <drw@handhelds.org>
5 =. 5 =.
6 .=l. 6 .=l.
7 .>+-= 7 .>+-=
8_;:, .> :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_, > . <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i, .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12- . .-<_> .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13 ._= =} : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14 .%`+i> _;_. 14 .%`+i> _;_.
15 .i_,=:_. -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17 : .. .:, . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.= = ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++= -. .` .: details. 21++= -. .` .: details.
22: = ...= . :.=- 22: = ...= . :.=-
23-. .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24 -_. . . )=. = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25 -- :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include <opie2/otabwidget.h> 32#include <opie2/otabwidget.h>
33 33
34/* OPIE */ 34/* OPIE */
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#include <opie2/otabbar.h> 38#include <opie2/otabbar.h>
39 39
40/* QT */ 40/* QT */
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qwidgetstack.h> 42#include <qwidgetstack.h>
43 43
44using namespace Opie::Ui; 44using namespace Opie::Ui;
45 45
46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
47 : QWidget( parent, name ) 47 : QWidget( parent, name )
48 , m_currTab( 0l ) 48 , m_currTab( 0l )
49 , m_tabBarStyle( Global )
50 , m_tabBarPosition( Top )
49 , m_usingTabs( true ) 51 , m_usingTabs( true )
50 , m_tabBar( 0l ) 52 , m_tabBar( 0l )
51 , m_tabList( 0l ) 53 , m_tabList( 0l )
52{ 54{
53 if ( s == Global ) 55 if ( s == Global )
54 { 56 {
55 // Read Opie global settings for style and position 57 // Read Opie global settings for style and position
56 Config config( "qpe" ); 58 Config config( "qpe" );
57 config.setGroup( "Appearance" ); 59 config.setGroup( "Appearance" );
58 60
59 // Style 61 // Style
60 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 62 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
61 if ( s <= Global || s > IconList) 63 if ( s <= Global || s > IconList)
62 s = IconTab; 64 s = IconTab;
63 65
64 // Position 66 // Position
65 ( config.readEntry( "TabPosition", "Top" ) == "Bottom" ) ? p = Bottom 67 ( config.readEntry( "TabPosition", "Top" ) == "Bottom" ) ? p = Bottom
66 : p = Top; 68 : p = Top;
67 } 69 }
68 70
69 // Initialize widget stack for tab widgets 71 // Initialize widget stack for tab widgets
70 m_widgetStack = new QWidgetStack( this ); 72 m_widgetStack = new QWidgetStack( this );
71 m_widgetStack->setFrameStyle( QFrame::NoFrame ); 73 m_widgetStack->setFrameStyle( QFrame::NoFrame );
72 m_widgetStack->setLineWidth( style().defaultFrameWidth() ); 74 m_widgetStack->setLineWidth( style().defaultFrameWidth() );
73 75
74 // Set initial selector control style and position 76 // Set initial selector control style and position
75 setTabStyle( s ); 77 setTabStyle( s );
76 setTabPosition( p ); 78 setTabPosition( p );
77} 79}
78 80
79OTabWidget::~OTabWidget() 81OTabWidget::~OTabWidget()
80{ 82{
81 m_tabs.setAutoDelete( true ); 83 m_tabs.setAutoDelete( true );
82 m_tabs.clear(); 84 m_tabs.clear();
83} 85}
84 86
85void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) 87void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
86{ 88{
87 int tabid = -1; 89 int tabid = -1;
88 90
89 if ( m_usingTabs ) 91 if ( m_usingTabs )
90 { 92 {
91 // Create new tab in tab bar 93 // Create new tab in tab bar
92 QTab *tab = new QTab(); 94 QTab *tab = new QTab();
93 95
94 // Set label (and icon if necessary) 96 // Set label (and icon if necessary)
95 if ( m_tabBarStyle == IconTab ) 97 if ( m_tabBarStyle == IconTab )
96 { 98 {
97 tab->label = QString::null; 99 tab->label = QString::null;
98 tab->iconset = new QIconSet( loadSmooth( icon ) ); 100 tab->iconset = new QIconSet( loadSmooth( icon ) );
99 } 101 }
100 else 102 else
101 tab->label = label; 103 tab->label = label;
102 104
103 tabid = m_tabBar->addTab( tab ); 105 tabid = m_tabBar->addTab( tab );
104 } 106 }
105 else 107 else
106 { 108 {
107 // Insert entry (with icon if necessary) into drop down list 109 // Insert entry (with icon if necessary) into drop down list
108 if ( m_tabBarStyle == IconList ) 110 if ( m_tabBarStyle == IconList )
109 m_tabList->insertItem( loadSmooth( icon ), label, -1 ); 111 m_tabList->insertItem( loadSmooth( icon ), label, -1 );
110 else 112 else
111 m_tabList->insertItem( label ); 113 m_tabList->insertItem( label );
112 } 114 }