Back to index

unity  6.0.0
Category.cpp
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 #include "Category.h"
00021 
00022 #include <sigc++/bind.h>
00023 
00024 namespace unity
00025 {
00026 namespace dash
00027 {
00028 
00029 Category::Category(DeeModel* model,
00030                    DeeModelIter* iter,
00031                    DeeModelTag* renderer_name_tag)
00032   : RowAdaptorBase(model, iter, renderer_name_tag)
00033 {
00034   SetupGetters();
00035 }
00036 
00037 Category::Category(Category const& other)
00038   : RowAdaptorBase(other)
00039 {
00040   SetupGetters();
00041 }
00042 
00043 Category& Category::operator=(Category const& other)
00044 {
00045   RowAdaptorBase::operator=(other);
00046   SetupGetters();
00047   return *this;
00048 }
00049 
00050 void Category::SetupGetters()
00051 {
00052   name.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 0));
00053   icon_hint.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 1));
00054   index.SetGetterFunction(sigc::mem_fun(this, &Category::get_index));
00055   renderer_name.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 2));
00056 }
00057 
00058 std::size_t Category::get_index() const
00059 {
00060   return dee_model_get_position(model_, iter_);
00061 }
00062 
00063 }
00064 }