2 * Copyright (C) 2009 by Aiwota Programmer
3 * aiwotaprog@tetteke.tk
5 * This file is part of Dialektos.
7 * Dialektos is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * Dialektos is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Dialektos. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef TEXT_VIEW_LAYOUTABLE_HXX
22 #define TEXT_VIEW_LAYOUTABLE_HXX
24 #include <glibmm/refptr.h>
25 #include <pangomm/layout.h>
26 #include <boost/ptr_container/ptr_vector.hpp>
27 #include <boost/shared_ptr.hpp>
28 #include "text_view_scrollable.hxx"
35 namespace text_element {
44 class Layoutable: public Scrollable {
46 typedef boost::ptr_vector<TextLine> LineListType;
47 typedef boost::shared_ptr<text_element::IDMap> IDMapPtrType;
48 // typedef boost::shared_ptr<const text_element::IDMap> ConstIDMapPtrType;
49 typedef boost::shared_ptr<text_element::ResNumMap> ResNumMapPtrType;
50 // typedef boost::shared_ptr<const text_element::ResNumMap> ConstResNumMapPtrType;
53 virtual ~Layoutable();
55 void add_line(TextLine*);
56 void set_id_map(IDMapPtrType map) { id_map_ = map; }
57 void set_res_num_map(ResNumMapPtrType map) { res_num_map_ = map; }
58 IDMapPtrType get_id_map() const { return id_map_; }
59 ResNumMapPtrType get_res_num_map() const { return res_num_map_; }
60 void set_res_num(int res_num) { res_num_ = res_num; }
61 int get_res_num() const { return res_num_; }
63 //virtual bool on_expose_event(GdkEventExpose*);
64 virtual bool on_configure_event(GdkEventConfigure*);
66 const TextLine* get_text_line(gdouble y) const;
67 const TextLine* get_nearest_text_line(gdouble& y) const;
68 const text_element::Plain* get_text_element(gdouble x, gdouble y) const;
69 const text_element::Plain* get_nearest_text_element(gdouble& x, gdouble& y) const;
71 Glib::RefPtr<Pango::Layout> pango_layout_;
72 LineListType line_list_;
73 boost::shared_ptr<text_element::IDMap> id_map_;
74 boost::shared_ptr<text_element::ResNumMap> res_num_map_;
81 } // namespace text_view
84 } // namespace dialektos