home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / edtable.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  7.1 KB  |  245 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. // edtable.h : header file
  20. //
  21. #ifdef EDITOR
  22. #ifndef _EDTABLE_H
  23. #define _EDTABLE_H
  24.  
  25. //#include "edres1.h"
  26. #include "edtrccln.h"
  27. #include "edprops.h" // For CColorButton
  28.  
  29. // Limits on table parameters
  30. #define MAX_TABLE_ROWS    100
  31. #define MAX_TABLE_COLUMNS 100
  32. // This is also limit used for cell size, padding, and borders
  33. #define MAX_TABLE_PIXELS  10000
  34.  
  35. ////////////////////////////////////////////////////
  36. // Property Pages for Tabbed Table dialogs
  37. class CTablePage : public CNetscapePropertyPage
  38. {
  39. public:
  40.     CTablePage(CWnd *pParent, MWContext * pMWContext = NULL,
  41.                CEditorResourceSwitcher * pResourceSwitcher = NULL,
  42.                EDT_TableData * pTableData = NULL);
  43.     void OnOK();
  44.  
  45.     //{{AFX_DATA(CTablePage)
  46.     enum { IDD = IDD_PAGE_TABLE };   // Put Dialog ID here
  47.     int        m_iRows;
  48.     int        m_iColumns;
  49.     int        m_iAlign;
  50.     int        m_iCaption;
  51.     int        m_iBorderWidth;
  52.     int        m_iCellPadding;
  53.     int     m_iCellSpacing;
  54.     BOOL    m_bColumnHeader;
  55.     BOOL    m_bUseColor;
  56.     BOOL    m_bUseWidth;
  57.     BOOL    m_bUseHeight;
  58.     int        m_iHeightType;
  59.     BOOL    m_bRowHeader;
  60.     int        m_iWidthType;
  61.     BOOL    m_bUseCols;
  62.     CString    m_csBackgroundImage;
  63.     BOOL    m_bNoSave;
  64.     BOOL    m_bBorderWidthDefined;
  65.     //}}AFX_DATA
  66.  
  67.  
  68.     // Implementation
  69. protected:              
  70.  
  71.     CColorButton m_ChooseColorButton;
  72.     BOOL         m_bActivated;
  73.     BOOL         OnSetActive();
  74.     int             m_iWidth;
  75.     int             m_iHeight;
  76.  
  77. private:
  78.     MWContext          *m_pMWContext;
  79.     EDT_TableData      *m_pTableData;
  80.     COLORREF           m_crColor;
  81.  
  82.     BOOL               m_bImageChanged;
  83.     BOOL               m_bValidImage;
  84.  
  85.     CColorButton       m_ColorButton;
  86.     BOOL               m_bCustomColor;
  87.     int32              m_iParentWidth;
  88.     int32              m_iParentHeight;
  89.  
  90.     // Set before calling UpdateWidthAndHeight()
  91.     //  to not set the associated checkbox
  92.     BOOL               m_bInternalChangeEditbox;
  93.  
  94.     // This is used to change resource hInstance back to EXE
  95.     CEditorResourceSwitcher * m_pResourceSwitcher;
  96.  
  97. #ifdef XP_WIN16
  98.     // This will change resource hInstance to Editor dll (in constructor)
  99.     CEditorResourceSwitcher m_ResourceSwitcher;
  100. #endif
  101.  
  102. // Overrides
  103.     // ClassWizard generated virtual function overrides
  104.     //{{AFX_VIRTUAL(CTablePage)
  105.     protected:
  106.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  107.     virtual BOOL OnKillActive();
  108.     //}}AFX_VIRTUAL
  109.  
  110.     // Generated message map functions
  111.     //{{AFX_MSG(CTablePage)
  112.         // NOTE: the ClassWizard will add member functions here
  113.     afx_msg void OnChangeWidth();
  114.     afx_msg void OnChangeWidthType();
  115.     afx_msg void OnChangeHeight();
  116.     afx_msg void OnChangeHeightType();
  117.     afx_msg void OnOverrideColor();
  118.     afx_msg void OnChooseColor();
  119.     afx_msg void OnExtraHTML();
  120.     afx_msg void OnUseBkgrndImage();
  121.     afx_msg void OnChooseBkgrndImage();
  122.     afx_msg void OnChangeBkgrndImage();
  123.     afx_msg void OnNoSave();
  124.     afx_msg void OnHelp();
  125.     afx_msg void OnChangeBorder();
  126.     afx_msg void EnableApplyButton();
  127.     //}}AFX_MSG
  128.     DECLARE_MESSAGE_MAP()
  129. };
  130.  
  131. class CTableCellPage : public CNetscapePropertyPage
  132. {
  133. public:
  134.     CTableCellPage(CWnd *pParent, MWContext * pMWContext = NULL,
  135.                    CEditorResourceSwitcher * pResourceSwitcher = NULL,
  136.                    EDT_TableCellData * pCellData = NULL,
  137.                    UINT nIDCaption = 0);
  138.  
  139.     void OnOK();
  140.  
  141.     //{{AFX_DATA(CTableCellPage)
  142.     enum { IDD = IDD_PAGE_TABLE_CELL };   // Put Dialog ID here
  143.     int        m_iAlign;
  144.     int        m_iVAlign;
  145.     int        m_iColumnSpan;
  146.     int        m_iRowSpan;
  147.     int     m_iUseColor;
  148.     int     m_iUseWidth;
  149.     int     m_iUseHeight;
  150.     int     m_iHeader;
  151.     int     m_iNoWrap;
  152.     int        m_iHeightType;
  153.     int        m_iWidthType;
  154.     CString    m_csBackgroundImage;
  155.     BOOL    m_bNoSave;
  156.     //}}AFX_DATA
  157.  
  158. // Implementation
  159. protected:              
  160.     CColorButton m_ChooseColorButton;
  161.     BOOL         m_bActivated;
  162.     int             m_iWidth;
  163.     int             m_iHeight;
  164.     BOOL         OnSetActive();
  165.  
  166. private:
  167.     MWContext         *m_pMWContext;
  168.     EDT_TableCellData *m_pCellData; 
  169.     COLORREF           m_crColor;
  170.     CString            m_csTitle;
  171.     
  172.     // Text on page's tab
  173.     CString            m_csSingleCell;
  174.     CString            m_csSelectedCells;
  175.     CString            m_csSelectedRow;
  176.     CString            m_csSelectedCol;
  177.  
  178.  
  179.     BOOL               m_bImageChanged;
  180.     BOOL               m_bValidImage;
  181.     CColorButton       m_ColorButton;
  182.     BOOL               m_bCustomColor;
  183.     ED_HitType         m_iSelectionType;
  184.  
  185.     int32              m_iParentWidth;
  186.     int32              m_iParentHeight;
  187.  
  188.     // Set before calling UpdateWidthAndHeight()
  189.     //  to not set the associated checkbox
  190.     BOOL               m_bInternalChangeEditbox;
  191.  
  192.     // This is used to change resource hInstance back to EXE
  193.     CEditorResourceSwitcher * m_pResourceSwitcher;
  194.  
  195.     
  196. #ifdef XP_WIN16
  197.     // This will change resource hInstance to Editor dll (in constructor)
  198.     CEditorResourceSwitcher m_ResourceSwitcher;
  199. #endif
  200.  
  201. // Overrides
  202.     // ClassWizard generated virtual function overrides
  203.     //{{AFX_VIRTUAL(CTableCellPage)
  204.     protected:
  205.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  206.     virtual BOOL OnKillActive();
  207.     //}}AFX_VIRTUAL
  208.  
  209.     // Generated message map functions
  210.     //{{AFX_MSG(CTableCellPage)
  211.         // NOTE: the ClassWizard will add member functions here
  212.     afx_msg void OnChangeHAlign();
  213.     afx_msg void OnChangeVAlign();
  214.     afx_msg void OnChangeWidth();
  215.     afx_msg void OnChangeWidthType();
  216.     afx_msg void OnChangeHeight();
  217.     afx_msg void OnChangeHeightType();
  218.     afx_msg void OnOverrideColor();
  219.     afx_msg void OnChooseColor();
  220.     afx_msg void OnExtraHTML();
  221.     afx_msg void OnUseBkgrndImage();
  222.     afx_msg void OnChooseBkgrndImage();
  223.     afx_msg void OnChangeBkgrndImage();
  224.     afx_msg void OnPrevious();
  225.     afx_msg void OnNext();
  226.     afx_msg void OnChangeSelectionType();
  227.     afx_msg void OnHelp();
  228.     afx_msg void EnableApplyButton();
  229.     afx_msg void OnInsert();
  230.     afx_msg void OnDelete();
  231.     //}}AFX_MSG
  232.     DECLARE_MESSAGE_MAP()
  233.  
  234.     void ChangeSelection(ED_MoveSelType iMoveType);
  235.     // Set 2-state vs. 3-state checkbox and return checkbox state
  236.     int InitCheckbox(UINT nIDCheckbox, ED_CellFormat cf, BOOL bSetState);
  237.  
  238.     // Init controls separated from OnInitDialog()
  239.     //  to allow switching cells while within the dialog
  240.     void InitPageData();
  241. };
  242.  
  243. #endif // _EDTABLE_H
  244. #endif // EDITOR
  245.