00001 // This code is a part of the NanoSoft NSViews C++ Library. 00002 // Copyright (C) 1996 NanoSoft Corporation. All rights reserved. 00003 00004 #ifndef __NSFlexPropertySheet_h__ 00005 #define __NSFlexPropertySheet_h__ 00006 00007 #include "NSViewsAfxExt.h" 00008 00009 class CNSFlexConstraintList; 00010 00011 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00012 00013 // CNSFlexPropertySheet turns a normal CPropertySheet into a "flexible" 00014 // property sheet with pages that automatically reposition their controls when 00015 // the property sheet window is resized. Note that pages of a CPropertySheet 00016 // must be derived from CNSFlexPropertyPage. 00017 00018 // See the MFC CPropertySheet documentation for additional information. 00019 00020 class AFX_EXT_NSVIEWS CNSFlexPropertySheet : public CPropertySheet 00021 { 00022 00023 DECLARE_DYNAMIC(CNSFlexPropertySheet) 00024 00025 // -------------------------------------------------------------------------- 00026 00027 public: 00028 00029 // Constructors. 00030 CNSFlexPropertySheet(); 00031 CNSFlexPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, 00032 UINT nSelectPage = 0, void* pSubject = NULL); 00033 CNSFlexPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, 00034 UINT nSelectPage = 0, void* pSubjecgt = NULL); 00035 // nIDCaption - ID of the caption to be used for the property sheet. 00036 // pParentWnd - Points to the parent window of the property sheet. If NULL, 00037 // the parent window will be the main window of the application. 00038 // nSelectPage - The index of the page that will initially be on top. 00039 // Default is the first page added to the sheet. 00040 // pszCaption - Points to a string containing the caption to be used for 00041 // the property sheet. Cannot be NULL. 00042 // pSubject - Pointer to subject that will be passed to OnApplyChanges(). 00043 00044 // Destructor. 00045 virtual ~CNSFlexPropertySheet(); 00046 00047 // Returns the subject pointer that was set in the constructor or using 00048 // SetSubject(). This function only applies to modal property sheets 00049 // (i.e. a CNSFlexPropertySheet that is NOT contained in a 00050 // CNSFlexPropertySheetView). 00051 void* GetSubject() const; 00052 00053 // Called when either the Apply or OK button is pressed. Provides a nice 00054 // place to handle the application of changes to a subject. Nonzero TRUE 00055 // return indicates changes were successfully applied. Zero FALSE return 00056 // indicates application of changes failed. This function only applies 00057 // to modal property sheets (i.e. a CNSFlexPropertySheet that is NOT 00058 // contained in a CNSFlexPropertySheetView). 00059 virtual BOOL OnApplyChanges(void* pSubject); 00060 // pSubject - Pointer to subject that was set in the constructor or using 00061 // SetSubject(). 00062 00063 // Set the subject pointer that gets passed to OnApplyChanges. 00064 // The typical time to call this function is after the CNSFlexDialog has 00065 // been constructed, but before calling DoModal(). This function only 00066 // applies to modal property sheets (i.e. a CNSFlexPropertySheet that is 00067 // NOT contained in a CNSFlexPropertySheetView). 00068 virtual void SetSubject(void* pSubject); 00069 // pSubject - Pointer to subject that will be passed to OnApplyChanges(). 00070 00071 // -------------------------------------------------------------------------- 00072 00073 public: 00074 00075 // ClassWizard 00076 //{{AFX_VIRTUAL(CNSFlexPropertySheet) 00077 public: 00078 virtual BOOL OnInitDialog(); 00079 virtual BOOL PreTranslateMessage(MSG* pMsg); 00080 //}}AFX_VIRTUAL 00081 00082 protected: 00083 00084 // ClassWizard 00085 //{{AFX_MSG(CNSFlexPropertySheet) 00086 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 00087 afx_msg void OnSize(UINT nType, int cx, int cy); 00088 afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); 00089 afx_msg BOOL OnEraseBkgnd(CDC* pDC); 00090 //}}AFX_MSG 00091 afx_msg LRESULT OnPageSetActive(WPARAM wParam, LPARAM lParam); 00092 afx_msg void OnApply(); 00093 afx_msg void OnCancel(); 00094 afx_msg void OnOK(); 00095 DECLARE_MESSAGE_MAP() 00096 00097 private: 00098 00099 CNSFlexConstraintList* m_pFlexConstraintList; 00100 int m_nMinTrackingWidth; 00101 int m_nMinTrackingHeight; 00102 void* m_pSubject; 00103 bool m_bLastCommandWasEscape; 00104 00105 }; 00106 00107 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00108 00109 #endif
1.5.1