NSFlexPropertySheetView.cpp

Go to the documentation of this file.
00001 #ifndef NSFLEXPROPERTYSHEETVIEW_IMPLEMENTATION_FILE
00002 #define NSFLEXPROPERTYSHEETVIEW_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 "NSFlexPropertySheetView.h"
00009 #include "NSFlexPropertySheet.h"
00010 #include "NSFlexMDIChildWnd.h"
00011 #include "NSFlexPropertyPage.h"
00012 #include "NSViewsMessages.h"
00013 
00014 #include <basis/convert_utf.h>
00015 
00016 IMPLEMENT_DYNAMIC(CNSFlexPropertySheetView, CScrollView)
00017 
00018 BEGIN_MESSAGE_MAP(CNSFlexPropertySheetView, CScrollView)
00019   //{{AFX_MSG_MAP(CNSFlexPropertySheetView)
00020   ON_WM_SIZE()
00021   ON_WM_SETFOCUS()
00022   //}}AFX_MSG_MAP
00023 END_MESSAGE_MAP()
00024 
00025 CNSFlexPropertySheetView::CNSFlexPropertySheetView(UINT nSelectPage /*=0*/)
00026 {
00027   m_pFlexPropertySheet = new CNSFlexPropertySheet(to_unicode_temp(""), this,nSelectPage);
00028 }
00029 
00030 CNSFlexPropertySheetView::~CNSFlexPropertySheetView()
00031 {
00032   delete m_pFlexPropertySheet;
00033 }
00034 
00035 CNSFlexPropertySheet* CNSFlexPropertySheetView::GetFlexPropertySheet()
00036 {
00037   return m_pFlexPropertySheet;
00038 }
00039 
00040 void CNSFlexPropertySheetView::OnInitialUpdate() 
00041 {
00042   // REVISION 4/10/97 TO WORK WITH SDI APPLICATIONS (Ed Smetak)
00043   // If File/New for SDI application, m_pFlexPropertySheet already
00044   // has been created, so just return in this case.
00045   if (m_pFlexPropertySheet->m_hWnd) 
00046     return;
00047   // END REVISION (Ver 1.04)
00048 
00049   m_pFlexPropertySheet->Create(this,WS_SYSMENU|WS_CHILD|WS_VISIBLE,0);
00050 
00051   ASSERT(::IsWindow(m_pFlexPropertySheet->GetSafeHwnd()));
00052   ASSERT(m_pFlexPropertySheet->GetPageCount() > 0);
00053 
00054     ::SetWindowLong(m_pFlexPropertySheet->m_hWnd,GWL_STYLE,
00055     (::GetWindowLong(m_pFlexPropertySheet->m_hWnd,GWL_STYLE)
00056     & ~(LONG)WS_SYSMENU));   
00057 
00058   CRect rectWindow;
00059   m_pFlexPropertySheet->GetWindowRect(rectWindow);
00060 
00061     SetScrollSizes(MM_TEXT,rectWindow.Size());
00062 
00063   DWORD dwExStyle = GetExStyle();
00064   if (dwExStyle & WS_EX_CLIENTEDGE)
00065     {
00066     dwExStyle &= ~((DWORD)WS_EX_CLIENTEDGE); 
00067       ::SetWindowLong(m_hWnd,GWL_EXSTYLE,(LONG)dwExStyle);
00068   }
00069 
00070   ResizeParentToFit(FALSE);
00071 
00072   CWnd *pParentFrame = GetParentFrame();
00073   ASSERT(pParentFrame);
00074   if (pParentFrame->IsKindOf(RUNTIME_CLASS(CNSFlexMDIChildWnd)))
00075     pParentFrame->SendMessage(WM_SETMINTRACKSIZE);
00076 #ifdef _DEBUG
00077   else
00078     TRACE_PRINT("Warning!  CNSFlexPropertySheetView used without "
00079            "a CNSFlexMDIChildWnd frame.\n");
00080 #endif
00081 }
00082 
00083 void CNSFlexPropertySheetView::OnSetFocus(CWnd* pOldWnd) 
00084 {
00085   m_pFlexPropertySheet->SetFocus();
00086 }
00087 
00088 void CNSFlexPropertySheetView::OnSize(UINT nType, int cx, int cy) 
00089 {
00090   CScrollView::OnSize(nType, cx, cy);
00091 
00092     if (nType != SIZE_MINIMIZED && 
00093     ::IsWindow(m_pFlexPropertySheet->GetSafeHwnd()))
00094   {
00095         CRect rect;
00096         GetWindowRect(rect);
00097         CSize sizeScroll = GetTotalSize();
00098         int cxNew = max(rect.Width(), sizeScroll.cx);
00099         int cyNew = max(rect.Height(), sizeScroll.cy);
00100     m_pFlexPropertySheet->SetWindowPos(NULL,0,0,cxNew,
00101       cyNew,SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
00102   }
00103 }
00104 
00105 void CNSFlexPropertySheetView::OnUpdate(CView* pSender, LPARAM lHint,
00106   CObject* pHint) 
00107 {
00108   for (int nPage = 0; nPage < m_pFlexPropertySheet->GetPageCount(); nPage++)
00109   {
00110     CNSFlexPropertyPage* pPropertyPage = 
00111       (CNSFlexPropertyPage*)m_pFlexPropertySheet->GetPage(nPage);
00112 
00113     if(::IsWindow(pPropertyPage->GetSafeHwnd()))
00114       pPropertyPage->OnUpdate(pSender,lHint,pHint);
00115   }
00116 }
00117 
00118 BOOL CNSFlexPropertySheetView::PreCreateWindow(CREATESTRUCT& cs) 
00119 {
00120     cs.style |= WS_CLIPCHILDREN;
00121   return CScrollView::PreCreateWindow(cs);
00122 }
00123 
00124 BOOL CNSFlexPropertySheetView::PreTranslateMessage(MSG* pMsg) 
00125 {
00126   // check for Shift+F1 help
00127   CFrameWnd* pFrameWnd = GetTopLevelFrame();
00128   if (pFrameWnd && pFrameWnd->m_bHelpMode)
00129     return FALSE;
00130 
00131   // make sure accelerators work
00132   pFrameWnd = GetParentFrame();
00133   while (pFrameWnd)
00134   {
00135     if (pFrameWnd->PreTranslateMessage(pMsg))
00136       return TRUE;
00137 
00138     pFrameWnd = pFrameWnd->GetParentFrame();
00139   }
00140 
00141   return FALSE;
00142 }
00143 
00144 #endif //NSFLEXPROPERTYSHEETVIEW_IMPLEMENTATION_FILE
00145 

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