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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62037 - (show annotations)
Sun Jul 30 06:18:37 2006 UTC (13 years, 4 months ago) by manus
File size: 5460 byte(s)
EiffelStudio docking branch. It only contains modified classes needed to get the docking version of EiffelStudio.
1 indexing
2 description : "Command that can be added in a toolbar."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date : "$Date$"
6 revision : "$Revision$"
7
8 deferred class
9 EB_TOOLBARABLE_COMMAND
10
11 inherit
12 EB_GRAPHICAL_COMMAND
13
14 EB_TOOLBARABLE
15 redefine
16 new_toolbar_item
17 end
18
19 feature -- Access
20
21 pixmap: EV_PIXMAP is
22 -- Pixmap representing the command.
23 deferred
24 end
25
26 mini_pixmap: EV_PIXMAP is
27 -- Pixmap representing the command for mini toolbars.
28 do
29 end
30
31 tooltip: STRING is
32 -- Tooltip for the toolbar button.
33 deferred
34 ensure
35 valid_result: Result /= Void
36 end
37
38 tooltext: STRING is
39 -- Text displayed on the toolbar button.
40 do
41 Result := ""
42 ensure
43 valid_result: Result /= Void
44 end
45
46 has_text: BOOLEAN is
47 -- Does `Current' show text when displayed
48 do
49 Result := tooltext /= Void and then not tooltext.is_equal ("")
50 end
51
52 is_tooltext_important: BOOLEAN is
53 -- Is the tooltext important shown when view is 'Selective Text'
54 do
55 Result := False
56 end
57
58 feature -- Status Report
59
60 is_displayed: BOOLEAN
61 -- Is the toolbar button currently displayed?
62
63 feature -- Status setting
64
65 enable_displayed is
66 -- Set `is_displayed' to True.
67 do
68 is_displayed := True
69 end
70
71 disable_displayed is
72 -- Set `is_displayed' to False.
73 do
74 is_displayed := False
75 end
76
77 enable_sensitive is
78 -- Set `is_sensitive' to True.
79 local
80 toolbar_items: like managed_toolbar_items
81 do
82 if not is_sensitive then
83 is_sensitive := True
84 toolbar_items := managed_toolbar_items
85 if toolbar_items /= Void then
86 from
87 toolbar_items.start
88 until
89 toolbar_items.after
90 loop
91 toolbar_items.item.enable_sensitive
92 toolbar_items.forth
93 end
94 end
95 end
96 end
97
98 disable_sensitive is
99 -- Set `is_sensitive' to True.
100 local
101 toolbar_items: like managed_toolbar_items
102 do
103 if is_sensitive then
104 toolbar_items := managed_toolbar_items
105 if toolbar_items /= Void then
106 from
107 toolbar_items.start
108 until
109 toolbar_items.after
110 loop
111 toolbar_items.item.disable_sensitive
112 toolbar_items.forth
113 end
114 end
115 is_sensitive := False
116 end
117 end
118
119 feature -- Basic operations
120
121 new_toolbar_item (display_text: BOOLEAN): EB_COMMAND_TOOL_BAR_BUTTON is
122 -- Create a new toolbar button for this command.
123 --
124 -- Call `recycle' on the result when you don't need it anymore otherwise
125 -- it will never be garbage collected.
126 do
127 create Result.make (Current)
128 initialize_toolbar_item (Result, display_text)
129 Result.select_actions.extend (agent execute)
130 end
131
132 new_mini_toolbar_item: EB_COMMAND_TOOL_BAR_BUTTON is
133 -- Create a new mini toolbar button for this command.
134 require
135 mini_pixmap_not_void: mini_pixmap /= Void
136 do
137 create Result.make (Current)
138 Result.set_pixmap (mini_pixmap)
139 if is_sensitive then
140 Result.enable_sensitive
141 else
142 Result.disable_sensitive
143 end
144 Result.set_tooltip (tooltip)
145 Result.select_actions.extend (agent execute)
146 end
147
148 feature {NONE} -- Implementation
149
150 initialize_toolbar_item (a_item: EB_COMMAND_TOOL_BAR_BUTTON; display_text: BOOLEAN) is
151 -- Initialize `a_item'
152 local
153 tt: STRING
154 do
155 if display_text and then has_text then
156 a_item.set_text (tooltext)
157 end
158 a_item.set_pixmap (pixmap)
159 if is_sensitive then
160 a_item.enable_sensitive
161 else
162 a_item.disable_sensitive
163 end
164 tt := tooltip.twin
165 if accelerator /= Void then
166 tt.append (opening_parenthesis)
167 tt.append (accelerator.out)
168 tt.append (closing_parenthesis)
169 end
170 a_item.set_tooltip (tt)
171 end
172
173 feature {EB_COMMAND_TOOL_BAR_BUTTON} -- Implementation
174
175 internal_managed_toolbar_items: ARRAYED_LIST [like new_toolbar_item]
176
177 managed_toolbar_items: ARRAYED_LIST [like new_toolbar_item] is
178 -- Toolbar items associated with this command.
179 do
180 if internal_managed_toolbar_items = Void then
181 create internal_managed_toolbar_items.make (1)
182 end
183 Result := internal_managed_toolbar_items
184 end
185
186 Opening_parenthesis: STRING is " ("
187 Closing_parenthesis: STRING is ")";
188 indexing
189 copyright: "Copyright (c) 1984-2006, Eiffel Software"
190 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
191 licensing_options: "http://www.eiffel.com/licensing"
192 copying: "[
193 This file is part of Eiffel Software's Eiffel Development Environment.
194
195 Eiffel Software's Eiffel Development Environment is free
196 software; you can redistribute it and/or modify it under
197 the terms of the GNU General Public License as published
198 by the Free Software Foundation, version 2 of the License
199 (available at the URL listed under "license" above).
200
201 Eiffel Software's Eiffel Development Environment is
202 distributed in the hope that it will be useful, but
203 WITHOUT ANY WARRANTY; without even the implied warranty
204 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
205 See the GNU General Public License for more details.
206
207 You should have received a copy of the GNU General Public
208 License along with Eiffel Software's Eiffel Development
209 Environment; if not, write to the Free Software Foundation,
210 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
211 ]"
212 source: "[
213 Eiffel Software
214 356 Storke Road, Goleta, CA 93117 USA
215 Telephone 805-685-1006, Fax 805-685-6869
216 Website http://www.eiffel.com
217 Customer support http://support.eiffel.com
218 ]"
219
220 end -- class EB_TOOLBARABLE_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23