Back to index

unity  6.0.0
LensBarIcon.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_LENS_BAR_ICON_H_
00020 #define UNITY_LENS_BAR_ICON_H_
00021 
00022 #include <string>
00023 
00024 #include <NuxGraphics/GraphicsEngine.h>
00025 #include <Nux/Nux.h>
00026 #include <Nux/HLayout.h>
00027 #include <Nux/View.h>
00028 
00029 #include "unity-shared/IconTexture.h"
00030 
00031 namespace unity
00032 {
00033 namespace dash
00034 {
00035 
00036 class LensBarIcon : public IconTexture
00037 {
00038   NUX_DECLARE_OBJECT_TYPE(LensBarIcon, IconTexture);
00039 public:
00040   LensBarIcon(std::string id, std::string icon_hint);
00041   ~LensBarIcon();
00042 
00043   nux::Property<std::string> id;
00044   nux::Property<bool> active;
00045 
00046 private:
00047   void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
00048   void OnActiveChanged(bool is_active);
00049 
00050   // Introspectable
00051   std::string GetName() const;
00052   void AddProperties(GVariantBuilder* builder);
00053 
00054 private:
00055   typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
00056 
00057   const float inactive_opacity_;
00058   LayerPtr focus_layer_;
00059 };
00060 
00061 }
00062 }
00063 #endif