menu.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: menu.hpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 19:52:19 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_FL___MENU__HPP
- #define GUI_WIDGETS_FL___MENU__HPP
- /* $Id: menu.hpp,v 1000.1 2004/06/01 19:52:19 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Andrey Yazhuk
- *
- */
- /// @file menu.hpp
-
- #include <corelib/ncbistd.hpp>
- #include <corelib/ncbi_tree.hpp>
- #include <gui/utils/command.hpp>
- #include <gui/widgets/fl/menu_item.hpp>
- #include <FL/Fl_Menu_.H>
- #include <FL/Fl_Menu_Item.H>
- #include <FL/Fl_Menu_Bar.H>
- #include <FL/Fl_Menu_Button.H>
- /** @addtogroup GUI_FltkWidgets
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- ////////////////////////////////////////////////////////////////////////////////
- /// class CMenuBase
- class NCBI_GUIWIDGETS_FL_EXPORT CMenuBase : public IMenu
- {
- public:
- CMenuBase();
- virtual ~CMenuBase();
- /// @name IMenu* implementation
- /// @{
- virtual void SetCmdTarget(CCommandTarget* target);
- virtual CCommandTarget* GetCmdTarget();
- /// @}
- protected:
- /// Traverses "submenu" tree and calls x_AddFLTKItem().
- ///
- /// This function works as "Interpreter" converting input CMenuItem tree to
- /// a sequence of FLTK menu items. This is NOT a "1-1" conversion. FLTK menu
- /// items are generated by calling x_AddFLTKItem() virtual function that must
- /// be overridden in the derived class.
- bool x_CreateFLTKMenu(const string& submenu_path, CMenuItem* submenu); //const
- /// called by x_CreateFLTKMenu for every FLTK item being created
- virtual void x_AddFLTKItem(const string& path, ulong shortcut,
- const TCmdID* cmd, int flags) = 0;
- protected:
- CCommandTarget* m_CmdTarget; /// root command target
- };
- ////////////////////////////////////////////////////////////////////////////////
- /// class CMenuBar - "extended" Fl_Menu_Bar.
- class NCBI_GUIWIDGETS_FL_EXPORT CMenuBar : public Fl_Menu_Bar,
- public CMenuBase
- {
- public:
- CMenuBar(int x, int y, int w, int h, const char *label = 0);
-
- virtual void SetItems(const SMenuItemRec* items);
- virtual void SetItems(CMenuItem* rootitem);
- protected:
- /// CMenuBase overridable
- virtual void x_AddFLTKItem(const string& path, ulong shortcut,
- const TCmdID* cmd, int flags);
- };
- ////////////////////////////////////////////////////////////////////////////////
- /// class CPopupMenu - "extended" Fl_Menu_Button.
- class NCBI_GUIWIDGETS_FL_EXPORT CPopupMenu : public Fl_Menu_Button,
- public CMenuBase
- {
- public:
- CPopupMenu(int x, int y, int w, int h, const char *label = 0);
-
- virtual void SetItems(const SMenuItemRec* items);
- virtual void SetItems(CMenuItem* rootitem);
- protected:
- void x_Init();
- /// CMenuBase overridable
- virtual void x_AddFLTKItem(const string& path, ulong shortcut,
- const TCmdID* cmd, int flags);
- };
- END_NCBI_SCOPE
- /* @} */
- /*
- * ===========================================================================
- * $Log: menu.hpp,v $
- * Revision 1000.1 2004/06/01 19:52:19 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- *
- * Revision 1.4 2004/05/11 18:55:14 dicuccio
- * Added doxygen modules info
- *
- * Revision 1.3 2004/04/22 16:49:29 yazhuk
- * Moved CMenuItem to menu_item.hpp
- *
- * Revision 1.2 2004/02/04 19:59:47 yazhuk
- * Moved CMenuBar constructor to cpp file
- *
- * Revision 1.1 2004/01/15 20:07:38 yazhuk
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_WIDGETS_FL___MENU__HPP