2008-10-28 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / collection.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, Enum
17 from factory import accessible_factory
18
19 __all__ = [
20             "Collection",
21           ]
22
23 #------------------------------------------------------------------------------
24
25 class Collection(BaseProxy):
26
27         def createMatchRule(self, *args, **kwargs):
28                 func = self.get_dbus_method("createMatchRule")
29                 return func(*args, **kwargs)
30
31         def freeMatchRule(self, *args, **kwargs):
32                 func = self.get_dbus_method("freeMatchRule")
33                 return func(*args, **kwargs)
34
35         def getActiveDescendant(self, *args, **kwargs):
36                 func = self.get_dbus_method("getActiveDescendant")
37                 return func(*args, **kwargs)
38
39         def getMatches(self, *args, **kwargs):
40                 func = self.get_dbus_method("getMatches")
41                 return func(*args, **kwargs)
42
43         def getMatchesFrom(self, *args, **kwargs):
44                 func = self.get_dbus_method("getMatchesFrom")
45                 return func(*args, **kwargs)
46
47         def getMatchesTo(self, *args, **kwargs):
48                 func = self.get_dbus_method("getMatchesTo")
49                 return func(*args, **kwargs)
50
51         def isAncestorOf(self, *args, **kwargs):
52                 func = self.get_dbus_method("isAncestorOf")
53                 return func(*args, **kwargs)
54
55         class MatchType(Enum):
56                 _enum_lookup = {
57                         0:'MATCH_INVALID',
58                         1:'MATCH_ALL',
59                         2:'MATCH_ANY',
60                         3:'MATCH_NONE',
61                         4:'MATCH_EMPTY',
62                         5:'MATCH_LAST_DEFINED',
63                 }
64
65         MATCH_ALL = MatchType(1)
66         MATCH_ANY = MatchType(2)
67         MATCH_EMPTY = MatchType(4)
68         MATCH_INVALID = MatchType(0)
69         MATCH_LAST_DEFINED = MatchType(5)
70         MATCH_NONE = MatchType(3)
71
72         class SortOrder(Enum):
73                 _enum_lookup = {
74                         0:'SORT_ORDER_INVALID',
75                         1:'SORT_ORDER_CANONICAL',
76                         2:'SORT_ORDER_FLOW',
77                         3:'SORT_ORDER_TAB',
78                         4:'SORT_ORDER_REVERSE_CANONICAL',
79                         5:'SORT_ORDER_REVERSE_FLOW',
80                         6:'SORT_ORDER_REVERSE_TAB',
81                         7:'SORT_ORDER_LAST_DEFINED',
82                 }
83
84         SORT_ORDER_CANONICAL = SortOrder(1)
85         SORT_ORDER_FLOW = SortOrder(2)
86         SORT_ORDER_INVALID = SortOrder(0)
87         SORT_ORDER_LAST_DEFINED = SortOrder(7)
88         SORT_ORDER_REVERSE_CANONICAL = SortOrder(4)
89         SORT_ORDER_REVERSE_FLOW = SortOrder(5)
90         SORT_ORDER_REVERSE_TAB = SortOrder(6)
91         SORT_ORDER_TAB = SortOrder(3)
92
93         class TreeTraversalType(Enum):
94                 _enum_lookup = {
95                         0:'TREE_RESTRICT_CHILDREN',
96                         1:'TREE_RESTRICT_SIBLING',
97                         2:'TREE_INORDER',
98                         3:'TREE_LAST_DEFINED',
99                 }
100
101         TREE_INORDER = TreeTraversalType(2)
102         TREE_LAST_DEFINED = TreeTraversalType(3)
103         TREE_RESTRICT_CHILDREN = TreeTraversalType(0)
104         TREE_RESTRICT_SIBLING = TreeTraversalType(1)
105
106 # Register the accessible class with the factory.
107 accessible_factory.register_accessible_class(interfaces.ATSPI_COLLECTION, Collection)
108
109 #END----------------------------------------------------------------------------