4 * Hierarchical sub-menu.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
30 * Revision 1.26 2001/05/22 12:49:33 robertj
31 * Did some seriously wierd rewrite of platform headers to eliminate the
32 * stupid GNU compiler warning about braces not matching.
34 * Revision 1.25 1999/03/10 03:49:53 robertj
35 * More documentation adjustments.
37 * Revision 1.24 1999/03/09 08:01:50 robertj
38 * Changed comments for doc++ support (more to come).
40 * Revision 1.23 1999/02/16 08:08:46 robertj
41 * MSVC 6.0 compatibility changes.
43 * Revision 1.22 1998/09/23 06:29:24 robertj
44 * Added open source copyright license.
46 * Revision 1.21 1995/06/17 11:13:29 robertj
47 * Documentation update.
49 * Revision 1.20 1995/03/14 12:42:44 robertj
50 * Updated documentation to use HTML codes.
52 * Revision 1.19 1995/02/19 04:19:22 robertj
53 * Added dynamically linked command processing.
55 * Revision 1.18 1995/01/09 12:30:11 robertj
56 * Added virtual to [] operator for unix implementation.
58 * Revision 1.17 1995/01/03 09:36:20 robertj
61 * Revision 1.16 1994/11/19 00:06:06 robertj
62 * Removed variable argument list binding for menus and controls.
64 * Revision 1.15 1994/10/30 11:47:23 robertj
65 * Changed mechanism for doing notification callback functions.
67 * Revision 1.14 1994/08/23 11:32:52 robertj
70 * Revision 1.13 1994/08/22 00:46:48 robertj
71 * Added pragma fro GNU C++ compiler.
73 * Revision 1.12 1994/07/17 10:46:06 robertj
74 * Removed unnecessary forward reference.
76 * Revision 1.11 1994/06/25 11:55:15 robertj
77 * Unix version synchronisation.
79 * Revision 1.10 1994/01/03 04:42:23 robertj
80 * Mass changes to common container classes and interactors etc etc etc.
82 * Revision 1.9 1993/12/16 06:20:57 robertj
83 * Changes to callback function definition due to GCC.
85 * Revision 1.8 1993/12/09 16:11:23 robertj
86 * Removed menu item pointer from array table form as is usually not usable.
88 * Revision 1.7 1993/12/01 16:09:05 robertj
91 * Revision 1.6 1993/09/27 16:35:25 robertj
94 * Revision 1.5 1993/08/21 01:50:33 robertj
95 * Made Clone() function optional, default will assert if called.
97 * Revision 1.4 1993/08/19 18:03:28 robertj
98 * Changed macro names so start with P
100 * Revision 1.3 1993/07/14 12:49:16 robertj
101 * Fixed RCS keywords.
111 /**A class representing a list of menu entries. An instance of a sub-menu,
112 rather than a \Ref{PRootMenu} which is descended from it, is a heirarchical
113 menu supported by most platforms.
115 class PSubMenu
: public PMenuEntry
117 PCLASSINFO(PSubMenu
, PMenuEntry
);
120 /**Create a new sub-menu in a hierarchical menu system. Place the new
121 sub-menu in the menu specified.
124 PSubMenu
& menu
, /// Menu into which the new entry is to be placed.
125 const PString
& itemName
, /// Name of the sub-menus title.
126 PMenuEntry
* before
= NULL
127 /**Menu entry before which the entry is to be inserted. If this is NULL
128 then the menu entry is appended to the end of the menu.
132 /** Destroy the menu and all its menu entries. */
136 /**@name Overrides from class PMenuEntry */
137 /**Set the string contents of the menu item. This string is scanned for the
138 special character '&' to place an underline attribute on the next
142 virtual void SetString(
143 const PString
& str
/// New string for the menu entry.
146 /**Get the current string name of the menu entry.
148 If a top level menu, \Ref{PRootMenu} class, then this returns an empty
152 string for the menu item name.
154 virtual PString
GetString() const;
156 /**@name New functions for class */
157 /**Get the count of the number of entries contained in this sub-menu.
160 number of entries in sub-menu.
162 PINDEX
GetSize() const;
164 /**Get the menu entry at the specified position. If the #index#
165 parameter is beyond the number of entries in the sub-menu then this
166 function will assert.
169 reference to the menu entry at the index position.
171 virtual PMenuEntry
& operator[](
172 PINDEX index
/// Ordinal index of the menu entry in the sub-menu.
177 /**@name New functions for class */
178 /** Contructor for top level menues, \Ref{PRootMenu} class. */
182 /**Scan through all menu items in the menu and execute their notification
183 function to enable or disable and check or uncheck the menu item.
185 For a sub-menu item this calls the UpdateMyCommandSources() function
186 for all its menu entries.
188 This function is used internally by the library. It would normally not
191 virtual void UpdateMyCommandSources();
194 /**@name Member variables */
198 PLIST(MenuEntryList
, PMenuEntry
);
199 /** List of menu items in the menu. */
200 MenuEntryList entries
;
203 friend class PMenuEntry
;
206 // Include platform dependent part of class
207 #include <pwlib/submenu.h>
211 // End Of File ///////////////////////////////////////////////////////////////