home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / winproto.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  9.5 KB  |  254 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 WINPROTO_H
  20. #define WINPROTO_H
  21. /*
  22.  * Prototypes for functions local to the windows front end
  23.  *
  24.  * This file will be included by both C and C++ files so please
  25.  *   be careful with how you do things
  26.  */
  27.  
  28. /*  Bookmark drag and drop defines*/
  29. #define NETSCAPE_BOOKMARK_FORMAT     "Netscape Bookmark"
  30. #define NETSCAPE_BOOKMARK_FOLDER_FORMAT "Netscape Bookmark Folder"
  31. #define NETSCAPE_SOURCETARGET_FORMAT "Netscape source-target"
  32. #define NETSCAPE_BKMKLISTL_FORMAT    "Netscape Bookmark List (Long)"
  33. #define NETSCAPE_HTNODE_FORMAT         "Netscape RDF Item"
  34.  
  35. typedef struct {
  36.     char szAnchor[1024];
  37.     char szText[1024];
  38. } BOOKMARKITEM;
  39.  
  40. typedef BOOKMARKITEM * LPBOOKMARKITEM;
  41.  
  42. /*
  43.  * C Functions
  44.  */
  45.  
  46. XP_BEGIN_PROTOS
  47. extern char * wfe_LoadResourceString (LPCSTR lpszName);
  48. XP_END_PROTOS
  49.  
  50. /*
  51.  * C++ Functions
  52.  */
  53. extern char * FE_Windowsify(const char * In);
  54. extern char* XP_NetToDosFileName(const char * NetName);
  55. extern char * fe_MiddleCutString(char *string ,int iNum, BOOL bModifyString = FALSE);
  56. void WFE_ConvertFile2Url(CString& csUrl, const char *LocalFileName);
  57. CString WFE_EscapeURL(const char* name);
  58. void WFE_CondenseURL(CString& csURL, UINT uLength, BOOL bParens = TRUE);    
  59. BOOL WFE_CopyFile(const char *cpSrc, const char *cpTarg);
  60. BOOL WFE_MoveFile(const char *cpSrc, const char *cpTarg);
  61. #ifdef XP_WIN16
  62. #define INVALID_HANDLE_VALUE NULL 
  63. void * FindFirstFile(const char * a, void * b);
  64. int FindNextFile(void * a, void * b);
  65. void FindClose(void * a);
  66. #endif
  67.  
  68.  
  69. //    Draw helpers.
  70.  
  71. void WFE_DrawWindowsButtonRect(HDC hDC, LPRECT lpRect, BOOL bPushed = FALSE);
  72. void WFE_DrawRaisedRect( HDC hDC, LPRECT lpRect );
  73. void WFE_DrawLoweredRect( HDC hDC, LPRECT lpRect );
  74. void WFE_Draw3DButtonRect( HDC hDC, LPRECT lpRect, BOOL bPushed );
  75. void WFE_FillSolidRect(CDC *pDC, CRect crRect, COLORREF rgbFill);
  76. void WFE_DrawHighlight( HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight );
  77.  
  78. // Bitmap helpers
  79.  
  80. #define RGB_TRANSPARENT RGB(255,0,255)
  81.  
  82. void WFE_MakeTransparentBitmap( HDC hDC, HBITMAP hBitmap );
  83. HBITMAP WFE_LoadSysColorBitmap( HINSTANCE hInst, LPCSTR lpszResource );
  84. // Forces bitmap to be compatible with our palette
  85. HBITMAP WFE_LoadBitmap( HINSTANCE hInst, HDC hDC, LPCSTR lpszResource );
  86. HBITMAP wfe_LoadBitmap(HINSTANCE hInst, HDC hDC, LPCSTR pszBmName );
  87. HBITMAP WFE_LoadTransparentBitmap(HINSTANCE hInstance, HDC hDC, COLORREF clrBackground, COLORREF clrTransparent,
  88.                                   HPALETTE hPalette, UINT nResID);
  89. HBITMAP WFE_LoadBitmapFromFile (const char* szFileName);
  90. void WFE_InitializeUIPalette(HDC hDC);
  91. HPALETTE WFE_GetUIPalette(CWnd * parent);
  92. BOOL WFE_IsGlobalPalette(HPALETTE hPal);
  93. void WFE_DestroyUIPalette(void);
  94. HBITMAP WFE_LookupLoadAndEnterBitmap(HDC hDC, UINT nID, BOOL bTransparent, HPALETTE hPalette, 
  95.                                      COLORREF clrBackground, COLORREF clrTransparent);
  96. void WFE_RemoveBitmapFromMap(UINT nID);
  97. void WFE_DestroyBitmapMap(void);
  98. HFONT WFE_GetUIFont(HDC hDC);
  99. void WFE_DestroyUIFont(void);
  100. CFrameWnd *WFE_GetOwnerFrame(CWnd *pWnd);
  101. int WFE_FindMenu(CMenu *pMenu, CString& menuItemName);
  102. int WFE_FindMenuItem(CMenu *pMenu, UINT nCommand);
  103.  
  104. void fe_UpdateMControlMimeTypes(void); //CRN_MIME
  105.  
  106. //
  107. // Prompt user for a file name
  108. //
  109. #define HTM       1
  110. #define TXT       2
  111. #define EXE       3
  112. #define ALL          4
  113. // Editor should open ONLY html files!
  114. #define HTM_ONLY -1
  115. #define P12       -2        
  116.  
  117. // If pPageTitle is not null, then edit box is added to allow user to enter document title for edited documents
  118. // Caller must free *ppPageTitle
  119. extern char * wfe_GetSaveFileName(HWND m_hWnd, char * prompt, char * initial, int * type, char **ppPageTitle = NULL);
  120.  
  121. // If pOpenIntoEditor is not null, then radio buttons are added to select window type
  122. //    set initial choice and read user's choice from this
  123. extern char * wfe_GetExistingFileName(HWND m_hWnd, char * prompt, int type, XP_Bool bMustExist,
  124.                                       BOOL * pOpenIntoEditor = NULL);
  125. // CLM: Similar above, but used to select Image Files: *.jpg, *.gif
  126. extern char * wfe_GetExistingImageFileName(HWND m_hWnd, char * prompt, XP_Bool bMustExist);
  127.  
  128. // Copy file routine for Editor - ask user permission
  129. //  to overwrite existing file
  130. // Params may be local file format or "file://" URL format,
  131. //   and assumes full pathnames
  132. BOOL FE_CopyFile(const char *cpSrc, const char *cpTarg);
  133.  
  134. // try to convert a URL to 8+3
  135. char * fe_URLtoLocalName(const char * url, const char *pMimeType);
  136.  
  137. // pop up a little box and ask the user for a filename
  138. char * fe_GetSaveFileName(HWND m_hWnd, char * initial);
  139.  
  140. // Module level prototypes
  141. extern void FE_DeleteFileOnExit(const char *filename, const char *pURL);
  142. extern void FE_DeleteTempFilesNow();
  143. extern void FE_FlushCache();    
  144. //Added pSwitcher to allow us to dictate which HINSTANCE to load the string from.  if NULL, we use AfxGetResourceHandle
  145. class ResourceSwitcher;
  146. extern char * szLoadString (UINT iID, ResourceSwitcher *pSwticher = NULL);
  147.  
  148. // Helper application handling functions
  149. //
  150. extern void fe_InitFileFormatTypes(void);
  151. extern CHelperApp * fe_AddNewFileFormatType(const char *mime_type,const char *subtype); 
  152. extern void fe_CleanupFileFormatTypes(void);
  153. extern HotlistStruct * fe_find_hotlist_root (HotlistStruct * pListTop, BOOL add_p, MWContext * context);
  154.  
  155. // Get a file name given a type prefix and extension 
  156. // Name is returned in static space --- user must not free
  157. // WARNING: Unlike the older version of this routine (XP_FileName) this one
  158. // returns a malloc'd string.
  159. extern char * WH_TempFileName(int type, const char * prefix, const char * extension);
  160.  
  161. // Read in the user's sig
  162. extern char * wfe_ReadUserSig(const char * msg);
  163.  
  164. // Set the display property for type to the given color
  165. extern void wfe_SetLayoutColor(int type, COLORREF color);
  166.  
  167. class CDNSObj : public CObject 
  168. {
  169. public:
  170.     CDNSObj();
  171.     ~CDNSObj();
  172.     int                  i_finished;
  173.     XP_List            * m_sock_list;
  174.     int               m_iError;
  175.     char            * m_host;
  176.     struct hostent  * m_hostent;
  177.     HANDLE              m_handle;
  178.     // Used by FE_DeleteDNSList in fenet.cpp
  179.     MWContext        * context;
  180. };
  181.  
  182. //    Form stuff.
  183. #define BUTTON_FUDGE 6 // extra spacing around buttons and checkboxes
  184.  
  185. #define EDIT_SPACE   2 // vertical spacing above edit and combo box fields
  186.  
  187. #define BOX(pStr)  ::MessageBox(NULL, pStr, "Fancy", MB_ICONEXCLAMATION)
  188.  
  189. // CLM: Some simple functions to aid in COLORREF to LO_Color conversions
  190.  
  191. // Fill a LoColor structure
  192. void WFE_SetLO_Color( COLORREF crColor, LO_Color *pLoColor );
  193.  
  194. // This allocates a new LoColor structure if it
  195. //   does not exist
  196. void WFE_SetLO_ColorPtr( COLORREF crColor, LO_Color **ppLoColor );
  197.  
  198. // Convert a LO_Color structure or get the default
  199. //  default document colors
  200. COLORREF WFE_LO2COLORREF( LO_Color * pLoColor, int iColorIndex );
  201.  
  202. // Parse a "#FFEEAA" style color string into colors make a COLORREF
  203. BOOL WFE_ParseColor(char *pRGB, COLORREF * pCRef );
  204.  
  205. // Helper to clear data
  206. void WFE_FreeLO_Color(LO_Color_struct **ppLo);
  207.  
  208. // Only drop target allowed is Composer
  209. #ifdef EDITOR
  210. // Drag drop images...
  211. void WFE_DragDropImage(HGLOBAL h, MWContext *pMWContext);
  212.  
  213. // Fill struct with data about an image
  214. //   for drag n drop and copying to clipboard
  215. HGLOBAL WFE_CreateCopyImageData(MWContext*pMWContext, LO_ImageStruct *pImage);
  216. #endif /* EDITOR */
  217.  
  218. // This will hide/show caret only if enabled
  219. //   or hide/show DragDrop caret if currently dragging over the view
  220. void WFE_HideEditCaret(MWContext * pMWContext);
  221. void WFE_ShowEditCaret(MWContext * pMWContext);
  222.  
  223. // Return value for WFE_GetCurrentFontColor when no color is set
  224. // Use as param with CColorComboBox::SetColor to set to default color (index 0)
  225. #define DEFAULT_COLORREF 0xFFFFFFFF
  226. // Return this when we have a mixed state - we don't have a single color
  227. #define MIXED_COLORREF 0xFFFFFFF0
  228.  
  229. // Return value when Canceling out of CColorPicker
  230. #define CANCEL_COLORREF 0xFFFFFF00
  231.  
  232. COLORREF WFE_GetCurrentFontColor(MWContext * pMWContext);
  233.  
  234. // Get a resource string and extract the tooltip portion
  235. //   if a '\n' is found in the string
  236. //   USE RESULT QUICKLY! 
  237. //   (String is in our temp buffer and should not be FREEd)
  238. char * FEU_GetToolTipText( UINT nID );
  239. char *FE_FindFileExt(char * path);
  240.  
  241. extern int PR_CALLBACK WinFEPrefChangedFunc(const char *pref, void *data);
  242. #ifdef MOZ_LDAP
  243. extern int PR_CALLBACK DirServerListChanged(const char *pref, void *data);
  244. #endif /* MOZ_LDAP */
  245. extern void fe_InitNSPR(void *stackBase);
  246. extern void fe_InitJava();
  247. extern void OpenDraftExit (URL_Struct *url_struct, int status, MWContext *pContext);
  248. extern BOOL fe_ShutdownJava();
  249. extern BOOL fe_RegisterOLEIcon(LPSTR szCLSIDObject, LPSTR szObjectName, LPSTR szIconPath);
  250. extern void WFE_DrawDragRect(CDC* pdc, LPCRECT lpRect, SIZE size,
  251.     LPCRECT lpRectLast, SIZE sizeLast, CBrush* pBrush, CBrush* pBrushLast);
  252.  
  253. #endif // WINPROTO_H
  254.