Added RFC 2190 H.263 code as created by Guilhem Tardy and AliceStreet
[pwlib.git] / include / pwlib / menuent.h
blobf28454cabf19300a46e015d3c046eae258dff135
1 /*
2 * menuent.h
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
18 * under the License.
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): ______________________________________.
29 * $Log$
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
54 * Documentation.
56 * Revision 1.6 1994/08/23 11:32:52 robertj
57 * Oops
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
69 * Fixed RCS keywords.
74 #define _PMENUENTRY
76 #ifdef __GNUC__
77 #pragma interface
78 #endif
81 class PSubMenu;
82 class PRootMenu;
83 class PMenuItem;
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
88 of more menu entries.
90 class PMenuEntry : public PObject
92 PCLASSINFO(PMenuEntry, PObject);
94 public:
95 /**Create a menu entry. This places the new menu entry into the menu
96 specified at the position specified.
98 PMenuEntry(
99 PSubMenu & menu, /// Menu into which the new entry is to be placed.
100 PMenuEntry * before
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".
113 @return
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.
119 ) const;
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
126 item.
128 virtual void SetString(
129 const PString & str /// New string for the menu entry.
130 ) = 0;
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
135 menu item.
137 @return
138 string for the menu entry.
140 virtual PString GetString() const = 0;
143 /**Get the menu this entry is contained in.
145 @return
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
151 contained in.
153 @return
154 root menu for entry.
156 PRootMenu * GetRootMenu() const;
158 /**Get the position in the menu of this entry. This first entry is at zero.
160 @return
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.
169 @return
170 TRUE if in check group, FALSE otherwise.
172 virtual BOOL IsMenuItemCheckGroup(const PMenuItem & groupItem) const;
175 protected:
176 /** Internal constructor for root menus. */
177 PMenuEntry();
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
184 be called directly.
186 virtual void UpdateMyCommandSources();
189 // Member variables
190 /** The menu that this entry is contained in. */
191 PSubMenu * itsMenu;
194 friend class PSubMenu;
197 // Include platform dependent part of class
198 #include <pwlib/menuent.h>
202 // End Of File ///////////////////////////////////////////////////////////////