NCBI C++ ToolKit
ialign_row.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef __GUI_WIDGETS_ALNMULTI___IALIGN_ROW__HPP
2 #define __GUI_WIDGETS_ALNMULTI___IALIGN_ROW__HPP
3 
4 /* $Id: ialign_row.hpp 46571 2021-07-14 19:08:41Z shkeda $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Andrey Yazhuk, Anatoliy Kuznetsov
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbiobj.hpp>
36 
38 
39 #include <gui/opengl/glpane.hpp>
42 
43 // This header must (at least indirectly) precede any wxWidgets headers.
45 
46 #include <wx/event.h>
47 
49 
50 
51 class IAlignRowHost;
52 class ITooltipFormatter;
53 class CSelectionVisitor;
54 class CConsensusRow;
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 /// Interface IAlignRow - abstracts row rendering in Multiple Alignment
58 /// Widget.
59 ///
60 /// IAlignRow represents an object that can render an alignment row as a set
61 /// of cells corresponding to enumerated columns. No asumptions is made about
62 /// data structure used for alignment representation. The concrete classes
63 /// implementing the interface are responsible for providing means for
64 /// accessing data.
65 
66 class IAlignRow
67 {
68 public:
69  typedef vector<CHTMLActiveArea> TAreaVector;
70  typedef int TColumnType;
71 
72  /// Column identifier for use as TColumnType, defines basic column types
73  /// this set can be extended in derived classes
74  enum EColumnType {
75  eInvalid = -1,
77  eIcons, ///< Strand + Expand icons
84  eIconStrand, ///< Icon for Positive/Negative (Mixed?) strand
85  eIconExpand, ///< Icon for expand (+) button
91  ePctIdentity, ///< % identity to consensus or anchor
92  ePctCoverage, ///< % coverage to anchor
93  eMismatches, ///< % number of mismatches to anchor/consensus
94  //eAlignmentScore,
96  eLast
97  };
98 
99  /// Row state.
100  enum EState {
101  fNone = 0,
103  fItemFocused = 0x02,
104  fItemHidden = 0x08,
105 
106  fWidgetFocused = 0x40000000, ///< it isn'e exactly a row state;
107  // this flag is added dynamicaly to control row rendering
108 
112  };
113 
116  eDelete
117  };
118 
119  virtual ~IAlignRow() {};
120 
121  virtual void SetHost(IAlignRowHost* pHost) = 0;
122  virtual void SetConsensus(CConsensusRow* crow) = 0;
123 
124  virtual void SetDisplayStyle(const CRowDisplayStyle* style) = 0;
125  virtual const CRowDisplayStyle* GetDisplayStyle() = 0;
126 
127  /// Returns index of row in IAlnMultiDataSource.
128  virtual int GetRowNum() const = 0;
129 
130  /// Returns height of the row in pixels.
131  virtual int GetHeightPixels() const = 0;
132 
133  /// Renders a row cell corresponding to column specified by "col_type". "Pane"
134  /// represents port corresponding to the cell; model space is Elems x Pixels.
135  virtual void RenderColumn(TColumnType col_type) = 0;
136 
137  virtual void RenderRow() {}
138 
139  virtual void OnMouseEvent(wxMouseEvent& event, TColumnType col_type, CGlPane& pane) = 0;
140 
141  virtual void GetTooltip(const TVPPoint& pt, TColumnType col_type, CGlPane& pane, ITooltipFormatter& tooltip) = 0;
142 
143  virtual void GraphicsCacheCmd(EGraphCacheCmd /*cmd*/) {};
144 
145  virtual void GetHTMLActiveAreas(TColumnType col_type, CGlPane& pane, TAreaVector& areas) = 0;
146 
147  virtual void UpdateOnStyleChanged() = 0;
148  virtual void UpdateOnAnchorChanged() {}; // TODO
149  virtual void Update(const CGlPane& pane, bool layout_only = false) {};
150 
151  virtual TSeqPos GetColumnAsSeqPos(TColumnType type, const TModelRect& rc_vis) const = 0;
152  virtual string& GetColumnText(TColumnType col_type, string& text, bool for_printer = false) const = 0;
153  virtual float GetColumnAsFloat(TColumnType type) const = 0;
154 
155  virtual string& GetAlnSeqString(string &buffer, const IAlnExplorer::TSignedRange &aln_rng) const = 0;
156  virtual string& GetStringAtPos(string& buffer, TSignedSeqPos aln_pos) const = 0;
157 
158  virtual void GetRowStatistics(ITooltipFormatter& tooltip) const = 0;
159 
160  virtual bool UsesAATranslation() const = 0;
161  virtual bool IsNucProtAlignment() const = 0;
162 
163 
164  // ------------------------------------------------------------------
165  /// @name Row State accessors
166  /// @{
167 
168  /// Returns row state (combination of EState flags)
169  virtual int GetRowState() const = 0;
170 
171  /// Set/Clear Row State
172  virtual void SetRowState(int mask, bool b_set) = 0;
173  /// @}
174 
175  virtual void PrepareRendering(CGlPane& pane, TVPUnit row_top, int state) = 0;
176 protected:
177  typedef struct SRenderCtx {
179  int m_Top = 0;
181  int m_State = 0;
184 
185 };
186 
187 
188 ////////////////////////////////////////////////////////////////////////////////
189 /// IAlignRowHost represents a context in which IAlignRow lives.
190 ///
192 {
193 public:
194  virtual ~IAlignRowHost() {};
195 
196  /// provides mouse coords in OpenGL viewport coord system
197  virtual TVPPoint ARH_GetVPPosByWindowPos(const wxPoint& pos) = 0;
198 
199  /// notifies a host about changes the row
200  virtual void ARH_OnRowChanged(IAlignRow* row) = 0;
201 
202  /// notifies a host about selection change
203  virtual void ARH_OnSelectionChanged() = 0;
204 
205  /// notifies a host about selection change
207 
208  /// Returns Y-pos for row
209  virtual int ARH_GetRowTop(IAlignRow* p_row) = 0;
210 
211 };
212 
213 
214 
215 
217 
218 #endif // __GUI_WIDGETS_ALNMULTI___IALIGN_ROW__HPP
ncbi::TMaskedQueryRegions mask
Class CConsensusRow - Simple interface to a row that represents the consensus for rendering purposes.
class CGlPane
Definition: glpane.hpp:62
CRowDisplayStyle is a base class representing a display style for IAlignRow.
class CSelectionVisitor is a concrete glyph visitor for selection traversal and deselection traversal...
IAlignRowHost represents a context in which IAlignRow lives.
Definition: ialign_row.hpp:192
virtual void ARH_OnSelectionChanged()=0
notifies a host about selection change
virtual ~IAlignRowHost()
Definition: ialign_row.hpp:194
virtual CSelectionVisitor * ARH_GetSelectionVisitor()=0
notifies a host about selection change
virtual int ARH_GetRowTop(IAlignRow *p_row)=0
Returns Y-pos for row.
virtual TVPPoint ARH_GetVPPosByWindowPos(const wxPoint &pos)=0
provides mouse coords in OpenGL viewport coord system
virtual void ARH_OnRowChanged(IAlignRow *row)=0
notifies a host about changes the row
Interface IAlignRow - abstracts row rendering in Multiple Alignment Widget.
Definition: ialign_row.hpp:67
virtual int GetRowNum() const =0
Returns index of row in IAlnMultiDataSource.
virtual void RenderRow()
Definition: ialign_row.hpp:137
virtual bool UsesAATranslation() const =0
virtual ~IAlignRow()
Definition: ialign_row.hpp:119
virtual void UpdateOnAnchorChanged()
Definition: ialign_row.hpp:148
virtual string & GetColumnText(TColumnType col_type, string &text, bool for_printer=false) const =0
virtual void GetTooltip(const TVPPoint &pt, TColumnType col_type, CGlPane &pane, ITooltipFormatter &tooltip)=0
virtual void SetConsensus(CConsensusRow *crow)=0
virtual TSeqPos GetColumnAsSeqPos(TColumnType type, const TModelRect &rc_vis) const =0
virtual string & GetAlnSeqString(string &buffer, const IAlnExplorer::TSignedRange &aln_rng) const =0
virtual void SetHost(IAlignRowHost *pHost)=0
int TColumnType
Definition: ialign_row.hpp:70
virtual const CRowDisplayStyle * GetDisplayStyle()=0
virtual void GetHTMLActiveAreas(TColumnType col_type, CGlPane &pane, TAreaVector &areas)=0
virtual void RenderColumn(TColumnType col_type)=0
Renders a row cell corresponding to column specified by "col_type".
@ fWidgetFocused
it isn'e exactly a row state;
Definition: ialign_row.hpp:106
@ fSelectedFocused
Definition: ialign_row.hpp:111
virtual float GetColumnAsFloat(TColumnType type) const =0
virtual string & GetStringAtPos(string &buffer, TSignedSeqPos aln_pos) const =0
virtual int GetRowState() const =0
Returns row state (combination of EState flags)
virtual void SetRowState(int mask, bool b_set)=0
Set/Clear Row State.
virtual void SetDisplayStyle(const CRowDisplayStyle *style)=0
virtual void OnMouseEvent(wxMouseEvent &event, TColumnType col_type, CGlPane &pane)=0
virtual void GetRowStatistics(ITooltipFormatter &tooltip) const =0
virtual void UpdateOnStyleChanged()=0
virtual int GetHeightPixels() const =0
Returns height of the row in pixels.
vector< CHTMLActiveArea > TAreaVector
Definition: ialign_row.hpp:69
virtual void Update(const CGlPane &pane, bool layout_only=false)
Definition: ialign_row.hpp:149
struct IAlignRow::SRenderCtx SRenderCtx
virtual void PrepareRendering(CGlPane &pane, TVPUnit row_top, int state)=0
SRenderCtx m_RenderCtx
Definition: ialign_row.hpp:183
virtual void GraphicsCacheCmd(EGraphCacheCmd)
Definition: ialign_row.hpp:143
EColumnType
Column identifier for use as TColumnType, defines basic column types this set can be extended in deri...
Definition: ialign_row.hpp:74
@ ePctIdentity
% identity to consensus or anchor
Definition: ialign_row.hpp:91
@ eIsolationSource
Definition: ialign_row.hpp:87
@ eIconStrand
Icon for Positive/Negative (Mixed?) strand.
Definition: ialign_row.hpp:84
@ eIconExpand
Icon for expand (+) button.
Definition: ialign_row.hpp:85
@ eIcons
Strand + Expand icons.
Definition: ialign_row.hpp:77
@ eCollectionDate
Definition: ialign_row.hpp:89
@ ePctCoverage
% coverage to anchor
Definition: ialign_row.hpp:92
@ eMismatches
% number of mismatches to anchor/consensus
Definition: ialign_row.hpp:93
virtual bool IsNucProtAlignment() const =0
primitive interface to arrange tabular data in the tooltips
Definition: tooltip.hpp:55
Workaround for wxWidgets header errors in certain configurations; MUST be included (at least indirect...
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
int TVPUnit
Definition: gltypes.hpp:47
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static void text(MDB_val *v)
Definition: mdb_dump.c:62
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
static pcre_uint8 * buffer
Definition: pcretest.c:1051
#define row(bind, expected)
Definition: string_bind.c:73
Definition: type.c:6
Modified on Sun Jul 14 04:55:52 2024 by modify_doxy.py rev. 669887