home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / fe_proto.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  49.7 KB  |  1,275 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.  
  20. #ifndef _FrontEnd_
  21. #define _FrontEnd_
  22.  
  23. #include "net.h"
  24. #include "xp_obs.h"
  25. #include "il_types.h"
  26. #include "ctxtfunc.h"
  27.  
  28. #include "prio.h"     /* for netlib function decls */
  29. #include "prnetdb.h"  /* for netlib function decls */
  30.  
  31. XP_BEGIN_PROTOS
  32.  
  33. /* Carriage return and linefeeds */
  34.  
  35. #define CR '\015'
  36. #define LF '\012'
  37. #define VTAB '\013'
  38. #define FF '\014'
  39. #define TAB '\011'
  40. #define CRLF "\015\012"     /* A CR LF equivalent string */
  41.  
  42. #ifdef XP_MAC
  43. #  define LINEBREAK             "\012"
  44. #  define LINEBREAK_LEN 1
  45. #else
  46. #  if defined(XP_WIN) || defined(XP_OS2)
  47. #    define LINEBREAK           "\015\012"
  48. #    define LINEBREAK_LEN       2
  49. #  else
  50. #    ifdef XP_UNIX
  51. #      define LINEBREAK         "\012"
  52. #      define LINEBREAK_LEN     1
  53. #    endif /* XP_UNIX */
  54. #  endif /* XP_WIN */
  55. #endif /* XP_MAC */
  56.  
  57. /* set a timer and load the specified URL after the
  58.  * timer has elapsed.  Cancel the timer if the user
  59.  * leaves the current page
  60.  */
  61. extern void FE_SetRefreshURLTimer(MWContext *context, 
  62.                                   uint32     seconds, 
  63.                                   char      *refresh_url);
  64.  
  65. #ifdef _USRDLL
  66. extern void NDLLFE_SetRefreshURLTimer(MWContext *context, 
  67.                                   uint32     seconds, 
  68.                                   char      *refresh_url);
  69. #endif
  70.  
  71. /* this function should register a function that will
  72.  * be called after the specified interval of time has
  73.  * elapsed.  This function should return an id 
  74.  * that can be passed to FE_ClearTimeout to cancel 
  75.  * the Timeout request.
  76.  *
  77.  * A) Timeouts never fail to trigger, and
  78.  * B) Timeouts don't trigger *before* their nominal timestamp expires, and
  79.  * C) Timeouts trigger in the same ordering as their timestamps
  80.  *
  81.  * After the function has been called it is unregistered
  82.  * and will not be called again unless re-registered.
  83.  *
  84.  * func:    The function to be invoked upon expiration of
  85.  *          the Timeout interval 
  86.  * closure: Data to be passed as the only argument to "func"
  87.  * msecs:   The number of milli-seconds in the interval
  88.  */
  89. typedef void
  90. (*TimeoutCallbackFunction) (void * closure);
  91.  
  92. extern void * 
  93. FE_SetTimeout(TimeoutCallbackFunction func, void * closure, uint32 msecs);
  94.  
  95. /* This function cancels a Timeout that has previously been
  96.  * set.  
  97.  * Callers should not pass in NULL or a timer_id that
  98.  * has already expired.
  99.  */
  100. extern void 
  101. FE_ClearTimeout(void *timer_id);
  102.  
  103. /* set and clear select fd's
  104.  */
  105. #ifdef XP_UNIX
  106. extern void FE_SetReadPoll(PRFileDesc *fd);
  107. extern void FE_ClearReadPoll(PRFileDesc *fd);
  108. extern void FE_SetConnectPoll(PRFileDesc *fd);
  109. extern void FE_ClearConnectPoll(PRFileDesc *fd);
  110. #endif /* XP_UNIX */
  111.  
  112. /* do async dns */
  113. extern int FE_AsyncDNSLookup(MWContext *context, 
  114.                              char * host_port,
  115.                              PRHostEnt ** hoststruct_ptr_ptr, 
  116.                              PRFileDesc *socket);
  117. extern void FE_AbortDNSLookup(PRFileDesc *socket);
  118.  
  119. /* all the other selects are depricated and should be removed shortly */
  120.  
  121. /* tell the front end to call ProcessNet with fd when fd
  122.  * has data ready for reading
  123.  */
  124. extern void FE_SetDNSSelect(MWContext * win_id, int fd);
  125. extern void FE_ClearDNSSelect(MWContext * win_id, int fd);
  126.  
  127. /* set and clear select fd's
  128.  */
  129. /* tell the front end to call ProcessNet with fd when fd
  130.  * has data ready for reading
  131.  */
  132. extern void FE_SetReadSelect(MWContext * win_id, int fd);
  133. extern void FE_ClearReadSelect(MWContext * win_id, int fd);
  134.  
  135. /* tell the front end to call ProcessNet with fd when fd
  136.  * has connected. (write select and exception select)
  137.  */
  138. extern void FE_SetConnectSelect(MWContext * win_id, int fd);
  139. extern void FE_ClearConnectSelect(MWContext * win_id, int fd);
  140.  
  141. /* tell the front end to call ProcessNet with fd whenever fd
  142.  * has data ready for reading
  143.  */
  144. extern void FE_SetFileReadSelect(MWContext * win_id, int fd);
  145. extern void FE_ClearFileReadSelect(MWContext * win_id, int fd);
  146.  
  147. /* tell the front end to call ProcessNet as often as possible
  148.  * This superseeds FE_SetCallNetlibAllTheTime
  149.  */
  150. extern void FE_SetCallNetlibAllTheTime(MWContext * win_id);
  151. /* Same as,FE_SetCallNetlibAllTheTime but not in context's function table */
  152. extern void XP_SetCallNetlibAllTheTime(MWContext * win_id);    
  153.  
  154. /* tell the front end to stop calling ProcessNet as often as possible
  155.  * This superseeds FE_ClearCallNetlibAllTheTime
  156.  */
  157. extern void FE_ClearCallNetlibAllTheTime(MWContext * win_id);
  158. /* Same as,FE_SetCallNetlibAllTheTime but not in context's function table */
  159. extern void XP_ClearCallNetlibAllTheTime(MWContext * win_id);    
  160.  
  161. /* use telnet, rlogin or tn3270 to connect to a remote host
  162.  * this function should be non_blocking if you want your front
  163.  * end to continue working.
  164.  */
  165. #define FE_TELNET_URL_TYPE 1
  166. #define FE_TN3270_URL_TYPE 2
  167. #define FE_RLOGIN_URL_TYPE 3
  168. PUBLIC void FE_ConnectToRemoteHost(MWContext * ctxt, int url_type, char *hostname, char * port,  char *username);
  169. #ifdef _USRDLL
  170. PUBLIC void NDLLFE_ConnectToRemoteHost(MWContext * ctxt, int url_type, char *hostname, char * port,  char *username);
  171. #endif
  172.  
  173. /* returns the users mail address as a constant string.  If not known the
  174.  * routine should return NULL.
  175.  */
  176. extern const char * FE_UsersMailAddress(void);
  177. /* returns the users full name as a constant string.  If not known the
  178.  * routine should return NULL.
  179.  */
  180. extern const char * FE_UsersFullName(void);
  181.  
  182. /* returns the contents of the users signature file as a constant string.
  183.  * If not known the routine should return NULL.
  184.  * The signature data should end with a single newline.
  185.  */
  186. extern const char *FE_UsersSignature(void);
  187.  
  188. /* puts up a FE security dialog
  189.  *
  190.  * Should return TRUE if the url should continue to
  191.  * be loaded
  192.  * Should return FALSE if the url should be aborted
  193.  */
  194. extern Bool FE_SecurityDialog(MWContext * context, int message, XP_Bool *prefs_toggle);
  195. #ifdef _USRDLL
  196. extern Bool NDLLFE_SecurityDialog(MWContext * context, int message);
  197. #endif
  198.  
  199. #define SD_INSECURE_POST_FROM_SECURE_DOC              1
  200. #define SD_INSECURE_POST_FROM_INSECURE_DOC            2
  201. #define SD_ENTERING_SECURE_SPACE                      3
  202. #define SD_LEAVING_SECURE_SPACE                       4
  203. #define SD_INSECURE_DOCS_WITHIN_SECURE_DOCS_NOT_SHOWN 5
  204. #define SD_REDIRECTION_TO_INSECURE_DOC                6
  205. #define SD_REDIRECTION_TO_SECURE_SITE                 7
  206.  
  207. /*
  208. ** Pass the password related preferences from the security library to the FE.
  209. **      "cx" is the window context
  210. **      "usePW" is true for "use a password", false otherwise
  211. **      "askPW" is when to ask for the password:
  212. **              -1 = every time its needed
  213. **              0  = once per session
  214. **              1  = after 'n' minutes of inactivity
  215. **      "timeout" is the number of inactive minutes to forget the password
  216. */
  217. extern void FE_SetPasswordPrefs(MWContext *context,
  218.                                 PRBool usePW, int askPW, int timeout);
  219.  
  220. /*
  221.  * Inform the FE that the security library is or is not using a password.
  222.  *      "cx" is the window context
  223.  *      "usePW" is true for "use a password", false otherwise
  224.  */
  225. extern void FE_SetPasswordEnabled(MWContext *context, PRBool usePW);
  226.  
  227. /*
  228.  * Inform the FE that the user has chosen when-to-ask-for-password preferences.
  229.  *      "cx" is the window context
  230.  *      "askPW" is when to ask for the password:
  231.  *              -1 = every time its needed
  232.  *               0 = once per session
  233.  *               1 = after 'n' minutes of inactivity
  234.  *      "timeout" is the number of inactive minutes to forget the password
  235.  *              (this value should be ignored unless askPW is 1)
  236.  */
  237. extern void FE_SetPasswordAskPrefs(MWContext *context, int askPW, int timeout);
  238.  
  239. /* Cipher preference handling:
  240.  *
  241.  * Sets the cipher preference item in the FE and saves the preference file.
  242.  * The FE will take a copy of passed in cipher argument.
  243.  * If context is NULL, FE will choose an appropriate context if neccessary.
  244.  */
  245. void FE_SetCipherPrefs(MWContext *context, char *cipher);
  246.  
  247. /* Return the copy of the current state of the cipher preference item.
  248.  * Caller is expected to free the returned string.
  249.  */
  250. char * FE_GetCipherPrefs(void);
  251.  
  252. /* causes the application to display a non modal mail/news editing window
  253.  *
  254.  * after the completion of mail editing the function controling the
  255.  * mail window should package the data as post data and call
  256.  * NET_GetURL with a mailto URL.  Any mail headers should be contained within
  257.  * URL_Struct->post_headers and the body of the mail message within
  258.  * the URL_Struct->post_data.
  259.  *
  260.  * if the newsgroups field is non-empty the same post data used for the
  261.  * call to the smtp code should be called with a newspost url.
  262.  * the news url minus the newsgroups is given as the "news_url" argument
  263.  * of this function.  If the newsgroups line is "comp.infosystems.www"
  264.  * then it should just be strcat'd onto the end of the "news_url"
  265.  * argument and passed to netlib.
  266.  */
  267. extern void FE_EditMailMessage(MWContext *context, 
  268.                                const char * to_address,
  269.                                const char * subject,
  270.                                const char * newsgroups,
  271.                                const char * references,
  272.                                const char * news_url);
  273.  
  274.  
  275. /* graph the progress of a transfer with a bar of
  276.  * some sort.  This will be called in place
  277.  * of FE_Progress when a content length is known
  278.  */
  279. extern void FE_GraphProgressInit    (MWContext  *context, 
  280.                                  URL_Struct *URL_s, 
  281.                                  int32       content_length);
  282. extern void FE_GraphProgressDestroy (MWContext  *context, 
  283.                                  URL_Struct *URL_s, 
  284.                                  int32       content_length,
  285.                                      int32       total_bytes_read);
  286.  
  287. extern void FE_GraphProgress        (MWContext  *context, 
  288.                                  URL_Struct *URL_s, 
  289.                                  int32       bytes_received,
  290.                                  int32       bytes_since_last_time,
  291.                                  int32       content_length);
  292.  
  293. /*      When the netlib or a netlib stream change state, they should inform the
  294.     front end so it can provide feedback */
  295. typedef enum _Net_RequestStatus {
  296.     nsStarted, nsConnected, nsResolved, nsProgress, nsFinished, nsAborted
  297. }       Net_RequestStatus;
  298. extern void FE_NetStatus (MWContext *context, void *request, Net_RequestStatus status);
  299.  
  300. /*      netlib and netlib streams will use this to keep the front end informed of
  301.     state changes but this information does not specify which request it
  302.     refers to, and the text message is only good for user text feedback */
  303. extern void FE_Progress (MWContext *context, const char * Msg);
  304.  
  305. extern void FE_Alert (MWContext * context, const char * Msg);
  306.  
  307. #if defined(XP_MAC)||defined(XP_UNIX)
  308. extern void FE_Message (MWContext * context, const char * Msg);
  309. #else
  310. #define FE_Message FE_Alert
  311. #endif
  312.  
  313. extern Bool FE_Confirm(MWContext * context, const char * Msg);
  314.  
  315. extern char * FE_Prompt (MWContext * context, const char * Msg, const char * dflt);
  316.  
  317. extern char * FE_PromptPassword (MWContext * context, const char * Msg);
  318.  
  319. extern char * FE_PromptMessageSubject(MWContext * context);
  320.  
  321.  
  322. /* Prompt for a  username and password
  323.  *
  324.  * message is a prompt message.
  325.  *
  326.  * if username and password are not NULL they should be used
  327.  * as default values and NOT MODIFIED.  New values should be malloc'd
  328.  * and put in their place.  
  329.  *
  330.  * If the user hits cancel, FALSE should be returned; otherwise,
  331.  * TRUE should be returned.
  332.  */
  333. PUBLIC Bool FE_PromptUsernameAndPassword (MWContext * window_id,
  334.                       const char *  message,
  335.                       char **       username,
  336.                       char **       password);
  337.  
  338. /*
  339.  * If the user has requested it, save the pop3 password.
  340.  */
  341. extern void FE_RememberPopPassword(MWContext * context, const char * password);
  342.  
  343.  
  344. /* Callback for FE_PromptForFileName() and FE_PromptForNewsHost() */
  345. typedef void (*ReadFileNameCallbackFunction) (MWContext *context,
  346.                                               char *file_name,
  347.                                               void *closure);
  348.  
  349.  
  350. /* Prompt the user for a file name.
  351.    This simply creates and raises the dialog, and returns.
  352.    When the user hits OK or Cancel, the callback will be run.
  353.  
  354.    prompt_string: the window title, or whatever.
  355.  
  356.    default_path: the directory which should be shown to the user by default.
  357.      This may be 0, meaning "use the same one as last time."  The pathname
  358.      will be in URL (Unix) syntax.  (If the FE can't do this, or if it
  359.      violates some guidelines, nevermind.  Unix uses it.)
  360.  
  361.    file_must_exist_p: if true, the user won't be allowed to enter the name
  362.      of a file that doesn't exist, otherwise, they will be allowed to make
  363.      up new names.
  364.  
  365.    directories_allowed_p: if true, then the user will be allowed to select
  366.      directories/folders as well; otherwise, they will be constrained to
  367.      select only files.
  368.  
  369.    The dialog should block the user interface while allowing
  370.    network activity to happen.
  371.  
  372.    The callback should be called with NULL if the user hit cancel,
  373.    and a newly-allocated string otherwise.
  374.  
  375.    The caller should be prepared for the callback to run before
  376.    FE_PromptForFileName() returns, though normally it will be
  377.    run some time later.
  378.  
  379.    Returns negative if something went wrong (in which case the
  380.    callback will not be run.)
  381. */
  382. extern int FE_PromptForFileName (MWContext *context,
  383.                                  const char *prompt_string,
  384.                                  const char *default_path,
  385.                                  XP_Bool file_must_exist_p,
  386.                                  XP_Bool directories_allowed_p,
  387.                                  ReadFileNameCallbackFunction fn,
  388.                                  void *closure);
  389.  
  390. /* Prompts the user for a news host, port, and protocol
  391.    (two text fields and a check box for `news' versus `snews'.)
  392.    Same callback conventions as FE_PromptForFileName(), except
  393.    that the returned string is a URL of the form "http://host:port"
  394.  */
  395. extern int FE_PromptForNewsHost (MWContext *context,
  396.                                  const char *prompt_string,
  397.                                  ReadFileNameCallbackFunction fn,
  398.                                  void *closure);
  399.  
  400.  
  401.  
  402.  
  403. /* FE_FileSortMethod
  404.  * returns one of:  SORT_BY_SIZE
  405.  *          SORT_BY_TYPE
  406.  *          SORT_BY_DATE
  407.  *          SORT_BY_NAME
  408.  * this determines how files are sorted in FTP and file listings
  409.  */
  410. extern int FE_FileSortMethod(MWContext * window_id);
  411.  
  412. /* defines to define the sort method
  413.  * for FTP and file listings
  414.  *
  415.  * these should be returned by: FE_FileSortMethod
  416.  */
  417. #define SORT_BY_NAME 0
  418. #define SORT_BY_TYPE 1
  419. #define SORT_BY_SIZE 2
  420. #define SORT_BY_DATE 3
  421.  
  422. /* FE_UseFancyFTP: check whether or not to use fancy ftp
  423.  */
  424. extern Bool FE_UseFancyFTP (MWContext * window_id);
  425.  
  426. /* FE_UseFancyNewsgroupListing()
  427.  *
  428.  * check whether or not to use fancy newsgroup listings
  429.  */
  430. extern Bool FE_UseFancyNewsgroupListing(MWContext *window_id);
  431.  
  432. /* FE_ShowAllNewsArticles
  433.  *
  434.  * Return true if the user wants to see all newsgroup 
  435.  * articles and not have the number restricted by
  436.  * .newsrc entries
  437.  */
  438. extern XP_Bool FE_ShowAllNewsArticles(MWContext *window_id);
  439.  
  440. /*
  441.  * Return builtin strings for about: displaying
  442.  */
  443. extern void* FE_AboutData(const char *which,
  444.              char **data_ret,
  445.              int32 *length_ret,
  446.              char **content_type_ret);
  447.  
  448. extern void FE_FreeAboutData (void * data, const char* which);
  449.  
  450.  
  451. typedef enum PREF_Enum {
  452.     PREF_EmailAddress,
  453.     PREF_Pop3ID,
  454.     PREF_SMTPHost,
  455.     PREF_PopHost,
  456.     PREF_NewsHost
  457. } PREF_Enum ;
  458. /* 
  459.  * Open a preferences window for a particular preference
  460.  */
  461. extern void FE_EditPreference(PREF_Enum which);
  462.  
  463. /* FE_GetContextID(MWContext * window_id)
  464.  *
  465.  * Gets a unique id for the window
  466.  */
  467. extern int32 FE_GetContextID(MWContext * window_id);
  468. #ifdef _USRDLL
  469. extern int32 NDLLFE_GetContextID(MWContext * window_id);
  470. #endif
  471.  
  472.  
  473. /* Given a local file path (file:///) returns the MIME type of the
  474.  * file.
  475.  * This is needed on the Mac (and possibly on Win95, because not all
  476.  * files have the right extension
  477.  * fileType and encoding should be freed by the caller
  478.  * both can be NULL on return. If they are NULL, useDefault is true
  479.  */
  480. #if !defined(XP_WIN) && !defined(XP_OS2)
  481. void    FE_FileType(char * path, 
  482.                     Bool * useDefault, 
  483.                     char ** fileType, 
  484.                     char ** encoding);
  485. #else
  486. BOOL   FE_FileType(char * path, 
  487.                     char * fileType, 
  488.                     char * encoding);
  489. #endif
  490. #ifdef NEW_FE_CONTEXT_FUNCS
  491.  
  492. /* ---------------------------------------------------------------------------
  493.  * Front end window control
  494.  */
  495.  
  496. #define FE_CreateNewDocWindow(context, URL) \
  497.         (*context->funcs->CreateNewDocWindow)(context, URL)
  498.  
  499. /* ---------------------------------------------------------------------------
  500.  * Front end setup for layout
  501.  */
  502.  
  503. #define FE_LayoutNewDocument(context, url_struct, iWidth, iHeight, mWidth, mHeight) \
  504.             (*context->funcs->LayoutNewDocument)(context, url_struct, iWidth, iHeight, mWidth, mHeight) 
  505. #define FE_FinishedLayout(context) \
  506.             (*context->funcs->FinishedLayout)(context)
  507. #define FE_SetDocTitle(context, title) \
  508.             (*context->funcs->SetDocTitle)(context, title)
  509.  
  510. /* ---------------------------------------------------------------------------
  511.  * Front end Information stuff
  512.  */
  513.  
  514. #define FE_TranslateISOText(context, charset, ISO_Text) \
  515.             (*context->funcs->TranslateISOText)(context, charset, ISO_Text)
  516. #define FE_GetTextInfo(context, text, text_info) \
  517.             (*context->funcs->GetTextInfo)(context, text, text_info)
  518. #ifdef LAYERS
  519. #define FE_GetTextFrame(context, element, start, end, frame) \
  520.             (*context->funcs->GetTextFrame)(context, element, start, end, frame)
  521. #endif
  522. #define FE_GetEmbedSize(context, embed_struct, force_reload) \
  523.             (*context->funcs->GetEmbedSize)(context, embed_struct, force_reload)
  524. #define FE_GetJavaAppSize(context, java_struct, force_reload) \
  525.             (*context->funcs->GetJavaAppSize)(context, java_struct, force_reload)
  526. #define FE_GetFormElementInfo(context, form_element) \
  527.             (*context->funcs->GetFormElementInfo)(context, form_element)
  528. #define FE_GetFormElementValue(context, form_element,hide) \
  529.             (*context->funcs->GetFormElementValue)(context, form_element,hide)
  530. #define FE_ResetFormElement(context, form_element) \
  531.             (*context->funcs->ResetFormElement)(context, form_element)
  532. #define FE_SetFormElementToggle(context, form_element,toggle) \
  533.             (*context->funcs->SetFormElementToggle)(context, form_element,toggle)
  534. #define FE_FreeEmbedElement(context, data) \
  535.             (*context->funcs->FreeEmbedElement)(context, data)
  536. #define FE_CreateEmbedWindow(context, data) \
  537.             (*context->funcs->CreateEmbedWindow)(context, data)
  538. #define FE_SaveEmbedWindow(context, data) \
  539.             (*context->funcs->SaveEmbedWindow)(context, data)
  540. #define FE_RestoreEmbedWindow(context, data) \
  541.             (*context->funcs->RestoreEmbedWindow)(context, data)
  542. #define FE_DestroyEmbedWindow(context, data) \
  543.             (*context->funcs->DestroyEmbedWindow)(context, data)
  544. #define FE_FreeJavaAppElement(context, data) \
  545.             (*context->funcs->FreeJavaAppElement)(context, data)
  546. #define FE_HideJavaAppElement(context, data) \
  547.             (*context->funcs->HideJavaAppElement)(context, data)
  548. #define FE_FreeEdgeElement(context, data) \
  549.             (*context->funcs->FreeEdgeElement)(context, data)
  550. #define FE_FormTextIsSubmit(context, form_element) \
  551.             (*context->funcs->FormTextIsSubmit)(context, form_element)
  552.  
  553.  
  554. /* ---------------------------------------------------------------------------
  555.  * Front end Drawing stuff
  556.  */
  557.  
  558. /* defines for iLocation parameter of display functions */
  559. #define FE_TLEDGE   0   /* Top Ledge */
  560. #define FE_VIEW     1   /* Main View Window */
  561. #define FE_BLEDGE   2   /* Bottom Ledge */
  562.  
  563. #define FE_DisplaySubtext(context, iLocation, text, start_pos, end_pos, need_bg) \
  564.             (*context->funcs->DisplaySubtext)(context, iLocation, text, start_pos, end_pos, need_bg)
  565. #define FE_DisplayText(context, iLocation, text, need_bg) \
  566.             (*context->funcs->DisplayText)(context, iLocation, text, need_bg)
  567. #define FE_DisplayEmbed(context, iLocation , embed_struct) \
  568.             (*context->funcs->DisplayEmbed)(context, iLocation ,embed_struct)
  569. #define FE_DisplayJavaApp(context, iLocation , java_struct) \
  570.             (*context->funcs->DisplayJavaApp)(context, iLocation ,java_struct)
  571. #define FE_DisplayEdge(context, iLocation ,edge_struct) \
  572.             (*context->funcs->DisplayEdge)(context, iLocation ,edge_struct)
  573. #define FE_DisplayTable(context, iLocation ,table_struct) \
  574.             (*context->funcs->DisplayTable)(context, iLocation ,table_struct)
  575. #define FE_DisplayCell(context, iLocation ,cell_struct) \
  576.             (*context->funcs->DisplayCell)(context, iLocation ,cell_struct)
  577.  
  578. /* brade:  not sure why this doesn't work on Windows but seems to work elsewhere */
  579. /*         therefore, short-term hack is to #ifdef out these lines */
  580. #ifdef XP_MAC
  581. #define FE_DisplayEntireTableOrCell(context, element) \
  582.             (*context->funcs->InvalidateEntireTableOrCell)(context, element)
  583. #define FE_DisplayAddRowOrColBorder(context, pRect, bErase) \
  584.             (*context->funcs->DisplayAddRowOrColBorder)(context, pRect, bErase)
  585. #define FE_UpdateEnableStates(context) \
  586.             (*context->funcs->UpdateEnableStates)(context)
  587. #endif
  588.  
  589. #define FE_DisplaySubDoc(context, iLocation ,subdoc_struct) \
  590.             (*context->funcs->DisplaySubDoc)(context, iLocation ,subdoc_struct)
  591. #define FE_DisplayLineFeed(context, iLocation , line_feed, need_bg) \
  592.             (*context->funcs->DisplayLineFeed)(context, iLocation , line_feed, need_bg)
  593. #define FE_DisplayHR(context, iLocation , HR_struct) \
  594.             (*context->funcs->DisplayHR)(context, iLocation , HR_struct)
  595. #define FE_DisplayBullet(context, iLocation, bullet) \
  596.             (*context->funcs->DisplayBullet)(context, iLocation, bullet)
  597. #define FE_DisplayFormElement(context, iLocation, form_element) \
  598.             (*context->funcs->DisplayFormElement)(context, iLocation, form_element)
  599. #define FE_DisplayBorder(context, iLocation, x, y, width, height, bw, color, style) \
  600.             (*context->funcs->DisplayBorder)(context, iLocation, x, y, width, height, bw, color, style)
  601. #define FE_DisplayFeedback(context, iLocation, element) \
  602.             (*context->funcs->DisplayFeedback)(context, iLocation, element)
  603. #ifdef LAYERS
  604. #define FE_EraseBackground(context, iLocation, x, y, width, height, bg) \
  605.             (*context->funcs->EraseBackground)(context, iLocation, x, y, width, height, bg)
  606. #define FE_SetDrawable(context, drawable) \
  607.             (*context->funcs->SetDrawable)(context, drawable)
  608. #endif /* LAYERS */
  609.  
  610. #define FE_ClearView(context, which) \
  611.             (*context->funcs->ClearView)(context, which)
  612.  
  613. #define FE_SetDocDimension(context, iLocation, iWidth, iLength) \
  614.             (*context->funcs->SetDocDimension)(context, iLocation, iWidth, iLength)
  615. #define FE_SetDocPosition(context, iLocation, iX, iY) \
  616.             (*context->funcs->SetDocPosition)(context, iLocation, iX, iY)
  617. #define FE_GetDocPosition(context, iLocation, iX, iY) \
  618.             (*context->funcs->GetDocPosition)(context, iLocation, iX, iY)
  619. #define FE_BeginPreSection(context) \
  620.             (*context->funcs->BeginPreSection)(context)
  621. #define FE_EndPreSection(context) \
  622.             (*context->funcs->EndPreSection)(context)
  623. #define FE_SetProgressBarPercent(context, percent) \
  624.             (*context->funcs->SetProgressBarPercent)(context, percent)
  625. #define FE_SetBackgroundColor(context, red, green, blue) \
  626.             (*context->funcs->SetBackgroundColor)(context, red, green, blue)
  627. #define FE_Progress(cx,msg) \
  628.             (*cx->funcs->Progress)(cx,msg)
  629. #define FE_SetCallNetlibAllTheTime(cx) \
  630.             (*cx->funcs->SetCallNetlibAllTheTime)(cx)
  631. #define FE_ClearCallNetlibAllTheTime(cx) \
  632.             (*cx->funcs->ClearCallNetlibAllTheTime)(cx)
  633. #define FE_GraphProgressInit(cx, URL_s, content_length) \
  634.             (*cx->funcs->GraphProgressInit)(cx, URL_s, content_length)
  635. #define FE_GraphProgressDestroy(cx, URL_s, content_length, total_read) \
  636.             (*cx->funcs->GraphProgressDestroy)(cx, URL_s, content_length, total_read)
  637. #define FE_GraphProgress(cx, URL_s, rec, new, len) \
  638.             (*cx->funcs->GraphProgress)(cx, URL_s, rec, new, len)
  639. #define FE_UseFancyFTP(window_id) \
  640.             (*window_id->funcs->UseFancyFTP)(window_id)
  641. #define FE_UseFancyNewsgroupListing(window_id) \
  642.             (*window_id->funcs->UseFancyNewsgroupListing)(window_id)
  643. #define FE_FileSortMethod(window_id) \
  644.             (*window_id->funcs->FileSortMethod)(window_id)
  645. #define FE_ShowAllNewsArticles(window_id) \
  646.             (*window_id->funcs->ShowAllNewsArticles)(window_id)
  647. #define FE_Confirm(context,Msg) \
  648.             (*context->funcs->Confirm)(context,Msg)
  649. #define FE_Prompt(context,Msg,dflt) \
  650.             (*context->funcs->Prompt)(context,Msg,dflt)
  651. #define FE_PromptWithCaption(context,caption,Msg,dflt) \
  652.             (*context->funcs->PromptWithCaption)(context,caption,Msg,dflt)
  653. #define FE_PromptPassword(context, Msg) \
  654.             (*context->funcs->PromptPassword)(context, Msg)
  655. #define FE_PromptUsernameAndPassword(cx, Msg, username, password) \
  656.             (*cx->funcs->PromptUsernameAndPassword)(cx,Msg,username,password)
  657. #define FE_EnableClicking(context) \
  658.             (*context->funcs->EnableClicking)(context)
  659. #define FE_GetDefaultBackgroundColor(context,color) \
  660.             (*context->funcs->GetDefaultBackgroundColor)(context,color)
  661.  
  662. /* these functions are to allow dealyed native window applet creation and transparent applet */
  663. #define FE_HandleClippingView(context, data, x, y, width, height) \
  664.             (*context->funcs->HandleClippingView)(context, data, x, y, width, height)
  665. #define FE_DrawJavaApp(context, iLocation, pJava) \
  666.             (*context->funcs->DrawJavaApp)(context, iLocation, pJava)
  667.  
  668. /* This will be called after ALL exit routines have been called and
  669.  * when there are no more pending or active connections in the Netlib.
  670.  * After FE_AllConnectionsComplete(MWContext *) the context will not
  671.  * be referenced again by the NetLib so the context can be free'd in
  672.  * that call if desired.
  673.  */
  674. #define FE_AllConnectionsComplete(context) \
  675.             (*context->funcs->AllConnectionsComplete)(context)
  676. #else
  677.  
  678. /* ---------------------------------------------------------------------------
  679.  * Front end window control
  680.  */
  681.  
  682. extern MWContext *  FE_CreateNewDocWindow(MWContext * calling_context,URL_Struct * URL);
  683.  
  684. /* ---------------------------------------------------------------------------
  685.  * Front end setup for layout
  686.  */
  687.  
  688. extern void FE_LayoutNewDocument(MWContext *context, URL_Struct *url_struct, int32 *iWidth, int32 *iHeight, int32 *mWidth, int32 *mHeight);
  689. extern void FE_SetDocTitle(MWContext * context, char * title);
  690. extern void FE_FinishedLayout (MWContext *context);
  691. extern void FE_BeginPreSection (MWContext *context);
  692. extern void FE_EndPreSection (MWContext *context);
  693.  
  694. /* ---------------------------------------------------------------------------
  695.  * Front end Information stuff
  696.  */
  697.  
  698. extern char *   FE_TranslateISOText(MWContext * context, int charset, char *ISO_Text);
  699. extern int      FE_GetTextInfo(MWContext * context, LO_TextStruct *text, LO_TextInfo *text_info);
  700. #ifdef XP_OS2       /* performance   */
  701. extern int      FE_GetMaxWidth(MWContext *pContext, LO_TextStruct *pText); /* performance */
  702. #endif
  703. #ifdef LAYERS
  704. void        FE_GetTextFrame(MWContext * context, LO_TextStruct *text, int32 start, int32 end, XP_Rect *frame);
  705. #endif
  706. void            FE_GetEmbedSize(MWContext * context, LO_EmbedStruct *embed_struct, NET_ReloadMethod force_reload);
  707. void            FE_GetJavaAppSize(MWContext * context, LO_JavaAppStruct *java_struct, NET_ReloadMethod force_reload);
  708. void            FE_GetFormElementInfo(MWContext * context, LO_FormElementStruct * form_element);
  709. void            FE_GetFormElementValue(MWContext * context, LO_FormElementStruct * form_element, Bool hide);
  710. void            FE_ResetFormElement(MWContext * context, LO_FormElementStruct * form_element);
  711. void            FE_SetFormElementToggle(MWContext * context, LO_FormElementStruct * form_element, Bool toggle);
  712. void            FE_FreeEmbedElement(MWContext *context, LO_EmbedStruct *);
  713. void            FE_FreeJavaAppElement(MWContext *context, struct LJAppletData *appletData);
  714. void            FE_HideJavaAppElement(MWContext *context, void*);
  715. void            FE_FreeEdgeElement(MWContext *context, LO_EdgeStruct *);
  716. void            FE_FormTextIsSubmit(MWContext * context, LO_FormElementStruct * form_element);
  717. void            FE_SetProgressBarPercent(MWContext *context, int32 percent);
  718. void            FE_SetBackgroundColor(MWContext *context, uint8 red, uint8 green, uint8 blue);
  719.  
  720.  
  721. /* ---------------------------------------------------------------------------
  722.  * Front end Drawing stuff
  723.  */
  724.  
  725. /* defines for iLocation parameter of display functions */
  726. #define FE_TLEDGE   0   /* Top Ledge */
  727. #define FE_VIEW     1   /* Main View Window */
  728. #define FE_BLEDGE   2   /* Bottom Ledge */
  729.  
  730. extern void FE_DisplaySubtext(MWContext * context, int iLocation, LO_TextStruct *text, int32 start_pos, int32 end_pos, Bool need_bg);
  731. extern void FE_DisplayText(MWContext * context, int iLocation, LO_TextStruct *text, Bool need_bg);
  732. void        FE_DisplayEmbed(MWContext * context, int iLocation ,LO_EmbedStruct *embed_struct);
  733. void        FE_DisplayJavaApp(MWContext * context, int iLocation ,LO_JavaAppStruct *java_struct);
  734. void        FE_DisplayEdge(MWContext * context, int iLocation ,LO_EdgeStruct *edge_struct);
  735. void        FE_DisplayTable(MWContext * context, int iLocation ,LO_TableStruct *table_struct);
  736. void        FE_DisplayCell(MWContext * context, int iLocation ,LO_CellStruct *cell_struct);
  737. void        FE_DisplaySubDoc(MWContext * context, int iLocation ,LO_SubDocStruct *subdoc_struct);
  738. void        FE_DisplayLineFeed(MWContext * context, int iLocation , LO_LinefeedStruct *line_feed, Bool need_bg);
  739. void        FE_DisplayHR(MWContext * context, int iLocation , LO_HorizRuleStruct *HR_struct);
  740. void        FE_DisplayBullet(MWContext *context, int iLocation, LO_BullettStruct *bullet);
  741. void        FE_DisplayFormElement(MWContext * context, int iLocation, LO_FormElementStruct * form_element);
  742. void        FE_DisplayBorder(MWContext *context, int iLocation, int x, int y, int width, int height, int bw, LO_Color *color, LO_LineStyle style);
  743. void        FE_DisplayFeedback(MWContext *context, int iLocation, LO_Element *element);
  744. #ifdef LAYERS
  745. void        FE_EraseBackground(MWContext * context, int iLocation, int32 x, int32 y, uint32 width, uint32 height, LO_Color *bg);
  746. void        FE_SetClipRegion(MWContext *context, int iLocation, FE_Region region);
  747. #endif
  748. void        FE_ClearView(MWContext * context, int which);
  749.  
  750. void        FE_SetDocDimension(MWContext *context, int iLocation, int32 iWidth, int32 iLength);
  751. void        FE_SetDocPosition(MWContext *context, int iLocation, int32 iX, int32 iY);
  752. void        FE_GetDocPosition(MWContext *context, int iLocation, int32 *iX, int32 *iY);
  753.  
  754. /* temporary testing fn's */
  755.  
  756. extern int  FE_DrawText(MWContext * context, const char * buffer);
  757. extern int  FE_DrawImage(MWContext * context, const char * filename);
  758.  
  759. extern void FE_EnableClicking(MWContext * context);
  760.  
  761. /* these functions are to allow dealyed native window applet creation and transparent applet */
  762. void        FE_HandleClippingView(MWContext *pContext, struct LJAppletData *appletD, int x, int y, int width, int height);
  763. void        FE_DrawJavaApp(MWContext *pContext, int iLocation, LO_JavaAppStruct *pJava);
  764.  
  765. /* This will be called after ALL exit routines have been called and
  766.  * when there are no more pending or active connections in the Netlib.
  767.  * After FE_AllConnectionsComplete(MWContext *) the context will not
  768.  * be referenced again by the NetLib so the context can be free'd in
  769.  * that call if desired.
  770.  */
  771. extern void FE_AllConnectionsComplete(MWContext * context);
  772.  
  773. #endif /* NEW_FE_CONTEXT_FUNCS */
  774.  
  775. /*
  776.  * Logically grouped with FE_GetTextInfo
  777.  */
  778. extern void     FE_ReleaseTextAttrFeData(MWContext * context, LO_TextAttr *attr);
  779.  
  780. /*
  781.  * Liberated from context function table
  782.  */
  783. void            FE_FreeFormElement(MWContext * context, LO_FormElementData *);
  784.  
  785. /* --------------------------------------------------------------------------
  786.  * Front end history stuff
  787.  */
  788.  
  789. extern int  FE_EnableBackButton(MWContext * context);
  790. extern int  FE_EnableForwardButton(MWContext * context);
  791. extern int  FE_DisableBackButton(MWContext * context);
  792. extern int  FE_DisableForwardButton(MWContext * context);
  793.  
  794. /* -------------------------------------------------------------------------
  795.  * Generic FE stuff
  796.  */
  797. /* display given string in 'view source' window */
  798. extern void FE_DisplaySource(MWContext * context, char * source);
  799. extern void FE_SaveAs(MWContext * context, char * source);
  800.  
  801. /* This is called when there's a chance that the state of the
  802.  * Stop button (and corresponding menu item) has changed.
  803.  * The FE should use XP_IsContextStoppable to determine the
  804.  * new state.
  805.  */
  806. extern void FE_UpdateStopState(MWContext * context);
  807.  
  808. /* -------------------------------------------------------------------------
  809.  * Grid stuff (where should this go?)
  810.  */
  811. extern MWContext *FE_MakeGridWindow (MWContext *old_context,
  812.     void *hist_list, void *history,
  813.     int32 x, int32 y, int32 width, int32 height,
  814.     char *url_str, char *window_name, int8 scrolling,
  815.     NET_ReloadMethod force_reload
  816.     , Bool no_edge
  817.     );
  818. extern void *FE_FreeGridWindow(MWContext *context, XP_Bool save_history);
  819. extern void FE_RestructureGridWindow(MWContext *context, int32 x, int32 y,
  820.     int32 width, int32 height);
  821. extern void FE_GetFullWindowSize(MWContext *context,
  822.     int32 *width, int32 *height);
  823. extern void FE_GetEdgeMinSize(MWContext *context, int32 *size
  824. #if defined(XP_WIN) || defined(XP_OS2)
  825.                   /* Windows needs this info here */
  826.                   , Bool no_edge
  827. #endif
  828.                   );
  829. extern void FE_LoadGridCellFromHistory(MWContext *context, void *hist,
  830.             NET_ReloadMethod force_reload);
  831.  
  832. /*
  833.  * Ugh for scrolling chat window.  And now for JavaScript
  834.  */
  835. extern void FE_ShiftImage (MWContext *context, LO_ImageStruct *lo_image);
  836. extern void FE_ScrollDocTo (MWContext *context, int iLocation, int32 x,int32 y);
  837. extern void FE_ScrollDocBy (MWContext *context, int iLocation, int32 x,int32 y);
  838.  
  839. /* JavaScript commands to allow full UI control of a window */
  840. extern void FE_BackCommand (MWContext *context);
  841. extern void FE_ForwardCommand (MWContext *context);
  842. extern void FE_HomeCommand (MWContext *context);
  843. extern void FE_PrintCommand (MWContext *context);
  844. /* Note: on Unix, the position reported by FE_GetWindowOffset() may get out 
  845.  *  of sync with reality, because we're relying on incoming events to tell
  846.  *  us the offset, rather than have to make a round trip to the X server
  847.  *  every time we need it.  If it causes a problem, come talk to francis.
  848.  *
  849.  * For more details, see FE_GetWindowOffset() in ns/cmd/xfe/context_func.cpp.
  850.  */
  851. extern void FE_GetWindowOffset (MWContext *pContext, int32 *sx, int32 *sy);
  852. extern void FE_GetScreenSize (MWContext *pContext, int32 *sx, int32 *sy);
  853. extern void FE_GetAvailScreenRect (MWContext *pContext, int32 *sx, int32 *sy, 
  854.                             int32 *left, int32 *top);
  855. extern XP_Bool FE_FindCommand (MWContext *context, char *szName, XP_Bool bCaseSensitve, 
  856.                                XP_Bool bBackwards, XP_Bool bWrap);
  857. extern void FE_GetPixelAndColorDepth (MWContext *pContext, int32 *pixelDepth, 
  858.                                       int32 *colorDepth);
  859. /*
  860.  *  To get information about the hardware
  861.  */
  862. /*
  863.  *  (need to add functions for other platforms!!!)
  864.  */
  865. #if defined(XP_WIN)
  866. extern char *FE_SystemCPUInfo(void);
  867. extern int32 FE_SystemRAM( void );
  868. extern int32 FE_SystemClockSpeed( void );
  869. #endif
  870. /*
  871.  * Named windows needs this.
  872.  */
  873. extern MWContext *FE_MakeBlankWindow(MWContext *old_context,
  874.     URL_Struct *url, char *window_name);
  875. extern void FE_SetWindowLoading(MWContext *context, URL_Struct *url,
  876.     Net_GetUrlExitFunc **exit_func);
  877.  
  878. /*
  879.  * Raise the window to the top of the view order
  880.  */
  881. extern void FE_RaiseWindow(MWContext *context);
  882.  
  883. /* Chrome controlled windows. */
  884. /* FE_MakeNewWindow()
  885.  *
  886.  * if Chrome is NULL, the behaviour will exactly be as FE_MakeBlankWindow
  887.  */
  888. extern MWContext *FE_MakeNewWindow(MWContext *old_context,
  889.     URL_Struct *url, char *window_name, Chrome *chrome);
  890. extern void FE_DestroyWindow(MWContext *context);
  891.  
  892. #if defined(XP_WIN) || defined(XP_MAC) || defined(XP_OS2)
  893. /* -------------------------------------------------------------------------
  894.  * FE Remote Control APIs called by netlib
  895.  */
  896. XP_Bool FE_UseExternalProtocolModule(MWContext *pContext,
  897.     FO_Present_Types iFormatOut, URL_Struct *pURL,
  898.     Net_GetUrlExitFunc *pExitFunc);
  899.  
  900. #ifdef _USRDLL
  901. XP_Bool NDLLFE_UseExternalProtocolModule(MWContext *pContext,
  902.     FO_Present_Types iFormatOut, URL_Struct *pURL,
  903.     Net_GetUrlExitFunc *pExitFunc);
  904. #endif
  905.  
  906. void FE_URLEcho(URL_Struct *pURL, int iStatus, MWContext *pContext);
  907. #ifdef _USRDLL
  908. void NDLLFE_URLEcho(URL_Struct *pURL, int iStatus, MWContext *pContext);
  909. #endif
  910.  
  911. #endif /* XP_WIN */
  912.  
  913. PUBLIC void FE_GetDocAndWindowPosition(MWContext * context, int32 *pX, int32 *pY,
  914.         int32 *pWidth, int32 *pHeight );
  915.  
  916. #ifdef EDITOR
  917. PUBLIC void FE_DisplayTextCaret(MWContext * context, int loc, LO_TextStruct * text_data, int char_offset);
  918.  
  919. PUBLIC void FE_DisplayImageCaret(MWContext * context, LO_ImageStruct * pImageData,
  920.             ED_CaretObjectPosition caretPos );
  921.  
  922. PUBLIC void FE_DisplayGenericCaret(MWContext * context, LO_Any * pLoAny,
  923.             ED_CaretObjectPosition caretPos );
  924.  
  925. #ifdef XP_WIN
  926. /* Ask front end to show where a dragged set of table cells may be dropped */
  927. PUBLIC void FE_DisplayDropTableFeedback(MWContext * context, EDT_DragTableData *pDragData);
  928. #endif
  929.  
  930. PUBLIC Bool FE_GetCaretPosition(MWContext *context, LO_Position* where,
  931.     int32* caretX, int32* caretYLow, int32* caretYHigh);
  932.  
  933. PUBLIC void FE_DestroyCaret(MWContext *pContext);
  934. PUBLIC void FE_ShowCaret(MWContext *pContext);
  935. PUBLIC void FE_DocumentChanged(MWContext * context, int32 iStartY, int32 iHeight );
  936.  
  937. PUBLIC MWContext *FE_CreateNewEditWindow(MWContext *pContext, URL_Struct *pURL);
  938.  
  939. /* Set default colors, background from user Preferences via the Page Data structure 
  940. */
  941. void FE_SetNewDocumentProperties(MWContext * pMWContext);
  942.  
  943. /*
  944.  * Formatting has changed.
  945.  */
  946. PUBLIC void FE_EditFormattingUpdate( MWContext *pContext );
  947.  
  948. /* 
  949.  * Brings up a modal image load dialog and returns.  Calls
  950.  *  EDT_ImageLoadCancel() if the cancel button is pressed
  951. */
  952. PUBLIC void FE_ImageLoadDialog( MWContext *pContext );
  953.  
  954. /* 
  955.  * called by the editor engine after the image has been loaded
  956. */
  957. PUBLIC void FE_ImageLoadDialogDestroy( MWContext *pContext );
  958.  
  959. /* 
  960.  * Bring up a files saving progress dialog.  While the dialog is modal to the edit
  961.  *  window. but should return immediately from the create call.  If cancel button
  962.  *  is pressed, EDT_SaveCancel(pMWContext) should be called if saving locally,
  963.  *  or  NET_InterruptWindow(pMWContext) if uploading files
  964.  *  Use bUpload = TRUE for Publishing file and images to remote site
  965. */
  966. PUBLIC void FE_SaveDialogCreate( MWContext *pContext, int iFileCount, ED_SaveDialogType saveType );
  967. /* Sent after filename is made, but before opening or saving */
  968. PUBLIC void FE_SaveDialogSetFilename( MWContext *pContext, char *pFilename );
  969.                      
  970. /* Sent after file is completely saved, even if user said no to overwrite
  971.  *  (then status = ED_ERROR_FILE_EXISTS)
  972.  * Not called if failed to open source file at all, but is called with error
  973.  *   status if failed during writing
  974. */
  975. PUBLIC void FE_FinishedSave( MWContext *pMWContext, int status, char *pDestURL, int iFileNumber );
  976. /* Sent after all files are saved or user cancels */
  977. PUBLIC void FE_SaveDialogDestroy( MWContext *pContext, int status, char *pFilename );
  978.  
  979. PUBLIC ED_SaveOption FE_SaveFileExistsDialog( MWContext *pContext, char* pFilename );
  980.  
  981. /* Sent after file is opened (or failed) -- same time saving is initiated */
  982. PUBLIC Bool FE_SaveErrorContinueDialog( MWContext *pContext, char* pFileName, ED_FileError error );
  983.  
  984. PUBLIC void FE_ClearBackgroundImage( MWContext *pContext );
  985.  
  986. PUBLIC void FE_EditorDocumentLoaded( MWContext *pContext );
  987.  
  988. /* 
  989.  * return a valid local base file name for the given URL.  If there is no
  990.  *  base name, return 0.
  991. */
  992. PUBLIC char* FE_URLToLocalName( char* );
  993.  
  994. PUBLIC Bool FE_EditorPrefConvertFileCaseOnWrite(void);
  995.  
  996. /* Defines to use for second parameter to FE_LoadUrl 
  997.  * for better readability
  998. */
  999. #define LOAD_URL_COMPOSER  TRUE
  1000. #define LOAD_URL_NAVIGATOR FALSE
  1001.  
  1002. /* Access function for calling from outside to Edit or Navigate
  1003.  * Primarily called by LiveWire SiteManager 
  1004.  * Set bEdit = TRUE to start Editor
  1005.  * Existing frames are searched first and activated if 
  1006.  *   URL is already loaded
  1007.  * Nothing happens if szURL is NULL
  1008. */
  1009. void FE_LoadUrl( char *szURL, XP_Bool bEdit );
  1010.  
  1011. /* This is used to find an existing Browser or Editor frame
  1012.  *  and load supplied URL. It is important to prevent 
  1013.  *  multiple windows editing the same file 
  1014. */
  1015. MWContext * FE_ActivateFrameWithURL(char *szURL, Bool bFindEditor);
  1016.  
  1017. /* Primarily an error recovery routine:
  1018.  * Try to find frame with our URL,
  1019.  *   or the previous frame in list,
  1020.  *   or create a new browser frame
  1021.  *   Then close current frame
  1022.  *   Return frame found or created
  1023. */
  1024. void FE_RevertToPreviousFrame(char *szURL, MWContext *pMWContext);
  1025.  
  1026. /*   Does editor-specific stuff when done loading a URL
  1027. */
  1028. void FE_EditorGetUrlExitRoutine(URL_Struct *pUrl, int iStatus, MWContext *pMWContext);
  1029.  
  1030. /* Check if change was made to an edit document, 
  1031.  *    prompt user to save if they was.
  1032.  * Returns TRUE for all cases except CANCEL by the user in any dialog
  1033.  * Call this before any URL load into the current frame window
  1034. */
  1035. Bool FE_CheckAndSaveDocument(MWContext *pMWContext);
  1036.  
  1037. /* Similar to above, but dialog to ask user if they want to save changes
  1038.  *    should have "AutoSave" caption and extra line to
  1039.  *    tell them "Cancel" will turn off Autosave until they 
  1040.  *    save the file later.
  1041. */
  1042. Bool FE_CheckAndAutoSaveDocument(MWContext *pMWContext);
  1043.  
  1044. /* Checks for new doc or remote editing and prompts
  1045.  *  to save. Return FALSE only if user cancels out of dialog
  1046.  * Use bSaveNewDocument = FALSE to not force saving of a new document
  1047. */
  1048. Bool FE_SaveNonLocalDocument(MWContext *pMWContext, Bool  bSaveNewDocument);
  1049.  
  1050. #if defined(XP_WIN) || defined(XP_OS2)
  1051. /* Tell the front end every time we finish relaying out so
  1052.  *  it can invalidate cached pointers to layout elements
  1053. */
  1054. void FE_FinishedRelayout(MWContext * pMWContext);
  1055.  
  1056. /* Call the front end to force updating button enable/disabling
  1057.  * Currently used after every Autosave event so toolbar SAVE button can be grayed 
  1058. */
  1059. void FE_UpdateEnableStates(MWContext * pMWContext);
  1060. #endif /* XP_WIN */
  1061.  
  1062. #if defined(XP_WIN) || defined(XP_UNIX)
  1063. /* MOVE THESE OUT OF XP_WIN WHEN ALL PLATFORMS IMPLEMENT IT*/
  1064. /* Called during "sizing" of a table when we are really adding/subtracting
  1065.  * rows or columns. Front end should draw a line
  1066.  *   from the point {rect.left, rect.top} to the point {rect.right,rect.bottom}
  1067.  *   (Thickness and style are left to FE, Windows uses a dashed line)
  1068.  *   This will be called with bErase = TRUE to remove the line when appropriate,
  1069.  *   so FEs don't need to worry about removing selection,
  1070.  *   but you must call EDT_CancelSizing or EDT_EndSizing for final removal.
  1071. */
  1072. void FE_DisplayAddRowOrColBorder(MWContext * pMWContext, XP_Rect *pRect, XP_Bool bErase);
  1073.  
  1074. /* This should invalidate the entire table or cell rect to cause redrawing of backgrounds
  1075.  *  and all table or cell contents. Use to unselect table/cell selection feedback
  1076. */
  1077. void FE_DisplayEntireTableOrCell(MWContext * pMWContext, LO_Element * pLoElement);
  1078.  
  1079. #endif /* XP_WIN || XP_UNIX */
  1080.  
  1081. #endif /* Editor */
  1082.  
  1083. /* This is how the libraries ask the front end to load a URL just
  1084.    as if the user had typed/clicked it (thermo and busy-cursor
  1085.    and everything.)  NET_GetURL doesn't do all this stuff.
  1086.  */
  1087. extern int FE_GetURL (MWContext *context, URL_Struct *url);
  1088.  
  1089. /* -------------------------------------------------------------------------
  1090.  * Input focus and event controls, for Mocha.
  1091.  */
  1092.  
  1093. /*
  1094.  * Force input to be focused on an element in the given window.
  1095.  */
  1096. void FE_FocusInputElement(MWContext *window, LO_Element *element);
  1097.  
  1098. /*
  1099.  * Force input to be defocused from an element in the given window.
  1100.  * It's ok if the input didn't have input focus.
  1101.  */
  1102. void FE_BlurInputElement(MWContext *window, LO_Element *element);
  1103.  
  1104. /*
  1105.  * Selectin input in a field, highlighting it and preparing for change.
  1106.  */
  1107. void FE_SelectInputElement(MWContext *window, LO_Element *element);
  1108.  
  1109. /*
  1110.  * Tell the FE that something in element changed, and to redraw it in a way
  1111.  * that reflects the change.  The FE is responsible for telling layout about
  1112.  * radiobutton state.
  1113.  */
  1114. void FE_ChangeInputElement(MWContext *window, LO_Element *element);
  1115.  
  1116. /*
  1117.  * Tell the FE that a form is being submitted without a UI gesture indicating
  1118.  * that fact, i.e., in a Mocha-automated fashion ("document.form.submit()").
  1119.  * The FE is responsible for emulating whatever happens when the user hits the
  1120.  * submit button, or auto-submits by typing Enter in a single-field form.
  1121.  */
  1122. void FE_SubmitInputElement(MWContext *window, LO_Element *element);
  1123.  
  1124. /*
  1125.  * Emulate a button or HREF anchor click for element.
  1126.  */
  1127. /*
  1128. #ifndef NO_TAB_NAVIGATION
  1129.     FE_ClickAnyElement() is based on FE_ClickInputElement(), and should replace the latter.
  1130.     If haveXY != 0, the xx, yy will be used for click. otherwise click the center of element.
  1131.  
  1132.     xx, yy are element coordinates, This function take care of :
  1133.     lo_any.x_offset, pWinCX->GetOriginX(), ClientToScreen(), and  ScreenToClient()
  1134. */
  1135. int FE_ClickAnyElement(MWContext * pContext,  LO_Element * pElement, int haveXY, int32 xx, int32 yy );
  1136. /* NO_TAB_NAVIGATION  */
  1137.  
  1138.  
  1139. void FE_ClickInputElement(MWContext *window, LO_Element *element);
  1140.  
  1141.  
  1142. char *FE_GetAcceptLanguage(void);
  1143.  
  1144. #ifdef LAYERS
  1145. PRBool FE_HandleLayerEvent(MWContext *context, CL_Layer *layer, 
  1146.                            CL_Event *event);
  1147. PRBool FE_HandleEmbedEvent(MWContext *context, LO_EmbedStruct *embed,
  1148.                            CL_Event *event);
  1149. #endif /* LAYERS */
  1150.  
  1151. /*
  1152.  * Configurable chrome for existing contexts.
  1153.  *
  1154.  * This routine uses only these entries from the chrome structure.
  1155.  *      show_url_bar, show_button_bar, show_directory_buttons,
  1156.  *      show_security_bar, show_menu, show_bottom_status_bar
  1157.  */
  1158. void FE_UpdateChrome(MWContext *window, Chrome *chrome);
  1159.  
  1160. /*
  1161.  * JavaScript calls to the window must be able to find the state of 
  1162.  * the existing chrome structure
  1163.  */
  1164. void FE_QueryChrome(MWContext *window, Chrome *chrome);
  1165.  
  1166. /*
  1167.  * Returns a string representing the default installed location of
  1168.  * the NetHelp directory as a file:// URL.  The caller is expected to
  1169.  * free the returned string.  Used by mkhelp.c to retrieve NetHelp content.
  1170.  */
  1171.  
  1172. extern char * FE_GetNetHelpDir(void);
  1173.  
  1174. /*
  1175.  * Returns the "default" MWContext to use when bringing up a nethelp
  1176.  * topic.  This should try to return the context associated with the topmost
  1177.  * visible window.
  1178.  */
  1179.  
  1180. extern MWContext * FE_GetNetHelpContext(void);
  1181.  
  1182. /*
  1183.  * Netcaster calls - EA
  1184.  */
  1185.  
  1186. /*
  1187.  * Returns true if Netcaster is installed, false otherwise.
  1188.  */
  1189.  
  1190. extern XP_Bool FE_IsNetcasterInstalled(void);
  1191.  
  1192. /*
  1193.  * If Netcaster is running, returns its context.  If not, returns NULL.
  1194.  * This function will always return NULL if Netcaster is not installed.
  1195.  */
  1196.  
  1197. extern MWContext * FE_IsNetcasterRunning(void);
  1198. /*
  1199.  * If the Netcaster component is not currently running, starts it and opens
  1200.  * the Netcaster drawer.  If the component is running, but it does not have
  1201.  * focus (it's not on top), or the drawer is closed, brings the window to top
  1202.  * and opens the drawer.  If the component is running, has focus, and is open,
  1203.  * does nothing.
  1204.  */
  1205.  
  1206. extern void FE_RunNetcaster(MWContext *context);
  1207.  
  1208.  
  1209. #if defined(XP_WIN) || defined(XP_OS2) /* removed this #ifdef when other platform implement this. */
  1210. extern XP_Bool FE_CheckFormTextAttributes(MWContext *context,
  1211.                 LO_TextAttr *oldAttr, LO_TextAttr *newAttr, int32 type);
  1212. #endif
  1213.  
  1214. #if defined(XP_WIN) || defined(XP_OS2)
  1215. /*
  1216.  *      Windows needs a way to know when a URL switches contexts,
  1217.  *              so that it can keep the NCAPI progress messages
  1218.  *              specific to a URL loading and not specific to the
  1219.  *              context attempting to load.
  1220.  */
  1221. void FE_UrlChangedContext(URL_Struct *pUrl, MWContext *pOldContext, MWContext *pNewContext);
  1222.  
  1223. /* these are used to load and use the compuserv auth DLL
  1224.  */
  1225. extern int WFE_DoCompuserveAuthenticate(MWContext *context, 
  1226.                                         URL_Struct *URL_s, 
  1227.                                         char *authenticate_header_value);
  1228.  
  1229. extern char *WFE_BuildCompuserveAuthString(URL_Struct *URL_s);
  1230.  
  1231. /* Way to attempt to keep the application messages flowing 
  1232.  * when need to block a return value.
  1233.  */
  1234. extern void FEU_StayingAlive(void);
  1235.  
  1236. /* convert logical pixels to device pixels */
  1237. extern int32  FE_LPtoDPoint(MWContext * context, int32 logicalPoint);
  1238.  
  1239. #endif /* XP_WIN */
  1240.  
  1241.  
  1242. extern void    FE_MochaImageGroupObserver(XP_Observable observable,
  1243.                                         XP_ObservableMsg message,
  1244.                                         void *message_data,
  1245.                                         void *closure);
  1246.  
  1247. /*
  1248.  * Get a context at init time suitable for putting up a password prompt.
  1249.  * We can add other features as necessary. This context is only needed before
  1250.  * we get the first window up. This function is need if FIPS140 is turned on.
  1251.  */
  1252. MWContext * FE_GetInitContext(void);
  1253.  
  1254. #ifdef XP_UNIX
  1255. /* Get the dimensions of an icon in pixels for the PostScript front end. */
  1256. extern void
  1257. FE_GetPSIconDimensions(int icon_number, int *width, int *height);
  1258.  
  1259. /* Fill in the bits of an icon for the PostScript front end. */
  1260. extern XP_Bool
  1261. FE_GetPSIconData(int icon_number, IL_Pixmap *image, IL_Pixmap *mask);
  1262. #endif
  1263.  
  1264. #ifdef XP_WIN
  1265. /* Check if Netscape is registered as default browser */
  1266. PRBool FE_IsNetscapeDefault(void);
  1267.  
  1268. /* Tell front end to set Netscape as default browser (if applicable on platform) */
  1269. PRBool FE_MakeNetscapeDefault(void);
  1270. #endif
  1271.  
  1272. XP_END_PROTOS
  1273.  
  1274. #endif /* _FrontEnd_ */
  1275.