home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / MNSearchFrame.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.0 KB  |  111 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.    MNSearchFrame.cpp -- Mail/News Search window stuff.
  20.    Created: Dora Hsu<dora@netscape.com>, 16-Dec-96.
  21.  */
  22.  
  23.  
  24.  
  25. #include "MNSearchFrame.h"
  26. #include "MNSearchView.h"
  27. #include "xpassert.h"
  28.  
  29. static XFE_MNSearchFrame *theFrame = NULL;
  30.  
  31. XFE_MNSearchFrame::XFE_MNSearchFrame(Widget toplevel, XFE_Frame *parent_frame,
  32.                                      Chrome *chromespec,
  33.                                      XFE_MNView *mnview,
  34.                                      MSG_FolderInfo *folderInfo)
  35.     : XFE_Frame("MNSearch",                // name
  36.                 toplevel,                // top level
  37.                 parent_frame,            // parent frame
  38.                 FRAME_MAILNEWS_SEARCH,    // frame type
  39.                 chromespec,                // chrome
  40.                 False,                    // have html display
  41.                 False,                    // have menu bar
  42.                 False,                    // have toolbar
  43.                 False,                    // have dashboard (we'll make our own)
  44.                 True)                    // destroy on close
  45.  
  46. {
  47.  
  48.   XP_ASSERT(mnview != NULL);
  49.  
  50.   XFE_MNSearchView *view = new XFE_MNSearchView(this,
  51.                                                 getViewParent(), 
  52.                                                 this,
  53.                                                 mnview, 
  54.                                                 m_context, 
  55.                                                 NULL, 
  56.                                                 folderInfo, 
  57.                                                 True);
  58.  
  59.   view->createWidgets(view->getBaseWidget());
  60.   setView(view);
  61.  
  62.   registerInterest(XFE_MNSearchView::CloseSearch, this,
  63.         (XFE_FunctionNotification)close_cb);
  64.  
  65.   view->show();
  66. }
  67.  
  68. XFE_MNSearchFrame::~XFE_MNSearchFrame()
  69. {
  70.     theFrame = NULL;
  71. }
  72.  
  73. void
  74. XFE_MNSearchFrame::setFolderOption(MSG_FolderInfo *folderInfo)
  75. {
  76.    ((XFE_MNSearchView*)getView())->setFolderOption(folderInfo);
  77. }
  78.  
  79. XFE_CALLBACK_DEFN(XFE_MNSearchFrame, close)(XFE_NotificationCenter */*obj*/,
  80.             void * /*clientData*/, 
  81.             void */*callData*/) 
  82. {
  83.     delete_response();
  84. }
  85.  
  86. extern "C" MWContext*
  87. fe_showMNSearch(Widget toplevel, XFE_Frame *parent_frame,
  88.                 Chrome *chromespec, XFE_MNView* mnview, 
  89.         MSG_FolderInfo* folderInfo )
  90. {
  91.   if (theFrame == NULL)
  92.         theFrame = new XFE_MNSearchFrame(toplevel, parent_frame,
  93.                                          chromespec, mnview, folderInfo);
  94.   else theFrame->setFolderOption(folderInfo);
  95.  
  96.   theFrame->show();
  97.  
  98.   return theFrame->getContext();
  99. }
  100.  
  101. extern "C" MWContext*
  102. fe_showSearch(Widget toplevel, XFE_Frame *parent_frame,
  103.               Chrome *chromespec)
  104. {
  105.   if (theFrame == NULL)
  106.         theFrame = new XFE_MNSearchFrame(toplevel, parent_frame, chromespec, NULL);
  107.   theFrame->show();
  108.  
  109.   return theFrame->getContext();
  110. }
  111.