home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / central / CNSContextCallbacks.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  11.5 KB  |  394 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. //    CNSContextCallbacks.h
  20.  
  21.  
  22. #pragma once
  23.  
  24. #include "ntypes.h"
  25. #include "structs.h"
  26. #include "ctxtfunc.h"
  27.  
  28. class CNSContext;
  29.  
  30.  
  31. class CNSContextCallbacks
  32. {
  33.     public:
  34.  
  35.         static CNSContextCallbacks* GetContextCallbacks(void);        // singleton class accessor
  36.     
  37.                                     CNSContextCallbacks();
  38.         virtual                        ~CNSContextCallbacks();
  39.  
  40.         ContextFuncs&                GetInternalCallbacks(void);
  41.         
  42.     protected:
  43.  
  44.         static    MWContext*             CreateNewDocWindow(
  45.                                             MWContext*                 inContext,
  46.                                             URL_Struct*                inURL);
  47.  
  48.         static    void                 LayoutNewDocument(
  49.                                             MWContext*                inContext,
  50.                                             URL_Struct*                inURL,
  51.                                             Int32*                    inWidth,
  52.                                             Int32*                    inHeight,
  53.                                             Int32*                    inMarginWidth,
  54.                                             Int32*                    inMarginHeight);
  55.  
  56.         static    void                 SetDocTitle(
  57.                                             MWContext*                 inContext,
  58.                                             char*                     inTitle);
  59.                                             
  60.         static    void                 FinishedLayout(
  61.                                             MWContext*                 inContext);
  62.                                             
  63.         static    char*                 TranslateISOText(
  64.                                             MWContext*                 inContext,
  65.                                             int                     inCharset,
  66.                                             char*                    inISOText);
  67.                                             
  68.         static    int                 GetTextInfo(
  69.                                             MWContext*                 inContext,
  70.                                             LO_TextStruct*            inText,
  71.                                             LO_TextInfo*            inTextInfo);
  72.                                             
  73.         static    int                 MeasureText(
  74.                                             MWContext*                 inContext,
  75.                                             LO_TextStruct*            inText,
  76.                                             short*                    outCharLocs);
  77.                                             
  78.         static    void                 GetEmbedSize(
  79.                                             MWContext*                 inContext,
  80.                                             LO_EmbedStruct*            inEmbedStruct,
  81.                                             NET_ReloadMethod        inReloadMethod);
  82.                                             
  83.         static    void                 GetJavaAppSize(
  84.                                             MWContext*                 inContext,
  85.                                             LO_JavaAppStruct*        inJavaAppStruct,
  86.                                             NET_ReloadMethod        inReloadMethod);
  87.                                             
  88.         static    void                 GetFormElementInfo(
  89.                                             MWContext*                 inContext,
  90.                                             LO_FormElementStruct*     inElement);
  91.  
  92.         static    void                 GetFormElementValue(
  93.                                             MWContext*                 inContext,
  94.                                             LO_FormElementStruct*     inElement,
  95.                                             XP_Bool                 inHide);
  96.  
  97.         static    void                 ResetFormElement(
  98.                                             MWContext*                 inContext,
  99.                                             LO_FormElementStruct*     inElement);
  100.  
  101.         static    void                 SetFormElementToggle(
  102.                                             MWContext*                 inContext,
  103.                                             LO_FormElementStruct*     inElement,
  104.                                             XP_Bool                 inToggle);
  105.  
  106.         static    void                 FreeEmbedElement(
  107.                                             MWContext*                 inContext,
  108.                                             LO_EmbedStruct*            inEmbedStruct);
  109.  
  110.         static    void                 CreateEmbedWindow(
  111.                                             MWContext*                 inContext,
  112.                                             NPEmbeddedApp*            inEmbeddedApp);
  113.  
  114.         static    void                 SaveEmbedWindow(
  115.                                             MWContext*                 inContext,
  116.                                             NPEmbeddedApp*            inEmbeddedApp);
  117.  
  118.         static    void                 RestoreEmbedWindow(
  119.                                             MWContext*                 inContext,
  120.                                             NPEmbeddedApp*            inEmbeddedApp);
  121.  
  122.         static    void                 DestroyEmbedWindow(
  123.                                             MWContext*                 inContext,
  124.                                             NPEmbeddedApp*            inEmbeddedApp);
  125.  
  126.         static    void                 FreeJavaAppElement(
  127.                                             MWContext*                 inContext,
  128.                                             LJAppletData*            inAppletData);
  129.  
  130.         static    void                 HideJavaAppElement(
  131.                                             MWContext*                 inContext,
  132.                                             LJAppletData*                inAppletData);
  133.  
  134.         static    void                 FreeEdgeElement(
  135.                                             MWContext*                 inContext,
  136.                                             LO_EdgeStruct*            inEdgeStruct);
  137.  
  138.         static    void                 FormTextIsSubmit(
  139.                                             MWContext*                 inContext,
  140.                                             LO_FormElementStruct*     inElement);
  141.  
  142.         static    void                 DisplaySubtext(
  143.                                             MWContext*                 inContext,
  144.                                             int                     inLocation,
  145.                                             LO_TextStruct*            inText,
  146.                                             Int32                     inStartPos,
  147.                                             Int32                    inEndPos,
  148.                                             XP_Bool                 inNeedBG);
  149.  
  150.         static    void                 DisplayText(
  151.                                             MWContext*                 inContext,
  152.                                             int                     inLocation,
  153.                                             LO_TextStruct*            inText,
  154.                                             XP_Bool                 inNeedBG);
  155.  
  156.         static    void                 DisplayEmbed(
  157.                                             MWContext*                 inContext,
  158.                                             int                     inLocation,
  159.                                             LO_EmbedStruct*            inEmbedStruct);
  160.  
  161.         static    void                 DisplayJavaApp(
  162.                                             MWContext*                 inContext,
  163.                                             int                     inLocation,
  164.                                             LO_JavaAppStruct*        inJavaAppStruct);
  165.  
  166.         static    void                 DisplayEdge (
  167.                                             MWContext*                 inContext,
  168.                                             int                     inLocation,
  169.                                             LO_EdgeStruct*            inEdgeStruct);
  170.  
  171.         static    void                 DisplayTable(
  172.                                             MWContext*                 inContext,
  173.                                             int                     inLocation,
  174.                                             LO_TableStruct*            inTableStruct);
  175.  
  176.         static    void                 DisplayCell(
  177.                                             MWContext*                 inContext,
  178.                                             int                     inLocation,
  179.                                             LO_CellStruct*            inCellStruct);
  180.  
  181.         static    void                 InvalidateEntireTableOrCell(
  182.                                             MWContext*                 inContext,
  183.                                             LO_Element*                inElement);
  184.  
  185.         static    void                 DisplayAddRowOrColBorder(
  186.                                             MWContext*                 inContext,
  187.                                             XP_Rect*                inRect,
  188.                                             XP_Bool                    inErase);
  189.  
  190.         static    void                 DisplaySubDoc(
  191.                                             MWContext*                 inContext,
  192.                                             int                     inLocation,
  193.                                             LO_SubDocStruct*        inSubdocStruct);
  194.  
  195.         static    void                 DisplayLineFeed(
  196.                                             MWContext*                 inContext,
  197.                                             int                     inLocation,
  198.                                             LO_LinefeedStruct*        inLinefeedStruct,
  199.                                             XP_Bool                 inNeedBG);
  200.  
  201.         static    void                 DisplayHR(
  202.                                             MWContext*                inContext,
  203.                                             int                     inLocation,
  204.                                             LO_HorizRuleStruct*        inRuleStruct);
  205.  
  206.         static    void                 DisplayBullet(
  207.                                             MWContext*                inContext,
  208.                                             int                     inLocation,
  209.                                             LO_BullettStruct*        inBullettStruct);
  210.  
  211.         static    void                 DisplayFormElement(
  212.                                             MWContext*                inContext,
  213.                                             int                     inLocation,
  214.                                             LO_FormElementStruct*     inFormElement);
  215.  
  216.         static    void                 DisplayBorder(
  217.                                             MWContext*                inContext,
  218.                                             int                     inLocation,
  219.                                             int                    inX,
  220.                                             int                    inY,
  221.                                             int                    inWidth,
  222.                                             int                    inHeight,
  223.                                             int                    inBW,
  224.                                             LO_Color*                 inColor,
  225.                                             LO_LineStyle        inStyle);
  226.  
  227.         static    void                 UpdateEnableStates(
  228.                                             MWContext*                 inContext);
  229.  
  230.         static    void                 DisplayFeedback(
  231.                                             MWContext*                inContext,
  232.                                             int                     inLocation,
  233.                                             LO_Element*             inElement);
  234.  
  235.         static    void                 ClearView(
  236.                                             MWContext*                 inContext,
  237.                                             int                     inWhich);
  238.  
  239.         static    void                 SetDocDimension(
  240.                                             MWContext*                inContext,
  241.                                             int                     inLocation,
  242.                                             Int32                     inWidth,
  243.                                             Int32                     inLength);
  244.  
  245.         static    void                 SetDocPosition(
  246.                                             MWContext*                inContext,
  247.                                             int                     inLocation,
  248.                                             Int32                     inX,
  249.                                             Int32                     inY);
  250.  
  251.         static    void                 GetDocPosition(
  252.                                             MWContext*                inContext,
  253.                                             int                     inLocation,
  254.                                             Int32*                    outX,
  255.                                             Int32*                    outY);
  256.  
  257.         static    void                 BeginPreSection(
  258.                                             MWContext*                inContext);
  259.  
  260.         static    void                 EndPreSection(
  261.                                             MWContext*                inContext);
  262.  
  263.         static    void                 SetProgressBarPercent(
  264.                                             MWContext*                inContext,
  265.                                             Int32                     inPercent);
  266.  
  267.         static    void                 SetBackgroundColor(
  268.                                             MWContext*                inContext,
  269.                                             Uint8                     inRed,
  270.                                             Uint8                    inGreen,
  271.                                             Uint8                     inBlue);
  272.  
  273.         static    void                 Progress(
  274.                                             MWContext*                 inContext,
  275.                                             const char*                inMessageText);
  276.  
  277.         static    void                 Alert(
  278.                                             MWContext*                 inContext,
  279.                                             const char*                inAlertText);
  280.  
  281.         static    void                 SetCallNetlibAllTheTime(
  282.                                             MWContext*                 inContext);
  283.  
  284.         static    void                 ClearCallNetlibAllTheTime(
  285.                                             MWContext*                 inContext);
  286.  
  287.         static    void                 GraphProgressInit(
  288.                                             MWContext*                inContext,
  289.                                             URL_Struct*                inURL,
  290.                                             Int32                     inContentLength);
  291.  
  292.         static    void                 GraphProgressDestroy(
  293.                                             MWContext*                inContext,
  294.                                             URL_Struct*                inURL,
  295.                                             Int32                     inContentLength,
  296.                                             Int32                     inTotalRead);
  297.  
  298.         static    void                 GraphProgress(
  299.                                             MWContext*                inContext,
  300.                                             URL_Struct*                inURL,
  301.                                             Int32                     inBytesReceived,
  302.                                             Int32                     inBytesSinceLast,
  303.                                             Int32                     inContentLength);
  304.  
  305.         static    XP_Bool             UseFancyFTP(
  306.                                             MWContext*                 inContext);
  307.  
  308.         static    XP_Bool             UseFancyNewsgroupListing(
  309.                                             MWContext*                 inContext);
  310.  
  311.         static    int                 FileSortMethod(
  312.                                             MWContext*                 inContext);
  313.  
  314.         static    XP_Bool             ShowAllNewsArticles(
  315.                                             MWContext*                 inContext);
  316.  
  317.         static    XP_Bool                Confirm(
  318.                                             MWContext*                inContext,
  319.                                             const char*             inMessage);
  320.  
  321.         static    char*                 PromptWithCaption(
  322.                                             MWContext*                inContext,
  323.                                             const char*             inCaption,
  324.                                             const char*             inMessage,
  325.                                             const char*                inDefaultText);
  326.  
  327.         static    char*                 Prompt(
  328.                                             MWContext*                inContext,
  329.                                             const char*             inMessage,
  330.                                             const char*                inDefaultText);
  331.  
  332.         static    XP_Bool             PromptUsernameAndPassword(
  333.                                             MWContext*                 inContext,
  334.                                             const char*                inMessage,
  335.                                             char**                    outUserName,
  336.                                             char**                    outPassword);
  337.  
  338.         static    char*                 PromptPassword(
  339.                                             MWContext*                 inContext,
  340.                                             const char*             inMessage);
  341.  
  342.         static    void                 EnableClicking(
  343.                                             MWContext*                 inContext);
  344.  
  345.         static    void                 AllConnectionsComplete(
  346.                                             MWContext*                 inContext);
  347.  
  348.         static    void                 EraseBackground(
  349.                                             MWContext*                inContext,
  350.                                             int                        inLocation,
  351.                                             Int32                    inX,
  352.                                             Int32                    inY,
  353.                                             Uint32                    inWidth,
  354.                                             Uint32                    inHeight,
  355.                                             LO_Color*                inColor);
  356.  
  357.         static    void                 SetDrawable(
  358.                                             MWContext*                inContext,
  359.                                             CL_Drawable*            inDrawable);
  360.  
  361.         static    void                 GetTextFrame(
  362.                                             MWContext*                inContext,
  363.                                             LO_TextStruct*            inTextStruct,
  364.                                             Int32                    inStartPos,
  365.                                             Int32                    inEndPos,
  366.                                             XP_Rect*                outFrame);
  367.  
  368.         static    void                 GetDefaultBackgroundColor(
  369.                                             MWContext*                inContext,
  370.                                             LO_Color*                outColor);
  371.  
  372.         static    void                 DrawJavaApp(
  373.                                             MWContext*                inContext,
  374.                                             int                     inLocation,
  375.                                             LO_JavaAppStruct*        inJavaAppStruct);
  376.                                             
  377.         static    void                 HandleClippingView(
  378.                                             MWContext*                inContext,
  379.                                             struct LJAppletData     *appletD, 
  380.                                             int                     x, 
  381.                                             int                     y, 
  382.                                             int                     width, 
  383.                                             int                     height);
  384.  
  385.         ContextFuncs                mCallbacks;
  386.  
  387.         static    CNSContextCallbacks* sContextCallbacks;        // singleton class
  388. };
  389.  
  390. inline _ContextFuncs& CNSContextCallbacks::GetInternalCallbacks(void)
  391.     {    return mCallbacks;                    }
  392. inline CNSContextCallbacks* CNSContextCallbacks::GetContextCallbacks(void)
  393.     {    return sContextCallbacks;            }
  394.