app_popup.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: app_popup.hpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 19:50:51 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_UTILS__APP_POPUP_HPP
- #define GUI_UTILS__APP_POPUP_HPP
- /* $Id: app_popup.hpp,v 1000.2 2004/06/01 19:50:51 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Peter Meric
- *
- * File Description:
- * CAppPopup -- launch a url in a web browser
- * widen() -- convert a string to a wstring
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/gui.hpp>
- /** @addtogroup GUI_UTILS
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- ///
- /// class CAppInfo defines an interface for application registration information
- ///
- class CAppInfo : public CObject
- {
- public:
- CAppInfo(const string& path = kEmptyStr);
- virtual ~CAppInfo();
- const string& GetExePath(void) const;
- private:
- string m_Exepath;
- };
- ///
- /// enumerated file type information
- ///
- BEGIN_SCOPE(filetype)
- enum EFileType
- {
- eUnknown = 0,
- ePdf
- };
- typedef enum EFileType TFileType;
- CNcbiOstream& operator<<(CNcbiOstream& strm, TFileType& ftype);
- END_SCOPE(filetype)
- ///
- /// class CAppRegistry defines the registry of application information for
- /// automated application link-outs
- ///
- class CAppRegistry
- {
- private:
- typedef CRef<CAppInfo> TAppInfoRef;
- typedef filetype::TFileType TFileType;
- public:
- CAppRegistry();
- virtual ~CAppRegistry();
- const TAppInfoRef& Find(TFileType filetype) const;
- TAppInfoRef& operator[](const TFileType& type);
- private:
- typedef map<TFileType, TAppInfoRef> TRegistry;
- TRegistry m_AppReg;
- };
- ///
- /// class CAppPopup allows applications to be launched based on standard
- /// registered types
- ///
- class NCBI_GUIUTILS_EXPORT CAppPopup
- {
- private:
- typedef filetype::TFileType TFileType;
- public:
- /// launch an application to handle a file
- static bool PopupFile(const string& file,
- TFileType filetype = filetype::eUnknown);
- /// launch an application to handle a URL
- static bool PopupURL(const string& url);
- /// retrieve the application registry
- static CAppRegistry& GetRegistry(void);
- private:
- static CAppRegistry m_Registry;
- };
- END_NCBI_SCOPE
- /* @} */
- /*
- * ===========================================================================
- * $Log: app_popup.hpp,v $
- * Revision 1000.2 2004/06/01 19:50:51 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10
- *
- * Revision 1.10 2004/05/03 12:41:09 dicuccio
- * Split library into gui_utils and gui_objutils. Added #include for gui/gui.hpp
- *
- * Revision 1.9 2004/04/16 14:27:17 dicuccio
- * Added doxygen module tag
- *
- * Revision 1.8 2003/09/24 18:16:51 dicuccio
- * Cleaned up C++ comment style. Make sure to export CAppPopup.
- *
- * Revision 1.7 2003/08/21 12:14:57 dicuccio
- * Added class descriptor comments. Changed typedefs to be standards-compliant
- *
- * Revision 1.6 2003/06/21 12:05:41 meric
- * removed $include <Types.h> for Mac OS
- *
- * Revision 1.5 2003/06/19 16:39:24 meric
- * Renamed AppInfo to CAppInfo
- *
- * Revision 1.4 2003/06/19 16:33:06 meric
- * Added CAppRegistry, a simple application registry for file types
- * Added unix support for opening files associated with applications
- *
- * Revision 1.3 2003/06/17 19:35:21 meric
- * Replace Popup() with PopupFile() and PopupURL()
- *
- * Revision 1.2 2003/06/16 15:55:58 dicuccio
- * Work-in-progress: everything compiles, still much reorganization to be done.
- * Moved generic functionality out of opengl/print/ and into gui/utils (print
- * options, print dialogs, etc.). Removed interactive state from CGlCanvas.
- * Added hook in CView for opening standard print dialog, and for generic print
- * handling.
- *
- * Revision 1.1 2003/06/13 19:01:28 meric
- * Initial revision
- *
- *
- * ===========================================================================
- */
- #endif /// GUI_UTILS__APP_POPUP_HPP