Back to index

unity  6.0.0
UnityWindowView.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2012 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  */
00019 
00020 #ifndef UNITYWINDOWVIEW_H
00021 #define UNITYWINDOWVIEW_H
00022 
00023 #include "unity-shared/BackgroundEffectHelper.h"
00024 #include "Introspectable.h"
00025 #include "UnityWindowStyle.h"
00026 #include <sigc++/sigc++.h>
00027 
00028 #include <Nux/Nux.h>
00029 #include <Nux/View.h>
00030 #include <NuxCore/ObjectPtr.h>
00031 #include <NuxCore/Property.h>
00032 
00033 namespace unity {
00034 namespace ui {
00035 
00036 class UnityWindowView : public debug::Introspectable, public nux::View
00037 {
00038   NUX_DECLARE_OBJECT_TYPE(UnityWindowView, nux::View)  
00039 public:
00040   nux::Property<nux::Color> background_color;
00041   nux::Property<UnityWindowStyle::Ptr> style;
00042 
00043   UnityWindowView(NUX_FILE_LINE_PROTO);
00044   virtual ~UnityWindowView();
00045 
00046   void SetupBackground(bool enabled = true);
00047 
00048 protected:
00049   void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
00050   void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
00051 
00052   virtual void PreDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {};
00053   virtual void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip) = 0;
00054   virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {};
00055   virtual nux::Geometry GetBackgroundGeometry() = 0;
00056 
00057   // Introspectable methods
00058   std::string GetName() const;
00059   void AddProperties(GVariantBuilder* builder);
00060 
00061 private:
00062   void DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo);
00063 
00064   BackgroundEffectHelper bg_helper_;
00065   nux::ObjectPtr<nux::IOpenGLBaseTexture> bg_texture_;
00066 };
00067 
00068 }
00069 }
00070 
00071 #endif