home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / edtrccln.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 KB  |  65 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /*edtrccln.h edtor client wrapper */
  20. /*Dynamic Library wrapper for loading on call*/
  21. #ifndef _EDTRCCLN_H
  22.  
  23. #define _EDTRCCLN_H
  24. #include "edtrcdll\edtdlgs.h"
  25.  
  26. //typedefs of placeholders for exported functions
  27. typedef IImageConversionDialog *(*IMAGEDIALOGCONSTRUCTOR)(HWND);
  28. typedef IJPEGOptionsDlg *(*IJPEGDLGCONSTRUCTOR)(HWND);
  29. typedef ITagDialog *(*TAGDIALOGCONSTRUCTOR)(IWFEInterface *, IEDTInterface *, char *,HWND);
  30. typedef IIMEDll *(*IMEDLLCONSTRUCTOR)();
  31.  
  32. class CEditorResourceDll
  33. {
  34.     static HINSTANCE s_dllinstance;
  35.     static unsigned int s_refcount;
  36.     //placeholders for exported functions
  37.     static IMAGEDIALOGCONSTRUCTOR s_pimagedialog;
  38.     static IJPEGDLGCONSTRUCTOR s_pjpegdialog;
  39.     static TAGDIALOGCONSTRUCTOR s_ptagdialog;
  40.     static IMEDLLCONSTRUCTOR s_pimedll;
  41.  
  42. public:
  43.     HINSTANCE switchResources();
  44.     CEditorResourceDll();
  45.     ~CEditorResourceDll();
  46.     //wrappers for exported functions
  47.     IImageConversionDialog *CreateImageConversionDialog(HWND pParent=NULL);
  48.     ITagDialog *CreateTagDialog(IWFEInterface *, IEDTInterface *, HWND pParent=NULL, char *pchar=NULL);
  49.     IIMEDll *CreateImeDll();
  50.     IJPEGOptionsDlg *CreateJpegDialog(HWND pParent=NULL);
  51. };
  52.  
  53. //thread safe resource handle switcher. also reference counts the dll. ya!
  54. class CEditorResourceSwitcher:public CEditorResourceDll
  55. {
  56.     HINSTANCE m_oldresourcehandle;
  57. public:
  58.     CEditorResourceSwitcher(){m_oldresourcehandle=switchResources();}
  59.     void Reset(){AfxSetResourceHandle(m_oldresourcehandle);}
  60.     ~CEditorResourceSwitcher(){Reset();}
  61. };
  62.  
  63. #endif //_EDTRCCLN_H
  64.  
  65.