home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / feutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  8.1 KB  |  210 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. #ifndef FE_UTILITIES__H
  20. #define FE_UTILITIES__H
  21.  
  22. #ifndef    __AFXWIN_H__
  23.     #error include 'stdafx.h' before including this    file for PCH
  24. #endif
  25.  
  26. //    File used for general purpose functions for the
  27. //        windows front end that have no other
  28. //        specific home.
  29. //    All functions should start with FEU to denote
  30. //        their origin.
  31.  
  32. //  Wrap some SDK calls here
  33. BOOL FEU_GetSaveFileName(OPENFILENAME *pOFN);
  34. BOOL FEU_GetOpenFileName(OPENFILENAME *pOFN);
  35. UINT FEU_GetCurrentDriveType(void);
  36.  
  37. //  Port some SDK calls here
  38. #ifdef XP_WIN16
  39. DWORD GetCurrentDirectory(DWORD nBufferLength, LPSTR lpBuffer);
  40. BOOL SetCurrentDirectory(LPCSTR lpPathName);
  41. #endif
  42.  
  43. #define FEU_FINDBROWSERONLY 0
  44. #define FEU_FINDBROWSERANDEDITOR 1
  45. #define FEU_FINDEDITORONLY 2
  46.  
  47. //    Way to get a frame window pointer out of a context ID.
  48. CFrameWnd *FEU_FindFrameByID(DWORD dwID, MWContextType cxType = MWContextAny);
  49.  
  50. //    Way to get a frame window that was last active browser window.
  51. CFrameWnd *FEU_GetLastActiveFrame(MWContextType cxType = MWContextAny, int bFindEditor = FEU_FINDBROWSERONLY);
  52.  
  53.  
  54. // Way to get the main context from the frameGlue.
  55. CAbstractCX *FEU_GetLastActiveFrameContext(MWContextType cxType = MWContextAny, int nFindEditor = FEU_FINDBROWSERONLY);
  56.  
  57. //  Way to get the last active frame window based on its customizable toolbar
  58. //  bUseSaveInfo is true if custToolbar's save info field should be used to disregard frames if save info is FALSE
  59. CFrameWnd *FEU_GetLastActiveFrameByCustToolbarType(CString custToolbar, CFrameWnd *pCurrentFrame, BOOL bUseSaveInfo);
  60.  
  61. // Way to get the bottommost frame of type cxType 
  62. CFrameWnd *FEU_GetBottomFrame(MWContextType cxType = MWContextAny, int nFindEditor = FEU_FINDBROWSERONLY);
  63.  
  64. // Way to get the number of active frames that are of type cxType
  65. int FEU_GetNumActiveFrames(MWContextType cxType = MWContextAny, int nFindEditor = FEU_FINDBROWSERONLY);
  66.  
  67.  
  68. //    Way to get the context ID out of the frame which was last active.
  69. DWORD FEU_GetLastActiveFrameID(MWContextType cxType = MWContextAny);
  70.  
  71. //    Way to block returning until a context is no longer in existance.
  72. void FEU_BlockUntilDestroyed(DWORD dwContextID);
  73.  
  74. //    Ensure a disk has space to write on, or ask the user about it.
  75. BOOL FEU_ConfirmFreeDiskSpace(MWContext *pContext, const char *pFileName, int32 lContentLength);
  76.  
  77. #if defined(XP_WIN16)
  78. //    Debuggin resource stuff on 16 bits.
  79. void FEU_FreeResources(const char *pString, int iDigit, BOOL bBox);
  80.  
  81. //    16 bits needs a GetDiskFreeSpace call.
  82. BOOL GetDiskFreeSpace(LPCTSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
  83.     LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);
  84. #endif
  85.  
  86. //#ifndef NO_TAB_NAVIGATION 
  87. void FEU_MakeRectVisible(MWContext *pContext, const UINT left, const UINT top, const UINT right, const UINT bottom);
  88. void FEU_MakeElementVisible(MWContext *pContext, LO_Any  *pElement);
  89. //#else /* NO_TAB_NAVIGATION  */
  90.  
  91. // scroll the given form into the visible part of the window                    
  92. // void FEU_MakeFormVisible(MWContext *pContext, LO_FormElementStruct *pForm);
  93. //#endif /* NO_TAB_NAVIGATION  */
  94.  
  95. //    Strip off all trailing backslashes
  96. char *FEU_NoTrailingBackslash(char *pBackslash);
  97.  
  98. //  Replace all occurrences of original in pStr with replace
  99. void FEU_ReplaceChar(char *pStr, char original, char replace);
  100.  
  101. // Replaces all occurrences of & with &&
  102. CString FEU_EscapeAmpersand(CString str);
  103.  
  104. //  Write string values to the registry in the said location.
  105. BOOL FEU_RegistryWizard(HKEY hRoot, const char *pKey, const char *pValue);
  106.  
  107. //  As the fucntion indicates.
  108. // char *FEU_ExtractCommaDilimetedString(const char *pArgList, int iArgToExtract);
  109. #define MAXFONTFACENAME     (LF_FACESIZE+1)
  110. int FEU_ExtractCommaDilimetedFontName(const char *pArgList, int offSetByte, char *argItem);
  111.  
  112. //  As the fucntion indicates.
  113. char *FEU_ExtractCommaDilimetedQuotedString(const char *pArgList, int iArgToExtract);
  114.  
  115. // Performs a transparent BitBlt - see the implementation for more info.
  116. BOOL FEU_TransBlt(CDC * pSrcDC, CDC * pDstDC, const CPoint & ptSrc,
  117.     const CPoint & ptDst, int nWidth, int nHeight, HPALETTE hPalette,
  118.     const COLORREF rgbTrans = RGB(255, 0, 255));
  119.  
  120. // Performs a transparent BitBlt, same as BitBlt except rgbTrans is the
  121. // color to be drawn transparently (not drawn)
  122. BOOL FEU_TransBlt(HDC hDstDC, int nXDest, int nYDest, int nWidth, int nHeight, 
  123.                   HDC hSrcDC, int nXSrc, int nYSrc, HPALETTE hPalette,
  124.                   COLORREF rgbTrans = RGB(0xff, 0x00, 0xff));
  125.     
  126. //  Correctly initialize a structure that no one seems to get right.
  127. void FEU_InitWINDOWPLACEMENT(HWND hWindow, WINDOWPLACEMENT *pWindowPlacement);
  128.  
  129. //  Mouse timer handler (to handle scrolling selections).
  130. class MouseTimerData    {
  131. public:
  132.     enum InvokeType  {
  133.         m_ContextNotify,
  134.         m_TimerNotify
  135.     } m_pType;
  136.     MWContext *m_pContext;
  137.     MouseTimerData(MWContext *pContext);
  138. };
  139. void FEU_MouseTimer(void *vpReallyMouseTimerData);
  140.  
  141. //  Mouse timer handler (to handle window exit messages).
  142. class MouseMoveTimerData    {
  143. public:
  144.     MWContext *m_pContext;
  145.     MouseMoveTimerData(MWContext *pContext);
  146. };
  147. void FEU_MouseMoveTimer(void *vpReallyMouseMoveTimerData);
  148.  
  149. //  Only remnant of great idle processing empire.
  150. //  Context calls FEU_RequestIdleProcessing to get checked in the idle loop
  151. //      by FEU_DoIdleProcessing.
  152. void FEU_RequestIdleProcessing(MWContext *pContext);
  153. BOOL FEU_DoIdleProcessing();
  154.  
  155. //  How to handle client pull requests.
  156. void FEU_ClientPull(MWContext *pContext, uint32 ulMilliseconds, URL_Struct *pUrl, int iFormatOut, BOOL bCanInterrupt);
  157. void FEU_ClientPullNow(void *vpReallyClientPullTimerData);
  158.  
  159. // Dynamically manage the MAPI libraries for mail posting
  160. void FEU_OpenMapiLibrary();
  161. void FEU_CloseMapiLibrary();
  162.  
  163. //  Global history flush timer.
  164. void FEU_GlobalHistoryTimeout(void *pNULL);
  165.  
  166. // This routine will return the handle of the pop-up menu whose first
  167. // menu item has the specified command ID
  168. HMENU FEU_FindSubmenu(HMENU hMenu, UINT nFirstCmdID);
  169.  
  170. BOOL FEU_IsConferenceAvailable(void);
  171. BOOL FEU_IsCalendarAvailable(void);
  172. BOOL FEU_IsIBMHostOnDemandAvailable(void);
  173. BOOL FEU_IsNetcasterAvailable(void);
  174. void FEU_OpenNetcaster(void);
  175. BOOL FEU_IsAimAvailable(void);
  176. void FEU_OpenAim(void);
  177. BOOL FEU_IsNetscapeFrame(CWnd* pFocusWnd);
  178.  
  179. #ifdef XP_WIN32
  180. CString FEU_GetCurrentRegistry(const CString &componentString);
  181. #endif
  182. CString FEU_GetInstallationDirectory(const CString &productString,const CString &installationString);
  183.  
  184. void FEU_FrameBroadcast(BOOL bSend, UINT Msg, WPARAM wParam, LPARAM lParam);
  185.  
  186. void FEU_AltMail_ShowMailBox(void); 
  187. void FEU_AltMail_ShowMessageCenter(void); 
  188. void FEU_AltMail_SetAltMailMenus(CMenu* pMenuCommunicator); 
  189. void FEU_AltMail_ModifyMenu(CMenu* pMenuCommunicator, UINT uiCommunicatorMenuID, LPCSTR pszAltMailMenuStr); 
  190.  
  191. BOOL FEU_Execute(MWContext *pContext, const char *pCommand, const char *pParams);
  192. BOOL FEU_FindExecutable(const char *pFileName, char *pExecutable, BOOL bIdentity, BOOL bExtension = FALSE);
  193.  
  194. BOOL FEU_SanityCheckFile(LPCSTR pszFileName);
  195. BOOL FEU_SanityCheckDir(LPCSTR pszDirName);
  196.  
  197. //  Free off misc URL data structs.
  198. void FEU_DeleteUrlData(URL_Struct *pUrl, MWContext *pCX);
  199.  
  200. extern "C" {
  201. // used in lj_init.c too:
  202. extern HWND FindNavigatorHiddenWindow(void);
  203. }
  204.  
  205. HWND FEU_GetWindowFromPoint(HWND hWndTop, POINT *pPoint);
  206. CNSGenFrame *FEU_GetDockingFrameFromPoint(POINT *pPoint);
  207.  
  208.  
  209. #endif //    FE_UTILITIES__H
  210.