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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_WORKSPACE___WM_CLIENT_HPP
2 #define GUI_WIDGETS_WORKSPACE___WM_CLIENT_HPP
3 
4 /* $Id: wm_client.hpp 31188 2014-09-10 16:14:04Z 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/utils/rgba_color.hpp>
39 
40 class wxWindow;
41 class wxMenu;
42 class wxEvtHandler;
43 
45 
46 ///////////////////////////////////////////////////////////////////////////////
47 /// IWClient - abstract Window Manager client
48 class IWMClient
49  : public IMenuContributor
50 {
51 public:
52  /// CFingerprint identifies an instance of IWMClient and is used for
53  /// labeling layout positions.
54  /// If Fingerprint is persistent it will be saved with the layout and when
55  /// the layout is loaded a client will be automatically instantiated based
56  /// on the saved fingerprint using a client factory.
58  {
59  public:
60  CFingerprint();
61  CFingerprint(const string& id, bool persistent);
63 
64  bool operator==(const CFingerprint& orig) const;
65  bool IsEmpty() const;
66 
67  /// returns a string for serialization (if persistent) or ""
68  string AsPersistentString() const;
69  void FromPersistentString(const string& s);
70 
71  const string GetId() const;
72 
73  protected:
74  string m_Id;
76  };
77 
78  /// Different flavors of label types for different GUI aspects
79  enum ELabel
80  {
81  eContent, ///< Short name with content
82  eTypeAndContent, ///< Short name with content and type
83  eDetailed, ///< Detailed name
85  };
86 
87 public:
88  /// returns a pointer to the wxWindow representing the client
89  virtual wxWindow* GetWindow() = 0;
90 
91  /// returns a pointer to the command handler (for menu commands and updates)
92  virtual wxEvtHandler* GetCommandHandler() = 0;
93 
94  /// returns the client label (name) to be displayed in UI
95  virtual string GetClientLabel(IWMClient::ELabel ltype = IWMClient::eDefault) const = 0;
96 
97  /// returns an icon alias that can be used to retrieve the client's icon
98  virtual string GetIconAlias() const = 0;
99 
100  /// returns a color associated with the client, n/a if NULL
101  virtual const CRgbaColor* GetColor() const = 0;
102 
103  /// returns a color associated with the client
104  virtual void SetColor(const CRgbaColor& color) = 0;
105 
106 
107  /// @name IWMClient implementation
108  /// @{
109  /// returns menu that can be merged with main menu of an application
110  // virtual const wxMenu* GetMenu();
111  // virtual const SwxMenuItemRec* GetMenuDef() const;
112  //@}
113 
114  /// returns a fingerprint identifying the client
115  virtual CFingerprint GetFingerprint() const = 0;
116  virtual void SetFingerprint(const string& /*fp*/) {}
117 
118  /// returns true if client is a Form - wants to be sized to its client area (like a dialog)
119  virtual bool IsAForm() const { return false; }
120 
121  /// returns true if client is a non-modal dioalog
122  virtual bool IsADialog() const { return false; }
123 
124 
125  virtual ~IWMClient() {}
126 };
127 
128 
129 ///////////////////////////////////////////////////////////////////////////////
130 /// IWMClientFactory - IWMClient factory.
131 
133 {
134 public:
136 
137  /// creates a client by fingerprint
138  /// returns NULL if fingerprint is not recognized.
139  virtual IWMClient* CreateClient(const TFingerprint& fingerprint,
140  wxWindow* parent) = 0;
141 
142  virtual ~IWMClientFactory() {};
143 };
144 
145 
147 
148 
149 #endif // GUI_WIDGETS_WORKSPACE___WM_CLIENT_HPP
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
IMenuContributor - contributes menu to Menu Service.
Definition: ui_command.hpp:371
IWMClientFactory - IWMClient factory.
Definition: wm_client.hpp:133
IWMClient::CFingerprint TFingerprint
Definition: wm_client.hpp:135
virtual IWMClient * CreateClient(const TFingerprint &fingerprint, wxWindow *parent)=0
creates a client by fingerprint returns NULL if fingerprint is not recognized.
virtual ~IWMClientFactory()
Definition: wm_client.hpp:142
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
Definition: wm_client.hpp:58
IWClient - abstract Window Manager client.
Definition: wm_client.hpp:50
virtual wxWindow * GetWindow()=0
returns a pointer to the wxWindow representing the client
ELabel
Different flavors of label types for different GUI aspects.
Definition: wm_client.hpp:80
@ eDetailed
Detailed name.
Definition: wm_client.hpp:83
@ eContent
Short name with content.
Definition: wm_client.hpp:81
@ eTypeAndContent
Short name with content and type.
Definition: wm_client.hpp:82
virtual void SetFingerprint(const string &)
Definition: wm_client.hpp:116
virtual const CRgbaColor * GetColor() const =0
returns a color associated with the client, n/a if NULL
virtual wxEvtHandler * GetCommandHandler()=0
returns a pointer to the command handler (for menu commands and updates)
virtual CFingerprint GetFingerprint() const =0
returns a fingerprint identifying the client
virtual void SetColor(const CRgbaColor &color)=0
returns a color associated with the client
virtual string GetClientLabel(IWMClient::ELabel ltype=IWMClient::eDefault) const =0
returns the client label (name) to be displayed in UI
virtual bool IsADialog() const
returns true if client is a non-modal dioalog
Definition: wm_client.hpp:122
virtual ~IWMClient()
Definition: wm_client.hpp:125
virtual bool IsAForm() const
returns true if client is a Form - wants to be sized to its client area (like a dialog)
Definition: wm_client.hpp:119
virtual string GetIconAlias() const =0
returns an icon alias that can be used to retrieve the client's icon
Include a standard set of the NCBI C++ Toolkit most basic headers.
bool operator==(const CEquivRange &A, const CEquivRange &B)
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
#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_GUIWIDGETS_WX_EXPORT
Definition: gui_export.h:543
n background color
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
Modified on Fri Sep 20 14:58:20 2024 by modify_doxy.py rev. 669887