funcobjs.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // gvectors is a frontend to libgvectors using gtkmm.
00004 // Copyright (C) 2007  Rafael Ostertag
00005 //
00006 // This program is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU General Public License
00008 // as published by the Free Software Foundation; either version 2
00009 // of the License, or (at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
00019 // USA.
00020 //
00021 // $Id: funcobjs_8h-source.html,v 1.1 2007-09-10 23:31:15 rafi Exp $
00022 //
00023 // File:   funcobjs.h
00024 // Author: Rafael Ostertag
00025 //
00026 // Created on August 11, 2007, 6:52 PM
00027 //
00028 
00029 
00035 
00036 #include <list>
00037 #include <gtkmm.h>
00038 #include <gvectors.h>
00039 
00040 #include "vectorlist.h"
00041 
00042 #ifndef _FUNCOBJS_H
00043 #define _FUNCOBJS_H
00044 
00046 
00047 //
00048 // ConvertTreePath2RowRef
00049 //
00050 class ConvertTreePath2RowRef {
00051 private:
00052     std::list<Gtk::TreeRowReference>& row_ref;
00053     Glib::RefPtr<Gtk::TreeStore> liststore;
00054     inline const ConvertTreePath2RowRef& operator=(const ConvertTreePath2RowRef) { return *this; }
00055     
00056 public:
00057     inline explicit ConvertTreePath2RowRef(std::list<Gtk::TreeRowReference>& rf, Glib::RefPtr<Gtk::TreeStore> ls) : row_ref(rf), liststore(ls) {}
00058     inline ConvertTreePath2RowRef(const ConvertTreePath2RowRef& conv) : row_ref(conv.row_ref), liststore(conv.liststore) {}
00059     void operator()(Gtk::TreePath& tp);
00060 };
00061 
00063 
00064 //
00065 // DeleteTreeRows
00066 //
00067 class DeleteTreeRows {
00068 private:
00069     Glib::RefPtr<Gtk::TreeStore> liststore;
00070     inline const DeleteTreeRows& operator=(const DeleteTreeRows&) { return *this; }
00071     
00072 public:
00073     inline explicit DeleteTreeRows(Glib::RefPtr<Gtk::TreeStore> ls) : liststore(ls) {}
00074     inline DeleteTreeRows(const DeleteTreeRows& dtr) : liststore(dtr.liststore) {}
00075     void operator()(Gtk::TreeRowReference& tp);
00076 };
00077 
00079 //
00080 // Class ImportVectors
00081 //
00082 class ImportVectors {
00083 private:
00085     VectorList& vectorlist;
00086     Glib::RefPtr<Gtk::TreeStore> liststore;
00089     std::map<GVectors::vslevel_t, Gtk::TreeModel::Row> levelmap;
00090     inline const ImportVectors& operator=(const ImportVectors&) { return *this; }
00091     
00092 public:
00093     inline explicit ImportVectors(VectorList& vl, Glib::RefPtr<Gtk::TreeStore> ts) : vectorlist(vl), liststore(ts) { ; }
00094     inline ImportVectors(const ImportVectors& iv) : vectorlist(iv.vectorlist), liststore(iv.liststore) { ; }
00095     inline ~ImportVectors() { ; }
00096     void operator()(GVectors::vslevel_t level,
00097             GVectors::gvid_t id,
00098             const GVectors::VisualVector* vv);
00099 };
00100 
00102 //
00103 // Class SumupVectors
00104 //
00105 class SumUpVectors {
00106 private:
00107     GVectors::VectorStore& vstore;
00108     GVectors::GVector sum;
00109     VectorList& vectorlist;
00110     
00111     inline const SumUpVectors& operator=(const SumUpVectors& wdc) { return *this; }
00112     
00113 public:
00114     inline explicit SumUpVectors(GVectors::VectorStore& vs, VectorList& vl) : vstore(vs),
00115             vectorlist(vl) { ; }
00116     inline SumUpVectors(const SumUpVectors& suv) : vstore(suv.vstore),
00117             vectorlist(suv.vectorlist), sum(suv.sum) { ; }
00118     inline ~SumUpVectors() { ; }
00119     void operator()(const Gtk::TreeModel::iterator& iter);
00120     inline GVectors::GVector get() const { return sum; }
00121 };
00122 
00125 //
00126 // Class GetTreeSelected
00127 //
00128 class GetTreeSelected {
00129 private:
00130     Gtk::TreeModel::iterator iterator;
00131     
00132 public:
00133     inline explicit GetTreeSelected() { ; }
00134     inline GetTreeSelected(const GetTreeSelected& gts) : iterator(gts.iterator) { ;  }
00135     inline ~GetTreeSelected() { ; }
00136     const GetTreeSelected& operator=(const GetTreeSelected& gts);
00137     inline Gtk::TreeModel::iterator get() const { return iterator; }
00138     void operator()(const Gtk::TreeModel::iterator& it);
00139 };
00140 
00147 class TreeLastTwoSelected {
00148 private:
00149     Gtk::TreeModel::Path path_a;
00150     Gtk::TreeModel::Path path_b;
00151     Gtk::TreeModel::iterator it_a;
00152     Gtk::TreeModel::iterator it_b;
00153     Gtk::TreeModel::Row row_a;
00154     Gtk::TreeModel::Row row_b;
00155     GVectors::gvid_t id_a;
00156     GVectors::gvid_t id_b;
00157     GVectors::VisualVector* vec_a;
00158     GVectors::VisualVector* vec_b;
00159     
00160     GVectors::VectorStore& vstore;
00161     VectorList& vlist;
00162     bool set_a;
00163     
00164 public:
00165     explicit TreeLastTwoSelected(GVectors::VectorStore& vs, VectorList& vl);
00166     TreeLastTwoSelected(const TreeLastTwoSelected& tlts);
00167     inline ~TreeLastTwoSelected() { ; }
00168     
00169     inline Gtk::TreeModel::Path get_path_A() const { return path_a; }
00170     inline Gtk::TreeModel::Path get_path_B() const { return path_b; }
00171     inline Gtk::TreeModel::iterator get_it_A() const { return it_a; }
00172     inline Gtk::TreeModel::iterator get_it_B() const { return it_b; }
00173     inline Gtk::TreeModel::Row get_row_A() const { return row_a; }
00174     inline Gtk::TreeModel::Row get_row_B() const { return row_b; }
00175     inline GVectors::gvid_t get_id_A() const { return id_a; }
00176     inline GVectors::gvid_t get_id_B() const { return id_b; }
00177     inline GVectors::VisualVector* get_vec_A() const { return vec_a; }
00178     inline GVectors::VisualVector* get_vec_B() const { return vec_b; }
00179     inline void reset() { set_a = true; }
00180     bool operator()(const Glib::RefPtr<Gtk::TreeModel>& model,
00181             const Gtk::TreeModel::Path& path,
00182             bool path_currently_selected);
00183     TreeLastTwoSelected operator=(const TreeLastTwoSelected& tlts);
00184 };
00185 
00186 #endif  /* _FUNCOBJS_H */

Generated on Tue Sep 11 01:14:28 2007 for gvectors by  doxygen 1.4.7