kwin.h

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1999 Matthias Ettrich (ettrich@kde.org)
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 #ifndef KWIN_H
00020 #define KWIN_H
00021 
00022 #include <sys/types.h>
00023 #include <qwindowdefs.h>
00024 #include <qstring.h>
00025 #include <qpixmap.h>
00026 #include "kdelibs_export.h"
00027 
00028 #ifdef Q_OS_UNIX
00029 
00030 #include <netwm_def.h>
00031 class NETWinInfo;
00032 
00061 class KDECORE_EXPORT KWin
00062 {
00063 public:
00064 
00092     static void activateWindow( WId win, long time = 0 );
00093 
00108     static void forceActiveWindow( WId win, long time = 0 );
00113     static void setActiveWindow( WId win ) KDE_DEPRECATED;
00114 
00126     static void demandAttention( WId win, bool set = true );
00127 
00138     static void setUserTime( WId win, long time );
00139 
00143     static void invokeContextHelp();
00144 
00145 
00159     static void setMainWindow( QWidget* subwindow, WId mainwindow );
00160 
00170     static void setSystemTrayWindowFor( WId trayWin, WId forWin );
00171 
00172     class WindowInfo;
00173     class WindowInfoPrivate;
00187     static WindowInfo windowInfo( WId win, unsigned long properties = 0, unsigned long properties2 = 0 );
00188 
00196     static WId transientFor( WId window );
00197 
00203     static WId groupLeader( WId window );
00204 
00221     static QPixmap icon( WId win, int width = -1, int height = -1, bool scale = false );
00222 
00231     enum IconSource { NETWM = 1, 
00232               WMHints = 2, 
00233               ClassHint = 4, 
00234               XApp = 8 
00235     };
00251     static QPixmap icon( WId win, int width, int height, bool scale, int flags );
00252 
00259     static void  setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon );
00260 
00267     static void setType( WId win, NET::WindowType windowType );
00268 
00280     static void setState( WId win, unsigned long state );
00281 
00293     static void clearState( WId win, unsigned long  state );
00294     
00305     static void setOpacity( WId win, uint percent );
00306     
00317     static void setShadowSize( WId win, uint percent );
00318 
00327     static void setOnAllDesktops( WId win, bool b );
00328 
00335     static void setOnDesktop( WId win, int desktop);
00336 
00358     static void setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00359         int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00360         int bottom_width, int bottom_start, int bottom_end );
00361 
00372     static void setStrut( WId win, int left, int right, int top, int bottom );
00377     static int currentDesktop();
00378 
00384     static int numberOfDesktops();
00385 
00391     static void setCurrentDesktop( int desktop );
00392 
00400     static void setCurrentDesktopViewport( int desktop, QPoint viewport );
00401 
00410     static void iconifyWindow( WId win, bool animation = true  );
00411 
00420     static void deIconifyWindow( WId win, bool animation = true );
00421 
00429     static void raiseWindow( WId win );
00430 
00438     static void lowerWindow( WId win );
00439 
00445     static bool icccmCompliantMappingState();
00446 
00451     static bool allowedActionsSupported();
00452 
00458     static QString readNameProperty( WId window, unsigned long atom );
00459 
00463     struct KDECORE_EXPORT Info
00464     {
00466     WId win;
00468     long unsigned int state;
00470     bool isMinimized() const;
00471     bool isIconified() const;
00472     NET::MappingState mappingState;
00474     NETStrut strut;
00476     NET::WindowType windowType;
00478     QString visibleName;
00480     QString name;
00482     int desktop;
00484     bool onAllDesktops;
00486     pid_t pid;
00488     QRect geometry;
00490     QRect frameGeometry;
00491 
00492     QString visibleNameWithState() const;
00493     };
00494 
00499     static Info info( WId win ) KDE_DEPRECATED;
00500 
00501 #ifdef KDE_NO_COMPAT
00502 private:
00503 #endif
00504 
00508     static void appStarted() KDE_DEPRECATED;
00509 };
00510 
00511 
00516 class KDECORE_EXPORT KWin::WindowInfo
00517 {
00518 public:
00522     WindowInfo( WId window, unsigned long properties, unsigned long properties2 );
00523     WindowInfo(); // to make QValueList and others happy
00524     ~WindowInfo();
00531     bool valid( bool withdrawn_is_valid = false ) const;
00535     WId win() const;
00540     unsigned long state() const;
00546     bool hasState( unsigned long s ) const { return ( state() & s ) == s; }
00554     bool isMinimized() const;
00561     NET::MappingState mappingState() const;
00566     NETExtendedStrut extendedStrut() const;
00572     NETStrut strut() const;
00578     NET::WindowType windowType( int supported_types ) const;
00584     QString visibleName() const;
00594     QString visibleNameWithState() const;
00600     QString name() const;
00607     QString visibleIconName() const;
00618     QString visibleIconNameWithState() const;
00625     QString iconName() const;
00630     bool isOnCurrentDesktop() const;
00635     bool isOnDesktop( int desktop ) const;
00641     bool onAllDesktops() const;
00647     int desktop() const;
00652     QRect geometry() const;
00657     QRect frameGeometry() const;
00663     WId transientFor() const;
00668     WId groupLeader() const;
00669 
00676     QCString windowClassClass() const;
00677 
00684     QCString windowClassName() const;
00685 
00691     QCString windowRole() const;
00692 
00698     QCString clientMachine() const;
00699 
00705     bool actionSupported( NET::Action action ) const;
00706 
00707     WindowInfo( const WindowInfo& );
00708     WindowInfo& operator=( const WindowInfo& );
00709 private:
00710     WindowInfoPrivate* d;
00711 };
00712 
00713 #endif //Q_OS_UNIX
00714 
00715 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys