Back to index

unity  6.0.0
LensBar.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 UNITYSHELL_LENS_BAR_H
00020 #define UNITYSHELL_LENS_BAR_H
00021 
00022 #include <memory>
00023 #include <string>
00024 #include <vector>
00025 
00026 #include <NuxGraphics/GraphicsEngine.h>
00027 #include <Nux/Nux.h>
00028 #include <Nux/HLayout.h>
00029 #include <Nux/View.h>
00030 #include <UnityCore/Lens.h>
00031 
00032 #include "unity-shared/IconTexture.h"
00033 #include "unity-shared/Introspectable.h"
00034 #include "LensBarIcon.h"
00035 
00036 namespace nux
00037 {
00038 class AbstractPaintLayer;
00039 }
00040 
00041 namespace unity
00042 {
00043 namespace dash
00044 {
00045 
00046 class LensBar : public nux::View, public unity::debug::Introspectable
00047 {
00048   NUX_DECLARE_OBJECT_TYPE(LensBar, nux::View);
00049   typedef std::vector<LensBarIcon*> LensIcons;
00050 
00051 public:
00052   LensBar();
00053 
00054   void AddLens(Lens::Ptr& lens);
00055   void Activate(std::string id);
00056   void ActivateNext();
00057   void ActivatePrevious();
00058 
00059   sigc::signal<void, std::string const&> lens_activated;
00060 
00061 private:
00062   void SetupBackground();
00063   void SetupLayout();
00064   void SetupHomeLens();
00065 
00066   void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
00067   void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
00068 
00069   void SetActive(LensBarIcon* icon);
00070 
00071   bool AcceptKeyNavFocus();
00072   std::string GetName() const;
00073   void AddProperties(GVariantBuilder* builder);
00074 
00075 private:
00076   std::string GetActiveLensId() const;
00077   typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
00078 
00079   LensIcons icons_;
00080 
00081   nux::HLayout* layout_;
00082   LayerPtr bg_layer_;
00083 };
00084 
00085 } // namespace dash
00086 } // namespace unity
00087 
00088 #endif // UNITYSHELL_LENS_BAR_H