NSFlexPropertyPage.cpp

Go to the documentation of this file.
00001 #ifndef NSFLEXPROPERTYPAGE_IMPLEMENTATION_FILE
00002 #define NSFLEXPROPERTYPAGE_IMPLEMENTATION_FILE
00003 
00004 // This code is a part of the NanoSoft NSViews C++ Library.
00005 // Copyright (C) 1996 NanoSoft Corporation. All rights reserved.
00006 
00007 #include "stdafx.h"
00008 #include "NSFlexPropertyPage.h"
00009 #include "NSFlexConstraintList.h"
00010 #include "NSFlexPropertySheet.h"
00011 #include "NSViewsMessages.h"
00012 
00013 #include <basis/convert_utf.h>
00014 
00015 IMPLEMENT_DYNAMIC(CNSFlexPropertyPage, CPropertyPage)
00016 
00017 BEGIN_MESSAGE_MAP(CNSFlexPropertyPage, CPropertyPage)
00018   //{{AFX_MSG_MAP(CNSFlexPropertyPage)
00019   ON_WM_CREATE()
00020   ON_WM_SIZE()
00021   //}}AFX_MSG_MAP
00022 END_MESSAGE_MAP()
00023 
00024 CNSFlexPropertyPage::CNSFlexPropertyPage() 
00025 : CPropertyPage()
00026 {
00027   m_pFlexConstraintList = new CNSFlexConstraintList(this);
00028 }
00029 
00030 CNSFlexPropertyPage::CNSFlexPropertyPage(UINT nIDTemplate, 
00031   UINT nIDCaption /*=0*/) : CPropertyPage(nIDTemplate,nIDCaption)
00032 {
00033   m_pFlexConstraintList = new CNSFlexConstraintList(this);
00034 }
00035   
00036 CNSFlexPropertyPage::CNSFlexPropertyPage(LPCTSTR lpszTemplateName, 
00037   UINT nIDCaption /*=0*/) : CPropertyPage(lpszTemplateName,nIDCaption)
00038 {
00039   m_pFlexConstraintList = new CNSFlexConstraintList(this);
00040 }
00041 
00042 CNSFlexPropertyPage::~CNSFlexPropertyPage()
00043 {
00044     delete m_pFlexConstraintList;
00045 }
00046 
00047 void CNSFlexPropertyPage::AddFlexConstraint(UINT nControlID, 
00048   const CNSFlexHorizontalConstraint& HorizontalConstraint,
00049   const CNSFlexVerticalConstraint& VerticalConstraint)
00050 {
00051   m_pFlexConstraintList->AddConstraint(nControlID,
00052     HorizontalConstraint, VerticalConstraint);
00053 }
00054 
00055 CDocument* CNSFlexPropertyPage::GetDocument() const
00056 {
00057   // This function was revised 2/24/97 to work properly for
00058   // SDI applications. (Ed Smetak)
00059 
00060   // ORIGINAL CODE:
00061 
00062     // CFrameWnd* pFrameWnd = (CFrameWnd *)GetParentFrame();
00063     // if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIChildWnd)) ||
00064   //     pFrameWnd->IsKindOf(RUNTIME_CLASS(COleIPFrameWnd)))
00065     //         return pFrameWnd->GetActiveDocument();
00066     // return NULL;
00067 
00068   // REVISED CODE: (Ver 1.03)
00069 
00070     CFrameWnd* pFrameWnd = GetParentFrame();
00071 
00072     if (pFrameWnd)
00073     return pFrameWnd->GetActiveDocument();
00074 
00075     return NULL;
00076 }
00077 
00078 CView* CNSFlexPropertyPage::GetView() const
00079 {
00080   // This function was revised 2/24/97 to work properly for
00081   // SDI applications. (Ed Smetak)
00082 
00083   // ORIGINAL CODE:
00084 
00085     // CFrameWnd* pFrameWnd = (CFrameWnd *)GetParentFrame();
00086     // if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIChildWnd)) ||
00087   //      pFrameWnd->IsKindOf(RUNTIME_CLASS(COleIPFrameWnd)))
00088     //         return pFrameWnd->GetActiveView();
00089     // return NULL;
00090 
00091   // REVISED CODE: (Ver 1.03)
00092 
00093     CFrameWnd* pFrameWnd = GetParentFrame();
00094 
00095   if (pFrameWnd)
00096     return pFrameWnd->GetActiveView();
00097 
00098   return NULL;
00099 }
00100 
00101 int CNSFlexPropertyPage::OnCreate(LPCREATESTRUCT lpCreateStruct) 
00102 {
00103     m_pFlexConstraintList->
00104     SetClientBaseSize(lpCreateStruct->cx,lpCreateStruct->cy);
00105 
00106   if (CPropertyPage::OnCreate(lpCreateStruct) == -1)
00107     return -1;
00108   
00109   return 0;
00110 }
00111 
00112 BOOL CNSFlexPropertyPage::OnInitDialog() 
00113 {
00114   CPropertyPage::OnInitDialog();
00115 
00116   if (GetDocument())
00117     OnUpdate(NULL,0,NULL);
00118 
00119 #ifdef _DEBUG
00120   if (!GetParent()->IsKindOf(RUNTIME_CLASS(CNSFlexPropertySheet)))
00121     TRACE_PRINT("Warning!  "
00122          "CNSFlexPropertyPage used without CNSFlexPropertySheet.\n");
00123 #endif
00124 
00125   ASSERT(m_pFlexConstraintList->AssertAllFlexControlsExist());
00126 
00127 
00128   return TRUE;
00129 }
00130 
00131 BOOL CNSFlexPropertyPage::OnSetActive() 
00132 {
00133   if (!CPropertyPage::OnSetActive())
00134     return FALSE;
00135 
00136   GetParent()->SendMessage(WM_PAGESETACTIVE);
00137     return TRUE;
00138 }
00139 
00140 void CNSFlexPropertyPage::OnSize(UINT nType, int cx, int cy) 
00141 {
00142   CPropertyPage::OnSize(nType, cx, cy);
00143   
00144     if (nType != SIZE_MINIMIZED)
00145     {
00146         m_pFlexConstraintList->PositionControls(cx,cy);
00147 
00148     // REVISION 4/10/97 TO WORK WITH ACTIVEX CONTROLS (Ed Smetak)
00149         // To get rid of screen garbage left on Windows NT before version 4.0
00150         // and under Win32s
00151         // DWORD dwVersion = GetVersion(); 
00152         // if (LOBYTE(LOWORD(dwVersion)) < 4)
00153     //     Invalidate();
00154         Invalidate();
00155     // END REVISION (Ver 1.04)
00156     }
00157 }
00158 
00159 void CNSFlexPropertyPage::OnUpdate(CView* pSender, LPARAM lHint, 
00160   CObject* pHint)  
00161 {
00162 
00163 }
00164 
00165 
00166 #endif //NSFLEXPROPERTYPAGE_IMPLEMENTATION_FILE
00167 

Generated on Fri Nov 28 04:28:59 2008 for HOOPLE Libraries by  doxygen 1.5.1