Back to index

unity  6.0.0
Filters.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2011 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: Neil Jagdish Patel <neil.patel@canonical.com>
00018  */
00019 
00020 #ifndef UNITY_FILTERS_H
00021 #define UNITY_FILTERS_H
00022 
00023 #include <memory>
00024 #include <map>
00025 
00026 #include "Model.h"
00027 #include "Filter.h"
00028 
00029 namespace unity
00030 {
00031 namespace dash
00032 {
00033 
00034 class FilterAdaptor : public RowAdaptorBase
00035 {
00036 public:
00037   FilterAdaptor(DeeModel* model, DeeModelIter* iter, DeeModelTag* tag);
00038   FilterAdaptor(FilterAdaptor const&);
00039 
00040   nux::ROProperty<std::string> renderer_name;
00041 
00042   DeeModel* model() const;
00043   DeeModelIter* iter() const;
00044 };
00045 
00046 
00047 class Filters : public Model<FilterAdaptor>
00048 {
00049 public:
00050   typedef std::shared_ptr<Filters> Ptr;
00051   typedef std::map<DeeModelIter*, Filter::Ptr> FilterMap;
00052 
00053   Filters();
00054   Filters(ModelType model_type);
00055   ~Filters();
00056 
00057   Filter::Ptr FilterAtIndex(std::size_t index);
00058 
00059   sigc::signal<void, Filter::Ptr> filter_added;
00060   sigc::signal<void, Filter::Ptr> filter_changed;
00061   sigc::signal<void, Filter::Ptr> filter_removed;
00062 
00063   /* There will be added/changed/removed signals here when we have that working */
00064 private:
00065   void OnRowAdded(FilterAdaptor& filter);
00066   void OnRowChanged(FilterAdaptor& filter);
00067   void OnRowRemoved(FilterAdaptor& filter);
00068 
00069   FilterMap filter_map_;
00070 };
00071 
00072 
00073 }
00074 }
00075 
00076 #endif