submenu.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:6k
- /*
- * submenu.h
- *
- * Hierarchical sub-menu.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: submenu.h,v $
- * Revision 1.25 1999/03/10 03:49:53 robertj
- * More documentation adjustments.
- *
- * Revision 1.24 1999/03/09 08:01:50 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.23 1999/02/16 08:08:46 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.22 1998/09/23 06:29:24 robertj
- * Added open source copyright license.
- *
- * Revision 1.21 1995/06/17 11:13:29 robertj
- * Documentation update.
- *
- * Revision 1.20 1995/03/14 12:42:44 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.19 1995/02/19 04:19:22 robertj
- * Added dynamically linked command processing.
- *
- * Revision 1.18 1995/01/09 12:30:11 robertj
- * Added virtual to [] operator for unix implementation.
- *
- * Revision 1.17 1995/01/03 09:36:20 robertj
- * Documentation.
- *
- * Revision 1.16 1994/11/19 00:06:06 robertj
- * Removed variable argument list binding for menus and controls.
- *
- * Revision 1.15 1994/10/30 11:47:23 robertj
- * Changed mechanism for doing notification callback functions.
- *
- * Revision 1.14 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.13 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.12 1994/07/17 10:46:06 robertj
- * Removed unnecessary forward reference.
- *
- * Revision 1.11 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.10 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.9 1993/12/16 06:20:57 robertj
- * Changes to callback function definition due to GCC.
- *
- * Revision 1.8 1993/12/09 16:11:23 robertj
- * Removed menu item pointer from array table form as is usually not usable.
- *
- * Revision 1.7 1993/12/01 16:09:05 robertj
- * Windows NT port.
- *
- * Revision 1.6 1993/09/27 16:35:25 robertj
- * Capitalised macro.
- *
- * Revision 1.5 1993/08/21 01:50:33 robertj
- * Made Clone() function optional, default will assert if called.
- *
- * Revision 1.4 1993/08/19 18:03:28 robertj
- * Changed macro names so start with P
- *
- * Revision 1.3 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PSUBMENU
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A class representing a list of menu entries. An instance of a sub-menu,
- rather than a Ref{PRootMenu} which is descended from it, is a heirarchical
- menu supported by most platforms.
- */
- class PSubMenu : public PMenuEntry
- {
- PCLASSINFO(PSubMenu, PMenuEntry);
- public:
- /**Create a new sub-menu in a hierarchical menu system. Place the new
- sub-menu in the menu specified.
- */
- PSubMenu(
- PSubMenu & menu, /// Menu into which the new entry is to be placed.
- const PString & itemName, /// Name of the sub-menus title.
- PMenuEntry * before = NULL
- /**Menu entry before which the entry is to be inserted. If this is NULL
- then the menu entry is appended to the end of the menu.
- */
- );
- /** Destroy the menu and all its menu entries. */
- virtual ~PSubMenu();
- /**@name Overrides from class PMenuEntry */
- /**Set the string contents of the menu item. This string is scanned for the
- special character '&' to place an underline attribute on the next
- character.
-
- */
- virtual void SetString(
- const PString & str /// New string for the menu entry.
- );
- /**Get the current string name of the menu entry.
- If a top level menu, Ref{PRootMenu} class, then this returns an empty
- string.
- @return
- string for the menu item name.
- */
- virtual PString GetString() const;
- /**@name New functions for class */
- /**Get the count of the number of entries contained in this sub-menu.
- @return
- number of entries in sub-menu.
- */
- PINDEX GetSize() const;
-
- /**Get the menu entry at the specified position. If the #index#
- parameter is beyond the number of entries in the sub-menu then this
- function will assert.
- @return
- reference to the menu entry at the index position.
- */
- virtual PMenuEntry & operator[](
- PINDEX index /// Ordinal index of the menu entry in the sub-menu.
- );
-
-
- protected:
- /**@name New functions for class */
- /** Contructor for top level menues, Ref{PRootMenu} class. */
- PSubMenu();
- /**Scan through all menu items in the menu and execute their notification
- function to enable or disable and check or uncheck the menu item.
- For a sub-menu item this calls the UpdateMyCommandSources() function
- for all its menu entries.
- This function is used internally by the library. It would normally not
- be called directly.
- */
- virtual void UpdateMyCommandSources();
- /**@name Member variables */
- /** Menu title. */
- PString title;
- PLIST(MenuEntryList, PMenuEntry);
- /** List of menu items in the menu. */
- MenuEntryList entries;
- friend class PMenuEntry;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////