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

Go to the SVN repository for this file.

1 /* $Id: viewable_alignment.hpp 33815 2007-05-04 17:18:18Z kazimird $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors: Paul Thiessen
27 *
28 * File Description:
29 * base class for information to be displayed in SequenceViewerWidget
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef WX_VIEWABLE_ALIGNMENT__HPP
35 #define WX_VIEWABLE_ALIGNMENT__HPP
36 
37 // This is the generic interface to a viewable alignment; it provides a minimal
38 // set of functions that are required to build the display. Any objects to be
39 // displayed in the SequenceViewerWidget must be derived from ViewableAlignment,
40 // and must implement these functions.
41 
42 class wxString;
43 class wxColour;
44 
46 {
47 public:
48  virtual ~ViewableAlignment(void) { }
49 
50  // should set the overall size of the display, in columns (width) and rows (height)
51  virtual void GetSize(unsigned int *columns, unsigned int *rows) const = 0;
52 
53  // should set a title string and color for a row; if the return value is false,
54  // the title area will be left blank.
55  virtual bool GetRowTitle(unsigned int row, wxString *title, wxColour *color) const = 0;
56 
57  // should set the character and its traits to display at the given location;
58  // both columns and rows are numbered from zero. If the return value is false,
59  // the cell for this character will be left blank. If drawBackground is true,
60  // then the cell's background will be redrawn with the given color (e.g.,
61  // for highlights).
62  virtual bool GetCharacterTraitsAt(unsigned int column, unsigned int row, // location
63  char *character, // character to draw
64  wxColour *color, // color of this character
65  bool *drawBackground, // special background color?
66  wxColour *cellBackgroundColor // background color
67  ) const = 0;
68 
69 
70  ///// the following funtions are optional; they do nothing as-is, but can /////
71  ///// be overridden to provide some user-defined behaviour on these events /////
72 
73  // this is called when the mouse is moved over a cell; (-1,-1) means
74  // the mouse is not over the character grid. This is only called called once
75  // when the mouse enters a cell, or leaves the grid - it is not repeated if
76  // the mouse is dragged around inside a single cell.
77  virtual void MouseOver(int column, int row) const { }
78 
79  // these are used in the the following feedback functions to tell whether
80  // control keys were down at the time of (the beginning of) selection. The
81  // 'controls' item may be any bitwise combination of the following:
82  enum eControlKeys {
83  eShiftDown = 0x01,
84  eControlDown = 0x02,
85  eAltOrMetaDown = 0x04
86  };
87 
88  // this is called when the mouse-down event occurs (i.e., at the
89  // beginning of selection), saying where the mouse was at the time and
90  // with what control keys (see eControlKeys above). If 'false' is returned,
91  // then no selection will ensue; if 'true', selection acts normally.
92  virtual bool MouseDown(int column, int row, unsigned int controls) { return true; }
93 
94  // this is the callback when the the widget is in eSelect mode; it gives the
95  // corners of the rectangle of cells selected.
96  virtual void SelectedRectangle(
97  int columnLeft, int rowTop,
98  int columnRight, int rowBottom) { }
99 
100  // this is the callback when the widget is in eDrag mode; it gives two cells,
101  // one where the mouse button-down occurred, and one where mouse-up occurred.
102  virtual void DraggedCell(
103  int columnFrom, int rowFrom,
104  int columnTo, int rowTo) { }
105 };
106 
107 #endif // WX_VIEWABLE_ALIGNMENT__HPP
virtual bool MouseDown(int column, int row, unsigned int controls)
virtual void MouseOver(int column, int row) const
virtual ~ViewableAlignment(void)
virtual void SelectedRectangle(int columnLeft, int rowTop, int columnRight, int rowBottom)
virtual void DraggedCell(int columnFrom, int rowFrom, int columnTo, int rowTo)
virtual bool GetCharacterTraitsAt(unsigned int column, unsigned int row, char *character, wxColour *color, bool *drawBackground, wxColour *cellBackgroundColor) const =0
virtual void GetSize(unsigned int *columns, unsigned int *rows) const =0
virtual bool GetRowTitle(unsigned int row, wxString *title, wxColour *color) const =0
static const char * column
Definition: stats.c:23
static const column_t columns[]
Definition: utf8_2.c:22
n background color
#define row(bind, expected)
Definition: string_bind.c:73
Modified on Wed May 15 15:04:10 2024 by modify_doxy.py rev. 669887