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

Go to the SVN repository for this file.

1 #ifndef PKG_SEQUENCE___AGP_LOAD_MANAGER__HPP
2 #define PKG_SEQUENCE___AGP_LOAD_MANAGER__HPP
3 
4 /* $Id: agp_loader.hpp 38477 2017-05-15 21:10:59Z evgeniev $
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: Roman Katargin
30 *
31 * File Description:
32 *
33 */
34 
35 #include <corelib/ncbistl.hpp>
36 #include <corelib/ncbiobj.hpp>
37 
40 
41 #include <gui/utils/extension.hpp>
42 
45 
47 
48 
50 
51 
52 /** @addtogroup GUI_PKG_SEQUENCE
53 *
54 * @{
55 */
56 
57 class CAgpLoadPage;
58 
59 ///////////////////////////////////////////////////////////////////////////////
60 /// CAgpLoader
61 class CAgpLoader :
62  public CObject,
64  public IFileLoadPanelClient,
65  public IToolWizard,
66  public IExtension,
67  public IRegSettings
68 {
69 public:
70  CAgpLoader();
71 
72  /// @name IFileLoadPanelClient interface implementation
73  /// @{
74  virtual string GetLabel() const;
75  virtual wxString GetFormatWildcard() const;
76  virtual string GetFileLoaderId() const { return Id(); }
77  /// @}
78 
79  /// @name IUILoadManager interface implementation
80  /// @{
81  virtual void SetServiceLocator(IServiceLocator* srv_locator);
82  virtual void SetParentWindow(wxWindow* parent);
83  virtual const IUIObject& GetDescriptor() const;
84  virtual void InitUI();
85  virtual void CleanUI();
86  virtual wxPanel* GetCurrentPanel();
87  virtual bool CanDo(EAction action);
88  virtual bool IsFinalState();
89  virtual bool IsCompletedState();
90  virtual bool DoTransition(EAction action);
91  virtual IAppTask* GetTask();
92  virtual IExecuteUnit* GetExecuteUnit();
93  virtual IWizardPage* GetFirstPage() { return 0; }
94  virtual IWizardPage* GetOptionsPage() { return &m_OptionsPage; }
95  virtual void SetPrevPage(IWizardPage* prevPage) { m_OptionsPage.SetPrevPage(prevPage); }
96  /// @}
97 
98  /// @{ IFileFormatLoaderManager - additional members
99  /// @{
100  virtual wxString GetFormatWildcard();
101  virtual bool ValidateFilenames(const vector<wxString>& filenames);
102  virtual void SetFilenames(const vector<wxString>& filenames);
103  virtual void GetFilenames(vector<wxString>& filenames) const;
104  virtual bool IsInitialState();
105  virtual bool RecognizeFormat(const wxString& filename);
106  virtual bool RecognizeFormat(CFormatGuess::EFormat fmt);
107  /// @}
108 
109  /// @name IExtension interface implementation
110  /// @{
111  virtual string GetExtensionIdentifier() const;
112  virtual string GetExtensionLabel() const;
113  /// @}
114 
115  /// @name IRegSettings interface implementation
116  /// @{
117  virtual void SetRegistryPath(const string& path);
118  virtual void LoadSettings();
119  virtual void SaveSettings() const;
120  /// @}
121 
122  static string Id() { return "file_loader_agp"; }
123  static string Label() { return "AGP"; }
124 
125 protected:
126  enum EState {
127  eInvalid = -1,
129  eCompleted
130  };
131 
132 protected:
133  class CPage : public CWizardPage
134  {
135  public:
136  CPage(CAgpLoader& manager) : m_Manager(manager) {}
137  virtual wxPanel* GetPanel();
138  virtual bool CanLeavePage(bool) { return true; }
140  };
141 
143 
145 
147  wxWindow* m_ParentWindow;
149 
150  string m_RegPath;
151 
154  vector<wxString> m_FileNames;
155 
157 };
158 
159 /* @} */
160 
162 
163 
164 #endif // PKG_SEQUENCE___AGP_LOAD_MANAGER__HPP
CAgpLoader.
Definition: agp_loader.hpp:68
EFormat
The formats are checked in the same order as declared here.
CObject –.
Definition: ncbiobj.hpp:180
CUIObject - default mix-in implementation of IUIObject.
Definition: ui_object.hpp:81
virtual void SetPrevPage(IWizardPage *page)
IAppTask.
Definition: app_task.hpp:83
IExtension IExtension interface represents an abstract pluggable component.
Definition: extension.hpp:57
IFileFormatLoaderManager.
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
IUIObject - object that provides basic properties often required in a UI object.
Definition: ui_object.hpp:63
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
Definition: agp_loader.cpp:170
CPage(CAgpLoader &manager)
Definition: agp_loader.hpp:136
CAgpLoadParams m_Params
Definition: agp_loader.hpp:153
wxWindow * m_ParentWindow
Definition: agp_loader.hpp:147
virtual string GetLabel() const
Definition: agp_loader.cpp:64
CAgpLoader()
CAgpLoader.
Definition: agp_loader.cpp:49
static string Id()
Definition: agp_loader.hpp:122
virtual void CleanUI()
CleanUI() is called after the host finished using the manager.
Definition: agp_loader.cpp:103
virtual void InitUI()
Initializes the Manager before using it in UI.
Definition: agp_loader.cpp:97
CAgpLoadPage * m_ParamsPanel
Definition: agp_loader.hpp:152
virtual void SetFilenames(const vector< wxString > &filenames)
initilize the manager with the given filenames
Definition: agp_loader.cpp:194
virtual string GetFileLoaderId() const
Definition: agp_loader.hpp:76
virtual bool CanDo(EAction action)
Indicates whether given transition is possible in the current state.
Definition: agp_loader.cpp:125
virtual wxPanel * GetCurrentPanel()
Return the panel corresponding to the current state of Tool Manager.
Definition: agp_loader.cpp:110
virtual bool DoTransition(EAction action)
Performs transition if possible and returns true, otherwise the function shall warn the user about th...
Definition: agp_loader.cpp:151
virtual IWizardPage * GetOptionsPage()
Returns page for tool options (long wizard path via "Options" button)
Definition: agp_loader.hpp:94
virtual bool IsFinalState()
True if Tool Manager has reached its final state, i.e.
Definition: agp_loader.cpp:139
virtual bool IsCompletedState()
Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred an...
Definition: agp_loader.cpp:145
virtual void SetRegistryPath(const string &path)
Definition: agp_loader.cpp:234
virtual bool ValidateFilenames(const vector< wxString > &filenames)
checks given filenames and returns true if the manager can handle them, otherwise - shows an error me...
Definition: agp_loader.cpp:187
EState m_State
Definition: agp_loader.hpp:148
virtual const IUIObject & GetDescriptor() const
Returns the object describing this tool (UI meta data).
Definition: agp_loader.cpp:91
string m_RegPath
Definition: agp_loader.hpp:150
virtual bool CanLeavePage(bool)
Definition: agp_loader.hpp:138
CAgpLoadPage * x_GetParamsPanel()
Definition: agp_loader.cpp:115
virtual void LoadSettings()
Definition: agp_loader.cpp:246
vector< wxString > m_FileNames
Definition: agp_loader.hpp:154
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
Definition: agp_loader.cpp:221
virtual void GetFilenames(vector< wxString > &filenames) const
get actual filenames that will be opened
Definition: agp_loader.cpp:199
CUIObject m_Descr
Definition: agp_loader.hpp:144
CPage m_OptionsPage
Definition: agp_loader.hpp:156
IServiceLocator * m_SrvLocator
Definition: agp_loader.hpp:146
static string Label()
Definition: agp_loader.hpp:123
virtual void SetServiceLocator(IServiceLocator *srv_locator)
Sets / unsets Service Locator.
Definition: agp_loader.cpp:79
virtual void SetPrevPage(IWizardPage *prevPage)
Sets a wizard page which should show before the first page of the tool.
Definition: agp_loader.hpp:95
virtual wxPanel * GetPanel()
Definition: agp_loader.cpp:42
virtual bool RecognizeFormat(const wxString &filename)
return true if the given file format is supported by this manager
Definition: agp_loader.cpp:209
virtual IWizardPage * GetFirstPage()
Returns first options page (if any) of the tool to be shown in wizard dialog.
Definition: agp_loader.hpp:93
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
Definition: agp_loader.cpp:228
virtual bool IsInitialState()
return true if the current state of the loader UI is the first valid state (first step in a wizard-li...
Definition: agp_loader.cpp:204
virtual void SaveSettings() const
Definition: agp_loader.cpp:240
virtual IExecuteUnit * GetExecuteUnit()
Definition: agp_loader.cpp:175
virtual void SetParentWindow(wxWindow *parent)
Definition: agp_loader.cpp:85
virtual wxString GetFormatWildcard() const
return file wildcard for the format (example - "*.txt;*.tab" )
Definition: agp_loader.cpp:69
CAgpLoader & m_Manager
Definition: agp_loader.hpp:139
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
The NCBI C++/STL use hints.
static int filenames
Definition: pcre2grep.c:247
Modified on Fri Sep 20 14:58:09 2024 by modify_doxy.py rev. 669887