home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / prefs / nsdlg / public / cppageex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.5 KB  |  96 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. #ifndef __CPPAGEEX_H_
  20. #define __CPPAGEEX_H_
  21.  
  22. #include "cdialog.h"
  23. #include "ippageex.h"
  24.  
  25. class CPropertyPageEx : public IPropertyPageEx, protected CDialog {
  26.     public:
  27.         CPropertyPageEx(HINSTANCE hInstance, UINT nTemplateID, LPCSTR lpszHelpTopic = NULL);
  28.         virtual ~CPropertyPageEx();
  29.  
  30.         // IUnknown methods
  31.         STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
  32.         STDMETHODIMP_(ULONG) AddRef();
  33.         STDMETHODIMP_(ULONG) Release();
  34.  
  35.         // IPropertyPage methods. CPropertyPageEx has no way to know if
  36.         // the page is dirty. IsPageDirty() returns TRUE if the page has
  37.         // ever been activated and FALSE otherwise. This assures that the
  38.         // Apply() method will be called by the preferences UI framework
  39.         STDMETHODIMP SetPageSite(LPPROPERTYPAGESITE pPageSite);
  40.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  41.         STDMETHODIMP Deactivate();
  42.         STDMETHODIMP GetPageInfo(LPPROPPAGEINFO pPageInfo);
  43.         STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN FAR* ppunk);
  44.         STDMETHODIMP Show(UINT nCmdShow);
  45.         STDMETHODIMP Move(LPCRECT prect);
  46.         STDMETHODIMP IsPageDirty();
  47.         STDMETHODIMP Apply();
  48.         STDMETHODIMP Help(LPCOLESTR lpszHelpDir);
  49.         STDMETHODIMP TranslateAccelerator(LPMSG lpMsg);
  50.  
  51.         // IPropertyPageEx methods
  52.         STDMETHODIMP PageChanging(LPPROPERTYPAGE pNewPage);
  53.  
  54.         // Free store operators
  55.         LPVOID    operator new(size_t);
  56.         void    operator delete(LPVOID);
  57.  
  58.     protected:
  59.         // Dialog data transfer. Override this routine and transfer data to/from
  60.         // the dialog box. Called from these member functions:
  61.         // - CDialog::InitDialog()
  62.         // - PageChanging()
  63.         // - Apply()
  64.         //
  65.         // When transfering data from the dialog box, return FALSE if validation
  66.         // is unsuccessful. PageChanging() will return S_FALSE which will prevent
  67.         // the page from losing the activation
  68.         virtual BOOL    DoTransfer(BOOL bSaveAndValidate) = 0;
  69.  
  70.         // Called from Apply(). Override this to apply any changes the user has
  71.         // made. Return TRUE if successful and FALSE otherwise
  72.         virtual BOOL    ApplyChanges() = 0;
  73.  
  74.         // Called by SetPageSite() to get the size of the page. This routine creates
  75.         // the dialog, gets its window size, and then destroys the dialog
  76.         //
  77.         // If all your property pages are the same size you can override this routine,
  78.         // compute the size once, and then return the cached size
  79.         virtual HRESULT    GetPageSize(SIZE &);
  80.     
  81.     protected:
  82.         // Event processing
  83.         virtual BOOL    InitDialog();
  84.  
  85.     protected:
  86.         LPPROPERTYPAGESITE    m_pPageSite;
  87.         LPUNKNOWN            m_pObject;
  88.         ULONG                m_uRef;
  89.         SIZE                m_size;
  90.         BOOL                m_bHasBeenActivated;  // TRUE if activated at least one time
  91.         LPCSTR              m_lpszHelpTopic;  // name of the help topic for this page
  92. };
  93.  
  94. #endif /* __CPPAGEEX_H_ */
  95.  
  96.