seqgraphic_widget.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: seqgraphic_widget.hpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 19:53:30 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_SEQ_GRAPHIC___SEQGRAPHIC_WIDGET__HPP
- #define GUI_WIDGETS_SEQ_GRAPHIC___SEQGRAPHIC_WIDGET__HPP
- /* $Id: seqgraphic_widget.hpp,v 1000.2 2004/06/01 19:53:30 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: Vlad Lebedev
- *
- * File Description:
- * Graphic Sequence Widget
- *
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/gui.hpp>
- #include <gui/opengl/glcolor.hpp>
- #include <gui/print/print_options.hpp>
- #include <gui/utils/command.hpp>
- #include <gui/objutils/iselection.hpp>
- #include <FL/Fl_Group.H>
- #include <FL/Fl_Scrollbar.H>
- #include <FL/Fl_Value_Slider.H>
- #include <FL/Fl_Input.H>
- #include <FL/Fl_Button.H>
- #include <FL/Fl_Choice.H>
- #include <objects/seqloc/Seq_loc.hpp>
- #include <objects/seqfeat/SeqFeatData.hpp>
- BEGIN_NCBI_SCOPE
- class CSeqGraphicPane;
- class CLayoutObject;
- class CSeqGraphicDataSource;
- class CSeqGraphicConfig;
- /// Definitions for Hit Matrix Widget commands
- ///
- enum ESeqGraphicsCommands {
- eCmdZoomObject = eBaseCmdLast + 200,
- eCmdPrevExon,
- eCmdNextExon
- };
- class NCBI_GUIWIDGETS_SEQGRAPHIC_EXPORT CSeqGraphicWidget
- : public Fl_Group,
- public CCommandTarget,
- public ISelection
- {
- public:
- CSeqGraphicWidget(int x, int y, int w, int h, const char* label = NULL);
- virtual ~CSeqGraphicWidget();
- void SetDataSource(CSeqGraphicDataSource* ds);
-
- enum ESearchRange {
- eWhole,
- eVisible
- };
- void SetZoomX(float value);
- void ZoomOnRange(const TSeqRange& range);
- // returns the visible sequence range
- TSeqRange GetVisibleRange(void) const;
- // indicates visible sequence range has changes
- bool VisibleRangeChanged() const;
- void ResetVisibleRangeChanged();
-
- // set/clear selections
- void SelectObject(const CObject* obj);
- void SelectSeqLoc(const objects::CSeq_loc* loc);
- void ClearSelection();
-
- // print hook
- void Print(const CPrintOptions& opts);
- // retrieve selected objects from this widget
- const TConstObjects& GetSelectedObjects(void) const;
- // retrieve selected seq-locs from this object
- // this is only for selections of raw sequence, not for seq-locs
- // arising from features, for example.
- vector< CRef<objects::CSeq_loc> > GetSelectedSeqLocs(void) const;
- // ISelection interface
- void GetSelections(TConstScopedObjects& objs) const;
- void SetSelections(const TConstScopedObjects& objs);
- /// Here is the config object you are going to use to configure yourself.
- /// make sure all your children who need it have references to it.
- void SetConfig(CRef<CSeqGraphicConfig> config);
-
- /// The config object has changed. Do what is necessary.
- void UpdateConfig();
-
- // override fltk redraw.
- void redraw();
- void OnShowPopup(void);
- DECLARE_CMD_MAP();
- public:
- void OnZoomIn(void);
- void OnZoomOut(void);
- void OnZoomAll(void);
- void OnZoomObject(void);
- void OnPrevExon(void);
- void OnNextExon(void);
- private:
- friend void s_CSeqGraphicWidget_ScrollCB (Fl_Widget*, void*);
- friend void s_CSeqGraphicWidget_SliderXCB(Fl_Widget*, void*);
- friend void s_CSeqGraphicWidget_SearchXCB(Fl_Widget*, void*);
-
- friend void s_CSeqGraphicWidget_PrevXCB(Fl_Widget*, void*);
- friend void s_CSeqGraphicWidget_NextXCB(Fl_Widget*, void*);
- friend class CSeqGraphicPane;
- void x_ScrollCB();
- void x_SliderCB();
- void x_SearchCB();
- void x_PrevCB();
- void x_NextCB();
-
- void x_UpdateSearchMsg(int pos);
-
- Fl_Scrollbar* m_ScrollX;
- Fl_Scrollbar* m_ScrollY;
- Fl_Value_Slider* m_SlideZoomX;
-
- int m_SearchCount;
- string m_SearchStr;
-
- Fl_Input* m_SearchInput;
- Fl_Button* m_PrevButton;
- Fl_Button* m_GoButton;
- Fl_Button* m_NextButton;
- Fl_Choice* m_SearchChoice;
- Fl_Choice* m_RangeChoice;
-
- CSeqGraphicPane* m_SeqGraphicPane;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: seqgraphic_widget.hpp,v $
- * Revision 1000.2 2004/06/01 19:53:30 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10
- *
- * Revision 1.10 2004/05/03 12:46:32 dicuccio
- * gui/utils ->gui/objutils where needed
- *
- * Revision 1.9 2004/04/16 14:35:49 dicuccio
- * Inherit from ISelection to support standard selection marshalling interface
- *
- * Revision 1.8 2004/03/30 13:56:13 lebedev
- * Move EDisplayElement list to CSeqGraphicColorConfig
- *
- * Revision 1.7 2004/03/12 15:57:34 lebedev
- * Implemented CCommandTarget interface, so the widget
- * can use command maps
- *
- * Revision 1.6 2004/03/11 17:23:38 dicuccio
- * Use TSeqRange instead of TRange. Deprecated TIndex / TPosition / TDimension
- *
- * Revision 1.5 2004/02/13 18:08:00 lebedev
- * Use SeqGraphic config for enabling/disabling viewing options
- *
- * Revision 1.4 2004/02/10 13:14:32 lebedev
- * ISelHandlerHost interface implemented for selections on sequence pane
- *
- * Revision 1.3 2004/01/27 16:12:26 lebedev
- * Methods for working with selections added
- *
- * Revision 1.2 2004/01/20 20:32:29 rsmith
- * add UpdatedConfig method.
- *
- * Revision 1.1 2003/12/22 12:52:42 lebedev
- * New files added
- *
- * Revision 1.21 2003/11/19 20:34:45 friedman
- * API to detect and reset visible range change
- *
- * Revision 1.20 2003/11/18 20:47:23 rsmith
- * SetConfig and redraw
- *
- * Revision 1.19 2003/11/13 15:31:25 lebedev
- * Methods to get visible sequence range added
- *
- * Revision 1.18 2003/11/06 20:01:08 dicuccio
- * Removed USING_SCOPE(objects)
- *
- * Revision 1.17 2003/10/24 13:21:18 lebedev
- * ZoomOnRange method added (in model space)
- *
- * Revision 1.16 2003/10/09 16:25:30 lebedev
- * Use new IRenderable interface for panels
- *
- * Revision 1.15 2003/09/16 14:37:14 dicuccio
- * Cleaned up and clarified export specifiers - added a new specifier for each
- * library
- *
- * Revision 1.14 2003/09/12 13:00:10 dicuccio
- * Changed export specifiers
- *
- * Revision 1.13 2003/08/18 16:17:51 lebedev
- * New methods to show/hide features added
- *
- * Revision 1.12 2003/08/15 19:33:23 dicuccio
- * Changed location of print code
- *
- * Revision 1.11 2003/08/14 18:36:16 lebedev
- * Feature search added
- *
- * Revision 1.10 2003/07/29 13:39:55 lebedev
- * eGraphs enum added
- *
- * Revision 1.9 2003/07/23 17:51:20 dicuccio
- * Added API to retrieve an option's state
- *
- * Revision 1.8 2003/07/22 13:34:53 lebedev
- * enums to variouse display options added
- *
- * Revision 1.7 2003/07/21 19:25:04 dicuccio
- * Added selection accessors
- *
- * Revision 1.6 2003/06/20 14:46:53 dicuccio
- * Added Print()
- *
- * Revision 1.5 2003/06/10 12:00:37 lebedev
- * Rendering engine separated from FLTK into it's own class
- *
- * Revision 1.4 2003/06/05 11:22:04 lebedev
- * Prepare to separate display renderer from the widget itself
- *
- * Revision 1.3 2003/05/23 10:56:10 lebedev
- * New rendering engine, hit test engine, many other changes
- *
- * Revision 1.2 2003/05/19 16:54:39 dicuccio
- * Better memory management - inherit data source from CObject
- *
- * Revision 1.1 2003/05/16 16:37:59 lebedev
- * Initial revision
- *
- * ===========================================================================
- */
- #endif /* GUI_WIDGETS_SEQ_GRAPHIC___SEQGRAPHIC_WIDGET__HPP */