home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / NavCenterFrame.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.4 KB  |  165 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.    NavCenterFrame.cpp -- class definition for the NavCenter frame class
  20.    Created: Stephen Lamm <slamm@netscape.com>, 5-Nov-97.
  21.  */
  22.  
  23.  
  24.  
  25. #include "NavCenterFrame.h"
  26. #include "NavCenterView.h"
  27. #include "Dashboard.h"
  28. #include "Menu.h"
  29.  
  30. #if DEBUG_slamm
  31. #define D(x) x
  32. #else
  33. #define D(x)
  34. #endif
  35.  
  36. MenuSpec XFE_NavCenterFrame::file_menu_spec[] = {
  37.   { xfeCmdClose,        PUSHBUTTON },
  38.   { xfeCmdExit,            PUSHBUTTON },
  39.   { NULL }
  40. };
  41.  
  42. MenuSpec XFE_NavCenterFrame::menu_bar_spec[] = {
  43.   { xfeMenuFile,     CASCADEBUTTON, (MenuSpec*)&XFE_NavCenterFrame::file_menu_spec },
  44.   { xfeMenuWindow,     CASCADEBUTTON, (MenuSpec*)&XFE_Frame::window_menu_spec },
  45.   { xfeMenuHelp,     CASCADEBUTTON, (MenuSpec*)&XFE_Frame::help_menu_spec },
  46.   { NULL }
  47. };
  48.  
  49. XFE_NavCenterFrame::XFE_NavCenterFrame(Widget toplevel,
  50.                                        XFE_Frame *parent_frame,
  51.                                        Chrome *chromespec) 
  52.   : XFE_Frame("navcenter", toplevel, 
  53.               parent_frame,
  54.               FRAME_NAVCENTER, 
  55.               chromespec,
  56.               False,
  57.               True,
  58.               False,
  59.               True,
  60.               False) // m_destroyOnClose, always keep one Bookmark instance
  61. {
  62.   D(printf("XFE_NavCenterFrame SUB-SYSTEM INSTANCIATING\n");)
  63.  
  64.   // create the bookmark view
  65.   XFE_View *view = new XFE_NavCenterView(this, getViewParent(), 
  66.                                          NULL, m_context);
  67.   setView(view);
  68.   setMenubar(menu_bar_spec);
  69.  
  70.   XtVaSetValues(view->getBaseWidget(),
  71.           XmNleftAttachment, XmATTACH_FORM,
  72.         XmNtopAttachment, XmATTACH_FORM,
  73.         XmNrightAttachment, XmATTACH_FORM,
  74.         XmNbottomAttachment, XmATTACH_FORM,
  75.         NULL);
  76.  
  77.   //setMenubar(menu_bar_spec);
  78.  
  79. #ifdef NOTYET
  80.   //
  81.   // Make the bookmark frame title more reasonable
  82.   //
  83.   char title[kMaxFullNameLength+64];
  84.  
  85.   PR_snprintf(title, 
  86.               sizeof(title),
  87.               XP_GetString(XFE_BM_FRAME_TITLE),
  88.               FE_UsersFullName());
  89.  
  90.   setTitle(title);
  91. #endif
  92.   //setTitle(HT_GetViewName(m_htview));
  93.  
  94.   view->show();
  95.  
  96.   m_dashboard->setShowStatusBar(True);
  97.   //m_dashboard->setShowProgressBar(True);
  98.  
  99.   realize();
  100.   resize(600,580); //XXX Default size for now
  101.  
  102. }
  103.  
  104. XFE_NavCenterFrame::~XFE_NavCenterFrame()
  105. {
  106.     D(printf("XFE_NavCenterFrame SUB-SYSTEM DESTRUCTING\n");)
  107.  
  108.       //BM_SaveBookmarks(main_bm_context, NULL);
  109. }
  110.  
  111. //////////////////////////////////////////////////////////////////////////
  112. XP_Bool
  113. XFE_NavCenterFrame::isCommandEnabled(CommandType cmd,
  114.                                    void *calldata, XFE_CommandInfo*)
  115. {
  116.     {
  117.       return XFE_Frame::isCommandEnabled(cmd, calldata);
  118.     }
  119. }
  120.  
  121. void
  122. XFE_NavCenterFrame::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo*info)
  123. {
  124.     {
  125.       XFE_Frame::doCommand(cmd,calldata,info);
  126.     }
  127. }
  128.  
  129. Boolean
  130. XFE_NavCenterFrame::handlesCommand(CommandType cmd, void *calldata,
  131.                             XFE_CommandInfo* info)
  132. {
  133.     {
  134.       return XFE_Frame::handlesCommand(cmd, calldata, info);
  135.     }
  136. }
  137.  
  138. char *
  139. XFE_NavCenterFrame::commandToString(CommandType cmd, void* calldata,
  140.                                     XFE_CommandInfo* info)
  141. {
  142.   return XFE_Frame::commandToString(cmd, calldata, info);
  143. }
  144.  
  145. //////////////////////////////////////////////////////////////////////////
  146. extern "C" MWContext *
  147. fe_showNavCenter(Widget toplevel, XFE_Frame *parent_frame, Chrome *chromespec, URL_Struct *url)
  148. {
  149.   // not a static global, since we can have multiple browsers.
  150.     XFE_NavCenterFrame *theFrame;
  151.     MWContext *theContext = NULL;
  152.     
  153.     D( printf("in fe_showNavCenter()\n"); );
  154.     
  155.     theFrame = new XFE_NavCenterFrame(toplevel, parent_frame, chromespec);
  156.     
  157.     theFrame->show();
  158.     
  159.     theContext = theFrame->getContext();
  160.  
  161.     D( printf("leaving fe_showNavCenter()\n"); );
  162.  
  163.     return theContext;
  164. }
  165.