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_ELEMENT_ANCHOR_HXX
22 #define TEXT_ELEMENT_ANCHOR_HXX
24 #include <glibmm/ustring.h>
25 #include <gdkmm/cursor.h>
26 #include <pangomm/attrlist.h>
27 #include <boost/range.hpp>
28 #include <boost/unordered_map.hpp>
29 #include "text_element_plain.hxx"
34 namespace text_element {
37 /*! @brief text element for Anchor. */
38 class Anchor: public Plain {
41 /*! @brief Constructor.
43 * @param range is text represented by Boost.Range concepts.
44 * @param bold is whether or not the text is bold.
45 * @param href is href represented by Boost.Range concepts.
47 template <typename RangeT, typename RangeT2>
48 Anchor(const RangeT& range, bool bold, const RangeT2 href) :
49 Plain(range, bold), href_(boost::begin(href), boost::end(href)) {
53 /*! @brief return a cursor type appropriated to the anchor text element.
55 * @return the cursor type for the anchor.
57 virtual Gdk::CursorType get_cursor_type() const;
59 /*! @brief return the href.
63 Glib::ustring get_href() const { return href_; }
66 /*! @brief set attributes for drawing the anchor text element.
70 virtual void set_attributes(Pango::AttrList& list) const;
73 virtual Anchor* do_clone() const { return new Anchor(*this); }
76 /*! @brief hyper reference */
77 const Glib::ustring href_;
81 } // namespace text_element
83 } // namespace dialektos