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

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_show_tool_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: 5342 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description : "Command to show/hide a tool."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date : "$Date$"
6 revision : "$Revision$"
7
8 class
9 EB_SHOW_TOOL_COMMAND
10
11 inherit
12 EB_DEVELOPMENT_WINDOW_COMMAND
13 rename
14 make as target_make
15 redefine
16 recycle
17 end
18
19 EB_TOOLBARABLE_AND_MENUABLE_COMMAND
20 redefine
21 new_toolbar_item,
22 new_sd_toolbar_item,
23 new_menu_item,
24 tooltext,
25 is_tooltext_important,
26 pixel_buffer,
27 mini_pixmap
28 end
29
30 create
31 make
32
33 feature {NONE} -- Initialization
34
35 make (a_target: EB_DEVELOPMENT_WINDOW; a_content: SD_CONTENT) is
36 -- Creation method.
37 require
38 valid_item: a_content /= Void
39 item_has_pixmap: a_content.pixmap /= Void
40 do
41 target_make (a_target)
42 content := a_content
43 is_sensitive := True
44 end
45
46 feature -- Access
47
48 content: SD_CONTENT
49 -- Content for docking.
50
51 tooltip: STRING is
52 -- Tooltip for Current
53 do
54 Result := "Show "
55 Result.append_string (content.long_title)
56 end
57
58 tooltext: STRING is
59 -- Text for toolbar button.
60 do
61 Result := content.short_title
62 end
63
64 is_tooltext_important: BOOLEAN is
65 -- Is the tooltext important shown when view is 'Selective Text'
66 do
67 Result := True
68 end
69
70 description: STRING is
71 -- Description for current command.
72 do
73 Result := "Show/hide " + content.short_title
74 end
75
76 menu_name: STRING is
77 -- Name as it appears in menus.
78 do
79 Result := content.short_title
80 end
81
82 name: STRING is
83 -- Name to be displayed.
84 do
85 Result := content.short_title
86 end
87
88 pixmap: EV_PIXMAP is
89 -- Pixmap representing the item (for buttons)
90 do
91 Result := content.pixmap
92 end
93
94 mini_pixmap: EV_PIXMAP
95 -- Mini pixmap
96
97 pixel_buffer: EV_PIXEL_BUFFER is
98 -- Pixel buffer representing the command.
99 do
100 Result := content.pixel_buffer
101 end
102
103 feature -- Execution
104
105 execute is
106 -- Execute command (toggle between show and hide).
107 do
108 if not content.is_visible then
109 content.show
110 end
111 content.set_focus
112 end
113
114 feature -- Basic operations
115
116 new_toolbar_item (display_text: BOOLEAN): EB_COMMAND_TOOL_BAR_BUTTON is
117 -- Create a new toolbar button for this command.
118 do
119 create Result.make (Current)
120 initialize_toolbar_item (Result, display_text)
121 Result.select_actions.extend (agent execute)
122 Result.select_actions.extend (agent update_tooltip (Result))
123 end
124
125 new_sd_toolbar_item (a_display_text: BOOLEAN): EB_SD_COMMAND_TOOL_BAR_BUTTON is
126 -- Create a new toolbar button for this command.
127 do
128 create Result.make (Current)
129 initialize_sd_toolbar_item (Result, a_display_text)
130 Result.select_actions.extend (agent execute)
131 Result.select_actions.extend (agent update_sd_tooltip (Result))
132 end
133
134 new_menu_item: EB_COMMAND_MENU_ITEM is
135 -- Create a new menu entry for this command.
136 do
137 -- Create the menu item
138 create Result.make (Current)
139 initialize_menu_item (Result)
140 Result.select_actions.extend (agent execute)
141 end
142
143 feature -- Element change
144
145 set_accelerator (a_accel: EV_ACCELERATOR) is
146 -- Set `accelerator' with `a_accel'.
147 require
148 a_accel_attached: a_accel /= Void
149 do
150 accelerator := a_accel
151 ensure
152 accelerator_not_void: accelerator = a_accel
153 end
154
155 set_mini_pixmap (a_mini_pixmap: EV_PIXMAP) is
156 -- Set `mini_pixmap' with `a_mini_pixmap'.
157 do
158 mini_pixmap := a_mini_pixmap
159 ensure
160 mini_pixmap_set: mini_pixmap = a_mini_pixmap
161 end
162
163 feature -- Recyclable
164
165 recycle is
166 -- Recycle
167 do
168 Precursor {EB_DEVELOPMENT_WINDOW_COMMAND}
169 accelerator := Void
170 end
171
172 feature {NONE} -- Implementation
173
174 update_tooltip (toggle: EB_COMMAND_TOOL_BAR_BUTTON) is
175 -- Update tooltip of `toggle'.
176 do
177 toggle.set_tooltip (tooltip)
178 end
179
180 update_sd_tooltip (a_toogle: EB_SD_COMMAND_TOOL_BAR_BUTTON) is
181 -- Update tooltip of `a_toggle'.
182 do
183 a_toogle.set_tooltip (tooltip)
184 end
185
186 feature {NONE} -- Implementation
187
188 safety_flag: BOOLEAN;
189 -- Are we changing the `is_selected' attribute? (To prevent stack overflows)
190
191 indexing
192 copyright: "Copyright (c) 1984-2006, Eiffel Software"
193 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
194 licensing_options: "http://www.eiffel.com/licensing"
195 copying: "[
196 This file is part of Eiffel Software's Eiffel Development Environment.
197
198 Eiffel Software's Eiffel Development Environment is free
199 software; you can redistribute it and/or modify it under
200 the terms of the GNU General Public License as published
201 by the Free Software Foundation, version 2 of the License
202 (available at the URL listed under "license" above).
203
204 Eiffel Software's Eiffel Development Environment is
205 distributed in the hope that it will be useful, but
206 WITHOUT ANY WARRANTY; without even the implied warranty
207 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
208 See the GNU General Public License for more details.
209
210 You should have received a copy of the GNU General Public
211 License along with Eiffel Software's Eiffel Development
212 Environment; if not, write to the Free Software Foundation,
213 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
214 ]"
215 source: "[
216 Eiffel Software
217 356 Storke Road, Goleta, CA 93117 USA
218 Telephone 805-685-1006, Fax 805-685-6869
219 Website http://www.eiffel.com
220 Customer support http://support.eiffel.com
221 ]"
222
223 end -- class EB_SHOW_TOOL_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23