home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / central / CNSContextCallbacks.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  20.5 KB  |  746 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.cp
  20.  
  21.  
  22. #include "CNSContextCallbacks.h"
  23. #include "CNSContext.h"
  24.  
  25. CNSContextCallbacks* CNSContextCallbacks::sContextCallbacks = NULL;        // singleton class
  26.  
  27. CNSContextCallbacks::CNSContextCallbacks()
  28. {
  29.     #define MAKE_FE_FUNCS_PREFIX(f)     CNSContextCallbacks::##f
  30.     #define MAKE_FE_FUNCS_ASSIGN         mCallbacks.
  31.     #include "mk_cx_fn.h"
  32.  
  33.     Assert_(sContextCallbacks == NULL);
  34.     sContextCallbacks = this;
  35. }
  36.  
  37. CNSContextCallbacks::~CNSContextCallbacks()
  38. {
  39.     sContextCallbacks = NULL;
  40. }
  41.  
  42. MWContext* CNSContextCallbacks::CreateNewDocWindow(
  43.     MWContext*             inContext,
  44.     URL_Struct*            inURL)
  45. {
  46.     CNSContext* theNSContext = ExtractNSContext(inContext);
  47.     Assert_(theNSContext != NULL);
  48.     
  49.     return theNSContext->CreateNewDocWindow(inURL);
  50. }
  51.  
  52. void CNSContextCallbacks::LayoutNewDocument(
  53.     MWContext*            inContext,
  54.     URL_Struct*            inURL,
  55.     int32*                inWidth,
  56.     int32*                inHeight,
  57.     int32*                inMarginWidth,
  58.     int32*                inMarginHeight)
  59. {
  60.     CNSContext* theNSContext = ExtractNSContext(inContext);
  61.     Assert_(theNSContext != NULL);
  62.     theNSContext->LayoutNewDocument(inURL, inWidth, inHeight, inMarginWidth, inMarginHeight);
  63. }
  64.     
  65. void CNSContextCallbacks::SetDocTitle(
  66.     MWContext*                 inContext,
  67.     char*                     inTitle)
  68. {
  69.     CNSContext* theNSContext = ExtractNSContext(inContext);
  70.     Assert_(theNSContext != NULL);
  71.     theNSContext->SetDocTitle(inTitle);
  72. }
  73.  
  74. void CNSContextCallbacks::FinishedLayout(MWContext* inContext)
  75. {
  76.     CNSContext* theNSContext = ExtractNSContext(inContext);
  77.     Assert_(theNSContext != NULL);
  78.     theNSContext->FinishedLayout();
  79. }
  80.  
  81. char* CNSContextCallbacks::TranslateISOText(                                            
  82.     MWContext*                 inContext,
  83.     int                     inCharset,
  84.     char*                    inISOText)
  85. {
  86.     CNSContext* theNSContext = ExtractNSContext(inContext);
  87.     Assert_(theNSContext != NULL);
  88.     return theNSContext->TranslateISOText(inCharset, inISOText);
  89. }
  90.  
  91. int CNSContextCallbacks::GetTextInfo(
  92.     MWContext*                 inContext,
  93.     LO_TextStruct*            inText,
  94.     LO_TextInfo*            inTextInfo)
  95. {
  96.     CNSContext* theNSContext = ExtractNSContext(inContext);
  97.     Assert_(theNSContext != NULL);
  98.     return theNSContext->GetTextInfo(inText, inTextInfo);
  99. }
  100.  
  101. int CNSContextCallbacks::MeasureText(
  102.     MWContext*                 inContext,
  103.     LO_TextStruct*            inText,
  104.     short*                    outCharLocs)
  105. {
  106.     CNSContext* theNSContext = ExtractNSContext(inContext);
  107.     Assert_(theNSContext != NULL);
  108.     return theNSContext->MeasureText(inText, outCharLocs);
  109. }
  110.  
  111. void CNSContextCallbacks::GetEmbedSize(
  112.     MWContext*                 inContext,
  113.     LO_EmbedStruct*            inEmbedStruct,
  114.     NET_ReloadMethod        inReloadMethod)
  115. {
  116.     CNSContext* theNSContext = ExtractNSContext(inContext);
  117.     Assert_(theNSContext != NULL);
  118.     theNSContext->GetEmbedSize(inEmbedStruct, inReloadMethod);
  119. }
  120.  
  121. void CNSContextCallbacks::GetJavaAppSize(
  122.     MWContext*                 inContext,
  123.     LO_JavaAppStruct*        inJavaAppStruct,
  124.     NET_ReloadMethod        inReloadMethod)
  125. {
  126.     CNSContext* theNSContext = ExtractNSContext(inContext);
  127.     Assert_(theNSContext != NULL);
  128.     theNSContext->GetJavaAppSize(inJavaAppStruct, inReloadMethod);
  129. }
  130.  
  131. void CNSContextCallbacks::GetFormElementInfo(
  132.     MWContext*                 inContext,
  133.     LO_FormElementStruct*     inElement)
  134. {
  135.     CNSContext* theNSContext = ExtractNSContext(inContext);
  136.     Assert_(theNSContext != NULL);
  137.     theNSContext->GetFormElementInfo(inElement);
  138. }
  139.  
  140. void CNSContextCallbacks::GetFormElementValue(
  141.     MWContext*                 inContext,
  142.     LO_FormElementStruct*     inElement,
  143.     XP_Bool                 inHide)
  144. {
  145.     CNSContext* theNSContext = ExtractNSContext(inContext);
  146.     Assert_(theNSContext != NULL);
  147.     theNSContext->GetFormElementValue(inElement, inHide);
  148. }
  149.  
  150. void CNSContextCallbacks::ResetFormElement(
  151.     MWContext*                 inContext,
  152.     LO_FormElementStruct*     inElement)
  153. {
  154.     CNSContext* theNSContext = ExtractNSContext(inContext);
  155.     Assert_(theNSContext != NULL);
  156.     theNSContext->ResetFormElement(inElement);
  157. }
  158.  
  159. void CNSContextCallbacks::SetFormElementToggle(
  160.     MWContext*                 inContext,
  161.     LO_FormElementStruct*     inElement,
  162.     XP_Bool                 inToggle)
  163. {
  164.     CNSContext* theNSContext = ExtractNSContext(inContext);
  165.     Assert_(theNSContext != NULL);
  166.     theNSContext->SetFormElementToggle(inElement, inToggle);
  167. }
  168.  
  169. void CNSContextCallbacks::FreeEmbedElement(
  170.     MWContext*                 inContext,
  171.     LO_EmbedStruct*            inEmbedStruct)
  172. {
  173.     CNSContext* theNSContext = ExtractNSContext(inContext);
  174.     Assert_(theNSContext != NULL);
  175.     theNSContext->FreeEmbedElement(inEmbedStruct);
  176.  
  177. }
  178.  
  179. void CNSContextCallbacks::CreateEmbedWindow(
  180.     MWContext*                inContext,
  181.     NPEmbeddedApp*            inEmbeddedApp)
  182. {
  183.     CNSContext* theNSContext = ExtractNSContext(inContext);
  184.     Assert_(theNSContext != NULL);
  185.     theNSContext->CreateEmbedWindow(inEmbeddedApp);
  186. }
  187.  
  188. void CNSContextCallbacks::SaveEmbedWindow(
  189.     MWContext*                inContext,
  190.     NPEmbeddedApp*            inEmbeddedApp)
  191. {
  192.     CNSContext* theNSContext = ExtractNSContext(inContext);
  193.     Assert_(theNSContext != NULL);
  194.     theNSContext->SaveEmbedWindow(inEmbeddedApp);
  195. }
  196.  
  197. void CNSContextCallbacks::RestoreEmbedWindow(
  198.     MWContext*                inContext,
  199.     NPEmbeddedApp*            inEmbeddedApp)
  200. {
  201.     CNSContext* theNSContext = ExtractNSContext(inContext);
  202.     Assert_(theNSContext != NULL);
  203.     theNSContext->RestoreEmbedWindow(inEmbeddedApp);
  204. }
  205.  
  206. void CNSContextCallbacks::DestroyEmbedWindow(
  207.     MWContext*                inContext,
  208.     NPEmbeddedApp*            inEmbeddedApp)
  209. {
  210.     CNSContext* theNSContext = ExtractNSContext(inContext);
  211.     Assert_(theNSContext != NULL);
  212.     theNSContext->DestroyEmbedWindow(inEmbeddedApp);
  213. }
  214.  
  215. void CNSContextCallbacks::FreeJavaAppElement(
  216.     MWContext*                 inContext,
  217.     LJAppletData*            inAppletData)
  218. {
  219.     CNSContext* theNSContext = ExtractNSContext(inContext);
  220.     Assert_(theNSContext != NULL);
  221.     theNSContext->FreeJavaAppElement(inAppletData);
  222. }
  223.  
  224. void CNSContextCallbacks::HideJavaAppElement(
  225.     MWContext*                 inContext,
  226.     LJAppletData*            inAppletData)
  227. {
  228.     CNSContext* theNSContext = ExtractNSContext(inContext);
  229.     Assert_(theNSContext != NULL);
  230.     theNSContext->HideJavaAppElement(inAppletData);
  231. }
  232.  
  233. void CNSContextCallbacks::FreeEdgeElement(
  234.     MWContext*                 inContext,
  235.     LO_EdgeStruct*            inEdgeStruct)
  236. {
  237.     CNSContext* theNSContext = ExtractNSContext(inContext);
  238.     Assert_(theNSContext != NULL);
  239.     theNSContext->FreeEdgeElement(inEdgeStruct);
  240. }
  241.  
  242. void CNSContextCallbacks::FormTextIsSubmit(
  243.     MWContext*                 inContext,
  244.     LO_FormElementStruct*     inElement)
  245. {
  246.     CNSContext* theNSContext = ExtractNSContext(inContext);
  247.     Assert_(theNSContext != NULL);
  248.     theNSContext->FormTextIsSubmit(inElement);
  249. }
  250.  
  251. void CNSContextCallbacks::DisplaySubtext(
  252.     MWContext*                 inContext,
  253.     int                     inLocation,
  254.     LO_TextStruct*            inText,
  255.     Int32                     inStartPos,
  256.     Int32                    inEndPos,
  257.     XP_Bool                 inNeedBG)
  258. {
  259.     CNSContext* theNSContext = ExtractNSContext(inContext);
  260.     Assert_(theNSContext != NULL);
  261.     theNSContext->DisplaySubtext(inLocation, inText, inStartPos, inEndPos, inNeedBG);
  262. }
  263.  
  264. void CNSContextCallbacks::DisplayText(
  265.     MWContext*                 inContext,
  266.     int                     inLocation,
  267.     LO_TextStruct*            inText,
  268.     XP_Bool                 inNeedBG)
  269. {
  270.     CNSContext* theNSContext = ExtractNSContext(inContext);
  271.     Assert_(theNSContext != NULL);
  272.     theNSContext->DisplayText(inLocation, inText, inNeedBG);
  273. }
  274.  
  275. void CNSContextCallbacks::DisplayEmbed(
  276.     MWContext*                 inContext,
  277.     int                     inLocation,
  278.     LO_EmbedStruct*            inEmbedStruct)
  279. {
  280.     CNSContext* theNSContext = ExtractNSContext(inContext);
  281.     Assert_(theNSContext != NULL);
  282.     theNSContext->DisplayEmbed(inLocation, inEmbedStruct);
  283. }
  284.  
  285. void CNSContextCallbacks::DisplayJavaApp(
  286.     MWContext*                 inContext,
  287.     int                     inLocation,
  288.     LO_JavaAppStruct*        inJavaAppStruct)
  289. {
  290.     CNSContext* theNSContext = ExtractNSContext(inContext);
  291.     Assert_(theNSContext != NULL);
  292.     theNSContext->DisplayJavaApp(inLocation, inJavaAppStruct);
  293. }
  294.  
  295. void CNSContextCallbacks::DisplayEdge(
  296.     MWContext*                 inContext,
  297.     int                     inLocation,
  298.     LO_EdgeStruct*            inEdgeStruct)
  299. {
  300.     CNSContext* theNSContext = ExtractNSContext(inContext);
  301.     Assert_(theNSContext != NULL);
  302.     theNSContext->DisplayEdge(inLocation, inEdgeStruct);
  303. }
  304.  
  305. void CNSContextCallbacks::DisplayTable(
  306.     MWContext*                 inContext,
  307.     int                     inLocation,
  308.     LO_TableStruct*            inTableStruct)
  309. {
  310.     CNSContext* theNSContext = ExtractNSContext(inContext);
  311.     Assert_(theNSContext != NULL);
  312.     theNSContext->DisplayTable(inLocation, inTableStruct);
  313. }
  314.  
  315. void CNSContextCallbacks::DisplayCell(
  316.     MWContext*                 inContext,
  317.     int                     inLocation,
  318.     LO_CellStruct*            inCellStruct)
  319. {
  320.     CNSContext* theNSContext = ExtractNSContext(inContext);
  321.     Assert_(theNSContext != NULL);
  322.     theNSContext->DisplayCell(inLocation, inCellStruct);
  323. }
  324.  
  325. void CNSContextCallbacks::InvalidateEntireTableOrCell(
  326.     MWContext*                 inContext,
  327.     LO_Element*                inElement)
  328. {
  329.     CNSContext* theNSContext = ExtractNSContext(inContext);
  330.     Assert_(theNSContext != NULL);
  331.     if (inElement)
  332.         theNSContext->InvalidateEntireTableOrCell(inElement);
  333. }
  334.  
  335. void CNSContextCallbacks::DisplayAddRowOrColBorder(
  336.     MWContext*                 inContext,
  337.     XP_Rect*                inRect,
  338.     XP_Bool                    inDoErase)
  339. {
  340.     CNSContext* theNSContext = ExtractNSContext(inContext);
  341.     Assert_(theNSContext != NULL);
  342.     theNSContext->DisplayAddRowOrColBorder(inRect, inDoErase);
  343. }
  344.  
  345. void CNSContextCallbacks::DisplaySubDoc(
  346.     MWContext*                 inContext,
  347.     int                     inLocation,
  348.     LO_SubDocStruct*        inSubdocStruct)
  349. {
  350.     CNSContext* theNSContext = ExtractNSContext(inContext);
  351.     Assert_(theNSContext != NULL);
  352.     theNSContext->DisplaySubDoc(inLocation, inSubdocStruct);
  353. }
  354.  
  355. void CNSContextCallbacks::DisplayLineFeed(
  356.     MWContext*                 inContext,
  357.     int                     inLocation,
  358.     LO_LinefeedStruct*        inLinefeedStruct,
  359.     XP_Bool                 inNeedBG)
  360. {
  361.     CNSContext* theNSContext = ExtractNSContext(inContext);
  362.     Assert_(theNSContext != NULL);
  363.     theNSContext->DisplayLineFeed(inLocation, inLinefeedStruct, inNeedBG);
  364. }
  365.  
  366. void CNSContextCallbacks::DisplayHR(
  367.     MWContext*                inContext,
  368.     int                     inLocation,
  369.     LO_HorizRuleStruct*        inRuleStruct)
  370. {
  371.     CNSContext* theNSContext = ExtractNSContext(inContext);
  372.     Assert_(theNSContext != NULL);
  373.     theNSContext->DisplayHR(inLocation, inRuleStruct);
  374. }
  375.  
  376. void CNSContextCallbacks::DisplayBullet(
  377.     MWContext*                inContext,
  378.     int                     inLocation,
  379.     LO_BullettStruct*        inBullettStruct)
  380. {
  381.     CNSContext* theNSContext = ExtractNSContext(inContext);
  382.     Assert_(theNSContext != NULL);
  383.     theNSContext->DisplayBullet(inLocation, inBullettStruct);
  384. }
  385.  
  386. void CNSContextCallbacks::DisplayFormElement(
  387.     MWContext*                inContext,
  388.     int                     inLocation,
  389.     LO_FormElementStruct*     inFormElement)
  390. {
  391.     CNSContext* theNSContext = ExtractNSContext(inContext);
  392.     Assert_(theNSContext != NULL);
  393.     theNSContext->DisplayFormElement(inLocation, inFormElement);
  394. }
  395.  
  396. void CNSContextCallbacks::DisplayBorder(
  397.     MWContext*                inContext,
  398.     int                     inLocation,
  399.     int                    inX,
  400.     int                    inY,
  401.     int                    inWidth,
  402.     int                    inHeight,
  403.     int                    inBW,
  404.     LO_Color*                 inColor,
  405.     LO_LineStyle            inStyle)
  406. {
  407.     CNSContext* theNSContext = ExtractNSContext(inContext);
  408.     Assert_(theNSContext != NULL);
  409.     theNSContext->DisplayBorder(inLocation, inX, inY, inWidth, inHeight, inBW, inColor, inStyle);
  410. }
  411.  
  412.  
  413. void CNSContextCallbacks::UpdateEnableStates( MWContext*    inContext )
  414. {
  415.     CNSContext* theNSContext = ExtractNSContext(inContext);
  416.     Assert_(theNSContext != NULL);
  417.     theNSContext->UpdateEnableStates();
  418. }
  419.  
  420. void CNSContextCallbacks::DisplayFeedback(
  421.     MWContext*                inContext,
  422.     int                     inLocation,
  423.     LO_Element*             inElement)
  424. {
  425.     // bail out if non-editor context
  426.     // this function is to be used only for the editor
  427.     if ( !inContext->is_editor )
  428.         return;
  429.     
  430.     // called even if the element is not selected
  431.     CNSContext* theNSContext = ExtractNSContext(inContext);
  432.     Assert_(theNSContext != NULL);
  433.     theNSContext->DisplayFeedback(inLocation, inElement);
  434. }
  435.  
  436. void CNSContextCallbacks::ClearView(
  437.     MWContext*                 inContext,
  438.     int                     inWhich)
  439. {
  440.     CNSContext* theNSContext = ExtractNSContext(inContext);
  441.     Assert_(theNSContext != NULL);
  442.     theNSContext->ClearView(inWhich);
  443. }
  444.  
  445. void CNSContextCallbacks::SetDocDimension(
  446.     MWContext*                inContext,
  447.     int                     inLocation,
  448.     Int32                     inWidth,
  449.     Int32                     inLength)
  450. {
  451.     CNSContext* theNSContext = ExtractNSContext(inContext);
  452.     Assert_(theNSContext != NULL);
  453.     theNSContext->SetDocDimension(inLocation, inWidth, inLength);
  454. }
  455.  
  456. void CNSContextCallbacks::SetDocPosition(
  457.     MWContext*                inContext,
  458.     int                     inLocation,
  459.     Int32                     inX,
  460.     Int32                     inY)
  461. {
  462.     CNSContext* theNSContext = ExtractNSContext(inContext);
  463.     Assert_(theNSContext != NULL);
  464.     theNSContext->SetDocPosition(inLocation, inX, inY);
  465. }
  466.  
  467. void CNSContextCallbacks::GetDocPosition(
  468.     MWContext*                inContext,
  469.     int                     inLocation,
  470.     Int32*                    outX,
  471.     Int32*                    outY)
  472. {
  473.     CNSContext* theNSContext = ExtractNSContext(inContext);
  474.     Assert_(theNSContext != NULL);
  475.     theNSContext->GetDocPosition(inLocation, outX, outY);
  476. }
  477.  
  478. void CNSContextCallbacks::BeginPreSection(
  479.     MWContext*                 inContext)
  480. {
  481.     CNSContext* theNSContext = ExtractNSContext(inContext);
  482.     Assert_(theNSContext != NULL);
  483.     theNSContext->BeginPreSection();
  484. }
  485.  
  486. void CNSContextCallbacks::EndPreSection(
  487.     MWContext*                 inContext)
  488. {
  489.     CNSContext* theNSContext = ExtractNSContext(inContext);
  490.     Assert_(theNSContext != NULL);
  491.     theNSContext->EndPreSection();
  492. }
  493.  
  494. void CNSContextCallbacks::SetProgressBarPercent(
  495.     MWContext*                inContext,
  496.     Int32                     inPercent)
  497. {
  498.     CNSContext* theNSContext = ExtractNSContext(inContext);
  499.     Assert_(theNSContext != NULL);
  500.     theNSContext->SetProgressBarPercent(inPercent);
  501. }
  502.  
  503. void CNSContextCallbacks::SetBackgroundColor(
  504.     MWContext*                inContext,
  505.     Uint8                     inRed,
  506.     Uint8                    inGreen,
  507.     Uint8                     inBlue)
  508. {
  509.     CNSContext* theNSContext = ExtractNSContext(inContext);
  510.     Assert_(theNSContext != NULL);
  511.     theNSContext->SetBackgroundColor(inRed, inGreen, inBlue);
  512. }
  513.  
  514. void CNSContextCallbacks::Progress(
  515.     MWContext*                 inContext,
  516.     const char*                inMessageText)
  517. {
  518.     CNSContext* theNSContext = ExtractNSContext(inContext);
  519.     Assert_(theNSContext != NULL);
  520.     theNSContext->Progress(inMessageText);
  521. }
  522.  
  523. void CNSContextCallbacks::Alert(
  524.     MWContext*                 inContext,
  525.     const char*                inAlertText)
  526. {
  527.     CNSContext* theNSContext = ExtractNSContext(inContext);
  528.     Assert_(theNSContext != NULL);
  529.     theNSContext->Alert(inAlertText);
  530. }
  531.  
  532. void CNSContextCallbacks::SetCallNetlibAllTheTime(
  533.     MWContext*                 inContext)
  534. {
  535.     CNSContext* theNSContext = ExtractNSContext(inContext);
  536.     Assert_(theNSContext != NULL);
  537.     theNSContext->SetCallNetlibAllTheTime();
  538. }
  539.  
  540. void CNSContextCallbacks::ClearCallNetlibAllTheTime(
  541.     MWContext*                inContext)
  542. {
  543.     CNSContext* theNSContext = ExtractNSContext(inContext);
  544.     Assert_(theNSContext != NULL);
  545.     theNSContext->ClearCallNetlibAllTheTime();
  546. }
  547.  
  548. void CNSContextCallbacks::GraphProgressInit(
  549.     MWContext*                inContext,
  550.     URL_Struct*                inURL,
  551.     Int32                     inContentLength)
  552. {
  553.     CNSContext* theNSContext = ExtractNSContext(inContext);
  554.     Assert_(theNSContext != NULL);
  555.     theNSContext->GraphProgressInit(inURL, inContentLength);
  556. }
  557.  
  558. void CNSContextCallbacks::GraphProgressDestroy(
  559.     MWContext*                inContext,
  560.     URL_Struct*                inURL,
  561.     Int32                     inContentLength,
  562.     Int32                     inTotalRead)
  563. {
  564.     CNSContext* theNSContext = ExtractNSContext(inContext);
  565.     Assert_(theNSContext != NULL);
  566.     theNSContext->GraphProgressDestroy(inURL, inContentLength, inTotalRead);
  567. }
  568.  
  569. void CNSContextCallbacks::GraphProgress(
  570.     MWContext*                inContext,
  571.     URL_Struct*                inURL,
  572.     Int32                     inBytesReceived,
  573.     Int32                     inBytesSinceLast,
  574.     Int32                     inContentLength)
  575. {
  576.     CNSContext* theNSContext = ExtractNSContext(inContext);
  577.     Assert_(theNSContext != NULL);
  578.     theNSContext->GraphProgress(inURL, inBytesReceived, inBytesSinceLast, inContentLength);
  579. }
  580.  
  581. XP_Bool CNSContextCallbacks::UseFancyFTP(
  582.     MWContext*                 inContext)
  583. {
  584.     CNSContext* theNSContext = ExtractNSContext(inContext);
  585.     Assert_(theNSContext != NULL);
  586.     return theNSContext->UseFancyFTP();
  587. }
  588.  
  589. XP_Bool CNSContextCallbacks::UseFancyNewsgroupListing(
  590.     MWContext*                 inContext)
  591. {
  592.     CNSContext* theNSContext = ExtractNSContext(inContext);
  593.     Assert_(theNSContext != NULL);
  594.     return theNSContext->UseFancyNewsgroupListing();
  595. }
  596.  
  597. int CNSContextCallbacks::FileSortMethod(
  598.     MWContext*                 inContext)
  599. {
  600.     CNSContext* theNSContext = ExtractNSContext(inContext);
  601.     Assert_(theNSContext != NULL);
  602.     return theNSContext->FileSortMethod();
  603. }
  604.  
  605. XP_Bool CNSContextCallbacks::ShowAllNewsArticles(
  606.     MWContext*                 inContext)
  607. {
  608.     CNSContext* theNSContext = ExtractNSContext(inContext);
  609.     Assert_(theNSContext != NULL);
  610.     return theNSContext->ShowAllNewsArticles();
  611. }
  612.  
  613. XP_Bool    CNSContextCallbacks::Confirm(
  614.     MWContext*                inContext,
  615.     const char*             inMessage)
  616. {
  617.     CNSContext* theNSContext = ExtractNSContext(inContext);
  618.     Assert_(theNSContext != NULL);
  619.     return theNSContext->Confirm(inMessage);
  620. }
  621.  
  622. char* CNSContextCallbacks::Prompt(
  623.     MWContext*                inContext,
  624.     const char*             inMessage,
  625.     const char*                inDefaultText)
  626. {
  627.     CNSContext* theNSContext = ExtractNSContext(inContext);
  628.     Assert_(theNSContext != NULL);
  629.     return theNSContext->Prompt(inMessage, inDefaultText);
  630. }
  631.  
  632. char* CNSContextCallbacks::PromptWithCaption(
  633.     MWContext*                inContext,
  634.     const char*                inCaption,
  635.     const char*             inMessage,
  636.     const char*                inDefaultText)
  637. {
  638.     CNSContext* theNSContext = ExtractNSContext(inContext);
  639.     Assert_(theNSContext != NULL);
  640.     return theNSContext->PromptWithCaption(inCaption, inMessage, inDefaultText);
  641. }
  642.  
  643. XP_Bool CNSContextCallbacks::PromptUsernameAndPassword(
  644.     MWContext*                 inContext,
  645.     const char*                inMessage,
  646.     char**                    outUserName,
  647.     char**                    outPassword)
  648. {
  649.     CNSContext* theNSContext = ExtractNSContext(inContext);
  650.     Assert_(theNSContext != NULL);
  651.     return theNSContext->PromptUsernameAndPassword(inMessage, outUserName, outPassword);
  652. }
  653.  
  654. char* CNSContextCallbacks::PromptPassword(
  655.     MWContext*                 inContext,
  656.     const char*             inMessage)
  657. {
  658.     CNSContext* theNSContext = ExtractNSContext(inContext);
  659.     Assert_(theNSContext != NULL);
  660.     return theNSContext->PromptPassword(inMessage);
  661. }
  662.  
  663. void CNSContextCallbacks::EnableClicking(
  664.     MWContext*                 inContext)
  665. {
  666.     CNSContext* theNSContext = ExtractNSContext(inContext);
  667.     Assert_(theNSContext != NULL);
  668.     theNSContext->EnableClicking();
  669. }
  670.  
  671. void CNSContextCallbacks::AllConnectionsComplete(
  672.     MWContext*                inContext)
  673. {
  674.     CNSContext* theNSContext = ExtractNSContext(inContext);
  675.     Assert_(theNSContext != NULL);
  676.     if (theNSContext)
  677.         theNSContext->AllConnectionsComplete();
  678. }
  679.  
  680. void CNSContextCallbacks::EraseBackground(
  681.     MWContext*                inContext,
  682.     int                        inLocation,
  683.     Int32                    inX,
  684.     Int32                    inY,
  685.     Uint32                    inWidth,
  686.     Uint32                    inHeight,
  687.     LO_Color*                inColor)
  688. {
  689.     CNSContext* theNSContext = ExtractNSContext(inContext);
  690.     Assert_(theNSContext != NULL);
  691.     theNSContext->EraseBackground(inLocation, inX, inY, inWidth, inHeight, inColor);
  692. }
  693.  
  694. void CNSContextCallbacks::SetDrawable(
  695.     MWContext*                inContext,
  696.     CL_Drawable*            inDrawable)
  697. {
  698.     CNSContext* theNSContext = ExtractNSContext(inContext);
  699.     Assert_(theNSContext != NULL);
  700.     theNSContext->SetDrawable(inDrawable);
  701. }
  702.  
  703. void CNSContextCallbacks::GetTextFrame(
  704.     MWContext*                inContext,
  705.     LO_TextStruct*            inTextStruct,
  706.     Int32                    inStartPos,
  707.     Int32                    inEndPos,
  708.     XP_Rect*                outFrame)
  709. {
  710.     CNSContext* theNSContext = ExtractNSContext(inContext);
  711.     Assert_(theNSContext != NULL);
  712.     theNSContext->GetTextFrame(inTextStruct, inStartPos, inEndPos, outFrame);
  713. }
  714.  
  715. void CNSContextCallbacks::GetDefaultBackgroundColor(
  716.     MWContext*                inContext,
  717.     LO_Color*                outColor)
  718. {
  719.     CNSContext* theNSContext = ExtractNSContext(inContext);
  720.     Assert_(theNSContext != NULL);
  721.     theNSContext->GetDefaultBackgroundColor(outColor);
  722. }
  723.  
  724. void CNSContextCallbacks::DrawJavaApp(
  725.     MWContext*                inContext,
  726.     int                     inLocation,
  727.     LO_JavaAppStruct*        inJavaAppStruct)
  728. {
  729.     CNSContext* theNSContext = ExtractNSContext(inContext);
  730.     Assert_(theNSContext != NULL);
  731.     theNSContext->DrawJavaApp(inLocation, inJavaAppStruct);
  732. }
  733.  
  734. void CNSContextCallbacks::HandleClippingView(
  735.     MWContext*                inContext,
  736.     struct LJAppletData     *appletD, 
  737.     int                     x, 
  738.     int                     y, 
  739.     int                     width, 
  740.     int                     height)
  741. {
  742.     CNSContext* theNSContext = ExtractNSContext(inContext);
  743.     Assert_(theNSContext != NULL);
  744.     theNSContext->HandleClippingView(appletD, x, y, width, height);
  745. }
  746.