Back to index

unity  6.0.0
window.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2012 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as published
00006  * by the  Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * version 3 along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>
00016  *
00017  * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
00018  *
00019  */
00020 
00021 #ifndef COMPIZ_WINDOW_MOCK_H
00022 #define COMPIZ_WINDOW_MOCK_H
00023 
00024 /* The real CompWindow */
00025 #include <core/window.h>
00026 
00027 class CompWindowMock {
00028 public:
00029   CompWindowMock() : _moved(false), _maximize_count(0), _maximize_state(0) {}
00030 
00031   int x() const {return _geometry.x();}
00032   int y() const {return _geometry.y();}
00033   int width() const {return _geometry.width() + (_geometry.border()*2);}
00034   int height() const {return _geometry.height() + (_geometry.border()*2);}
00035 
00036   void move(int dx, int dy, bool immediate = true) {
00037     _moved = true;
00038     _movement_x = dx;
00039     _movement_y = dy;
00040   }
00041 
00042   unsigned int actions () {return _actions;}
00043 
00044   void maximize(int state) {++_maximize_count; _maximize_state = state;}
00045 
00046   /* OBS: I wonder why it returns a reference */
00047   unsigned int &state() {return _state;}
00048 
00049   void grabNotify(int x, int y, unsigned int state, unsigned int mask) {}
00050   void ungrabNotify() {}
00051 
00052   void syncPosition() {}
00053 
00054   compiz::window::Geometry &serverGeometry() {return _serverGeometry;}
00055 
00056   unsigned int _actions;
00057   unsigned int _state;
00058   compiz::window::Geometry _serverGeometry;
00059   compiz::window::Geometry _geometry;
00060 
00061   bool _moved;
00062   int _movement_x;
00063   int _movement_y;
00064 
00065   int _maximize_count;
00066   int _maximize_state;
00067 };
00068 
00069 #endif