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

Go to the SVN repository for this file.

1 #ifndef GUI_CORE___SELECTION_SERVICE_IMPL__HPP
2 #define GUI_CORE___SELECTION_SERVICE_IMPL__HPP
3 
4 /* $Id: selection_service_impl.hpp 38846 2017-06-26 15:23:36Z 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 #include <corelib/ncbistd.hpp>
36 
37 #include <gui/gui_export.h>
38 
40 #include <gui/core/document.hpp>
41 
43 
45 
46 // This header must (at least indirectly) precede any wxWidgets headers.
48 
50 
52 {
53 public:
54  enum EType {
59  };
60 
62 
64 
65 private:
67 };
68 
70 
71 ///////////////////////////////////////////////////////////////////////////////
72 /// CSelectionService
74 : public CObjectEx,
75  public IService,
77  public ISelectionService,
78  public CEventHandler,
79  public IRegSettings
80 {
81 
82 public:
83  typedef vector<ISelectionClient*> TClients;
84 
86  virtual ~CSelectionService();
87 
88  /// @name IService interface implementation
89  /// @{
90  virtual void InitService();
91  virtual void ShutDownService();
92  /// @}
93 
94  void InitStatusBar(wxWindow* parent);
95 
96  void GetClients(TClients& clients);
97 
98  /// @name ISelectionService implemenation
99  /// @{
100  virtual void AttachClient(ISelectionClient* client);
101  virtual void DetachClient(ISelectionClient* client);
102  virtual bool IsAttached(ISelectionClient* client) const;
103 
104  virtual void GetCurrentSelection(TConstScopedObjects& sel);
105  virtual void GetActiveObjects(TConstScopedObjects& sel);
106  virtual void GetActiveObjects(vector<TConstScopedObjects>& sel); // Prioritized active objects
107 
108  virtual void Broadcast( CSelectionEvent& evt, ISelectionClient* source );
109 
110  virtual void OnActiveClientChanged(ISelectionClient* active);
112  /// @}
113 
114  /// @name IRegSettings implementation
115  /// @{
116  virtual void SetRegistryPath(const string& path);
117  virtual void LoadSettings();
118  virtual void SaveSettings() const;
119  /// @}
120 
121  /// @name IServiceLocatorConsumer interface implementation
122  /// @{
123  virtual void SetServiceLocator(IServiceLocator* locator);
124  /// @}
125 
126  bool IsAutoBroadcast() { return mf_AutoBroadcast; }
127  void SetAutoBroadcast( bool pAuto );
128 
129 protected:
130  void x_Broadcast(
132  );
133 
134 protected:
137 
139  string m_RegPath;
140 
141 private:
142  /// @name various selection service options
143  /// @{
145  /// @}
146 
148 };
149 
150 
152 
153 #endif // GUI_CORE___SELECTION_SERVICE_HPP
CEventHandler.
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
vector< CIRef< IProjectView > > TViews
Definition: document.hpp:131
CObjectEx –.
Definition: ncbiobj.hpp:2531
CSelectionBroadcastSlot - a Status Bar slot that displays information about tasks in Application Task...
CSelectionEvent CSelectionEvent is used for broadcasting selection between views.
Definition: obj_event.hpp:68
CIRef< ISelectionClient > GetClient()
CSelectionServiceEvent(EType type, ISelectionClient *client)
CWeakIRef< ISelectionClient > m_Client
vector< ISelectionClient * > TClients
IServiceLocator * m_SrvLocator
CSelectionBroadcastSlot * m_StatusBarSlot
ISelectionClient * m_ActiveClient
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
virtual void SaveSettings() const =0
virtual void LoadSettings()=0
virtual void SetRegistryPath(const string &path)=0
ISelectionClient - represents an object that support a notion of selection.
ISelectionService - an interface.
virtual void OnSelectionChanged(ISelectionClient *source)=0
notifies Service and its observers about changes in selection
virtual void AttachClient(ISelectionClient *client)=0
virtual void OnActiveClientChanged(ISelectionClient *active)=0
this function is called by GUI components to notify server
virtual void GetActiveObjects(TConstScopedObjects &sel)=0
returns objects currently active in the application, this function should be used for obtaining argum...
virtual void DetachClient(ISelectionClient *client)=0
virtual void GetCurrentSelection(TConstScopedObjects &sel)=0
returns objects currently selected in the application, this function should be used for obtaining arg...
virtual bool IsAttached(ISelectionClient *client) const =0
virtual void Broadcast(CSelectionEvent &evt, ISelectionClient *source)=0
request broadcasting of the given event, Broadcast() notifies observers about changes in selection (d...
IServiceLocatorConsumer - classes that need IServiceLocator should implement this interface.
Definition: service.hpp:103
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
Include a standard set of the NCBI C++ Toolkit most basic headers.
Workaround for wxWidgets header errors in certain configurations; MUST be included (at least indirect...
virtual void SetServiceLocator(IServiceLocator *locator)=0
virtual void InitService()=0
virtual void ShutDownService()=0
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
TRefType Lock(void) const
Lock the object and return reference to it.
Definition: ncbiobj.hpp:2864
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUICORE_EXPORT
Definition: gui_export.h:508
Defines to provide correct exporting from DLLs in Windows.
const CharType(& source)[N]
Definition: pointer.h:1149
static CNamedPipeClient * client
Definition: type.c:6
Modified on Sat Dec 09 04:45:14 2023 by modify_doxy.py rev. 669887