align_row.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: align_row.hpp,v $
- * PRODUCTION Revision 1000.4 2004/04/12 18:15:43 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.27
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef __GUI_WIDGETS_ALNMULTI___ALIGN_ROW__HPP
- #define __GUI_WIDGETS_ALNMULTI___ALIGN_ROW__HPP
- /* $Id: align_row.hpp,v 1000.4 2004/04/12 18:15:43 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 <gui/opengl/gldlist.hpp>
- #include <gui/widgets/aln_multiple/ialign_row.hpp>
- #include <gui/widgets/aln_multiple/attr_range_coll.hpp>
- #include <gui/widgets/aln_multiple/alnvec_row_handle.hpp>
- BEGIN_NCBI_SCOPE
- class CScoreCache;
- class IAlnVecRowGraph;
- class IAlnRowGraphProperties;
- ////////////////////////////////////////////////////////////////////////////////
- /// CAlnVecRowDisplayStyle - extension of CRowDisplayStyle for CAlnVecRow.
- ///
- class NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT CAlnVecRowDisplayStyle
- : public CRowDisplayStyle
- {
- public:
- CAlnVecRowDisplayStyle()
- : m_AlignTextColor(0.0f, 0.0f, 0.0f),
- m_AlignColor(0.8f, 0.8f, 0.8f)
- {
- }
-
- virtual const CGlColor& GetAlignTextColor() const;
- virtual const CGlColor& GetAlignColor() const;
- protected:
- CGlColor m_AlignTextColor; /// sequence color
- CGlColor m_AlignColor; /// background color for aligned segments
- };
- ////////////////////////////////////////////////////////////////////////////////
- /// class CAlnVecRow - implementation of IAlignRow for CAlnVec-based alignments.
- /// CAlnVecRow uses CAlnVecRowHandle as proxy for accesing data in CAlnVec.
- class NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT CAlnVecRow : public IAlignRow
- {
- public:
- CAlnVecRow(const CAlnVecRowHandle& handle);
- ~CAlnVecRow();
- /// @name IAlignRow implementation
- /// @{
- virtual void SetHost(IAlignRowHost* host);
- virtual void SetDisplayStyle(const CRowDisplayStyle* style);
- virtual const CRowDisplayStyle* GetDisplayStyle();
- virtual int GetRowNum() const;
- virtual int GetHeightPixels() const;
- virtual void RenderColumn(EColumnType col_type, CGlPane& pane, int state);
-
- virtual int handle(CGUIEvent& event, EColumnType col_type, CGlPane& pane);
-
- virtual string GetTooltip(EColumnType col_type, CGlPane& pane);
-
- virtual void GraphicsCacheCmd(EGraphCacheCmd cmd);
- virtual void GetHTMLActiveAreas(EColumnType col_type, CGlPane& pane, TAreaVector& areas);
- /// @}
- void SetScoreCache(CScoreCache* cache);
- virtual bool IsExpandable() const;
- virtual bool IsExpanded() const;
- virtual void Expand(bool b_exp);
- virtual const IAlnRowGraphProperties* GetProperties() const;
- virtual void SetProperties(IAlnRowGraphProperties* props);
- protected:
- enum EButtons {
- eStrandMarker,
- eExpand,
- eSetupGraphs
- };
-
- typedef CRef<CAlnVec::CAlnChunkVec> TRefChunks;
- virtual void x_CreateGraph();
- virtual void x_DestroyGraph();
- void x_RenderDescr(CGlPane& pane, int State);
- void x_RenderAlign(CGlPane& pane);
- void x_RenderIcons(CGlPane& pane);
- void x_RenderEmptyBox(CGlPane& pane);
- void x_RenderAlignSegments(CGlPane& pane, TRefChunks& chunks, int top_y, int bottom_y);
- void x_RenderAlignScores(CGlPane& pane, TRefChunks& chunks);
- bool x_CanRenderSeq(CGlPane& pane);
- void x_RenderSequence(CGlPane& pane, float y, int start, int stop);
- virtual void x_RenderGraph(CGlPane& pane, CConstRef<CAlnVec::CAlnChunkVec> chunks);
- void x_RenderStartPos(CGlPane& pane);
- void x_RenderEndPos(CGlPane& pane);
- void x_RenderSeqEnd(CGlPane& pane);
- void x_RenderAlnPos(CGlPane& pane, TSeqPos aln_pos,
- objects::CAlnVec::ESearchDirection dir);
- void x_RenderPos(CGlPane& pane, TSeqPos pos, const char* s_marker);
-
- TVPRect x_GetButtonRect(CGlPane& pane, EButtons btn);
- virtual void x_OnClickExpandBtn();
- virtual string x_GetIconsTooltip(CGlPane& pane);
- virtual string x_GetAlignmentTooltip(CGlPane& pane);
- IAlignRowHost* x_GetHost() { return m_pHost; }
- protected:
- const CAlnVecRowHandle& m_Handle;
-
- IAlignRowHost* m_pHost;
-
- int m_Height;
- int m_BaseHeight;
- string m_Text;
- bool m_bExpanded;
-
- const CAlnVecRowDisplayStyle* m_pStyle; /// row display style
- CScoreCache* m_pCache;
-
- IAlnVecRowGraph* m_pGraph; /// graph hosted in the expandable area
- /// Graphics caching
- CGlDisplayList m_DList;
- TVPUnit m_PixLeft, m_PixRight;
- TModelUnit m_ModelLeft, m_ModelRight;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: align_row.hpp,v $
- * Revision 1000.4 2004/04/12 18:15:43 gouriano
- * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.27
- *
- * Revision 1.27 2004/04/06 21:48:16 yazhuk
- * Added NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT to CAlnVecRow
- *
- * Revision 1.26 2004/04/06 19:09:27 yazhuk
- * Added "EColumnType col_type" to GetHTMLActiveAreas()
- *
- * Revision 1.25 2004/04/02 16:40:29 yazhuk
- * Rearranged values in EButtons
- *
- * Revision 1.24 2004/03/29 19:08:01 yazhuk
- * Added API for Graph properties access, GetHTMLActiveAreas generation,
- * eliminated m_TraceProxy
- *
- * Revision 1.23 2004/03/26 15:01:15 yazhuk
- * CTraceDataProxy class added
- *
- * Revision 1.22 2004/03/18 17:09:40 yazhuk
- * Added API for expanding rows
- *
- * Revision 1.21 2004/03/08 17:06:59 yazhuk
- * Replaced CTraceGraph with IAlnVecRowGraph interface; make some functions
- * virtual
- *
- * Revision 1.20 2004/03/08 15:51:59 yazhuk
- * Replaced list of graph with a pointer to grapp, added x_IsExpandable()
- *
- * Revision 1.19 2004/03/02 15:11:52 yazhuk
- * Added support for Trace Graphs
- *
- * Revision 1.18 2004/02/17 15:18:47 yazhuk
- * Support for graphics caching
- *
- * Revision 1.17 2004/02/10 19:54:08 yazhuk
- * Added RenderAlignSegments() RenderAlignScores() member functions
- *
- * Revision 1.16 2004/01/08 19:42:44 yazhuk
- * Added x_GetIconsTooltip(), x_GetAlignmentTooltip()
- *
- * Revision 1.15 2003/12/29 23:19:45 yazhuk
- * Added GetTooltip()
- *
- * Revision 1.14 2003/12/18 21:10:08 yazhuk
- * Redesigned CAlnVecRow - separated display style
- *
- * Revision 1.13 2003/12/01 16:55:41 yazhuk
- * In handle() replaced "int event" with CGUIEvent&
- *
- * Revision 1.12 2003/11/06 20:01:09 dicuccio
- * Removed USING_SCOPE(objects)
- *
- * Revision 1.11 2003/11/03 16:50:22 yazhuk
- * Implemented event handling and support for expanding/collapsing alignment rows
- *
- * Revision 1.10 2003/10/29 23:24:54 yazhuk
- * Removed IAlignRowRenderer, renamed CAlignRowRenderer to CAlnVecRow
- *
- * Revision 1.9 2003/10/15 21:22:31 yazhuk
- * Migrated from using CAlnVec to accessing data via "generic" interface in CAlignDataSource.
- *
- * Revision 1.8 2003/10/10 19:05:00 yazhuk
- * Added support for score coloring and setting fonts
- *
- * Revision 1.7 2003/10/08 14:12:41 dicuccio
- * Made interface class's dtor inline. Use CRef<> for CGlBitmapFont. Moved
- * CGlPane into opengl
- *
- * Revision 1.6 2003/09/29 15:20:08 dicuccio
- * Deprecated gui/scope.hpp. Merged gui/core/types.hpp into gui/types.hpp
- *
- * Revision 1.5 2003/09/29 13:44:28 yazhuk
- * Added "SeqEnd" column and functions for rendering "Start", "End" and "SeqEnd" columns
- *
- * Revision 1.4 2003/09/23 20:52:57 yazhuk
- * Added #include <corelib/ncbistl.hpp>
- *
- * Revision 1.3 2003/09/10 20:39:30 yazhuk
- * Introduced notion of Columns
- *
- * Revision 1.2 2003/09/08 16:22:33 yazhuk
- * Drawing insertions, small improvements
- *
- * Revision 1.1 2003/08/28 18:22:45 yazhuk
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // __GUI_WIDGETS_ALNMULTI___ALIGN_ROW__HPP