/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/widgets/eb_classes_tree_class_item.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/widgets/eb_classes_tree_class_item.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62061 - (show annotations)
Sun Jul 30 06:23:29 2006 UTC (13 years, 4 months ago) by manus
File size: 7700 byte(s)
EiffelStudio docking branch. It only contains modified classes needed to get the docking version of EiffelStudio.
1 indexing
2 description: "Representation of a class in the cluster tree."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 author: "Xavier Rousselot"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 class
10 EB_CLASSES_TREE_CLASS_ITEM
11
12 inherit
13 EB_CLASSES_TREE_ITEM
14 redefine
15 data,
16 set_data,
17 recycle
18 end
19
20 EB_PIXMAPABLE_ITEM_PIXMAP_FACTORY
21 undefine
22 default_create, is_equal, copy
23 end
24
25 create
26 make
27
28 feature {NONE} -- Initialization
29
30 make (a_class: CLASS_I; a_name: STRING) is
31 -- Create a tree item representing class `a_class' with `a_name' in its context.
32 require
33 a_class_ok: a_class /= Void and then a_class.is_valid
34 a_name_ok: a_name /= Void
35 do
36 default_create
37 name := a_name
38 set_data (a_class)
39 ensure
40 name_set: name = a_name
41 data_set: data = a_class
42 end
43
44 feature -- Status report
45
46 data: CLASS_I
47 -- Class represented by `Current'.
48
49 name: STRING
50 -- Renamed name in the context of this item in the classes tree.
51
52 stone: CLASSI_STONE is
53 -- Class stone representing `Current', can be a classi_stone or a classc_stone.
54 local
55 l_classc: CLASS_C
56 do
57 l_classc := data.compiled_representation
58 if l_classc /= Void then
59 create {CLASSC_STONE} Result.make (l_classc)
60 else
61 create {CLASSI_STONE} Result.make (data)
62 end
63 end
64
65 feature -- Status setting
66
67 set_data (a_class: CLASS_I) is
68 -- Change the associated class to `a_class'.
69 do
70 set_text (name)
71 data := a_class
72 set_pebble_function (agent stone)
73 drop_actions.wipe_out
74 drop_actions.set_veto_pebble_function (agent droppable)
75 set_accept_cursor (Cursors.cur_Class)
76 set_deny_cursor (Cursors.cur_X_Class)
77 set_tooltip (name)
78 set_pixmap (pixmap_from_class_i (a_class))
79 end
80
81 load_overriden_children is
82 -- Add classes this class overrides or the class that overrides this class as children.
83 -- (needs to be called after the class has been completely set up)
84 local
85 conf_class: CONF_CLASS
86 overs: ARRAYED_LIST [CONF_CLASS]
87 over_item: EB_CLASSES_TREE_CLASS_ITEM
88 class_i: CLASS_I
89 do
90 conf_class := data.config_class
91 if conf_class.does_override then
92 from
93 overs := conf_class.overrides
94 overs.start
95 until
96 overs.after
97 loop
98 class_i ?= overs.item
99 check
100 class_i: class_i /= Void
101 end
102 if class_i.is_valid then
103 create over_item.make (class_i, class_i.name_in_upper)
104
105 if associated_window /= Void then
106 over_item.set_associated_window (associated_window)
107 end
108 if associated_textable /= Void then
109 over_item.set_associated_textable (associated_textable)
110 end
111
112 from
113 pointer_double_press_actions.start
114 until
115 pointer_double_press_actions.after
116 loop
117 over_item.add_double_click_action (pointer_double_press_actions.item)
118 pointer_double_press_actions.forth
119 end
120
121 extend (over_item)
122 end
123 overs.forth
124 end
125 elseif conf_class.is_overriden then
126 class_i ?= conf_class.overriden_by
127 check
128 class_i: class_i /= Void
129 end
130 if class_i.is_valid then
131 create over_item.make (class_i, class_i.name_in_upper)
132
133 if associated_window /= Void then
134 over_item.set_associated_window (associated_window)
135 end
136 if associated_textable /= Void then
137 over_item.set_associated_textable (associated_textable)
138 end
139
140 from
141 pointer_double_press_actions.start
142 until
143 pointer_double_press_actions.after
144 loop
145 over_item.add_double_click_action (pointer_double_press_actions.item)
146 pointer_double_press_actions.forth
147 end
148 extend (over_item)
149 end
150 end
151 end
152
153 set_associated_textable (textable: EV_TEXT_COMPONENT) is
154 -- Associate `Current' with `textable' and change event handling.
155 require
156 textable /= Void
157 do
158 associated_textable := textable
159 select_actions.wipe_out
160 select_actions.extend (agent print_name)
161 end
162
163 set_associated_window (window: like associated_window) is
164 -- Associate `Current' with `window' and change event handling.
165 require
166 window /= Void
167 do
168 if associated_window = Void then
169 pointer_button_press_actions.extend (agent double_press_action)
170 end
171 associated_window := window
172 end
173
174 add_double_click_action (p: PROCEDURE [ANY, TUPLE [INTEGER, INTEGER, INTEGER, DOUBLE, DOUBLE, DOUBLE, INTEGER, INTEGER]]) is
175 -- Add a double click action `p' on `Current'.
176 do
177 pointer_double_press_actions.extend (p)
178 end
179
180 feature -- Recycle
181
182 recycle is
183 -- Recycle
184 do
185 Precursor {EB_CLASSES_TREE_ITEM}
186 associated_window := Void
187 end
188
189 feature {NONE} -- Implementation
190
191 cluster_contains_class (f: CONF_GROUP): BOOLEAN is
192 -- Does `f' recursively contains `data'?
193 require
194 f_not_void: f /= Void
195 do
196 Result := f = data.group
197 end
198
199 double_press_action (a_x: INTEGER; a_y: INTEGER; a_button: INTEGER
200 a_x_tilt: DOUBLE; a_y_tilt: DOUBLE; a_pressure: DOUBLE
201 a_screen_x: INTEGER; a_screen_y: INTEGER) is
202 -- Send a stone corresponding to `Current' to `associated_window'.
203 do
204 if a_button = 1 and then associated_window /= Void then
205 associated_window.set_stone (stone)
206 end
207 end
208
209 droppable (a_pebble: ANY): BOOLEAN is
210 -- Can user drop `a_pebble' on `Current'?
211 local
212 conv_folder: CLUSTER_STONE
213 conv_st: CLASSI_STONE
214 fs: FEATURE_STONE
215 fparent: EB_CLASSES_TREE_FOLDER_ITEM
216 do
217 -- we can only drop things on clusters
218 fparent ?= parent
219 if fparent /= Void and then fparent.data.is_cluster then
220 conv_folder ?= a_pebble
221 if conv_folder /= Void then
222 Result := not cluster_contains_class (conv_folder.group)
223 else
224 conv_st ?= a_pebble
225 fs ?= a_pebble
226
227 Result :=
228 -- We have a class stone...
229 conv_st /= Void and then
230 -- ...from a different cluster...
231 conv_st.class_i.group /= data.group and then
232 -- ...and that is not a feature.
233 fs = Void
234 end
235 end
236 end
237
238 associated_textable: EV_TEXT_COMPONENT
239 -- Text component in which `Current' writes its name when clicked on.
240
241 associated_window: EB_STONABLE
242 -- Is `Current' already associated to a window?
243
244 print_name is
245 -- Print class name in textable, the associated text component.
246 do
247 if associated_textable /= Void then
248 associated_textable.set_text (data.name_in_upper)
249 end
250 end
251
252 indexing
253 copyright: "Copyright (c) 1984-2006, Eiffel Software"
254 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
255 licensing_options: "http://www.eiffel.com/licensing"
256 copying: "[
257 This file is part of Eiffel Software's Eiffel Development Environment.
258
259 Eiffel Software's Eiffel Development Environment is free
260 software; you can redistribute it and/or modify it under
261 the terms of the GNU General Public License as published
262 by the Free Software Foundation, version 2 of the License
263 (available at the URL listed under "license" above).
264
265 Eiffel Software's Eiffel Development Environment is
266 distributed in the hope that it will be useful, but
267 WITHOUT ANY WARRANTY; without even the implied warranty
268 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
269 See the GNU General Public License for more details.
270
271 You should have received a copy of the GNU General Public
272 License along with Eiffel Software's Eiffel Development
273 Environment; if not, write to the Free Software Foundation,
274 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
275 ]"
276 source: "[
277 Eiffel Software
278 356 Storke Road, Goleta, CA 93117 USA
279 Telephone 805-685-1006, Fax 805-685-6869
280 Website http://www.eiffel.com
281 Customer support http://support.eiffel.com
282 ]"
283
284 end -- class EB_CLASSES_TREE_CLASS_ITEM

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23