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

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_menuable_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: 3815 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description : "Command that can be added in a menu."
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_MENUABLE_COMMAND
10
11 inherit
12 EB_GRAPHICAL_COMMAND
13
14 EB_SHARED_WINDOW_MANAGER
15 export
16 {NONE} all
17 end
18
19 feature -- Access
20
21 menu_name: STRING is
22 -- Name as it appears in the menu (with '&' symbol).
23 deferred
24 ensure
25 valid_result: Result /= Void
26 end
27
28 pixmap: EV_PIXMAP is
29 -- Pixmap
30 deferred
31 end
32
33 feature -- Status setting
34
35 enable_sensitive is
36 -- Set `is_sensitive' to True.
37 local
38 menu_items: like managed_menu_items
39 do
40 if not is_sensitive then
41 is_sensitive := True
42 menu_items := managed_menu_items
43 if menu_items /= Void then
44 from
45 menu_items.start
46 until
47 menu_items.after
48 loop
49 menu_items.item.enable_sensitive
50 menu_items.forth
51 end
52 end
53 end
54 end
55
56 disable_sensitive is
57 -- Set `is_sensitive' to False.
58 local
59 menu_items: like managed_menu_items
60 do
61 if is_sensitive then
62 menu_items := managed_menu_items
63 if menu_items /= Void then
64 from
65 menu_items.start
66 until
67 menu_items.after
68 loop
69 menu_items.item.disable_sensitive
70 menu_items.forth
71 end
72 end
73 is_sensitive := False
74 end
75 end
76
77 feature -- Basic operations
78
79 new_menu_item: EB_COMMAND_MENU_ITEM is
80 --
81 do
82 create Result.make (Current)
83 initialize_menu_item (Result)
84 if pixmap /= Void then
85 Result.set_pixmap (pixmap)
86 end
87 Result.select_actions.extend (agent execute)
88 end
89
90 initialize_menu_item (a_menu_item: EB_COMMAND_MENU_ITEM) is
91 -- Initialize `a_menu_item'
92 local
93 mname: STRING
94 do
95 mname := menu_name.twin
96 if accelerator /= Void then
97 mname.append (Tabulation)
98 mname.append (accelerator.out)
99 end
100 a_menu_item.set_text (mname)
101 if is_sensitive then
102 a_menu_item.enable_sensitive
103 else
104 a_menu_item.disable_sensitive
105 end
106 end
107
108 feature --{EB_COMMAND_MENU_ITEM} -- Implementation
109
110 managed_menu_items: ARRAYED_LIST [like new_menu_item] is
111 -- Menu items associated with this command.
112 do
113 if internal_managed_menu_items = Void then
114 create internal_managed_menu_items.make (1)
115 end
116 Result := internal_managed_menu_items
117 end
118
119 internal_managed_menu_items: ARRAYED_LIST [like new_menu_item]
120 -- Menu items associated with this command.
121
122 Tabulation: STRING is "%T";
123
124 indexing
125 copyright: "Copyright (c) 1984-2006, Eiffel Software"
126 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
127 licensing_options: "http://www.eiffel.com/licensing"
128 copying: "[
129 This file is part of Eiffel Software's Eiffel Development Environment.
130
131 Eiffel Software's Eiffel Development Environment is free
132 software; you can redistribute it and/or modify it under
133 the terms of the GNU General Public License as published
134 by the Free Software Foundation, version 2 of the License
135 (available at the URL listed under "license" above).
136
137 Eiffel Software's Eiffel Development Environment is
138 distributed in the hope that it will be useful, but
139 WITHOUT ANY WARRANTY; without even the implied warranty
140 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
141 See the GNU General Public License for more details.
142
143 You should have received a copy of the GNU General Public
144 License along with Eiffel Software's Eiffel Development
145 Environment; if not, write to the Free Software Foundation,
146 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
147 ]"
148 source: "[
149 Eiffel Software
150 356 Storke Road, Goleta, CA 93117 USA
151 Telephone 805-685-1006, Fax 805-685-6869
152 Website http://www.eiffel.com
153 Customer support http://support.eiffel.com
154 ]"
155
156 end -- class EB_MENUABLE_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23