layout_chooser.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: layout_chooser.hpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 19:46:34 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_UTILS___LAYOUT_CHOOSER__HPP
- #define GUI_UTILS___LAYOUT_CHOOSER__HPP
- /* $Id: layout_chooser.hpp,v 1000.1 2004/06/01 19:46:34 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: Robert G. Smith
- *
- * File Description:
- *
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/gui.hpp>
- #include <vector>
- BEGIN_NCBI_SCOPE
- ///
- /// class CLayoutObjectChooser
- ///
- /// interface to select Layout Objects.
- /// Descendants should have some criteria to match various CLayoutObjects
- /// such as accept all alignment objects or all features whose type/subtypes
- /// are in a given list.
- ///
- class CLayoutObject;
- class CLayoutFeat;
- class NCBI_GUICONFIG_EXPORT CLayoutObjectChooser : public CObject
- {
- public:
- virtual ~CLayoutObjectChooser();
- /// does the layout object match the criteria given by this class?
- virtual bool Matches(const CLayoutObject* obj) const = 0;
- /// will any alignments be matched?
- virtual bool CanMatchAlignments() const;
- /// will any graphs be matched?
- virtual bool CanMatchGraphs() const;
- /// will any features be matched?
- virtual bool CanMatchFeats() const;
-
-
- virtual string ToString() const = 0;
- static CLayoutObjectChooser* FromString(const string& s);
- };
- /// matches all alignment layout objects. Does not match anything else.
- class NCBI_GUICONFIG_EXPORT CLayoutAlignChooser : public CLayoutObjectChooser
- {
- public:
- virtual bool Matches(const CLayoutObject* obj) const;
- virtual bool CanMatchAlignments() const;
- static string GetClassKey();
- virtual string ToString() const;
- };
- /// matches all graph layout objects. Does not match anything else.
- class NCBI_GUICONFIG_EXPORT CLayoutGraphChooser : public CLayoutObjectChooser
- {
- public:
- virtual bool Matches(const CLayoutObject* obj) const;
- virtual bool CanMatchGraphs() const;
- static string GetClassKey();
- virtual string ToString() const;
- };
- /// matches all feature layout objects. Does not match anything else.
- class NCBI_GUICONFIG_EXPORT CLayoutFeatChooser : public CLayoutObjectChooser
- {
- public:
- virtual bool Matches(const CLayoutObject* obj) const;
- virtual bool CanMatchFeats() const;
-
- static string GetClassKey();
- virtual string ToString() const;
- /// Does this feature match our criteria?
- /// use when you know you have a CLayoutFeat
- /// available when CanMatchFeats returns true.
- virtual bool MatchFeat(const CLayoutFeat& feat) const;
- };
- /// Matches features with a particular type and subtype. Nothing else.
- class NCBI_GUICONFIG_EXPORT CLayoutFeatTypeChooser : public CLayoutFeatChooser
- {
- public:
- CLayoutFeatTypeChooser();
- CLayoutFeatTypeChooser(int type, int subtype);
- CLayoutFeatTypeChooser(const string& data);
-
- static string GetClassKey();
- virtual string ToString() const;
- /// Does this feature match our criteria?
- /// use when you know you have a CLayoutFeat
- virtual bool MatchFeat(const CLayoutFeat& feat) const;
-
- int GetMatchingType() const;
- int GetMatchingSubtype() const;
- void SetMatchingType(int t);
- void SetMatchingSubtype(int s);
-
- private:
- int m_MatchingType;
- int m_MatchingSubtype;
- };
- /// Matches features that have one of a list of types/subtypes.
- class NCBI_GUICONFIG_EXPORT CLayoutFeatTypeListChooser : public CLayoutFeatChooser
- {
- public:
- CLayoutFeatTypeListChooser();
- CLayoutFeatTypeListChooser(const string& data);
- CLayoutFeatTypeListChooser(const vector<CLayoutFeatTypeChooser>& );
-
- static string GetClassKey();
- virtual string ToString() const;
-
- void AddTypeSubtype(int type, int subtype);
-
- /// Does this feature match one of our list of types/subtypes?
- /// use when you know you have a CLayoutFeat
- virtual bool MatchFeat(const CLayoutFeat& feat) const;
- private:
- vector<CLayoutFeatTypeChooser> m_MatchTypes;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: layout_chooser.hpp,v $
- * Revision 1000.1 2004/06/01 19:46:34 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2
- *
- * Revision 1.2 2004/05/03 12:39:54 dicuccio
- * Added #include for gui/gui.hpp
- *
- * Revision 1.1 2003/12/30 14:56:04 dicuccio
- * Moved layout_chooser.hpp to config library (avoids circular dependency). Moved
- * all FLTK stuff to gui/dialogs/config/.
- *
- * Revision 1.2 2003/12/29 19:26:20 rsmith
- * Add serialization (ToString, from string) to Layout Chooser classes.
- *
- * Revision 1.1 2003/11/26 21:14:41 rsmith
- * Initial checkin
- *
- *
- * ===========================================================================
- */
- #endif // GUI_UTILS___LAYOUT_CHOOSER__HPP