home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / ABDirPropertyDlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.0 KB  |  124 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.    ABDirPropertyDlg.cpp -- class definition for ABDirPropertyDlg
  20.    Created: Tao Cheng <tao@netscape.com>, 10-nov-97
  21.  */
  22.  
  23. #include "ABDirPropertyDlg.h"
  24. #include "PropertySheetView.h"
  25. #include "ABDirGenTabView.h"
  26.  
  27. #include "abcom.h"
  28.  
  29. #include "xpgetstr.h"
  30.  
  31. extern int XFE_ABDIR_DLG_TITLE;
  32.  
  33. //
  34. // This is the dialog it self
  35. //
  36. XFE_ABDirPropertyDlg::XFE_ABDirPropertyDlg(Widget    parent,
  37.                                            char     *name,
  38.                                            Boolean   modal,
  39.                                            MWContext *context):
  40.     XFE_PropertySheetDialog((XFE_View *)0, parent, name,
  41.                         context,
  42.                         TRUE,    /* ok */
  43.                         TRUE,    /* cancel */
  44.                         TRUE,    /* help */
  45.                         FALSE,   /* apply */
  46.                         FALSE,   /* separator */
  47.                         modal),
  48.     m_dir(NULL),
  49.     m_proc(NULL),
  50.     m_callData(NULL)
  51. #if defined(USE_ABCOM)
  52.     , m_pane(NULL)
  53. #endif /* USE_ABCOM */
  54. {
  55.     XFE_PropertySheetView* folderView = (XFE_PropertySheetView *) m_view;
  56.     
  57.     /* Add tabs
  58.      */
  59.     /* Gen
  60.      */
  61.     folderView->addTab(new XFE_ABDirGenTabView((XFE_Component *)this, 
  62.                                                folderView));
  63.     XtVaSetValues(XtParent(m_chrome), 
  64.                   XmNtitle, XP_GetString(XFE_ABDIR_DLG_TITLE), 
  65.                   NULL);
  66. }
  67.  
  68. XFE_ABDirPropertyDlg::~XFE_ABDirPropertyDlg()
  69. {
  70.  
  71. }
  72.  
  73. #if defined(USE_ABCOM)
  74. void 
  75. XFE_ABDirPropertyDlg::setPane(MSG_Pane *pane)
  76. {
  77.     m_pane = pane;
  78. }
  79. #endif /* USE_ABCOM */
  80.  
  81. void XFE_ABDirPropertyDlg::setDlgValues(DIR_Server *dir)
  82. {
  83.     m_dir = dir;
  84.     XFE_PropertySheetDialog::setDlgValues();
  85. }
  86.  
  87. void XFE_ABDirPropertyDlg::apply()
  88. {
  89.   getDlgValues();
  90.   if (m_proc)
  91.       m_proc(m_dir, m_callData);
  92. #if defined(USE_ABCOM)
  93.   else if (m_pane) {
  94.       int error = 
  95.           AB_UpdateDIRServerForContainerPane(m_pane, m_dir);
  96.   }/* else */
  97. #endif /* USE_ABCOM */
  98. }
  99.  
  100. void XFE_ABDirPropertyDlg::registerCB(ABDirPropertyCBProc proc, 
  101.                                       void               *callData)
  102. {
  103.     m_proc = proc;
  104.     m_callData = callData;
  105. }
  106.  
  107. extern "C" void 
  108. fe_showABDirPropertyDlg(Widget               parent,
  109.                         MWContext           *context,
  110.                         DIR_Server          *dir,
  111.                         ABDirPropertyCBProc  proc,
  112.                         void                *callData)
  113. {
  114.     XFE_ABDirPropertyDlg* Dlg = 
  115.         new XFE_ABDirPropertyDlg(parent,
  116.                                  "abDirProperties", 
  117.                                  True, 
  118.                                  context);
  119.     Dlg->setDlgValues(dir);
  120.     Dlg->registerCB(proc, callData);
  121.     Dlg->show();
  122. }
  123.  
  124.