author | drw <drw> | 2005-03-01 00:16:32 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-01 00:16:32 (UTC) |
commit | 73faad9d936d5af7a331411a9572fd362907e023 (patch) (side-by-side diff) | |
tree | aaa2b212906baba1b5c25d772b9a181f52f05284 | |
parent | 2daad674b92c1fd94b0260a15f0baa732e5db20e (diff) | |
download | opie-73faad9d936d5af7a331411a9572fd362907e023.zip opie-73faad9d936d5af7a331411a9572fd362907e023.tar.gz opie-73faad9d936d5af7a331411a9572fd362907e023.tar.bz2 |
Provide initial values for tab bar style & position
-rw-r--r-- | libopie2/opieui/otabwidget.cpp | 2 |
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,144 +1,146 @@ /* This file is part of the Opie Project Copyright (c) 2002, 2005 Dan Williams <drw@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <opie2/otabwidget.h> /* OPIE */ #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/resource.h> #include <opie2/otabbar.h> /* QT */ #include <qcombobox.h> #include <qwidgetstack.h> using namespace Opie::Ui; OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) : QWidget( parent, name ) , m_currTab( 0l ) + , m_tabBarStyle( Global ) + , m_tabBarPosition( Top ) , m_usingTabs( true ) , m_tabBar( 0l ) , m_tabList( 0l ) { if ( s == Global ) { // Read Opie global settings for style and position Config config( "qpe" ); config.setGroup( "Appearance" ); // Style s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); if ( s <= Global || s > IconList) s = IconTab; // Position ( config.readEntry( "TabPosition", "Top" ) == "Bottom" ) ? p = Bottom : p = Top; } // Initialize widget stack for tab widgets m_widgetStack = new QWidgetStack( this ); m_widgetStack->setFrameStyle( QFrame::NoFrame ); m_widgetStack->setLineWidth( style().defaultFrameWidth() ); // Set initial selector control style and position setTabStyle( s ); setTabPosition( p ); } OTabWidget::~OTabWidget() { m_tabs.setAutoDelete( true ); m_tabs.clear(); } void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) { int tabid = -1; if ( m_usingTabs ) { // Create new tab in tab bar QTab *tab = new QTab(); // Set label (and icon if necessary) if ( m_tabBarStyle == IconTab ) { tab->label = QString::null; tab->iconset = new QIconSet( loadSmooth( icon ) ); } else tab->label = label; tabid = m_tabBar->addTab( tab ); } else { // Insert entry (with icon if necessary) into drop down list if ( m_tabBarStyle == IconList ) m_tabList->insertItem( loadSmooth( icon ), label, -1 ); else m_tabList->insertItem( label ); } // Add widget to stack m_widgetStack->addWidget( child, tabid ); m_widgetStack->raiseWidget( child ); m_widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); // Keep track of tab information OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); m_tabs.append( tabinfo ); // Make newly added tab the current one displayed selectTab( tabinfo ); } void OTabWidget::removePage( QWidget *childwidget ) { if ( childwidget ) { // Find tab information for desired widget OTabInfo *tab = m_tabs.first(); while ( tab && tab->control() != childwidget ) tab = m_tabs.next(); if ( tab && tab->control() == childwidget ) { if ( m_usingTabs ) { // Remove tab from tab bar m_tabBar->setTabEnabled( tab->id(), false ); m_tabBar->removeTab( m_tabBar->tab( tab->id() ) ); } else |