/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_create_link_command.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_create_link_command.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62171 - (show annotations)
Tue Aug 1 01:27:17 2006 UTC (13 years, 4 months ago) by larryl
File size: 5965 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description: "Command to select which kind of new link will be created."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 author: "Etienne Amodeo"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 class
10 EB_CREATE_LINK_COMMAND
11
12 inherit
13 EB_CONTEXT_DIAGRAM_COMMAND
14 redefine
15 new_toolbar_item,
16 make,
17 description
18 end
19
20 create
21 make
22
23 feature {NONE} -- Initialization
24
25 make (a_target: like tool) is
26 -- Initialize `Current'.
27 -- Client-supplier links are selected by default.
28 do
29 Precursor (a_target)
30 selected_type := Inheritance
31 end
32
33
34 feature -- Basic operations
35
36 execute is
37 -- Perform operation.
38 do
39 if selected_type = inheritance then
40 tool.on_new_inherit_click
41 elseif selected_type = Supplier then
42 tool.on_new_client_click
43 else
44 tool.on_new_agg_client_click
45 end
46 end
47
48 new_toolbar_item (display_text: BOOLEAN): EB_COMMAND_TOOL_BAR_BUTTON is
49 -- Create a new toolbar button for this command.
50 --
51 -- Call `recycle' on the result when you don't need it anymore otherwise
52 -- it will never be garbage collected.
53 do
54 create Result.make (Current)
55 initialize_toolbar_item (Result, display_text)
56 current_button := Result
57 Result.select_actions.extend (agent show_text_menu)
58 end
59
60 feature -- Status report
61
62 selected_type: INTEGER
63 -- Currently selected type of new links
64
65 inheritance, supplier, aggregate: INTEGER is unique
66 -- Possible values for `selected_type'.
67
68 feature -- Status setting
69
70 select_type (a_type: INTEGER) is
71 -- Set current type of link to `Supplier', `Inheritance' or`Aggregate'.
72 require
73 valid_type: a_type = Inheritance or else a_type = Supplier or else a_type = Aggregate
74 local
75 tbb: EB_COMMAND_TOOL_BAR_BUTTON
76 tt: STRING
77 do
78 selected_type := a_type
79 execute
80
81 tt := tooltip.twin
82 if accelerator /= Void then
83 tt.append (Opening_parenthesis)
84 tt.append (accelerator.out)
85 tt.append (Closing_parenthesis)
86 end
87 from
88 managed_toolbar_items.start
89 until
90 managed_toolbar_items.after
91 loop
92 tbb := managed_toolbar_items.item
93 tbb.set_pixmap (pixmap)
94 tbb.set_tooltip (tt)
95 if is_sensitive then
96 tbb.enable_sensitive
97 else
98 tbb.disable_sensitive
99 end
100 managed_toolbar_items.forth
101 end
102 end
103 feature {NONE} -- Implementation
104
105 pixmap: EV_PIXMAP is
106 -- Pixmap representing the command.
107 do
108 if selected_type = inheritance then
109 Result := pixmaps.icon_pixmaps.new_inheritance_link_icon
110 elseif selected_type = Supplier then
111 Result := pixmaps.icon_pixmaps.new_supplier_link_icon
112 else
113 Result := pixmaps.icon_pixmaps.new_aggregate_supplier_link_icon
114 end
115 end
116
117 pixel_buffer: EV_PIXEL_BUFFER is
118 -- Pixel buffer representing the command.
119 do
120 -- Currently there is no pixel buffer for this command.
121 end
122
123 tooltip: STRING is
124 -- Tooltip for the toolbar button.
125 do
126 if selected_type = inheritance then
127 Result := Interface_names.f_diagram_create_inheritance_links
128 elseif selected_type = Supplier then
129 Result := Interface_names.f_diagram_create_supplier_links
130 else
131 Result := Interface_names.f_diagram_create_aggregate_supplier_links
132 end
133 end
134
135 description: STRING is
136 -- Description for this command.
137 do
138 Result := Interface_names.l_diagram_create_links
139 end
140
141 name: STRING is "New_links"
142 -- Name of the command. Used to store the command in the
143 -- preferences.
144
145 show_text_menu is
146 -- Show menu to enable selection of link type.
147 local
148 menu: EV_MENU
149 menu_item: EV_CHECK_MENU_ITEM
150 do
151 create menu
152 create menu_item
153 menu_item.set_text (Interface_names.f_diagram_create_inheritance_links)
154 if selected_type = Inheritance then
155 menu_item.enable_select
156 end
157 menu_item.select_actions.extend (agent select_type (Inheritance))
158 menu.extend (menu_item)
159 create menu_item
160 menu_item.set_text (Interface_names.f_diagram_create_supplier_links)
161 menu.extend (menu_item)
162 if selected_type = Supplier then
163 menu_item.enable_select
164 end
165 menu_item.select_actions.extend (agent select_type (Supplier))
166 create menu_item
167 menu_item.set_text (Interface_names.f_diagram_create_aggregate_supplier_links)
168 if selected_type = Aggregate then
169 menu_item.enable_select
170 end
171 menu_item.select_actions.extend (agent select_type (Aggregate))
172 menu.extend (menu_item)
173 menu.show_at (current_button.parent, current_button.parent.pointer_position.x, current_button.parent.height)
174 end
175
176 feature {EB_CONTEXT_EDITOR} -- Implementation
177
178 current_button: EB_COMMAND_TOOL_BAR_BUTTON;
179 -- Current toggle button.
180
181 indexing
182 copyright: "Copyright (c) 1984-2006, Eiffel Software"
183 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
184 licensing_options: "http://www.eiffel.com/licensing"
185 copying: "[
186 This file is part of Eiffel Software's Eiffel Development Environment.
187
188 Eiffel Software's Eiffel Development Environment is free
189 software; you can redistribute it and/or modify it under
190 the terms of the GNU General Public License as published
191 by the Free Software Foundation, version 2 of the License
192 (available at the URL listed under "license" above).
193
194 Eiffel Software's Eiffel Development Environment is
195 distributed in the hope that it will be useful, but
196 WITHOUT ANY WARRANTY; without even the implied warranty
197 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
198 See the GNU General Public License for more details.
199
200 You should have received a copy of the GNU General Public
201 License along with Eiffel Software's Eiffel Development
202 Environment; if not, write to the Free Software Foundation,
203 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
204 ]"
205 source: "[
206 Eiffel Software
207 356 Storke Road, Goleta, CA 93117 USA
208 Telephone 805-685-1006, Fax 805-685-6869
209 Website http://www.eiffel.com
210 Customer support http://support.eiffel.com
211 ]"
212
213 end -- class EB_CREATE_LINK_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23