home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / PropertySheetDialog.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.3 KB  |  140 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.    PropertySheetDialog.cpp -- class definition for PropertySheetDialog
  20.    Created: Tao Cheng <tao@netscape.com>, 12-nov-96
  21.  */
  22.  
  23.  
  24.  
  25. #include "PropertySheetDialog.h"
  26. #include "PropertySheetView.h"
  27.  
  28. //
  29. // This is the dialog it self
  30. //
  31. XFE_PropertySheetDialog::XFE_PropertySheetDialog(XFE_View  *view, 
  32.                                          Widget     parent,
  33.                                          char      *name,
  34.                                          MWContext *context,
  35.                                          Boolean    ok, 
  36.                                          Boolean    cancel,
  37.                                          Boolean    help, 
  38.                                          Boolean    apply, 
  39.                                          Boolean    separator, 
  40.                                          Boolean    modal):
  41.     XFE_ViewDialog(view, 
  42.                    parent, 
  43.                    name,
  44.                    context,
  45.                    ok,
  46.                    cancel,
  47.                    help,
  48.                    apply,
  49.                    separator,
  50.                    modal)
  51. {
  52.   
  53.   /* 1. Dialog frame is created in XFE_ViewDialog::XFE_ViewDialog
  54.    */
  55.   m_clientData = 0;
  56.  
  57.   /* 2. Create a folder view. m_chrome is the dialog widget
  58.    */
  59.   XFE_PropertySheetView *folderview = 
  60.     new XFE_PropertySheetView(this /* topComponent */, m_chrome, 
  61.               0, 0);
  62.  
  63.   folderview->show();
  64.  
  65.   //
  66.   // we don't want a default value, since return does other stuff for
  67.   // us.
  68.   XtVaSetValues(m_chrome, /* the dialog */
  69.         XmNdefaultButton, NULL,
  70.         NULL);
  71.  
  72.   /* set and show view 
  73.    */
  74.   setView(folderview);
  75.  
  76.  
  77. }
  78.  
  79. XFE_PropertySheetDialog::~XFE_PropertySheetDialog()
  80. {
  81.     /* 100892: Caldera: address book problem causes continuous loop 
  82.      * reset flag to leave fe_eventloop()
  83.      */
  84.     if (m_clientData)
  85.         *m_clientData = (ANS_t) eCANCEL;
  86.     
  87. }
  88.  
  89. void XFE_PropertySheetDialog::setDlgValues()
  90. {
  91.   if (m_view)
  92.     ((XFE_PropertySheetView *) m_view)->setDlgValues();
  93. #if defined(DEBUG_tao_)
  94.   else
  95.     printf("\n***[XFE_PropertySheetDialog::setDlgValues] m_view is not set!");
  96. #endif
  97. }
  98.  
  99. void XFE_PropertySheetDialog::getDlgValues()
  100. {
  101.   if (m_view)
  102.     ((XFE_PropertySheetView *) m_view)->getDlgValues();
  103. #if defined(DEBUG_tao_)
  104.   else
  105.     printf("\n***[XFE_PropertySheetDialog::setDlgValues] m_view is not set!");
  106. #endif
  107. }
  108.  
  109. void XFE_PropertySheetDialog::cancel()
  110. {
  111.   // default setting
  112.   if (m_clientData)
  113.       *m_clientData = (ANS_t) eCANCEL;
  114.   else
  115.       hide();
  116. }
  117.  
  118. void XFE_PropertySheetDialog::apply()
  119. {
  120.  
  121.   // default setting
  122.   if (m_clientData)
  123.       *m_clientData = (ANS_t) eAPPLY;
  124.  
  125.   if (m_view)
  126.     ((XFE_PropertySheetView *) m_view)->apply();
  127. }
  128.  
  129. void XFE_PropertySheetDialog::ok()
  130. {
  131.   // default setting
  132.   if (m_clientData)
  133.       *m_clientData = (ANS_t) eAPPLY;
  134.  
  135.   apply();
  136.  
  137.   if (!m_clientData && m_okToDestroy)
  138.       hide();
  139. }
  140.