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

Go to the SVN repository for this file.

1 #ifndef GUI_CORE_VIEW_GRAPHIC___VIEW_GRAPHIC__HPP
2 #define GUI_CORE_VIEW_GRAPHIC___VIEW_GRAPHIC__HPP
3 
4 /* $Id: view_graphic.hpp 47598 2023-10-30 19:16:39Z asztalos $
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: Vlad Lebedev
30  *
31  * File Description:
32  * User-modifiable part for future extension of the main graphical view
33  * class.
34  */
35 
36 
37 #include <corelib/ncbiobj.hpp>
38 
46 
47 
49 
50 
51 /** @addtogroup GUI_PKG_SEQUENCE
52  *
53  * @{
54  */
55 
56 class CGraphicPanel;
57 
58 ///////////////////////////////////////////////////////////////////////////////
59 /// CViewGraphic
60 class CViewGraphic : public CProjectView
61  , public ISeqLocSearchContext
62  , public IViewSettingsAtProject
63 
64 {
65  friend class CViewGraphicFactory;
67 public:
68  CViewGraphic();
69  ~CViewGraphic();
70 
71  /// @name IWMClient interface implementation
72  /// @{
73  virtual wxWindow* GetWindow();
74  virtual const wxMenu* GetMenu();
75  /// @}
76 
77  /// @name IView interface implementation
78  /// @{
79  virtual const CViewTypeDescriptor& GetTypeDescriptor() const;
80  virtual void CreateViewWindow(wxWindow* parent);
81  virtual void DestroyViewWindow();
82  /// @}
83 
84  /// @name IProjectView implementation
85  /// @{
86  virtual bool InitView(TConstScopedObjects& objects, const objects::CUser_object* params);
87  virtual void OnProjectChanged(CProjectViewEvent& evt);
88  virtual void SetOrigObject(SConstScopedObject& obj);
89  /// @}
90 
91  /// @name IViewSettingsAtProject implementation
92  /// @{
93  void SaveSettingsAtProject(objects::CGBProjectHandle& project) const;
94  /// @}
95 
96  /// @name ISelectionClient Implementation
97  /// @{
98  void GetSelection(CSelectionEvent& evt) const;
99  void GetSelection(TConstScopedObjects& objs) const;
100  /// @}
101 
102  /// @name IVisibleRangeClient interface implementation
103  /// @{
104  virtual void OnVisibleRangeChanged (const CVisibleRange& vrange,
106  /// @}
107 
108  /// @name IDataMiningContext Implementation
109  /// @{
110  virtual string GetDMContextName();
111  /// @}
112 
113  /// @name CProjectView overridables
114  /// @{
115  virtual void GetVisibleRanges( CVisibleRange& vrange ) const;
116  virtual void OnWidgetRangeChanged();
117  /// @}
118  void OnWidgetDataChanged(CEvent* evt);
119  void OnOpenGraphicalView(CEvent* evt);
120 
121  /// @name CProjectViewBase overridables
122  /// @{
123  virtual void OnViewAttached(IView&);
124  virtual void OnViewReleased(IView&);
125  /// @}
126 
127  virtual void SetWorkbench(IWorkbench* workbench);
131  virtual set<string> GetAnnotNames() const;
132 
133 protected:
134  /// @addtogroup CProjectView overridables
135  /// @{
136  virtual void x_OnSetSelection(CSelectionEvent& evt);
137  /// @}
138 
139  /// @addtogroup CProjectViewBase overridables
140  /// @{
141  virtual void GetCompatibleToolBars(vector<string>& names);
142  virtual const CObject* x_GetOrigObject() const;
143  /// @}
144 
146 
147  virtual bool x_MergeObjects( TConstScopedObjects& objects );
148 
149  string x_GetViewSettingsFromParams(const objects::CUser_object* params);
150 
151  void x_SetNonAsnInput(const objects::CProjectFolder &prj_folder);
152 
153 private:
157 };
158 
159 
160 ///////////////////////////////////////////////////////////////////////////////
161 /// CViewGraphicFactory
163  public CObject,
164  public IExtension,
165  public IProjectViewFactory
166 {
167 public:
168  /// @name IExtension interface implementation
169  /// @{
170  virtual string GetExtensionIdentifier() const;
171  virtual string GetExtensionLabel() const;
172  /// @}
173 
174  /// @name IProjectViewFactory interface implementation
175  /// @{
176  virtual IView* CreateInstance() const;
177  virtual IView* CreateInstanceByFingerprint(const TFingerprint& fingerprint) const;
178  virtual void RegisterIconAliases(wxFileArtProvider& provider);
179  virtual void RegisterCommands(CUICommandRegistry& cmd_reg, wxFileArtProvider& provider);
180 
183  virtual bool IsCompatibleWith( const CObject& object, objects::CScope& scope );
184  /// @}
185 private:
186  bool x_NeedsConversion(const CObject& object, objects::CScope& scope);
187 };
188 
189 
190 /* @} */
191 
193 
194 #endif // GUI_CORE_VIEW_GRAPHIC___VIEW_GRAPHIC__HPP
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
CObject –.
Definition: ncbiobj.hpp:180
virtual void OnProjectChanged()
CProjectViewEvent.
Definition: document.hpp:62
CProjectViewTypeDescriptor - holds description of a project view type.
CProjectView.
CSelectionEvent CSelectionEvent is used for broadcasting selection between views.
Definition: obj_event.hpp:68
CUICommandRegistry is a centralized registry where all application commands should be registered.
Definition: ui_command.hpp:146
CViewGraphicFactory.
CViewGraphic.
CViewTypeDescriptor - holds description of a view type.
Definition: view.hpp:98
IExtension IExtension interface represents an abstract pluggable component.
Definition: extension.hpp:57
IProjectViewFactory.
ISeqlocSearchContext.
IView - represents a standard visual part of Workbench UI.
Definition: view.hpp:73
IVisibleRangeClient - represents an object that wants notifications about visible range changes.
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
Definition: wm_client.hpp:58
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
static const struct name_t names[]
virtual const CObject * x_GetOrigObject() const
virtual void GetCompatibleToolBars(vector< string > &names)
returns the names of toolbars compatible with this class (toolbars that are relevant and useful in th...
virtual void x_OnSetSelection(CSelectionEvent &evt)
override in derived classes in order to handle selection broadcast
vector< CIRef< IView > > TViews
virtual string GetExtensionIdentifier() const
CViewGraphicFactory.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual void CreateViewWindow(wxWindow *parent)
create Window corresponding to the view
CConstRef< objects::CSeq_id > m_SeqId
virtual void GetVisibleRanges(CVisibleRange &vrange) const
populate a visible range event for broadcasting
virtual void RegisterCommands(CUICommandRegistry &cmd_reg, wxFileArtProvider &provider)
called by the framework to give Factory a chance to register commands used by view
void OnWidgetDataChanged(CEvent *evt)
virtual IView * CreateInstanceByFingerprint(const TFingerprint &fingerprint) const
if fingerprint is recognized - creates and returns a new instance
virtual void SetWorkbench(IWorkbench *workbench)
IView implementation.
virtual const CViewTypeDescriptor & GetTypeDescriptor() const
return an object providing meta information about thei view type
virtual const wxMenu * GetMenu()
returns a menu (must be deleted by the caller) menu injections should follow a separator named "Contr...
virtual INonAsnTrackData * GetNonAsnData()
virtual CRef< objects::CScope > GetSearchScope()
virtual CRef< objects::CSeq_loc > GetSearchLoc()
virtual void DestroyViewWindow()
destroy Window corresponding to the view
string x_GetViewSettingsFromParams(const objects::CUser_object *params)
void x_SetNonAsnInput(const objects::CProjectFolder &prj_folder)
void x_UpdateVisRangeLayout(const IViewManagerService::TViews &views)
virtual string GetDMContextName()
returns Name of the context to be used in UI
void OnOpenGraphicalView(CEvent *evt)
virtual void RegisterIconAliases(wxFileArtProvider &provider)
called by the framework to give Factory a chance to register images used by view
virtual bool IsCompatibleWith(const CObject &object, objects::CScope &scope)
CGraphicPanel * m_GraphicPanel
virtual bool InitView(TConstScopedObjects &objects, const objects::CUser_object *params)
initialize view with data, inside this function the view must call CProjectService::AttachView to con...
virtual set< string > GetAnnotNames() const
virtual const CProjectViewTypeDescriptor & GetProjectViewTypeDescriptor() const
returns a Descriptor for the View Type supported by the Factory
virtual void OnViewReleased(IView &)
virtual void OnWidgetRangeChanged()
virtual IView * CreateInstance() const
creates a view instance
virtual void OnViewAttached(IView &)
void SaveSettingsAtProject(objects::CGBProjectHandle &project) const
virtual void SetOrigObject(SConstScopedObject &obj)
virtual void OnVisibleRangeChanged(const CVisibleRange &vrange, IVisibleRangeClient *source)
void GetSelection(CSelectionEvent &evt) const
get selection for broadcasting
bool x_NeedsConversion(const CObject &object, objects::CScope &scope)
CIRef< INonAsnTrackData > m_NonAsnTrackData
virtual int TestInputObjects(TConstScopedObjects &objects)
tests input objects (not using object conversion) and returns a combination of ETestResult flags bett...
virtual wxWindow * GetWindow()
returns a pointer to the wxWindow representing the client
virtual bool x_MergeObjects(TConstScopedObjects &objects)
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
const CharType(& source)[N]
Definition: pointer.h:1149
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Fri Sep 20 14:57:39 2024 by modify_doxy.py rev. 669887