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

Go to the SVN repository for this file.

1 #ifndef GUI_UTILS__APP_POPUP_HPP
2 #define GUI_UTILS__APP_POPUP_HPP
3 
4 /* $Id: app_popup.hpp 14562 2007-05-18 11:48:21Z dicuccio $
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: Peter Meric
30  *
31  * File Description:
32  * CAppPopup -- launch a url in a web browser
33  * widen() -- convert a string to a wstring
34  */
35 
36 
37 #include <corelib/ncbiobj.hpp>
38 #include <gui/gui.hpp>
39 
40 
41 /** @addtogroup GUI_UTILS
42  *
43  * @{
44  */
45 
46 
48 
49 
50 ///
51 /// class CAppInfo defines an interface for application registration information
52 ///
54 {
55 public:
56  CAppInfo(const string& path = kEmptyStr);
57  virtual ~CAppInfo();
58  const string& GetExePath(void) const;
59 
60 private:
61  string m_Exepath;
62 };
63 
64 
65 ///
66 /// enumerated file type information
67 ///
68 BEGIN_SCOPE(filetype)
69 
71 {
72  eUnknown = 0,
73  ePdf
74 };
75 typedef enum EFileType TFileType;
76 
78 
79 END_SCOPE(filetype)
80 
81 
82 ///
83 /// class CAppRegistry defines the registry of application information for
84 /// automated application link-outs
85 ///
87 {
88 public:
91 
92  CAppRegistry();
93  virtual ~CAppRegistry();
94 
95  const TAppInfoRef& Find(TFileType filetype) const;
96  TAppInfoRef& operator[](const TFileType& type);
97 
98 private:
101 };
102 
103 
104 ///
105 /// class CAppPopup allows applications to be launched based on standard
106 /// registered types
107 ///
109 {
110 public:
112 
113  /// launch an application to handle a file
114  static bool PopupFile(const string& file,
115  TFileType filetype = filetype::eUnknown);
116 
117  /// launch an application to handle a URL
118  static bool PopupURL(const string& url);
119 
120  /// retrieve the application registry
121  static CAppRegistry& GetRegistry(void);
122 
123 private:
125 };
126 
127 
129 
130 /* @} */
131 
132 #endif /// GUI_UTILS__APP_POPUP_HPP
class CAppInfo defines an interface for application registration information
Definition: app_popup.hpp:54
class CAppPopup allows applications to be launched based on standard registered types
Definition: app_popup.hpp:109
class CAppRegistry defines the registry of application information for automated application link-out...
Definition: app_popup.hpp:87
CObject –.
Definition: ncbiobj.hpp:180
CRef –.
Definition: ncbiobj.hpp:618
map< TFileType, TAppInfoRef > TRegistry
Definition: app_popup.hpp:99
string m_Exepath
Definition: app_popup.hpp:61
EFileType
enumerated file type information
Definition: app_popup.hpp:71
TRegistry m_AppReg
Definition: app_popup.hpp:100
CRef< CAppInfo > TAppInfoRef
Definition: app_popup.hpp:89
filetype::TFileType TFileType
Definition: app_popup.hpp:111
filetype::TFileType TFileType
Definition: app_popup.hpp:90
enum EFileType TFileType
Definition: app_popup.hpp:75
static CAppRegistry m_Registry
Definition: app_popup.hpp:124
CNcbiOstream & operator<<(CNcbiOstream &strm, TFileType &ftype)
@ ePdf
Definition: app_popup.hpp:73
@ eUnknown
Definition: app_popup.hpp:72
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define kEmptyStr
Definition: ncbistr.hpp:123
#define NCBI_GUIUTILS_EXPORT
Definition: gui_export.h:518
FILE * file
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Definition: type.c:6
Modified on Sun Feb 25 03:02:33 2024 by modify_doxy.py rev. 669887