kwin/tile.h

126 lines
2.6 KiB
C
Raw Normal View History

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2009 Nikhil Marathe <nsm.nikhil@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_TILE_H
#define KWIN_TILE_H
#include <QRect>
#include <QString>
namespace KWin
{
class Client;
class Workspace;
class Tile
2011-01-30 17:34:42 +03:00
{
public:
enum Direction {
Top,
Right,
Bottom,
Left
};
2011-01-30 17:34:42 +03:00
enum LayoutMode {
UseRatio, // uses m_ratio
UseGeometry, // uses current geometry of children
Equal // distribute equally
};
2011-01-30 17:34:42 +03:00
Tile(Client *c, const QRect& area);
Tile(const Tile& orig);
virtual ~Tile();
void setGeometry(const QRect& area);
void setGeometry(int x, int y, int w, int h);
2011-01-30 17:34:42 +03:00
void resize(const QRect area);
2011-01-30 17:34:42 +03:00
void restorePreviousGeometry();
2011-01-30 17:34:42 +03:00
void commit();
2011-01-30 17:34:42 +03:00
void focus();
2011-01-30 17:34:42 +03:00
// :| the float datatype interferes with naming
void floatTile();
void unfloatTile();
2011-01-30 17:34:42 +03:00
bool minimized() const;
bool floating() const;
bool ignoreGeometry() const;
QRect geometry() const;
Client* client() const;
2011-01-30 17:34:42 +03:00
void dumpTile(const QString& indent = "") const;
2011-01-30 17:34:42 +03:00
private:
2011-01-30 17:34:42 +03:00
// -------------
// PROPERTIES
// -------------
2011-01-30 17:34:42 +03:00
// our client
Client *m_client;
2011-01-30 17:34:42 +03:00
// tiled geometry
QRect m_geom;
// before tiling was enabled, if any
QRect m_prevGeom;
2011-01-30 17:34:42 +03:00
bool m_floating;
};
inline QRect Tile::geometry() const
2011-01-30 17:34:42 +03:00
{
return m_geom;
2011-01-30 17:34:42 +03:00
}
inline Client* Tile::client() const
2011-01-30 17:34:42 +03:00
{
return m_client;
2011-01-30 17:34:42 +03:00
}
inline bool Tile::floating() const
2011-01-30 17:34:42 +03:00
{
return m_floating;
2011-01-30 17:34:42 +03:00
}
/*
* should be respected by all geometry modifying methods.
* It returns true if the Tile is 'out' of the layout,
* due to being minimized, floating or for some other reason.
*/
inline bool Tile::ignoreGeometry() const
2011-01-30 17:34:42 +03:00
{
return minimized() || floating();
2011-01-30 17:34:42 +03:00
}
inline void Tile::setGeometry(const QRect& area)
2011-01-30 17:34:42 +03:00
{
setGeometry(area.x(), area.y(), area.width(), area.height());
2011-01-30 17:34:42 +03:00
}
} // namespace
#endif