Back to index

unity  6.0.0
ResultView.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright 2011 Canonical Ltd.
00004  *
00005  * This program is free software: you can redistribute it and/or modify it
00006  * under the terms of the GNU Lesser 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, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License version 3 along with this program.  If not, see
00017  * <http://www.gnu.org/licenses/>
00018  *
00019  * Authored by: Gordon Allott <gord.allott@canonical.com>
00020  *
00021  */
00022 
00023 #ifndef RESULTVIEW_H
00024 #define RESULTVIEW_H
00025 
00026 #include <Nux/Nux.h>
00027 #include <Nux/View.h>
00028 #include <dee.h>
00029 
00030 #include <UnityCore/GLibSignal.h>
00031 #include <UnityCore/Results.h>
00032 
00033 #include "unity-shared/Introspectable.h"
00034 #include "ResultRenderer.h"
00035 
00036 namespace unity
00037 {
00038 namespace dash
00039 {
00040 class ResultView : public nux::View, public debug::Introspectable
00041 {
00042 public:
00043   NUX_DECLARE_OBJECT_TYPE(ResultView, nux::View);
00044 
00045   typedef std::vector<Result> ResultList;
00046 
00047   ResultView(NUX_FILE_LINE_DECL);
00048   virtual ~ResultView();
00049 
00050   void SetModelRenderer(ResultRenderer* renderer);
00051 
00052   void AddResult(Result& result);
00053   void RemoveResult(Result& result);
00054 
00055   ResultList GetResultList ();
00056 
00057   nux::Property<bool> expanded;
00058   nux::Property<int> results_per_row;
00059 
00060   sigc::signal<void, std::string const&> UriActivated;
00061 
00062   std::string GetName() const;
00063   void AddProperties(GVariantBuilder* builder);
00064   IntrospectableList GetIntrospectableChildren();
00065 
00066 protected:
00067   virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
00068   virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
00069   virtual long ComputeContentSize();
00070 
00071   // properties
00072   ResultRenderer* renderer_;
00073   ResultList results_;
00074   IntrospectableList introspectable_children_;
00075 
00076 private:
00077   void ClearIntrospectableWrappers();
00078 };
00079 
00080 }
00081 }
00082 
00083 #endif //RESULTVIEW_H