idocument.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:7k
- /*
- * ===========================================================================
- * PRODUCTION $Log: idocument.hpp,v $
- * PRODUCTION Revision 1000.3 2004/04/12 18:12:24 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.10
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_CORE___IDOCUMENT__HPP
- #define GUI_CORE___IDOCUMENT__HPP
- /* $Id: idocument.hpp,v 1000.3 2004/04/12 18:12:24 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: Mike DiCuccio
- *
- * File Description:
- * IDocument -- the basic data unit for GBENCH
- */
- #include <corelib/ncbiobj.hpp>
- #include <objmgr/scope.hpp>
- #include <gui/types.hpp>
- #include <list>
- BEGIN_NCBI_SCOPE
- class IView;
- class CSelectionBuffer;
- class IEventTransmitter;
- class IEventReceiver;
- //
- // class IDocument defines the abstract interface required of document objects.
- //
- // This class defines the properties that any code that works with documents
- // can reasonably expect a document to offer. It is not quite a pure interface
- // class, as it inherits from CObject and gains the data members of CObject as a result.
- // The interface includes hooks for view atachment and retrieval, document
- // identification, and retrieval of the core components of the document
- // itself. In essence, all documents must provide a CScope object that
- // can be used to retrieve the contents of the document. The base object in
- // the document is also expose for const manipulation.
- //
- class IDocument : public CObject
- {
- public:
- // Typedef for our views and lists of views
- typedef list< CRef<IView> > TViews;
- // virtual destructor
- virtual ~IDocument(void) { }
- // Get a description of our contents.
- // This is suitable for display in a GUI component such as a list view.
- virtual const string& GetTitle(void) const = 0;
- virtual const string& GetShortTitle(void) const = 0;
- // Retrieve the unique ID associated with this document
- virtual size_t GetDocID(void) const = 0;
- // Attach a view to the current document
- virtual void AttachView(IView* view, const string& pool = "") = 0;
- // detach a view from the current document
- virtual void DetachView(IView* view) = 0;
- // Retrieve the existing views for this class
- virtual const TViews& GetViews(void) const = 0;
- virtual TViews& SetViews(void) = 0;
- // Clear this document. This is called at application shut-down
- // to make sure all data is properly destroyed.
- virtual void Clear(void) = 0;
- // Hide/Show the workspace associated with this document
- virtual void ShowWorkspace(void) = 0;
- virtual void HideWorkspace(void) = 0;
- // Add an annotation to this document. This will throw an exception if the
- // action is unsupported.
- virtual void AttachAnnot(objects::CSeq_annot& annot) = 0;
- // access the scope associated with this document
- virtual objects::CScope& GetScope(void) const = 0;
- virtual void SetScope(objects::CScope& scope) = 0;
- // access the core object associated with this document
- // this is pure virtual to allow derived documents to define what their
- // central object is and how to return it to the system
- virtual const CObject* GetObject(void) const = 0;
- virtual CObject* GetObject(void) = 0;
- //
- // Messaging APIs
- //
- // Force all views to update themselves relative to this document
- // This is equivalent to calling PostDocumentChanged()
- virtual void UpdateAllViews(void) = 0;
- // Inform the members of a named pool that the document has changed
- virtual void PostDocumentChanged(const string& msg_pool = kEmptyStr) = 0;
- // Inform the members of a pool that the visible range has changed
- virtual void PostVisibleRangeChanged(const objects::CSeq_loc& loc,
- const string& msg_pool = kEmptyStr) = 0;
- // Inform the members of a pool that the selections have changed.
- virtual void PostSelectionChanged(const CSelectionBuffer& buf,
- const string& msg_pool = kEmptyStr) = 0;
- // Inform our views that there is a new view.
- virtual void PostViewCreated(IView& view) = 0;
- // Inform our views that a view has been deleted
- virtual void PostViewReleased(IView& view) = 0;
- // Send event to a view's message pool
- virtual void PostGroupMessage(IView* view, TUpdateFlags flags,
- const void* user_data) = 0;
- // Transmitter/reciever QI
- virtual IEventTransmitter * QueryInterfaceTransmitter(void) = 0;
- virtual IEventReceiver * QueryInterfaceReceiver(void) = 0;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: idocument.hpp,v $
- * Revision 1000.3 2004/04/12 18:12:24 gouriano
- * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.10
- *
- * Revision 1.10 2004/03/30 17:09:56 tereshko
- * Added support for events broadcasting
- *
- * Revision 1.9 2004/03/22 14:17:14 dicuccio
- * Replace gui/gui with gui/types - relieves FLTK dependency
- *
- * Revision 1.8 2004/03/11 17:16:04 dicuccio
- * Use gui/gui instead of gui/types
- *
- * Revision 1.7 2003/12/22 19:12:10 dicuccio
- * Modified mechanism for view-view messaging: provide more explicit function
- * signatures; added helper functions to make posting messages easier.
- *
- * Revision 1.6 2003/11/19 20:41:07 friedman
- * Added grouping views into group message pools
- *
- * Revision 1.5 2003/11/14 17:42:46 dicuccio
- * Added Clear()
- *
- * Revision 1.4 2003/11/06 19:51:40 dicuccio
- * Changed API for ATtachView() to take an optional message pool name
- *
- * Revision 1.3 2003/10/10 17:10:30 dicuccio
- * Added interface functions to detach a view from a document
- *
- * Revision 1.2 2003/09/29 15:20:06 dicuccio
- * Deprecated gui/scope.hpp. Merged gui/core/types.hpp into gui/types.hpp
- *
- * Revision 1.1 2003/09/04 13:56:53 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_CORE___IDOCUMENT__HPP