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

Go to the SVN repository for this file.

1 #ifndef GUI_FRAMEWORK___WORKBENCH__HPP
2 #define GUI_FRAMEWORK___WORKBENCH__HPP
3 
4 /* $Id: workbench.hpp 34721 2016-02-04 14:05:23Z katargir $
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
30  *
31  * File Description:
32  *
33  */
34 
35 /** @addtogroup GUI_FRAMEWORK
36 *
37 * @{
38 */
39 
40 #include <corelib/ncbistd.hpp>
41 
43 
44 class wxFileArtProvider;
45 class wxFrame;
46 class wxCommandEvent;
47 
49 
50 class IServiceLocator;
51 class IEventLogService;
52 class IStatusBarService;
54 class IMenuService;
55 class IToolBarService;
56 
57 class CUICommandRegistry;
58 class CAppTaskService;
60 
61 class IWMClient;
62 class IWorkbench;
63 
64 ///////////////////////////////////////////////////////////////////////////////
65 /// IWorkbenchAdvisor
66 /// This is an interface that assists IWorkbench in carrying out its functions.
67 /// IWorkbench calls IWorkbenchAdvisor's methods at particular moments during
68 /// its lifetime. Overrding IWorkbenchAdvisor is the recommended way for adding
69 /// application-specific funtionality.
71 {
72 public:
73  /// get application title
74  virtual string GetAppTitle() = 0;
75 
76  /// called by Workbench after creating main app window
77  virtual void PostCreateWindow() = 0;
78 
79  /// called after Workbench initialization has been completed
80  virtual void PostInit() = 0;
81 
82  /// called by Workbench before starting ShutDown
83  virtual void PreShutDown() = 0;
84 
85  /// called by Workbench before destroying main app window
86  virtual void PreDestroyWindow() = 0;
87 
88  virtual bool CanShutDown() = 0;
89 
90  virtual ~IWorkbenchAdvisor() {};
91 };
92 
93 
94 ///////////////////////////////////////////////////////////////////////////////
95 /// IWorkbench is the central interface in the application framework.
96 /// Workbench provides critical application services and UI components and, so
97 /// forms the environment in which various application components exist and
98 /// function. An application creates an instance of Workbench at startup and
99 /// registers additional services and components if needed. Workbench
100 /// constructs the basic UI, then uses extension registry to retrieve
101 /// user-defined components that add functionality to Workbench. A typical
102 /// application does not need to implement IWorkbench interface, a standard
103 /// implementation of the interface can be used, customization can be achieved
104 /// by implementing IWorkbenchAdvisor interface and be registering custom
105 /// extensions in Extension Registry.
106 ///
107 /// IWorkbench is derived from IServiceLocator, components that implement
108 /// IService interface can be obtained using IServiceLocator methods.
109 
110 
111 class IWorkbench :
112  public IServiceLocator
113 {
114 public:
115  /// enumerates major Registry sections
119  eTools
120  };
121 
122 public:
123  virtual void Init() = 0;
124  virtual bool CanShutDown() = 0;
125  virtual void ShutDown() = 0;
126 
130  virtual IMenuService* GetMenuService() = 0;
132 
136 
137  //TODO implement virtual CIRef<IHelpService> GetHelpService();
138 
139  /// get a Service Locator associated with the Workspace
141 
142  /// register an application-specific service;
143  /// Workbench assumes ownership of the service
144  virtual void RegisterService(const string& class_name,
145  IService* service) = 0;
146 
147  /// remove application-specific service
148  virtual void UnRegisterService(const string& class_name) = 0;
149 
150  /// returns a pointer to the main application frame window
151  virtual wxFrame* GetMainWindow() = 0;
152 
153  /// returns an instance of Command Registry associated with the Workbench
155 
156  /// returns a path to CGuiRegistry section where resources of the
157  /// specified type shall be located
158  virtual string GetRegistrySectionPath(ERegistrySection section) = 0;
159 };
160 
162 
163 /* @} */
164 
165 #endif // GUI_FRAMEWORK___WORKBENCH__HPP
166 
CAppTaskService - Application Task Service.
CUICommandRegistry is a centralized registry where all application commands should be registered.
Definition: ui_command.hpp:146
IEventLogService - records application events.
IMenuService - Menu Service.
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
IService – an abstraction that represents an application component providing specific functional capa...
Definition: service.hpp:56
IToolBarService.
IViewManagerService IViewManagerService manages views in Workbench.
IWClient - abstract Window Manager client.
Definition: wm_client.hpp:50
IWindowManagerService Window Manager Service provides access to Window Manager functionality.
IWorkbenchAdvisor This is an interface that assists IWorkbench in carrying out its functions.
Definition: workbench.hpp:71
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
Include a standard set of the NCBI C++ Toolkit most basic headers.
virtual wxFrame * GetMainWindow()=0
returns a pointer to the main application frame window
virtual IServiceLocator * GetServiceLocator()=0
get a Service Locator associated with the Workspace
virtual IToolBarService * GetToolBarService()=0
virtual IMenuService * GetMenuService()=0
virtual CUICommandRegistry & GetUICommandRegistry()=0
returns an instance of Command Registry associated with the Workbench
virtual bool CanShutDown()=0
virtual IStatusBarService * GetStatusBarService()=0
virtual void PreShutDown()=0
called by Workbench before starting ShutDown
virtual wxFileArtProvider & GetFileArtProvider()=0
virtual string GetRegistrySectionPath(ERegistrySection section)=0
returns a path to CGuiRegistry section where resources of the specified type shall be located
virtual void ShutDown()=0
virtual void UnRegisterService(const string &class_name)=0
remove application-specific service
virtual IEventLogService * GetEventLogService()=0
virtual IViewManagerService * GetViewManagerService()=0
virtual void PreDestroyWindow()=0
called by Workbench before destroying main app window
virtual IWindowManagerService * GetWindowManagerService()=0
virtual void Init()=0
virtual void RegisterService(const string &class_name, IService *service)=0
register an application-specific service; Workbench assumes ownership of the service
virtual void PostInit()=0
called after Workbench initialization has been completed
virtual void PostCreateWindow()=0
called by Workbench after creating main app window
virtual bool CanShutDown()=0
virtual ~IWorkbenchAdvisor()
Definition: workbench.hpp:90
virtual CAppTaskService * GetAppTaskService()=0
ERegistrySection
enumerates major Registry sections
Definition: workbench.hpp:116
virtual string GetAppTitle()=0
get application title
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Fri Sep 20 14:57:38 2024 by modify_doxy.py rev. 669887