selection_buffer.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: selection_buffer.hpp,v $
- * PRODUCTION Revision 1000.4 2004/06/01 19:47:01 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.18
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_CORE___SELECTION_BUFFER__HPP
- #define GUI_CORE___SELECTION_BUFFER__HPP
- /* $Id: selection_buffer.hpp,v 1000.4 2004/06/01 19:47:01 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:
- * Container classes for GBENCH selection information
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/objutils/objects.hpp>
- #include <gui/objutils/iselection.hpp>
- #include <gui/core/idocument.hpp>
- #include <map>
- BEGIN_NCBI_SCOPE
- class IDocument;
- class CLayoutObject;
- //
- // Basic interface for a set of selected items
- //
- class NCBI_GUICORE_EXPORT CSelectionBuffer : public CObject,
- public ISelection
- {
- public:
- // typedef for our container
- // this maps a given document to the selection items that reference it
- typedef map< CConstRef<IDocument>, TConstObjects> TSelMap;
- // copy all selections from a given selection buffer
- void Copy(const CSelectionBuffer& other);
- // clear the current selections
- void Clear(void);
- // clear the selections for a given document
- void Clear(const IDocument* doc);
- // select a given document
- void AddSelection(const IDocument* doc);
- // select an object in a given document
- void AddSelection(const IDocument* doc, const CObject& obj);
- // remove the selection of a whole document
- void RemoveSelection(const IDocument* doc);
- // remove the selection of a given object
- void RemoveSelection(const IDocument* doc, const CObject& obj);
- // retrieve the selections for a given document
- const TConstObjects& GetSelections(const IDocument* doc) const;
- TConstObjects& SetSelections(const IDocument* doc);
- // ISelection interface requirements
- void GetSelections(TConstScopedObjects& objs) const;
- void SetSelections(const TConstScopedObjects& objs);
- // utility: decompose a set of selections into a list of objects
- // paired with their scopes of origin
- TConstScopedObjects DecomposeToPairs(void) const;
- operator bool(void) const;
- protected:
- mutable TSelMap m_SelMap;
- };
- inline
- CSelectionBuffer::operator bool(void) const
- {
- return m_SelMap.size() != 0;
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: selection_buffer.hpp,v $
- * Revision 1000.4 2004/06/01 19:47:01 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.18
- *
- * Revision 1.18 2004/05/03 12:42:17 dicuccio
- * Split gui_utils into gui_utils and gui_objutils
- *
- * Revision 1.17 2004/04/21 12:41:26 dicuccio
- * Added ISelection interface
- *
- * Revision 1.16 2004/04/16 14:28:25 dicuccio
- * Simplified interface - all selections set as CObject
- *
- * Revision 1.15 2004/04/07 12:37:11 dicuccio
- * Reworked CSelectionBuffer to use the structs and typedefs in objects.hpp
- *
- * Revision 1.14 2003/12/30 14:54:33 dicuccio
- * Store const IDocument* instead of non-const pointers. Pass IDocument as
- * const pointer
- *
- * Revision 1.13 2003/12/22 19:13:16 dicuccio
- * Added Copy(). Added lots of comments
- *
- * Revision 1.12 2003/11/06 19:59:29 dicuccio
- * Removed USING_SCOPE(objects)
- *
- * Revision 1.11 2003/09/04 14:00:26 dicuccio
- * Introduce IDocument and IView as abstract base classes. Use IDocument
- * instead of CDocument.
- *
- * Revision 1.10 2003/07/21 19:21:27 dicuccio
- * Large clean-ups. Removed all type-specific accessors - CSelectionBuffer is
- * now very generic
- *
- * Revision 1.9 2003/06/25 16:59:41 dicuccio
- * Changed CPluginHandle into a pointer-to-implementation (the previous
- * implementation is now the pointer held). Lots of #include file clean-ups.
- *
- * Revision 1.8 2003/04/16 18:17:01 dicuccio
- * Added ability to retrieve selections as generic CObjects, decomposed into
- * pairwise matches with source documents
- *
- * Revision 1.7 2003/02/24 13:00:17 dicuccio
- * Renamed classes in plugin spec:
- * CArgSeg --> CPluginArgSet
- * CArgument --> CPluginArg
- * CPluginArgs --> CPluginCommand
- * CPluginCommands --> CPluginCommandSet
- *
- * Revision 1.6 2003/02/20 19:44:06 dicuccio
- * Created new plugin architecture, mediated via an ASN.1 spec. Moved GBENCH
- * framework over to use new plugin architecture.
- *
- * Revision 1.5 2003/01/13 13:11:42 dicuccio
- * Namespace clean-up. Retired namespace gui -> converted to namespace ncbi.
- * Moved all FLUID-generated code into namespace ncbi.
- *
- * Revision 1.4 2002/12/19 18:13:02 dicuccio
- * Added export specifiers for Win32.
- *
- * Revision 1.3 2002/11/29 15:55:17 dicuccio
- * Added somewhat obtuse work-around for MSVC's handling of namespaces (the
- * nested namespace ncbi::objects presents a lot of difficulty for MSVC's
- * compiler)
- *
- * Revision 1.2 2002/11/07 18:20:13 dicuccio
- * Moved #ifdef to top of file.
- *
- * Revision 1.1 2002/11/04 21:09:06 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_CORE___SELECTION_BUFFER__HPP