2008-10-28 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / hypertext.py
1 #Copyright (C) 2008 Codethink Ltd
2
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.
6
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.
14
15 import interfaces
16 from base import BaseProxy
17 from factory import accessible_factory
18
19 __all__ = [
20            "Hypertext",
21           ]
22
23 #------------------------------------------------------------------------------
24
25 class Hypertext(BaseProxy):
26         """
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.
32         """
33
34         def getLink(self, *args, **kwargs):
35                 """
36                 Get one of the Hyperlinks associated with this Hypertext object,
37                 by index.
38                 @param : linkIndex
39                 an integer from 0 to getNLinks() - 1. 
40                 @return the Hyperlink in this Hypertext object.
41                 """
42                 func = self.get_dbus_method("getLink")
43                 return func(*args, **kwargs)
44
45         def getLinkIndex(self, *args, **kwargs):
46                 """
47                 Get the hyperlink index, if any, associated with a particular
48                 character offset in the Hypertext object. For Hypertext implementors
49                 without textual content, all hyperlinks are associated with character
50                 offset '0'.
51                 @return the index of the Hyperlink associated with character
52                 offset characterIndex, or -1 if no Hyperlink is associated with
53                 that character offset.
54                 """
55                 func = self.get_dbus_method("getLinkIndex")
56                 return func(*args, **kwargs)
57
58         def getNLinks(self, *args, **kwargs):
59                 """
60                 Query the hypertext object for the number of Hyperlinks it contains.
61                 @return the number of Hyperlinks associated with this Hypertext
62                 object, as a long integer.
63                 """
64                 func = self.get_dbus_method("getNLinks")
65                 return func(*args, **kwargs)
66
67 # Register the accessible class with the factory.
68 accessible_factory.register_accessible_class(interfaces.ATSPI_HYPERTEXT, Hypertext)
69
70 #END----------------------------------------------------------------------------