Back to index

unity  6.0.0
ShortcutView.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: Andrea Azzarone <azzaronea@gmail.com>
00017  */
00018 
00019 #ifndef UNITYSHELL_SHORTCUTVIEW_H
00020 #define UNITYSHELL_SHORTCUTVIEW_H
00021 
00022 #include <Nux/Nux.h>
00023 #include <Nux/GridHLayout.h>
00024 #include <Nux/HLayout.h>
00025 #include <NuxCore/ObjectPtr.h>
00026 #include <NuxCore/Property.h>
00027 #include <Nux/StaticText.h>
00028 #include <Nux/View.h>
00029 #include <Nux/VLayout.h>
00030 
00031 #include "unity-shared/UnityWindowView.h"
00032 #include "unity-shared/BackgroundEffectHelper.h"
00033 #include "ShortcutModel.h"
00034 
00035 namespace unity
00036 {
00037 namespace shortcut
00038 {
00039 
00040 class View : public ui::UnityWindowView
00041 {
00042   NUX_DECLARE_OBJECT_TYPE(View, ui::UnityWindowView);
00043 public:
00044   typedef nux::ObjectPtr<View> Ptr;
00045 
00046   // Ctor and dtor
00047   View();
00048   ~View();
00049 
00050   // Public methods
00051   bool GetBaseGeometry(nux::Geometry&);
00052   void SetAdjustment(int x, int y);
00053   void SetModel(Model::Ptr model);
00054   Model::Ptr GetModel();
00055 
00056 protected:
00057   // Protected methods
00058   void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip);
00059   nux::Geometry GetBackgroundGeometry();
00060 
00061   // Introspectable methods
00062   std::string GetName() const;
00063 
00064 private:
00065   // Private methods
00066   nux::LinearLayout* CreateSectionLayout(const char* section_name);
00067   nux::View* CreateShortKeyEntryView(AbstractHint::Ptr const& hint);
00068   nux::LinearLayout* CreateIntermediateLayout();
00069 
00070   void RenderColumns();
00071 
00072   // Private members
00073   Model::Ptr model_;
00074 
00075   nux::VLayout* layout_;
00076   nux::HLayout* columns_layout_;
00077   std::vector<nux::VLayout*> columns_;
00078 
00079   int x_adjustment_;
00080   int y_adjustment_;
00081 };
00082 
00083 } // namespace shortcut
00084 
00085 } // namespace unity
00086 
00087 #endif // UNITYSHELL_SHORTCUTVIEW_H
00088