1 #Copyright (C) 2008 Codethink Ltd
3 #This library is free software; you can redistribute it and/or
4 #modify it under the terms of the GNU Lesser General Public
5 #License version 2 as published by the Free Software Foundation.
7 #This program is distributed in the hope that it will be useful,
8 #but WITHOUT ANY WARRANTY; without even the implied warranty of
9 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 #GNU General Public License for more details.
11 #You should have received a copy of the GNU Lesser General Public License
12 #along with this program; if not, write to the Free Software
13 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 from interfaces import *
16 from accessible import Accessible
17 from factory import accessible_factory
23 #------------------------------------------------------------------------------
25 class Hypertext(Accessible):
27 An interface used for objects which implement linking between
28 multiple resource or content locations, or multiple 'markers'
29 within a single document. A Hypertext instance is associated
30 with one or more Hyperlinks, which are associated with particular
31 offsets within the Hypertext's included content.
34 def getLink(self, index):
36 Get one of the Hyperlinks associated with this Hypertext object,
39 an integer from 0 to getNLinks() - 1.
40 @return the Hyperlink in this Hypertext object.
42 func = self.get_dbus_method("getLink", dbus_interface=ATSPI_HYPERTEXT)
43 return self._cache.create_accessible(self._app_name, func(index),
44 interfaces.ATSPI_HYPERTEXT)
46 def getLinkIndex(self, character_index):
48 Get the hyperlink index, if any, associated with a particular
49 character offset in the Hypertext object. For Hypertext implementors
50 without textual content, all hyperlinks are associated with character
52 @return the index of the Hyperlink associated with character
53 offset characterIndex, or -1 if no Hyperlink is associated with
54 that character offset.
56 func = self.get_dbus_method("getLinkIndex", dbus_interface=ATSPI_HYPERTEXT)
57 return func(character_index)
61 Query the hypertext object for the number of Hyperlinks it contains.
62 @return the number of Hyperlinks associated with this Hypertext
63 object, as a long integer.
65 func = self.get_dbus_method("getNLinks", dbus_interface=ATSPI_HYPERTEXT)
68 # Register the accessible class with the factory.
69 accessible_factory.register_accessible_class(ATSPI_HYPERTEXT, Hypertext)
71 #END----------------------------------------------------------------------------