00001 #ifndef NSFLEXPROPERTYPAGE_IMPLEMENTATION_FILE
00002 #define NSFLEXPROPERTYPAGE_IMPLEMENTATION_FILE
00003
00004
00005
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
00019 ON_WM_CREATE()
00020 ON_WM_SIZE()
00021
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 ) : CPropertyPage(nIDTemplate,nIDCaption)
00032 {
00033 m_pFlexConstraintList = new CNSFlexConstraintList(this);
00034 }
00035
00036 CNSFlexPropertyPage::CNSFlexPropertyPage(LPCTSTR lpszTemplateName,
00037 UINT nIDCaption ) : 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
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
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
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
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
00149
00150
00151
00152
00153
00154 Invalidate();
00155
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