• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

ktogglefullscreenaction.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
00003               (C) 1999 Simon Hausmann <hausmann@kde.org>
00004               (C) 2000 Nicolas Hadacek <haadcek@kde.org>
00005               (C) 2000 Kurt Granroth <granroth@kde.org>
00006               (C) 2000 Michael Koch <koch@kde.org>
00007               (C) 2001 Holger Freyther <freyther@kde.org>
00008               (C) 2002 Ellis Whitehead <ellis@kde.org>
00009               (C) 2002 Joseph Wenninger <jowenn@kde.org>
00010               (C) 2003 Andras Mantia <amantia@kde.org>
00011               (C) 2005-2006 Hamish Rodda <rodda@kde.org>
00012 
00013     This library is free software; you can redistribute it and/or
00014     modify it under the terms of the GNU Library General Public
00015     License version 2 as published by the Free Software Foundation.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Library General Public License for more details.
00021 
00022     You should have received a copy of the GNU Library General Public License
00023     along with this library; see the file COPYING.LIB.  If not, write to
00024     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00025     Boston, MA 02110-1301, USA.
00026 */
00027 
00028 #include "ktogglefullscreenaction.h"
00029 
00030 #include <QtCore/QEvent>
00031 
00032 #include <kdebug.h>
00033 #include <kicon.h>
00034 #include <klocale.h>
00035 
00036 class KToggleFullScreenAction::Private
00037 {
00038 public:
00039     Private()
00040         : window( 0 )
00041     {
00042     }
00043 
00044     QWidget* window;
00045 };
00046 
00047 KToggleFullScreenAction::KToggleFullScreenAction( QObject *parent )
00048   : KToggleAction( KIcon( "view-fullscreen" ), i18n( "F&ull Screen Mode" ), parent ),
00049     d( new Private )
00050 {
00051     setIconText( i18n( "Full Screen" ) );
00052 }
00053 
00054 KToggleFullScreenAction::KToggleFullScreenAction( QWidget *window, QObject *parent )
00055   : KToggleAction( KIcon( "view-fullscreen" ), i18n( "F&ull Screen Mode" ), parent ),
00056     d( new Private )
00057 {
00058     setIconText( i18n( "Full Screen" ) );
00059     setWindow( window );
00060 }
00061 
00062 KToggleFullScreenAction::~KToggleFullScreenAction()
00063 {
00064   delete d;
00065 }
00066 
00067 void KToggleFullScreenAction::setWindow( QWidget* window )
00068 {
00069   if ( d->window )
00070     d->window->removeEventFilter( this );
00071 
00072   d->window = window;
00073 
00074   if ( d->window )
00075     d->window->installEventFilter( this );
00076 }
00077 
00078 void KToggleFullScreenAction::slotToggled( bool checked )
00079 {
00080   if ( checked ) {
00081     setText( i18n( "Exit F&ull Screen Mode" ) );
00082     setIconText( i18n( "Exit Full Screen" ) );
00083     setIcon( KIcon( "view-restore" ) );
00084   } else {
00085     setText( i18n( "F&ull Screen Mode" ) );
00086     setIconText( i18n( "Full Screen" ) );
00087     setIcon( KIcon( "view-fullscreen" ) );
00088   }
00089 
00090   KToggleAction::slotToggled( checked );
00091 }
00092 
00093 bool KToggleFullScreenAction::eventFilter( QObject* object, QEvent* event )
00094 {
00095   if ( object == d->window )
00096     if ( event->type() == QEvent::WindowStateChange ) {
00097       if ( d->window->isFullScreen() != isChecked() )
00098         activate( QAction::Trigger );
00099     }
00100 
00101   return false;
00102 }
00103 
00104 void KToggleFullScreenAction::setFullScreen( QWidget* window, bool set )
00105 {
00106   if( set )
00107     window->setWindowState( window->windowState() | Qt::WindowFullScreen );
00108   else
00109     window->setWindowState( window->windowState() & ~Qt::WindowFullScreen );
00110 }
00111 
00112 #include "ktogglefullscreenaction.moc"

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal