4 * Menu entry ancestor class.
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.14 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.13 1999/03/10 03:49:52 robertj
35 * More documentation adjustments.
37 * Revision 1.12 1999/03/09 08:01:49 robertj
38 * Changed comments for doc++ support (more to come).
40 * Revision 1.11 1999/02/16 08:08:45 robertj
41 * MSVC 6.0 compatibility changes.
43 * Revision 1.10 1998/09/23 06:24:19 robertj
44 * Added open source copyright license.
46 * Revision 1.9 1995/03/14 12:41:47 robertj
47 * Updated documentation to use HTML codes.
49 * Revision 1.8 1995/02/19 04:11:03 robertj
50 * Changed mechanism for implementing menu item check groups.
51 * Added dynamically linked command processing.
53 * Revision 1.7 1995/01/03 09:36:15 robertj
56 * Revision 1.6 1994/08/23 11:32:52 robertj
59 * Revision 1.5 1994/08/22 00:46:48 robertj
60 * Added pragma fro GNU C++ compiler.
62 * Revision 1.4 1994/06/25 11:55:15 robertj
63 * Unix version synchronisation.
65 * Revision 1.3 1994/01/03 04:42:23 robertj
66 * Mass changes to common container classes and interactors etc etc etc.
68 * Revision 1.2 1993/07/14 12:49:16 robertj
86 /**A abstract class representing an entry in a menu. A menu entry may be a
87 menu item that may be selected by the user, a menu separator or a sub-menu
90 class PMenuEntry
: public PObject
92 PCLASSINFO(PMenuEntry
, PObject
);
95 /**Create a menu entry. This places the new menu entry into the menu
96 specified at the position specified.
99 PSubMenu
& menu
, /// Menu into which the new entry is to be placed.
101 /**Menu entry before which the entry is to be inserted. If this is NULL
102 then the menu entry is appended to the end of the menu.
106 /** Destroy the menu entry. */
107 virtual ~PMenuEntry();
110 /**@name Overrides from PObject */
111 /**Determine if the two menu entry objects are the "same".
114 #EqualTo# if the two menus entries have the same position in
115 the same menu, otherwise #GreaterThan#.
117 virtual Comparison
Compare(
118 const PObject
& obj
/// Menu entry to compare against.
122 /**@name New functions for class */
123 /**Set the string name of the menu entry. The specific descendent class
124 determines what the string is. For example in a separator this does
125 nothing but in a menu item it is the text representation of the menu
128 virtual void SetString(
129 const PString
& str
/// New string for the menu entry.
132 /**Get the current string name of the menu entry. The specific descendent
133 class determines what the string is. For example in a separator this
134 does nothing but in a menu item it is the text representation of the
138 string for the menu entry.
140 virtual PString
GetString() const = 0;
143 /**Get the menu this entry is contained in.
146 pointer to owner menu.
148 PSubMenu
* GetMenu() const;
150 /**Get the top most menu of the tree of sub-menus that the entry is
156 PRootMenu
* GetRootMenu() const;
158 /**Get the position in the menu of this entry. This first entry is at zero.
161 ordinal index position in the menu for the entry.
163 PINDEX
GetPosition() const;
165 /**Determine if the menu entry is in a menu item check group. If the entry
166 is not a menu item or does not have the same notification function, the
167 qualification for being in a menu check group, then returns FALSE.
170 TRUE if in check group, FALSE otherwise.
172 virtual BOOL
IsMenuItemCheckGroup(const PMenuItem
& groupItem
) const;
176 /** Internal constructor for root menus. */
180 /**Scan through all menu items in the menu and execute their notification
181 function to enable or disable and check or uncheck the menu item.
183 This function is used internally by the library. It would normally not
186 virtual void UpdateMyCommandSources();
190 /** The menu that this entry is contained in. */
194 friend class PSubMenu
;
197 // Include platform dependent part of class
198 #include <pwlib/menuent.h>
202 // End Of File ///////////////////////////////////////////////////////////////