placement.h

00001 /*****************************************************************
00002  KWin - the KDE window manager
00003  This file is part of the KDE project.
00004 
00005 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
00006 Copyright (C) 1997 to 2002 Cristian Tibirna <tibirna@kde.org>
00007 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
00008 
00009 You can Freely distribute this program under the GNU General Public
00010 License. See the file "COPYING" for the exact licensing terms.
00011 ******************************************************************/
00012 
00013 #ifndef KWIN_PLACEMENT_H
00014 #define KWIN_PLACEMENT_H
00015 
00016 #include <qpoint.h>
00017 #include <qvaluelist.h>
00018 
00019 namespace KWinInternal
00020 {
00021 
00022 class Workspace;
00023 class Client;
00024 
00025 class Placement
00026     {
00027     public:
00028 
00029         Placement(Workspace* w);
00030 
00037         enum Policy
00038             {
00039             NoPlacement, // not really a placement
00040             Default, // special, means to use the global default
00041             Unknown, // special, means the function should use its default
00042             Random,
00043             Smart,
00044             Cascade,
00045             Centered,
00046             ZeroCornered,
00047             UnderMouse, // special
00048             OnMainWindow, // special
00049             Maximizing
00050             };
00051 
00052         void place(Client* c, QRect& area );
00053         
00054         void placeAtRandom            (Client* c, const QRect& area, Policy next = Unknown );
00055         void placeCascaded            (Client* c, QRect& area, Policy next = Unknown );
00056         void placeSmart               (Client* c, const QRect& area, Policy next = Unknown );
00057         void placeMaximizing          (Client* c, QRect& area, Policy next = Unknown );
00058         void placeCentered    (Client* c, const QRect& area, Policy next = Unknown );
00059         void placeZeroCornered(Client* c, const QRect& area, Policy next = Unknown );
00060         void placeDialog      (Client* c, QRect& area, Policy next = Unknown );
00061         void placeUtility     (Client* c, QRect& area, Policy next = Unknown );
00062 
00063         void reinitCascading( int desktop );
00064 
00065         static Policy policyFromString( const QString& policy, bool no_special );
00066         static const char* policyToString( Policy policy );
00067 
00068     private:
00069 
00070         void place(Client* c, QRect& area, Policy policy, Policy nextPlacement = Unknown );
00071         void placeUnderMouse(Client* c, QRect& area, Policy next = Unknown );
00072         void placeOnMainWindow(Client* c, QRect& area, Policy next = Unknown );
00073         QRect checkArea( const Client*c, const QRect& area );
00074 
00075         Placement();
00076 
00077     //CT needed for cascading+
00078         struct DesktopCascadingInfo 
00079             {
00080             QPoint pos;
00081             int col;
00082             int row;
00083             };
00084 
00085         QValueList<DesktopCascadingInfo> cci;
00086 
00087         Workspace* m_WorkspacePtr;
00088     };
00089 
00090 } // namespace
00091 
00092 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys