~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kstyles/oxygen/demo/oxygentabwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef oxygentabwidget_h
 
2
#define oxygentabwidget_h
 
3
 
 
4
//////////////////////////////////////////////////////////////////////////////
 
5
// oxygendemodialog.h
 
6
// oxygen demo dialog
 
7
// -------------------
 
8
//
 
9
// Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
 
10
//
 
11
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
12
// of this software and associated documentation files (the "Software"), to
 
13
// deal in the Software without restriction, including without limitation the
 
14
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 
15
// sell copies of the Software, and to permit persons to whom the Software is
 
16
// furnished to do so, subject to the following conditions:
 
17
//
 
18
// The above copyright notice and this permission notice shall be included in
 
19
// all copies or substantial portions of the Software.
 
20
//
 
21
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
22
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
23
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
24
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
25
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
26
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 
27
// IN THE SOFTWARE.
 
28
//////////////////////////////////////////////////////////////////////////////
 
29
 
 
30
#include <KTabWidget>
 
31
#include <KTabBar>
 
32
#include <KIcon>
 
33
 
 
34
namespace Oxygen
 
35
{
 
36
    class TabWidget: public KTabWidget
 
37
    {
 
38
 
 
39
        Q_OBJECT
 
40
 
 
41
        public:
 
42
 
 
43
        TabWidget( QWidget* parent ):
 
44
        KTabWidget( parent )
 
45
        {
 
46
 
 
47
            // make tabs movable, for further debugging
 
48
            tabBar()->setMovable( true );
 
49
 
 
50
        }
 
51
 
 
52
 
 
53
        void adjustTabBarSize( void )
 
54
        {  if( tabBar() ) tabBar()->adjustSize(); }
 
55
 
 
56
        //! show icons
 
57
        void showIcons( void )
 
58
        {
 
59
            // add icons to tabs
 
60
            tabBar()->setTabIcon( 0, KIcon( "document-open-folder" ) );
 
61
            tabBar()->setTabIcon( 1, KIcon( "document-open-folder" ) );
 
62
            tabBar()->setTabIcon( 2, KIcon( "document-open-folder" ) );
 
63
            tabBar()->setTabIcon( 3, KIcon( "document-open-folder" ) );
 
64
        }
 
65
 
 
66
        void hideIcons( void )
 
67
        {
 
68
            // add icons to tabs
 
69
            tabBar()->setTabIcon( 0, QIcon() );
 
70
            tabBar()->setTabIcon( 1, QIcon() );
 
71
            tabBar()->setTabIcon( 2, QIcon() );
 
72
            tabBar()->setTabIcon( 3, QIcon() );
 
73
        }
 
74
 
 
75
        void showText( void )
 
76
        {
 
77
            tabBar()->setTabText( 0, "First Tab" );
 
78
            tabBar()->setTabText( 1, "Second Tab" );
 
79
            tabBar()->setTabText( 2, "Third Tab" );
 
80
            tabBar()->setTabText( 3, "Fourth Tab" );
 
81
        }
 
82
 
 
83
        void hideText( void )
 
84
        {
 
85
            tabBar()->setTabText( 0, "" );
 
86
            tabBar()->setTabText( 1, "" );
 
87
            tabBar()->setTabText( 2, "" );
 
88
            tabBar()->setTabText( 3, "" );
 
89
        }
 
90
 
 
91
        public slots:
 
92
 
 
93
        // toggle tabbar visibility
 
94
        void toggleTabBarVisibility( bool value )
 
95
        { if( tabBar() ) tabBar()->setVisible( !value ); }
 
96
 
 
97
    };
 
98
 
 
99
}
 
100
 
 
101
#endif