Back to index

unity  6.0.0
LauncherHoverMachine.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2011 Canonical Ltd
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  *
00009  * This program 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
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  *
00017  * Authored by: Didier Roche <didrocks@ubuntu.com>
00018  */
00019 
00020 #ifndef LAUNCHERHOVERMACHINE
00021 #define LAUNCHERHOVERMACHINE
00022 
00023 #include <UnityCore/GLibSource.h>
00024 
00025 namespace unity
00026 {
00027 
00028 class LauncherHoverMachine : public sigc::trackable
00029 {
00030 public:
00031 
00032   typedef enum
00033   {
00034     DEFAULT                = 0,
00035     LAUNCHER_HIDDEN        = 1 << 0,
00036     MOUSE_OVER_LAUNCHER    = 1 << 1,
00037     MOUSE_OVER_BFB         = 1 << 2,
00038     SHORTCUT_KEYS_VISIBLE  = 1 << 3,
00039     QUICKLIST_OPEN         = 1 << 4,
00040     KEY_NAV_ACTIVE         = 1 << 5,
00041     LAUNCHER_IN_ACTION     = 1 << 6,
00042     PLACES_VISIBLE         = 1 << 7,
00043   } HoverQuirk;
00044 
00045   LauncherHoverMachine();
00046 
00047   void SetQuirk(HoverQuirk quirk, bool active);
00048   bool GetQuirk(HoverQuirk quirk, bool allow_partial = true);
00049 
00050   sigc::signal<void, bool> should_hover_changed;
00051 
00052   std::string DebugHoverQuirks();
00053 
00054 private:
00055   void EnsureHoverState();
00056   void SetShouldHover(bool value);
00057   bool EmitShouldHoverChanged();
00058 
00059   bool       _should_hover;
00060   bool       _latest_emit_should_hover;
00061   HoverQuirk _quirks;
00062 
00063   glib::Source::UniquePtr _hover_changed_emit_idle;
00064 };
00065 
00066 } // unity namespace
00067 
00068 #endif