NSFlexFormView.cpp

Go to the documentation of this file.
00001 #ifndef NSFLEXFORMVIEW_IMPLEMENTATION_FILE
00002 #define NSFLEXFORMVIEW_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 "NSFlexFormView.h"
00009 #include "NSFlexConstraintList.h"
00010 #include "NSFlexMDIChildWnd.h"
00011 #include "NSViewsMessages.h"
00012 
00013 #include <basis/convert_utf.h>
00014 
00015 IMPLEMENT_DYNAMIC(CNSFlexFormView, CFormView)
00016 
00017 BEGIN_MESSAGE_MAP(CNSFlexFormView, CFormView)
00018   //{{AFX_MSG_MAP(CNSFlexFormView)
00019   ON_WM_CREATE()
00020   ON_WM_SIZE()
00021   //}}AFX_MSG_MAP
00022 END_MESSAGE_MAP()
00023 
00024 CNSFlexFormView::CNSFlexFormView(UINT nIDTemplate) :
00025     CFormView(nIDTemplate)
00026 {
00027   m_pFlexConstraintList = new CNSFlexConstraintList(this);
00028 
00029   // REVISION 4/10/97 TO WORK WITH SDI APPLICATIONS (Ed Smetak)
00030   m_bNeedInitialUpdate = TRUE;
00031   // END REVISION (Ver 1.04)
00032 }
00033 
00034 CNSFlexFormView::CNSFlexFormView(LPCTSTR lpszTemplateName) :
00035   CFormView(lpszTemplateName)
00036 {
00037   m_pFlexConstraintList = new CNSFlexConstraintList(this);
00038 
00039   // REVISION 4/10/97 TO WORK WITH SDI APPLICATIONS (Ed Smetak)
00040   m_bNeedInitialUpdate = TRUE;
00041   // END REVISION (Ver 1.04)
00042 }
00043 
00044 CNSFlexFormView::~CNSFlexFormView()
00045 {
00046     delete m_pFlexConstraintList;
00047 }
00048 
00049 void CNSFlexFormView::AddFlexConstraint(UINT nControlID, 
00050   const CNSFlexHorizontalConstraint& HorizontalConstraint,
00051   const CNSFlexVerticalConstraint& VerticalConstraint)
00052 {
00053   m_pFlexConstraintList->AddConstraint(nControlID,
00054     HorizontalConstraint, VerticalConstraint);
00055 }
00056 
00057 int CNSFlexFormView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
00058 {
00059   if (CFormView::OnCreate(lpCreateStruct) == -1)
00060     return -1;
00061   
00062     m_pFlexConstraintList->
00063     SetClientBaseSize(lpCreateStruct->cx,lpCreateStruct->cy);
00064   
00065   return 0;
00066 }
00067 
00068 void CNSFlexFormView::OnInitialUpdate() 
00069 {
00070   // REVISION 4/10/97 TO WORK WITH SDI APPLICATIONS (Ed Smetak)
00071   if (m_bNeedInitialUpdate)
00072   {
00073     m_bNeedInitialUpdate = FALSE;
00074   // END REVISION (Ver 1.04)
00075 
00076 
00077     ResizeParentToFit(FALSE);
00078 
00079   CWnd *pParentFrame = GetParentFrame();
00080   ASSERT(pParentFrame);
00081 
00082   if (pParentFrame->IsKindOf(RUNTIME_CLASS(CNSFlexMDIChildWnd)))
00083     pParentFrame->SendMessage(WM_SETMINTRACKSIZE);
00084 #ifdef _DEBUG
00085   else
00086     TRACE_PRINT("Warning!  "
00087          "CNSFlexFormView used without CNSFlexMDIChildWnd frame.\n");
00088 #endif
00089 
00090   CFormView::OnInitialUpdate();
00091 
00092   ASSERT(m_pFlexConstraintList->AssertAllFlexControlsExist());
00093 
00094   // REVISION 4/10/97 TO WORK WITH SDI APPLICATIONS (Ed Smetak)
00095   }
00096   else
00097     CFormView::OnInitialUpdate();
00098   // END REVISION (Ver 1.04)
00099 }
00100 
00101 void CNSFlexFormView::OnSize(UINT nType, int cx, int cy) 
00102 {
00103   CFormView::OnSize(nType, cx, cy);
00104   
00105     if (nType != SIZE_MINIMIZED)
00106         m_pFlexConstraintList->PositionControls(cx,cy);
00107 
00108 /* Here is an alternate version of this function that was presented in the context of a 
00109    bug fix but does not resemble the code above.  
00110    May be useful to try if things aren't working as expected here.  MTM 12-8-2000
00111 
00112     if (nType != SIZE_MINIMIZED)
00113   {
00114     CPoint* pt = NULL;
00115         CPoint scrollPos;
00116     if (m_nMapMode > 0)
00117     {
00118       scrollPos = GetScrollPosition();
00119       pt = &scrollPos;
00120     }
00121         m_pFlexConstraintList->PositionControls(cx, cy, pt);
00122     Invalidate();
00123   }
00124 */
00125 }
00126 
00127 #endif //NSFLEXFORMVIEW_IMPLEMENTATION_FILE
00128 

Generated on Wed Nov 19 04:28:39 2008 for HOOPLE Libraries by  doxygen 1.5.1