Back to index

unity  6.0.0
UScreen.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 Canonical Ltd
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 3 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00015  *
00016  * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
00017  */
00018 
00019 #ifndef _UNITY_SCREEN_H_
00020 #define _UNITY_SCREEN_H_
00021 
00022 #include <gdk/gdk.h>
00023 #include <Nux/Nux.h>
00024 #include <sigc++/sigc++.h>
00025 #include <vector>
00026 
00027 #include <UnityCore/GLibSignal.h>
00028 #include <UnityCore/GLibSource.h>
00029 #include <UnityCore/GLibWrapper.h>
00030 #include <UnityCore/GLibDBusProxy.h>
00031 
00032 namespace unity
00033 {
00034 
00035 class UScreen : public sigc::trackable
00036 {
00037 public:
00038   UScreen();
00039   ~UScreen();
00040 
00041   static UScreen* GetDefault();
00042 
00043   int             GetPrimaryMonitor();
00044   int             GetMonitorWithMouse();
00045   int             GetMonitorAtPosition(int x, int y);
00046   nux::Geometry&  GetMonitorGeometry(int monitor);
00047 
00048   std::vector<nux::Geometry>& GetMonitors();
00049 
00050   // <void, primary_monitor, monitors>
00051   sigc::signal<void, int, std::vector<nux::Geometry>&> changed;
00052   sigc::signal<void> resuming;
00053 
00054 private:
00055   void Changed(GdkScreen* screen);
00056   void Refresh();
00057 
00058 private:
00059   std::vector<nux::Geometry> monitors_;
00060   glib::Object<GdkScreen> screen_;
00061   glib::DBusProxy proxy_;
00062   glib::Signal<void, GdkScreen*> size_changed_signal_;
00063   glib::Signal<void, GdkScreen*> monitors_changed_signal_;
00064   glib::Source::UniquePtr refresh_idle_;
00065   int primary_;
00066 };
00067 
00068 } // Namespace
00069 #endif // _UNITY_SCREEN_H_