home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / prefs / edpref / src / pages.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.1 KB  |  75 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. #include "pch.h"
  20. #include <assert.h>
  21. #include "dllcom.h"
  22. #include "pages.h"
  23. #include "xp_core.h"
  24. #include "prefapi.h"
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // Helper functions
  28.  
  29. int
  30. PREF_GetStringPref(LPCSTR lpszPref, CString &str)
  31. {
  32.     int        nBufLength = 0;
  33.  
  34.     if (PREF_GetCharPref(lpszPref, NULL, &nBufLength) == PREF_ERROR)
  35.         return PREF_ERROR;
  36.  
  37.     if (nBufLength <= 1) {
  38.         str.Empty();
  39.         return PREF_NOERROR;
  40.  
  41.     } else {
  42.         return PREF_GetCharPref(lpszPref, str.BufferSetLength(nBufLength - 1), &nBufLength);
  43.     }
  44. }
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CEditorPropertyPage implementation
  48.  
  49. CEditorPropertyPage::CEditorPropertyPage(UINT nTemplateID, LPCSTR lpszHelpTopic)
  50.     : CPropertyPageEx(CComDll::m_hInstance, nTemplateID, lpszHelpTopic)
  51. {
  52. }
  53.  
  54. SIZE    CEditorPropertyPage::m_size = {0, 0};
  55.  
  56. HRESULT
  57. CEditorPropertyPage::GetPageSize(SIZE &size)
  58. {
  59.     // All of our pages are the same size. See if we already
  60.     // have the size
  61.     if (m_size.cx == 0) {
  62.         // Ask our base class to determine the size
  63.         HRESULT hres = CPropertyPageEx::GetPageSize(m_size);
  64.  
  65.         if (FAILED(hres))
  66.             return hres;
  67.     }
  68.  
  69.     // Use the cached size
  70.     assert(m_size.cx > 0 && m_size.cy > 0);
  71.     size = m_size;
  72.     return NOERROR;
  73. }
  74.  
  75.