Back to index

unity  6.0.0
LauncherController.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2010 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: Jason Smith <jason.smith@canonical.com>
00018  *              Tim Penhey <tim.penhey@canonical.com>
00019  */
00020 
00021 #ifndef LAUNCHERCONTROLLER_H
00022 #define LAUNCHERCONTROLLER_H
00023 
00024 #include <memory>
00025 #include <vector>
00026 #include <sigc++/sigc++.h>
00027 
00028 #include "LauncherOptions.h"
00029 #include "SoftwareCenterLauncherIcon.h"
00030 
00031 namespace unity
00032 {
00033 namespace launcher
00034 {
00035 class AbstractLauncherIcon;
00036 class Launcher;
00037 class LauncherModel;
00038 
00039 class Controller : public unity::debug::Introspectable, public sigc::trackable
00040 {
00041 public:
00042   typedef std::shared_ptr<Controller> Ptr;
00043   typedef std::vector<nux::ObjectPtr<Launcher> > LauncherList;
00044 
00045   nux::Property<Options::Ptr> options;
00046   nux::Property<bool> multiple_launchers;
00047 
00048   Controller(Display* display);
00049   ~Controller();
00050 
00051   Launcher& launcher() const;
00052   LauncherList& launchers() const;
00053   Window LauncherWindowId(int launcher) const;
00054   Window KeyNavLauncherInputWindowId() const;
00055 
00056   void UpdateNumWorkspaces(int workspaces);
00057   std::vector<char> GetAllShortcuts() const;
00058   std::vector<AbstractLauncherIcon::Ptr> GetAltTabIcons(bool current) const;
00059 
00060   void PushToFront();
00061 
00062   void SetShowDesktopIcon(bool show_desktop_icon);
00063 
00064   bool AboutToShowDash(int was_tap, int when) const;
00065 
00066   void HandleLauncherKeyPress(int when);
00067   void HandleLauncherKeyRelease(bool was_tap, int when);
00068   bool HandleLauncherKeyEvent(Display *display,
00069                               unsigned int key_sym,
00070                               unsigned long key_code,
00071                               unsigned long key_state,
00072                               char* key_string);
00073 
00074   void KeyNavActivate();
00075   void KeyNavGrab();
00076   void KeyNavTerminate(bool activate = true);
00077   void KeyNavNext();
00078   void KeyNavPrevious();
00079   bool KeyNavIsActive() const;
00080 
00081   bool IsOverlayOpen() const;
00082 
00083 protected:
00084   // Introspectable methods
00085   std::string GetName() const;
00086   void AddProperties(GVariantBuilder* builder);
00087 
00088 private:
00089   class Impl;
00090   std::unique_ptr<Impl> pimpl;
00091 };
00092 
00093 }
00094 }
00095 
00096 #endif // LAUNCHERCONTROLLER_H