1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 from muntjac.event.component_event_listener import IComponentEventListener
17 from muntjac.event.mouse_events import ClickEvent
18
19
21
23 """Layout has been clicked
24
25 @param event:
26 Component click event.
27 """
28 raise NotImplementedError
29
30 clickMethod = layoutClick
31
32
34 """The interface for adding and removing C{LayoutClickEvent} listeners.
35 By implementing this interface a class explicitly announces that it will
36 generate a C{LayoutClickEvent} when a component inside it is clicked and
37 a C{LayoutClickListener} is registered.
38
39 @see: L{LayoutClickListener}
40 @see: L{LayoutClickEvent}
41 """
42
44 """Add a click listener to the layout. The listener is called whenever
45 the user clicks inside the layout. An event is also triggered when
46 the click targets a component inside a nested layout or Panel,
47 provided the targeted component does not prevent the click event from
48 propagating. A caption is not considered part of a component.
49
50 The child component that was clicked is included in the
51 L{LayoutClickEvent}.
52
53 Use L{removeListener} to remove the listener.
54
55 @param listener:
56 The listener to add
57 """
58 raise NotImplementedError
59
60
61 - def addCallback(self, callback, eventType=None, *args):
62 raise NotImplementedError
63
64
66 """Removes an LayoutClickListener.
67
68 @param listener:
69 LayoutClickListener to be removed
70 """
71 raise NotImplementedError
72
73
75 raise NotImplementedError
76
77
79 """An event fired when the layout has been clicked. The event contains
80 information about the target layout (component) and the child component
81 that was clicked. If no child component was found it is set to null.
82 """
83
84 - def __init__(self, source, mouseEventDetails, clickedComponent,
85 childComponent):
86 super(LayoutClickEvent, self).__init__(source, mouseEventDetails)
87 self._clickedComponent = clickedComponent
88 self._childComponent = childComponent
89
90
92 """Returns the component that was clicked, which is somewhere inside
93 the parent layout on which the listener was registered.
94
95 For the direct child component of the layout, see L{getChildComponent}.
96
97 @return: clicked L{Component}, C{None} if none found
98 """
99 return self._clickedComponent
100
101
103 """Returns the direct child component of the layout which contains the
104 clicked component.
105
106 For the clicked component inside that child component of the layout,
107 see L{getClickedComponent}.
108
109 @return: direct child L{Component} of the layout which contains
110 the clicked Component, null if none found
111 """
112 return self._childComponent
113