menuent.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:6k
- /*
- * menuent.h
- *
- * Menu entry ancestor class.
- *
- * 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: menuent.h,v $
- * Revision 1.13 1999/03/10 03:49:52 robertj
- * More documentation adjustments.
- *
- * Revision 1.12 1999/03/09 08:01:49 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.11 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.10 1998/09/23 06:24:19 robertj
- * Added open source copyright license.
- *
- * Revision 1.9 1995/03/14 12:41:47 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.8 1995/02/19 04:11:03 robertj
- * Changed mechanism for implementing menu item check groups.
- * Added dynamically linked command processing.
- *
- * Revision 1.7 1995/01/03 09:36:15 robertj
- * Documentation.
- *
- * Revision 1.6 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.5 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.4 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.3 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PMENUENTRY
- #ifdef __GNUC__
- #pragma interface
- #endif
- class PSubMenu;
- class PRootMenu;
- class PMenuItem;
- /**A abstract class representing an entry in a menu. A menu entry may be a
- menu item that may be selected by the user, a menu separator or a sub-menu
- of more menu entries.
- */
- class PMenuEntry : public PObject
- {
- PCLASSINFO(PMenuEntry, PObject);
- public:
- /**Create a menu entry. This places the new menu entry into the menu
- specified at the position specified.
- */
- PMenuEntry(
- PSubMenu & menu, /// Menu into which the new entry is to be placed.
- PMenuEntry * before
- /**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 entry. */
- virtual ~PMenuEntry();
- /**@name Overrides from PObject */
- /**Determine if the two menu entry objects are the "same".
- @return
- #EqualTo# if the two menus entries have the same position in
- the same menu, otherwise #GreaterThan#.
- */
- virtual Comparison Compare(
- const PObject & obj /// Menu entry to compare against.
- ) const;
- /**@name New functions for class */
- /**Set the string name of the menu entry. The specific descendent class
- determines what the string is. For example in a separator this does
- nothing but in a menu item it is the text representation of the menu
- item.
- */
- virtual void SetString(
- const PString & str /// New string for the menu entry.
- ) = 0;
-
- /**Get the current string name of the menu entry. The specific descendent
- class determines what the string is. For example in a separator this
- does nothing but in a menu item it is the text representation of the
- menu item.
- @return
- string for the menu entry.
- */
- virtual PString GetString() const = 0;
- /**Get the menu this entry is contained in.
- @return
- pointer to owner menu.
- */
- PSubMenu * GetMenu() const;
- /**Get the top most menu of the tree of sub-menus that the entry is
- contained in.
-
- @return
- root menu for entry.
- */
- PRootMenu * GetRootMenu() const;
- /**Get the position in the menu of this entry. This first entry is at zero.
- @return
- ordinal index position in the menu for the entry.
- */
- PINDEX GetPosition() const;
- /**Determine if the menu entry is in a menu item check group. If the entry
- is not a menu item or does not have the same notification function, the
- qualification for being in a menu check group, then returns FALSE.
- @return
- TRUE if in check group, FALSE otherwise.
- */
- virtual BOOL IsMenuItemCheckGroup(const PMenuItem & groupItem) const;
- protected:
- /** Internal constructor for root menus. */
- PMenuEntry();
- /**Scan through all menu items in the menu and execute their notification
- function to enable or disable and check or uncheck the menu item.
- This function is used internally by the library. It would normally not
- be called directly.
- */
- virtual void UpdateMyCommandSources();
- // Member variables
- /** The menu that this entry is contained in. */
- PSubMenu * itsMenu;
- friend class PSubMenu;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////