// $Revision: 1.2 $ // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSample_MENUHOLDER #define TaligentSample_MENUHOLDER //---------------------------------- // Includes //---------------------------------- #ifndef Taligent_PRIMITIVETYPES #include #endif #ifndef Taligent_DEQUEOF #include #endif #ifndef Taligent_MENUCONTROLS #include #endif // TMenuHolder helps maintain menus in presentations. A small enabler class to make menu work easier. class TMenuHolder { public: TMenuHolder(); ~TMenuHolder(); TMenuHolder& operator=(TMenu* adoptMenu); TMenuHolder& operator=(MMenuItem* adoptMenuItem); operator bool() const; // True if initialized void ActivateFirst(TMenu& menu); void ActivateLast(TMenu& menu); void ActivateAfter(MMenuItem& after); void ActivateAfter(TMenu& menu, const TMenuDomainID& domain, const TMenuItemID& id); void Deactivate(); // Enable or disable entire menu void SetEnabled(bool enabled); // Enable or disable menu item(s) matching ID. Recursively examines all menu items. void SetEnabled(bool enabled, TMenuItemID id); protected: // Used for recursive examination of menu items void SetEnabled(bool enabled, TMenuItemID id, TMenu& menu); private: enum EState { kNew, kInactive, kActive }; EState fState; TDequeOf fItems; }; #endif // TaligentSample_MENUHOLDER