tax_tree.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: tax_tree.hpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 19:53:33 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS___TAX_TREE__HPP
- #define GUI_WIDGETS___TAX_TREE__HPP
- /* $Id: tax_tree.hpp,v 1000.1 2004/06/01 19:53:33 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:
- *
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/widgets/fl/tree_browser.hpp>
- #include <gui/widgets/tax_tree/tax_tree_ds.hpp>
- #include <gui/utils/view_event.hpp>
- #include <util/ievent_receiver.hpp>
- #include <util/ievent_transmitter.hpp>
- #include <memory>
- BEGIN_NCBI_SCOPE
- BEGIN_SCOPE(objects)
- class CSeq_id;
- //class ITreeIterator;
- END_SCOPE(objects)
- class CTaxTree;
- class IReporter;
- class CTaxTreeDataSource;
- //
- // class CTaxTreeBrowser implements a tree-based view of a taxonomic
- // hierarchy. This class was designed to deal with generating common
- // taxonomic trees, but should be flexible enough to deal with any
- // sort of taxonomic tree.
- //
- // This class wraps a data source that provides an abstraction for dealing
- // with taxonomic trees. The data source must provide a taxonomy tree
- // iterator conforming to that defined in <objects/taxon1/taxon1.hpp>.
- // No assumption is made about how the data are derived internally. In
- // addition, no assumption is made about the UIDs that this data source
- // contains. The data source must provide a mapping between a UID of
- // user-specified significance and a taxonomy ID and tax tree node.
- //
- class NCBI_GUIWIDGETS_SEQ_EXPORT CTaxTreeBrowser : public CTreeBrowser,
- public IEventTransmitter,
- public IEventReceiver
- {
- public:
- // default ctor (for FLTK)
- CTaxTreeBrowser(int x, int y, int w, int h, const char* label = NULL);
- // dtor
- ~CTaxTreeBrowser();
- // set the abstract reporter interface
- void SetReporter(IReporter* reporter);
- // set the data source for this widget
- void SetDataSource(CTaxTreeDataSource& ds);
- // set the current display mode. This controls how many nodes in the
- // tax tree we show, and how deep the branches should run.
- void SetDisplayMode(CTaxTreeDataSource::EDisplayMode mode);
- // retrieve the selected UIDs
- void GetSelectedUids(CTaxTreeDataSource::TUidVec& uids) const;
- // set selected ids
- void SetSelectedUids(const CTaxTreeDataSource::TUidVec& uids, Node* node);
- // callback function
- friend void OnTaxtreeNotify(Fl_Widget * widget, void * data);
- // handler for selection changed event
- void OnSelChangedEvent(CViewEvent::TEventObject evt);
- // IEventReciever
- EVENT_MAP_RX_BEGIN_INT
- EVENT_ACCEPT(CViewEvent::eSelectionChanged, OnSelChangedEvent)
- EVENT_MAP_RX_END
- // IEventTransmitter
- EVENT_MAP_TX_BEGIN
- EVENT_FIRE_ALL()
- EVENT_MAP_TX_END
- protected:
- friend class CTreeFiller;
- // the data source we use
- CRef<CTaxTreeDataSource> m_DataSource;
- // our internal tree structure
- auto_ptr<CTaxTree> m_TaxTree;
- // display mode
- CTaxTreeDataSource::EDisplayMode m_DispMode;
- // our reporter interface
- IReporter* m_Reporter;
- // This will clear our current tree and repopulate it from our data source
- void x_Refresh();
- typedef CTaxTreeDataSource::TTaxMap TTaxMap;
- void x_PopulateTree(Node* node, CTaxTree* tree);
- CTaxTreeBrowser(const CTaxTreeBrowser&);
- CTaxTreeBrowser& operator=(const CTaxTreeBrowser&);
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: tax_tree.hpp,v $
- * Revision 1000.1 2004/06/01 19:53:33 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- *
- * Revision 1.7 2004/05/13 17:31:17 dicuccio
- * Renamed data source file
- *
- * Revision 1.6 2004/04/09 16:53:08 tereshko
- * Added functionality to send/accept selections
- *
- * Revision 1.5 2004/04/07 12:44:08 dicuccio
- * Use CConstRef<CSeq_id> instead of int for sequences
- *
- * Revision 1.4 2004/04/01 19:03:41 dicuccio
- * Added support for limiting the tax tree to a more manageable set of nodes.
- *
- * Revision 1.3 2003/12/23 21:14:08 ucko
- * +<memory> for auto_ptr<>
- *
- * Revision 1.2 2003/12/23 15:38:22 dicuccio
- * Added lots of comments. Made the classes gi-agnostic (UIDs instead). Altered
- * the data source to return an ITreeIterator
- *
- * Revision 1.1 2003/12/22 19:46:00 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_WIDGETS___TAX_TREE__HPP