frame_window.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: frame_window.hpp,v $
- * PRODUCTION Revision 1000.0 2004/06/01 19:57:17 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_WORKSPACE___FRAME_WINDOW_HPP
- #define GUI_WIDGETS_WORKSPACE___FRAME_WINDOW_HPP
- /* $Id: frame_window.hpp,v 1000.0 2004/06/01 19:57:17 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 Description:
- *
- */
- #include <corelib/ncbistd.hpp>
- #include <gui/utils/command.hpp>
- #include <gui/utils/gui_event.hpp>
- #include <gui/widgets/fl/menu_item.hpp>
- #include <gui/widgets/fl/menu_window.hpp>
- #include <gui/widgets/fl/fltk_timer.hpp>
- #include <gui/widgets/fl/status_bar.hpp>
- #include <FL/Fl_Group.H>
- #include <FL/Fl_Double_Window.H>
- BEGIN_NCBI_SCOPE
- class CFrameWindow;
- ///////////////////////////////////////////////////////////////////////////////
- /// IFrameWindowClient
- class IFrameWindowClient
- {
- public:
- virtual ~IFrameWindowClient() {};
- virtual void SetFrameWindow(CFrameWindow* frame) = 0;
- virtual const CMenuItem* GetMenu() const = 0;
- };
- ///////////////////////////////////////////////////////////////////////////////
- /// CFrameWindow - top-level frame window providing basic services to its child
- /// widgets such as:
- /// - top-level shared menu bar and menu merging capabilities
- /// - top-level status bar
- /// - command routing and command update mechansim
- /// - keyboard shortcuts
- class NCBI_GUIWIDGETS_WORKSPACE_EXPORT CFrameWindow : public Fl_Double_Window,
- public CCommandTarget,
- public ITimerListener,
- public IMenuHintListener
- {
- public:
- typedef Fl_Double_Window TParent;
- CFrameWindow(int w, int h, const char* title);
- virtual ~CFrameWindow();
- /// Replace existing menu with one specified by "item", make it a "backbone"
- /// (default) menu of the window and then merge Client's menu into it.
- virtual void ResetMenu(const CMenuItem& item);
-
- /// Resets current menu to "backbone"
- virtual void ResetMenu();
- /// Merge provided menu into exisitng FrameWindow's menu. This does not affect
- /// "backbone" menu of the Frame.
- virtual void MergeMenu(const CMenuItem& item);
- virtual void SetClient(IFrameWindowClient* client);
- virtual void RemoveClient();
- /// @name Fl_Widget overridables
- /// @{
- virtual void show();
- virtual void hide();
- virtual void resize(int x, int y, int w, int h);
- virtual int handle(int event);
- /// @}
- /// ITimerListener implementation
- virtual void OnTimeout(int timer_id);
- /// IMenuHintListener implementation
- virtual void OnHint(const string& hint);
- protected:
- Fl_Widget* x_ClientWidget();
- virtual void x_SetupStatusBar();
- virtual void x_AddClientMenu();
- virtual void x_Layout();
- virtual void x_OnUpdateUI();
- static void x_OnUpdateUI(void* data); // callback for
- virtual bool x_HandleAccelerator();
- virtual bool x_HandleMenuActivate();
- protected:
- CMenuItem* m_BaseMenu; // static backbone that does not depend on Client
- CMenuBar1* m_MenuBar;
- int m_MenuBarH;
- CStatusBar1* m_StatusBar;
- CStatusBar1::TSlotHandle m_CmdHintSlot;
- int m_StatusBarH;
-
- Fl_Group* m_ClientGroup; // place holder for a client
- IFrameWindowClient* m_Client;
- CCommandTarget* m_CmdTarget; // client target
- CFLTKTimer m_UpdateUITimer;
- CGUIEvent m_Event;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: frame_window.hpp,v $
- * Revision 1000.0 2004/06/01 19:57:17 gouriano
- * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3
- *
- * Revision 1.3 2004/05/20 12:24:55 dicuccio
- * Added export specifiers
- *
- * Revision 1.2 2004/05/13 17:33:06 yazhuk
- * Added support for status bar, accelerators, keyboard activated menu bar
- *
- * Revision 1.1 2004/05/07 14:22:01 yazhuk
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_WIDGETS_WORKSPACE___FRAME_WINDOW_HPP