home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / prefs / brpref / src / pages.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  9.3 KB  |  349 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 __PAGES_H_
  20. #define __PAGES_H_
  21.  
  22. #include "cppageex.h"
  23. #include "ibrprefs.h"
  24. #include "intlfont.h"
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // Helper functions
  28.  
  29. // CString interface to PREF_GetCharPref routine
  30. int
  31. PREF_GetStringPref(LPCSTR lpszPref, CString &str);
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CBrowserPropertyPage
  35.  
  36. // Simple base class that handles reference counting of the DLL object and
  37. // caching the size of the property page. Note: all property pages derived
  38. // from this class MUST be the same size
  39. class CBrowserPropertyPage : public CPropertyPageEx {
  40.     public:
  41.         CBrowserPropertyPage(UINT nTemplateID, LPCSTR lpszHelpTopic);
  42.  
  43.     protected:
  44.         HRESULT        GetPageSize(SIZE &);
  45.  
  46.         // Disables the control (specified by ID) and return TRUE if the preference
  47.         // is locked; returns FALSE otherwise
  48.         BOOL        CheckIfLockedPref(LPCSTR lpszPref, UINT nIDCtl);
  49.  
  50.         // Helper routine to disable all the radio buttons in a group
  51.         void        DisableRadioButtonGroup(UINT nIDButton);
  52.  
  53.     private:
  54.         CRefDll    m_refDll;
  55.  
  56.         static SIZE    m_size;  // cached size
  57. };
  58.  
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CAppearancePrefs
  61.  
  62. class CAppearancePrefs : public CBrowserPropertyPage {
  63.     public:
  64.         CAppearancePrefs();
  65.  
  66.     protected:
  67.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  68.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  69.         BOOL         ApplyChanges();
  70.         BOOL         InitDialog();
  71.  
  72.     private:
  73.         BOOL    m_bStartupBrowser;
  74.         BOOL    m_bStartupMail;
  75.         BOOL    m_bStartupNews;
  76.         BOOL    m_bStartupEditor;
  77.         BOOL    m_bStartupNetcaster;
  78.         int        m_nShowToolbarAs;
  79. };
  80.  
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CFontsPrefs
  83.  
  84. class CFontsPrefs : public CBrowserPropertyPage {
  85.     public:
  86.         CFontsPrefs();
  87.  
  88.     protected:
  89.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  90.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  91.         BOOL         ApplyChanges();            
  92.         BOOL         InitDialog();
  93.  
  94.         // Override to acquire/release the IBrowserPrefs interface
  95.         // pointer
  96.         STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN FAR* ppunk);
  97.         
  98.         // Event Processing
  99.         LRESULT         WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  100.         BOOL         OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  101.     
  102.     private:
  103.         LPINTLFONT    m_lpIntlFont;
  104.         CString        m_strVariableFaceName;
  105.         CString        m_strFixedFaceName;
  106.         int            m_nVariableSize;
  107.         int            m_nFixedSize;
  108.         DWORD        m_dwEncodings;
  109.         int            m_nCharset;  // charset num for currently selected encoding
  110.         int            m_nUseDocumentFonts;
  111.         int            m_nMaxFontHeight;
  112.         BOOL        m_bDBCSEnabled;
  113.  
  114.         void    FillFontFace(BOOL bIgnorePitch);
  115.         void    FillEncodingNames();
  116.         void    OnEncodingChanged();
  117.         BOOL    UseSystemFont();
  118.         void    DrawComboBoxItem(LPDRAWITEMSTRUCT lpdis);
  119.         void    MeasureComboBoxItem(LPMEASUREITEMSTRUCT lpmis);
  120. };
  121.  
  122. /////////////////////////////////////////////////////////////////////////////
  123. // CColorsPrefs
  124.  
  125. class CColorsPrefs : public CBrowserPropertyPage {
  126.     public:
  127.         CColorsPrefs();
  128.  
  129.     protected:
  130.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  131.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  132.         BOOL         ApplyChanges();
  133.         BOOL         InitDialog();
  134.  
  135.         // Event Processing
  136.         LRESULT    WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  137.         BOOL    OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  138.  
  139.     private:
  140.         BOOL        m_bUnderlineLinks;
  141.         COLORREF    m_rgbVisitedLinks;
  142.         COLORREF    m_rgbUnvisitedLinks;
  143.         BOOL        m_bUseWindowsColors;
  144.         COLORREF    m_rgbTextColor;
  145.         COLORREF    m_rgbBackgroundColor;
  146.         BOOL        m_bOverrideDocumentColors;
  147.  
  148.         void        EnableColorButtons();
  149.         COLORREF    GetColorButtonColor(UINT nCtlID);
  150.         void        SetColorButtonColor(UINT nCtlID, COLORREF);
  151. };
  152.  
  153. /////////////////////////////////////////////////////////////////////////////
  154. // CBrowserPrefs
  155.  
  156. class CBrowserPrefs : public CBrowserPropertyPage {
  157.     public:
  158.         CBrowserPrefs();
  159.  
  160.     protected:
  161.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  162.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  163.         BOOL         ApplyChanges();
  164.         BOOL         InitDialog();
  165.         
  166.         // Event Processing
  167.         BOOL    OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  168.  
  169.     private:
  170.         CString    m_strHomePageURL;
  171.         int        m_nStartsWith;
  172.         int        m_nExpireAfter;
  173.         CString    m_strCurrentPage;
  174. };
  175.  
  176. /////////////////////////////////////////////////////////////////////////////
  177. // CLanguagesPrefs
  178.  
  179. class CLanguagesPrefs : public CBrowserPropertyPage {
  180.     public:
  181.         CLanguagesPrefs();
  182.  
  183.     protected:
  184.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  185.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  186.         BOOL         ApplyChanges();
  187.         BOOL         InitDialog();
  188.         
  189.         // Event Processing
  190.         BOOL        OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  191.         LRESULT        WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  192.  
  193.     private:
  194.         HBITMAP    m_hUpBitmap;
  195.         HBITMAP    m_hDownBitmap;
  196.         HDC        m_hMemDC;
  197.         int        m_nTabStops[2];
  198.         CString    m_strAcceptLangs;
  199.  
  200.         void    CheckButtons();
  201.         void    SetLBoxItemHeight();
  202.         void    DrawLBoxItem(LPDRAWITEMSTRUCT lpdis);
  203.         void    FillListBox();
  204. };
  205.  
  206. /////////////////////////////////////////////////////////////////////////////
  207. // CApplicationsPrefs
  208.  
  209. class CApplicationsPrefs : public CBrowserPropertyPage {
  210.     public:
  211.         CApplicationsPrefs();
  212.  
  213.     protected:
  214.         BOOL    DoTransfer(BOOL bSaveAndValidate);
  215.         BOOL    ApplyChanges();
  216.         BOOL    InitDialog();
  217.         
  218.         // Override to acquire/release the IBrowserPrefs interface
  219.         // pointer
  220.         STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN FAR* ppunk);
  221.         
  222.         // Event Processing
  223.         BOOL        OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  224.         LRESULT        WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  225.         
  226.         void        OnNewItem();
  227.         void        OnEditItem();
  228.         void        OnRemoveItem();
  229.  
  230.     private:
  231.         LPBROWSERPREFS    m_lpBrowserPrefs;
  232.         NET_cdataStruct    m_telnet;
  233.         NET_cdataStruct    m_tn3270;
  234.         CString            m_strTelnet;
  235.         CString            m_strTN3270;
  236.  
  237.         // Helper routines
  238.         void    DisplayFileDetails();
  239.         void    SetLBoxItemHeight();
  240.         void    DrawLBoxItem(LPDRAWITEMSTRUCT lpdis);
  241. };
  242.  
  243. /////////////////////////////////////////////////////////////////////////////
  244. // CAdvancedPrefs
  245.  
  246. class CAdvancedPrefs : public CBrowserPropertyPage {
  247.     public:
  248.         CAdvancedPrefs();
  249.  
  250.     protected:
  251.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  252.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  253.         BOOL         ApplyChanges();
  254.         BOOL         InitDialog();
  255.  
  256.     private:
  257.         BOOL    m_bAutoLoadImages;
  258.         BOOL    m_bEnableJava;
  259.         BOOL    m_bEnableJavaScript;
  260.         BOOL    m_bEnableStyleSheets;
  261.         BOOL    m_bSendEmailAddressForFTPPassword;
  262.         BOOL    m_bEnableAutoInstall;
  263.         int        m_nCookieAcceptance;
  264.         BOOL    m_bWarnAboutCookies;
  265. };
  266.  
  267. /////////////////////////////////////////////////////////////////////////////
  268. // CCachePrefs
  269.  
  270. class CCachePrefs : public CBrowserPropertyPage {
  271.     public:
  272.         CCachePrefs();
  273.  
  274.     protected:
  275.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  276.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  277.         BOOL         ApplyChanges();
  278.         BOOL         InitDialog();
  279.  
  280.         // Event Processing
  281.         BOOL        OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  282.     
  283.     private:
  284.         UINT    m_uDiskCacheSize;
  285.         UINT    m_uMemoryCacheSize;
  286.         int        m_nCheckDocFrequency;
  287.         CString    m_strDiskCacheDir;
  288.  
  289. #ifdef _WIN32
  290.         BOOL        BrowseForCacheFolder(LPSTR lpszPath);
  291. #endif
  292. };
  293.  
  294. /////////////////////////////////////////////////////////////////////////////
  295. // CProxiesPrefs
  296.  
  297. class CProxiesPrefs : public CBrowserPropertyPage {
  298.     public:
  299.         CProxiesPrefs();
  300.  
  301.     protected:
  302.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  303.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  304.         BOOL         ApplyChanges();
  305.         BOOL         InitDialog();
  306.  
  307.         // Event Processing
  308.         BOOL    OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  309.  
  310.     private:
  311.         int        m_nProxyType;
  312.         CString    m_strAutoConfigURL;
  313.         
  314.         void    EnableControls();
  315. };
  316.  
  317. /////////////////////////////////////////////////////////////////////////////
  318. // CDiskSpacePrefs
  319.  
  320. class CDiskSpacePrefs : public CBrowserPropertyPage {
  321.     public:
  322.         CDiskSpacePrefs();
  323.  
  324.     protected:
  325.         STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  326.         BOOL         InitDialog();
  327.         BOOL         DoTransfer(BOOL bSaveAndValidate);
  328.         BOOL         ApplyChanges();
  329.  
  330.         // Event Processing
  331.         BOOL    OnCommand(int id, HWND hwndCtl, UINT notifyCode);
  332.  
  333.     private:
  334.  
  335.         BOOL    m_bLimitSize;
  336.         int        m_nLimitSize;
  337.         BOOL    m_bPromptPurge;
  338.         int        m_nPurgeSize;
  339.         int        m_nKeepMethod;
  340.         int        m_nKeepDays;
  341.         int        m_nKeepCounts;
  342.         BOOL    m_bKeepUnread;
  343.         BOOL    m_bRemoveBody;
  344.         int        m_nRemoveDays;
  345. };
  346.  
  347. #endif /* __PAGES_H_ */
  348.  
  349.