1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module atk.Hyperlink; 26 27 private import atk.ActionIF; 28 private import atk.ActionT; 29 private import atk.ObjectAtk; 30 private import atk.c.functions; 31 public import atk.c.types; 32 private import glib.Str; 33 private import glib.c.functions; 34 private import gobject.ObjectG; 35 private import gobject.Signals; 36 private import std.algorithm; 37 38 39 /** 40 * An ATK object which encapsulates a link or set of links (for 41 * instance in the case of client-side image maps) in a hypertext 42 * document. It may implement the AtkAction interface. AtkHyperlink 43 * may also be used to refer to inline embedded content, since it 44 * allows specification of a start and end offset within the host 45 * AtkHypertext object. 46 */ 47 public class Hyperlink : ObjectG, ActionIF 48 { 49 /** the main Gtk struct */ 50 protected AtkHyperlink* atkHyperlink; 51 52 /** Get the main Gtk struct */ 53 public AtkHyperlink* getHyperlinkStruct(bool transferOwnership = false) 54 { 55 if (transferOwnership) 56 ownedRef = false; 57 return atkHyperlink; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)atkHyperlink; 64 } 65 66 /** 67 * Sets our main struct and passes it to the parent class. 68 */ 69 public this (AtkHyperlink* atkHyperlink, bool ownedRef = false) 70 { 71 this.atkHyperlink = atkHyperlink; 72 super(cast(GObject*)atkHyperlink, ownedRef); 73 } 74 75 // add the Action capabilities 76 mixin ActionT!(AtkHyperlink); 77 78 79 /** */ 80 public static GType getType() 81 { 82 return atk_hyperlink_get_type(); 83 } 84 85 /** 86 * Gets the index with the hypertext document at which this link ends. 87 * 88 * Returns: the index with the hypertext document at which this link ends 89 */ 90 public int getEndIndex() 91 { 92 return atk_hyperlink_get_end_index(atkHyperlink); 93 } 94 95 /** 96 * Gets the number of anchors associated with this hyperlink. 97 * 98 * Returns: the number of anchors associated with this hyperlink 99 */ 100 public int getNAnchors() 101 { 102 return atk_hyperlink_get_n_anchors(atkHyperlink); 103 } 104 105 /** 106 * Returns the item associated with this hyperlinks nth anchor. 107 * For instance, the returned #AtkObject will implement #AtkText 108 * if @link_ is a text hyperlink, #AtkImage if @link_ is an image 109 * hyperlink etc. 110 * 111 * Multiple anchors are primarily used by client-side image maps. 112 * 113 * Params: 114 * i = a (zero-index) integer specifying the desired anchor 115 * 116 * Returns: an #AtkObject associated with this hyperlinks 117 * i-th anchor 118 */ 119 public ObjectAtk getObject(int i) 120 { 121 auto __p = atk_hyperlink_get_object(atkHyperlink, i); 122 123 if(__p is null) 124 { 125 return null; 126 } 127 128 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) __p); 129 } 130 131 /** 132 * Gets the index with the hypertext document at which this link begins. 133 * 134 * Returns: the index with the hypertext document at which this link begins 135 */ 136 public int getStartIndex() 137 { 138 return atk_hyperlink_get_start_index(atkHyperlink); 139 } 140 141 /** 142 * Get a the URI associated with the anchor specified 143 * by @i of @link_. 144 * 145 * Multiple anchors are primarily used by client-side image maps. 146 * 147 * Params: 148 * i = a (zero-index) integer specifying the desired anchor 149 * 150 * Returns: a string specifying the URI 151 */ 152 public string getUri(int i) 153 { 154 auto retStr = atk_hyperlink_get_uri(atkHyperlink, i); 155 156 scope(exit) Str.freeString(retStr); 157 return Str.toString(retStr); 158 } 159 160 /** 161 * Indicates whether the link currently displays some or all of its 162 * content inline. Ordinary HTML links will usually return 163 * %FALSE, but an inline <src> HTML element will return 164 * %TRUE. 165 * 166 * Returns: whether or not this link displays its content inline. 167 */ 168 public bool isInline() 169 { 170 return atk_hyperlink_is_inline(atkHyperlink) != 0; 171 } 172 173 /** 174 * Determines whether this AtkHyperlink is selected 175 * 176 * Deprecated: Please use ATK_STATE_FOCUSABLE for all links, 177 * and ATK_STATE_FOCUSED for focused links. 178 * 179 * Returns: True if the AtkHyperlink is selected, False otherwise 180 * 181 * Since: 1.4 182 */ 183 public bool isSelectedLink() 184 { 185 return atk_hyperlink_is_selected_link(atkHyperlink) != 0; 186 } 187 188 /** 189 * Since the document that a link is associated with may have changed 190 * this method returns %TRUE if the link is still valid (with 191 * respect to the document it references) and %FALSE otherwise. 192 * 193 * Returns: whether or not this link is still valid 194 */ 195 public bool isValid() 196 { 197 return atk_hyperlink_is_valid(atkHyperlink) != 0; 198 } 199 200 /** 201 * The signal link-activated is emitted when a link is activated. 202 */ 203 gulong addOnLinkActivated(void delegate(Hyperlink) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 204 { 205 return Signals.connect(this, "link-activated", dlg, connectFlags ^ ConnectFlags.SWAPPED); 206 } 207 }