home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / libevent.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  21.1 KB  |  749 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.  * Header file for event passing between the mozilla thread and
  21.  *   the mocha thread
  22.  */
  23.  
  24. #ifndef libevent_h___
  25. #define libevent_h___
  26.  
  27. #include "libmocha.h"
  28. #include "prtypes.h"
  29. #ifndef NSPR20
  30. #include "prevent.h"
  31. #else
  32. #include "plevent.h"
  33. #endif
  34. #include "shist.h"
  35. #include "fe_proto.h"
  36. #include "lo_ele.h"
  37.  
  38. NSPR_BEGIN_EXTERN_C
  39.  
  40. extern PREventQueue * mozilla_event_queue;
  41.  
  42. /* 
  43.  * XXX - should we use the same event values as layer events?
  44.  */
  45.  
  46. /* Event bits stored in the low end of decoder->event_mask. */
  47. #define EVENT_MOUSEDOWN 0x00000001
  48. #define EVENT_MOUSEUP   0x00000002
  49. #define EVENT_MOUSEOVER 0x00000004      /* user is mousing over a link */
  50. #define EVENT_MOUSEOUT  0x00000008      /* user is mousing out of a link */
  51. #define EVENT_MOUSEMOVE 0x00000010  
  52. #define EVENT_MOUSEDRAG 0x00000020
  53. #define EVENT_CLICK     0x00000040      /* input element click in progress */
  54. #define EVENT_DBLCLICK  0x00000080
  55. #define EVENT_KEYDOWN   0x00000100
  56. #define EVENT_KEYUP     0x00000200
  57. #define EVENT_KEYPRESS    0x00000400
  58. #define EVENT_DRAGDROP  0x00000800      /* not yet implemented */
  59. #define EVENT_FOCUS     0x00001000      /* input focus event in progress */
  60. #define EVENT_BLUR      0x00002000      /* loss of focus event in progress */
  61. #define EVENT_SELECT    0x00004000      /* input field selection in progress */
  62. #define EVENT_CHANGE    0x00008000      /* field value change in progress */
  63. #define EVENT_RESET     0x00010000      /* form submit in progress */
  64. #define EVENT_SUBMIT    0x00020000      /* form submit in progress */
  65. #define EVENT_SCROLL    0x00040000      /* window is being scrolled */
  66. #define EVENT_LOAD      0x00080000      /* layout parsed a loaded document */
  67. #define EVENT_UNLOAD    0x00100000
  68. #define EVENT_XFER_DONE    0x00200000      /* document has loaded */
  69. #define EVENT_ABORT     0x00400000
  70. #define EVENT_ERROR     0x00800000
  71. #define EVENT_LOCATE    0x01000000
  72. #define EVENT_MOVE    0x02000000
  73. #define EVENT_RESIZE    0x04000000
  74. #define EVENT_FORWARD   0x08000000
  75. #define EVENT_HELP    0x10000000        /* for handling of help events */
  76. #define EVENT_BACK      0x20000000
  77.  
  78. /* #define EVENT_PRINT     0x20000000    *//* To be removed per joki */
  79.  
  80. #define STATUS_STOP      0x00000001      /* stop processing */
  81. #define STATUS_IGNORE    0x00000002      /* no new messages */
  82.  
  83. #define    EVENT_ALT_MASK        0x00000001
  84. #define    EVENT_CONTROL_MASK  0x00000002
  85. #define    EVENT_SHIFT_MASK    0x00000004
  86. #define    EVENT_META_MASK        0x00000008
  87.  
  88. #define ARGTYPE_NULL    0x00000001
  89. #define ARGTYPE_INT32    0x00000002
  90. #define ARGTYPE_BOOL    0x00000004
  91. #define ARGTYPE_STRING    0x00000008
  92.  
  93. #define SIZE_MAX    0x00000001
  94. #define SIZE_MIN        0X00000002
  95. /*
  96.  * When the event has been processed by the backend, there will be
  97.  *   a front-end callback that gets called.  If the event processed
  98.  *   successfully, the callback will be passed EVENT_OK.  If the
  99.  *   event wasn't successful (i.e. the user canceled it) the return
  100.  *   status will be EVENT_CANCEL.  If something radical happened
  101.  *   and the front-end should do nothing (i.e. mocha changed the
  102.  *   underlying context) the status will be EVENT_PANIC and the
  103.  *   front end should treat the context and element passed to the
  104.  *   exit routine as bogus
  105.  */
  106. typedef enum {
  107.     EVENT_OK,
  108.     EVENT_CANCEL,
  109.     EVENT_PANIC
  110. } ETEventStatus;
  111.  
  112. /*
  113.  * When a given event gets processed we may need to tell the front
  114.  *   end about it so that they can update the UI / continue the 
  115.  *   operation.  The context, lo_element, lType and whatever
  116.  *   field are all supplied by the original ET_SendEvent() call.
  117.  *   See ET_SendEvent() for a description of the values for
  118.  *   the status parameter
  119.  */
  120. typedef void
  121. (*ETClosureFunc)(MWContext * pContext, LO_Element * lo_element, 
  122.                  int32 lType, void * whatever, ETEventStatus status);
  123.  
  124. /*
  125.  * Someone has initiated a call to LM_EvaluateBuffer().  This function
  126.  *   gets called back with the result
  127.  */
  128.  typedef void
  129. (*ETEvalAckFunc)(void * data, char * result_string, size_t result_length,
  130.          char * wysiwyg_url, char * base_href, Bool valid);
  131.  
  132. /*
  133.  * This function is called back after a layer's state has been restored
  134.  * in a resize_relayout.
  135.  */
  136.  typedef void
  137.  (*ETRestoreAckFunc)(void * data, LO_BlockInitializeStruct *param);
  138.  
  139. /*
  140.  * Typedef for a function taking a void pointer and
  141.  *   returning nothing
  142.  */
  143.  typedef void
  144. (*ETVoidPtrFunc)(void * data);
  145.  
  146. /*
  147.  * Typedef for a function taking a void pointer and
  148.  *   returning a bool
  149.  */
  150.  typedef PRBool
  151. (*ETBoolPtrFunc)(void * data);
  152.  
  153. /*
  154.  * Typedef for a function taking a void pointer and
  155.  *   returning a int32
  156.  */
  157.  typedef int32
  158. (*ETIntPtrFunc)(void * data);
  159.  
  160. /*
  161.  * Typedef for a function taking a void pointer and
  162.  *   returning a char *
  163.  */
  164.  typedef char *
  165. (*ETStringPtrFunc)(void * data);
  166.  
  167. /*
  168.  * Struct for passing JS typed variable info through C interface calls
  169.  */
  170. typedef union ArgVal {
  171.     int32        intArg;
  172.     XP_Bool        boolArg;
  173.     char *        stringArg;
  174. } ArgVal;
  175.  
  176. typedef struct {
  177.     uint8        type;      /* arg type as defined at top of file */
  178.     ArgVal        value;        
  179. } JSCompArg;
  180.  
  181. /*
  182.  * Typedef for a function used to verify installed components and 
  183.  *   get back components utility functions.
  184.  */
  185.  typedef PRBool
  186. (*ETVerifyComponentFunc)(void **active_callback, void **startup_callback);
  187.  
  188. /*
  189.  * Generic function for JS setting values with native calls.
  190.  */
  191.  typedef void
  192. (*ETCompPropSetterFunc)(char *name, void *value);
  193.  
  194. /*
  195.  * Generic function for JS getting values from native calls.
  196.  */
  197.  typedef void*
  198. (*ETCompPropGetterFunc)(char *name);
  199.  
  200. /*
  201.  * Generic function for JS calling native methods.
  202.  */
  203.  typedef void*
  204. (*ETCompMethodFunc)(int32 argc, JSCompArg *argv);
  205.  
  206. /* --------------------------------------------------------------------------
  207.  * Common prologue for talking between the mocha thread and the mozilla 
  208.  *   thread
  209.  */
  210. typedef struct {
  211.     PREvent        event;      /* the PREvent structure */
  212.     MWContext*        context;  /* context */
  213.     int32        doc_id;   /* doc id of context when event launched */
  214.     PRPackedBool    handle_eagerly;
  215. } ETEvent;
  216.  
  217. /*
  218.  * Struct to send back from front end in order to get additional 
  219.  *   event information without having to initialize event object 
  220.  *   until necessary.  Yow, there is a lot of junk in here now
  221.  *   can we make a union out of some of these or are they always
  222.  *   needed?
  223.  */
  224. typedef struct {
  225.     ETEvent        ce;
  226.     MochaDecoder  * decoder;
  227.     JSObject      * object;
  228.     int32        type;
  229.     int32           layer_id;
  230.     int32        id;
  231.     LO_Element      * lo_element;
  232.     ETClosureFunc   fnClosure;    /* event sender closure           */
  233.     void          * whatever;     /* anything other state           */
  234.     int32        x,y;
  235.     int32        docx,docy;
  236.     int32        screenx,screeny;
  237.     uint32        which;
  238.     uint32        modifiers;
  239.     void      * data;
  240.     uint32        dataSize;
  241.     PRPackedBool    saved;
  242.     PRPackedBool    event_handled;
  243. } JSEvent;
  244.  
  245. /*
  246.  * Tell the backend about a new event.
  247.  * The event is placed onto an event queue, it is not processed
  248.  *   immediately.  If the event is the type that can be cancelled
  249.  *   by the backend (i.e. a button click or a submit) the front
  250.  *   end must wait until the callback routine gets called before
  251.  *   continuing with the operation.  The ETEventStatus will be
  252.  *   EVENT_OK if the operation is to continue or EVENT_CANCEL
  253.  *   if it got cancelled.
  254.  * 
  255.  * The processing of the event may cause the document to change 
  256.  *   or even the whole window to close.  In those cases the callback 
  257.  *   will still get called in case there is any front-end cleanup 
  258.  *   to do but the ETEventStatus will be set to EVENT_PANIC
  259.  *
  260.  */
  261.  
  262. extern JSBool
  263. ET_SendEvent(MWContext * pContext, LO_Element *pElement, JSEvent *pEvent, 
  264.              ETClosureFunc fnClosure, void * whatever);
  265.  
  266. /*
  267.  * Tell the backend about a new document load event.  We need a 
  268.  *   closure so that libparse/layout knows when its safe to discard
  269.  *   the old document when they were waiting for onunload events to
  270.  *   finish processing
  271.  */
  272. extern void
  273. ET_SendLoadEvent(MWContext * pContext, int32 type, ETVoidPtrFunc fnClosure,
  274.          NET_StreamClass *stream, int32 layer_id, Bool resize_reload);
  275.  
  276. /*
  277.  * Tell the backend about a new image event.  Async.  No closure
  278.  */
  279. extern void
  280. ET_SendImageEvent(MWContext * pContext, LO_ImageStruct *image_data,
  281.                   LM_ImageEvent event);
  282.  
  283. /*
  284.  * Send an interrupt event to the current context
  285.  * Remove all pending events for the event queue of the given context.
  286.  */
  287. extern void
  288. ET_InterruptContext(MWContext * pContext);
  289.  
  290. extern JSBool
  291. ET_ContinueProcessing(MWContext * pContext);
  292.  
  293. /*
  294.  * Tell mocha to destroy the given context's data.  The callback 
  295.  *   function gets called when mocha is done with all of its data
  296.  *   that was associated with the context
  297.  */
  298. extern void
  299. ET_RemoveWindowContext(MWContext * context, ETVoidPtrFunc fn, 
  300.                        void * data);
  301.  
  302. typedef struct {
  303.     uint       len, line_no;
  304.     char     * scope_to;
  305.     void     * data;
  306.     JSVersion       version;
  307.     JSPrincipals * principals;
  308.     JSBool         want_result;
  309.     JSBool       unicode;
  310. } ETEvalStuff;
  311.  
  312. /*
  313.  * Evaluate the mocha code in the given buffer
  314.  */
  315. extern void
  316. ET_EvaluateBuffer(MWContext * context, char * buffer, uint buflen,
  317.           uint line_no, char * scope_to, JSBool want_result,
  318.           ETEvalAckFunc fn, void * data,
  319.           JSVersion ver, struct JSPrincipals *);
  320.  
  321. extern void
  322. ET_EvaluateScript(MWContext * context, char * buffer, ETEvalStuff * stuff,
  323.           ETEvalAckFunc fn);
  324.  
  325. /*
  326.  * Ask Mocha to reflect the given object into JavaScript
  327.  */
  328. extern void
  329. ET_ReflectObject(MWContext * pContext, void * lo_ele, void * tag,
  330.          int32 layer_id, uint index, ReflectedObject type);
  331.  
  332. void
  333. ET_ReflectFormElement(MWContext * pContext, void * form,
  334.               LO_FormElementStruct * form_element, PA_Tag * tag);
  335.  
  336. extern void
  337. ET_ReflectWindow(MWContext * pContext, 
  338.          PA_Block onLoad, PA_Block onUnload, 
  339.          PA_Block onFocus, PA_Block onBlur, PA_Block onHelp,
  340.          PA_Block onMouseOver, PA_Block onMouseOut, PA_Block onDragDrop,
  341.          PA_Block onMove, PA_Block onResize,
  342.                  PA_Block id, char *all,
  343.          Bool bDelete, int newline_count);
  344.  
  345. /*
  346.  * Tell mocha we are processing a form
  347.  */
  348. extern void
  349. ET_SetActiveForm(MWContext * pContext, struct lo_FormData_struct * loElement);
  350.  
  351. /*
  352.  * Tell mocha which layer we are processing
  353.  */
  354. void
  355. ET_SetActiveLayer(MWContext * pContext, int32 layer_id);
  356.  
  357. /*
  358. ** Tell mocha where to send its output
  359. */
  360. extern void
  361. ET_ClearDecoderStream(MWContext * context, NET_StreamClass * old_stream);
  362.  
  363. extern void
  364. ET_SetDecoderStream(MWContext * context, NET_StreamClass *stream,
  365.                 URL_Struct *url_struct, JSBool free_stream_on_close);
  366.  
  367. /*
  368. ** Remember the current nesting URL in the MochaDecoder
  369. */
  370. extern void
  371. ET_SetNestingUrl(MWContext * context, char * szUrl);
  372.  
  373. /*
  374. ** Remember the current language version in the MochaDecoder
  375. */
  376. extern void
  377. ET_SetVersion(MWContext * context, JSVersion version);
  378.  
  379. /*
  380.  * Tell mocha to trash the current document.  around and around...
  381.  */
  382. extern void
  383. ET_ReleaseDocument(MWContext * pContext, JSBool resize_reload);
  384.  
  385. /*
  386.  * Tell mocha to trash the layer's document.
  387.  */
  388. extern void
  389. ET_DestroyLayer(MWContext * pContext, JSObject *layer_obj);
  390.  
  391. extern void
  392. ET_MochaStreamComplete(MWContext * context, void * buf, int len, 
  393.                char * content_type, Bool isUnicode);
  394.  
  395. extern void
  396. ET_MochaStreamAbort(MWContext * context, int status);
  397.             
  398. /*
  399.  * Called when a layer's contents are changing and we want to create
  400.  * a new layer document.
  401.  */
  402. extern void
  403. ET_NewLayerDocument(MWContext *pContext, int32 layer_id);
  404.  
  405. extern void
  406. ET_DocWriteAck(MWContext *pContext, int status);
  407.  
  408. extern void
  409. ET_RegisterComponent(char *name, void *active_callback, void *startup_callback);
  410.  
  411. extern void
  412. ET_RegisterComponentProp(char *comp, char *name, uint8 retType, void *setter, 
  413.              void *getter);
  414.  
  415. extern void
  416. ET_RegisterComponentMethod(char *comp, char *name, uint8 retType, void *method, 
  417.                int32 argc);
  418.  
  419. /* =============================================================== */
  420.  
  421. /*
  422.  * This event can be sent to both the mozilla thread and the moacha thread
  423.  */
  424. typedef struct {
  425.     ETEvent            ce;
  426.     TimeoutCallbackFunction    fnCallback;
  427.     void*            pClosure;
  428.     uint32            ulTime;
  429.     void*            pTimerId;
  430. } MozillaEvent_Timeout;
  431.  
  432.  
  433. /* =============================================================== */
  434.  
  435. /*
  436.  * Busy loop waiting for events to come along
  437.  */
  438. extern void PR_CALLBACK
  439. lm_wait_for_events(void *);
  440.  
  441. /* 
  442.  * global mocha event queues.  It would be nice to not have these
  443.  *   exported this globally
  444.  */
  445. extern PREventQueue *lm_InterpretQueue;
  446. extern PREventQueue *lm_PriorityQueue;
  447.  
  448. /*
  449.  * Ways to send events to the front end
  450.  */
  451. extern JSBool
  452. ET_PostMessageBox(MWContext* context, char* szMessage, 
  453.           JSBool bConfirm);
  454.  
  455. extern void
  456. ET_PostProgress(MWContext* context, const char* szMessage);
  457.  
  458. /* --- timeout routines --- */
  459.  
  460. /*
  461.  * Set (or clear) a timeout to go off.  The timeout will go off in the
  462.  *   mozilla thread so we will use the routine ET_FireTimeoutCallBack()
  463.  *   to get back into our thread to actually run the closure
  464.  */
  465. extern void * 
  466. ET_PostSetTimeout(TimeoutCallbackFunction fnCallback, 
  467.           void * pClosure, uint32 ulTime, int32 doc_id);
  468.  
  469. extern void
  470. ET_PostClearTimeout(void * stuff);
  471.  
  472. extern void
  473. ET_FireTimeoutCallBack(void *);
  474.  
  475. /* --- end of timeout routines --- */
  476.  
  477. extern void
  478. ET_PostDestroyWindow(MWContext * context);
  479.  
  480. extern void
  481. ET_PostManipulateForm(MWContext * context, LO_Element * pForm, int32 action);
  482.  
  483. extern void
  484. ET_PostClearView(MWContext * context);
  485.  
  486. extern void
  487. ET_PostFreeImageElement(MWContext * context, void * stuff);
  488.  
  489. extern void
  490. ET_PostFreeImageContext(MWContext *context, IL_GroupContext *img_cx);
  491.  
  492. extern void
  493. ET_PostFreeAnonImages(MWContext *context, IL_GroupContext *img_cx);
  494.  
  495. extern void
  496. ET_PostDisplayImage(MWContext *, int, LO_ImageStruct *);
  497.  
  498. extern void
  499. ET_PostGetUrl(MWContext *, URL_Struct * pUrl);
  500.  
  501. extern char *
  502. ET_PostPrompt(MWContext* context, const char* szMessage, 
  503.               const char * szDefault);
  504.  
  505. extern MWContext *
  506. ET_PostNewWindow(MWContext* context, URL_Struct * pUrl, 
  507.                  char * szName, Chrome * pChrome);
  508.  
  509. extern void
  510. ET_PostUpdateChrome(MWContext* context, Chrome * pChrome);
  511.  
  512. extern void
  513. ET_PostQueryChrome(MWContext* context, Chrome * pChrome);
  514.  
  515. extern void
  516. ET_PostGetScreenSize(MWContext* context, int32 *pX, int32 *pY);
  517.  
  518. extern void
  519. ET_PostGetAvailScreenRect(MWContext* context, int32 *pX, int32 *pY, 
  520.                         int32 *pLeft, int32 *pTop);
  521.  
  522. extern void
  523. ET_PostGetColorDepth(MWContext* context, int32 *pPixel, int32 *pPallette);
  524.  
  525. extern char *
  526. ET_PostGetSelectedText(MWContext* context);
  527.  
  528. extern void
  529. ET_PostScrollDocTo(MWContext* context, int loc, int32 x, int32 y);
  530.  
  531. extern void
  532. ET_PostScrollDocBy(MWContext* context, int loc, int32 x, int32 y);
  533.  
  534. extern void
  535. ET_PostBackCommand(MWContext* context);
  536.  
  537. extern void
  538. ET_PostForwardCommand(MWContext* context);
  539.  
  540. extern void
  541. ET_PostHomeCommand(MWContext* context);
  542.  
  543. extern JSBool
  544. ET_PostFindCommand(MWContext* context, char * szName, JSBool matchCase, 
  545.            JSBool searchBackward);
  546. extern void
  547. ET_PostPrintCommand(MWContext* context);
  548.  
  549. extern void
  550. ET_PostOpenFileCommand(MWContext* context);
  551.  
  552. extern void 
  553. ET_MakeHTMLAlert(MWContext * context, const char * szString);
  554.  
  555. /* respond to events sent to the mocha thread by the mozilla thread */
  556.  
  557. extern void
  558. ET_PostJsEventAck(MWContext* context, LO_Element * pEle, int type, 
  559.                   ETClosureFunc fnClosure, void * pStuff, 
  560.                   ETEventStatus status);
  561.  
  562.  
  563.  
  564. extern void
  565. ET_PostEvalAck(MWContext * context, int doc_id, void * data, 
  566.            char * str, size_t len, char * wysiwyg_url, 
  567.            char * base_href, Bool valid, ETEvalAckFunc fn);
  568.  
  569. extern void
  570. ET_PostRestoreAck(void *data, LO_BlockInitializeStruct *param, 
  571.                   ETRestoreAckFunc fn);
  572.  
  573. /* netlib events */
  574.  
  575. extern char *
  576. ET_net_GetCookie(MWContext* context, int32 doc_id);
  577.  
  578. extern char *
  579. ET_net_SetCookieString(MWContext* context, char * szCookie, int32 doc_id);
  580.  
  581. extern NET_StreamClass *
  582. ET_net_CacheConverter(FO_Present_Types format, void * obj,
  583.                       URL_Struct *pUrl, MWContext * pContext);
  584.  
  585. extern void
  586. ET_net_FindURLInCache(URL_Struct * pUrl, MWContext * pContext);
  587.  
  588. extern NET_StreamClass    *
  589. ET_net_StreamBuilder(FO_Present_Types format, URL_Struct *pUrl, 
  590.              MWContext * pContext);
  591.  
  592. /* layout events */
  593.  
  594. extern  void
  595. ET_lo_ResetForm(MWContext * pContext, LO_Element * ele);
  596.  
  597. void
  598. ET_fe_SubmitInputElement(MWContext * pContext, LO_Element * ele);
  599.  
  600. /*
  601.  * Synchronously shove the given text down the parser's processing
  602.  *   queue.  If the currently loaded document is not equal to 
  603.  *   doc_id, this message should be ignored since it arrived too
  604.  *   late for the intended document
  605.  */
  606. extern int
  607. ET_lo_DoDocWrite(JSContext *cx, MWContext * context, NET_StreamClass * stream, 
  608.                  char * str, size_t len, int32 doc_id);
  609.  
  610.  
  611. extern void
  612. ET_il_GetImage(const char * str, MWContext * pContext, IL_GroupContext *img_cx,
  613.                LO_ImageStruct * image_data, NET_ReloadMethod how);
  614.  
  615. extern void
  616. ET_il_SetGroupObserver(MWContext * pContext, IL_GroupContext *pImgCX, void *pDpyCX,
  617.                        JSBool bAddObserver);
  618.                
  619. extern void
  620. ET_InterruptImgCX(MWContext * pContext);
  621.  
  622. /*
  623.  * Tell layout to trash the current document.
  624.  */
  625. extern void
  626. ET_lo_DiscardDocument(MWContext * pContext);
  627.  
  628. /*
  629.  * Tell layout to prepare a layer for writing.
  630.  */
  631. extern Bool
  632. ET_lo_PrepareLayerForWriting(MWContext *context, int32 layer_id,
  633.                  const char *referer);
  634.  
  635. /*
  636.  * Return a copy of the current history element.  Caller must free
  637.  */
  638. extern History_entry * 
  639. ET_shist_GetCurrent(MWContext * pContext);
  640.  
  641. /*
  642.  * Return the current security status.
  643.  */
  644. extern int 
  645. ET_GetSecurityStatus(MWContext * pContext);
  646.  
  647. /*
  648.  * Make sure Mocha/Java glue is ready.  Returns the same return code as
  649.  * LM_InitMoja.
  650.  */
  651. extern int
  652. ET_InitMoja(MWContext * pContext);
  653.  
  654. /*
  655.  * Pack up toys and go home
  656.  */
  657. extern void
  658. ET_FinishMocha(void);
  659.  
  660. /*
  661.  * Used to call a stream completion function in the mozilla
  662.  *   thread
  663.  */
  664. extern void
  665. ET_moz_CallFunction(ETVoidPtrFunc fn, void * data);
  666.  
  667. extern void
  668. ET_moz_CallFunctionAsync(ETVoidPtrFunc fn, void * data);
  669.  
  670. extern PRBool
  671. ET_moz_CallFunctionBool(ETBoolPtrFunc fn, void * data);
  672.  
  673. extern int32
  674. ET_moz_CallFunctionInt(ETIntPtrFunc fn, void * data);
  675.  
  676. extern char *
  677. ET_moz_CallFunctionString(ETStringPtrFunc fn, void * data);
  678.  
  679. extern void
  680. ET_moz_CallAsyncAndSubEventLoop(ETVoidPtrFunc fn, void *data,
  681.                 MWContext *context);
  682.  
  683. extern void
  684. ET_moz_Abort(MKStreamAbortFunc fn, void * data, int status);
  685.  
  686. extern void
  687. ET_moz_SetMochaWriteStream(MochaDecoder * decoder);
  688.  
  689. extern NET_StreamClass *
  690. ET_moz_DocCacheConverter(MWContext * context, URL_Struct * pUrl, 
  691.              char * wysiwyg_url, int32 layer_id);
  692.  
  693. extern PRBool
  694. ET_moz_VerifyComponentFunction(ETVerifyComponentFunc fn, ETBoolPtrFunc *pActive_callback, 
  695.                    ETVoidPtrFunc *pStartup_callback);
  696.  
  697. extern void
  698. ET_moz_CompSetterFunction(ETCompPropSetterFunc fn, char *name, void *data);
  699.  
  700. extern void *
  701. ET_moz_CompGetterFunction(ETCompPropGetterFunc fn, char *name);
  702.  
  703. extern void *
  704. ET_moz_CompMethodFunction(ETCompMethodFunc fn, int32 argc, JSCompArg *argv);
  705.  
  706. typedef enum { 
  707.     CL_Move,
  708.     CL_MoveX,
  709.     CL_MoveY,
  710.     CL_Offset,
  711.     CL_Resize,
  712.     CL_SetBboxWidth,
  713.     CL_SetBboxHeight,
  714.     CL_SetBboxTop,
  715.     CL_SetBboxLeft,
  716.     CL_SetBboxBottom,
  717.     CL_SetBboxRight,
  718.     CL_SetHidden,
  719.     CL_MoveInZ,
  720.     CL_SetSrc,
  721.     CL_SetSrcWidth,
  722.     CL_SetZ,
  723.     CL_SetBgColor,
  724.     CL_SetBackdrop
  725. } ETLayerOp;
  726.  
  727. extern int
  728. ET_TweakLayer(MWContext * context, CL_Layer * layer, int32 x, int32 y, 
  729.               void *param_ptr, int32 param_val, ETLayerOp op,
  730.           const char *referer, int32 doc_id);
  731.  
  732. extern void
  733. ET_RestoreLayerState(MWContext *context, int32 layer_id,
  734.                      LO_BlockInitializeStruct *param, ETRestoreAckFunc fn,
  735.                      void *data);
  736.  
  737. extern int32
  738. ET_npl_RefreshPluginList(MWContext* context, XP_Bool refreshInstances);
  739.  
  740. extern JSBool
  741. ET_HandlePref(JSContext * cx, uint argc, jsval * argv, jsval * rval);
  742.  
  743. extern void
  744. ET_SetPluginWindow(MWContext * pContext, void * app);
  745.  
  746. NSPR_END_EXTERN_C
  747.  
  748. #endif /* libevent_h___ */
  749.