Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CParentInfo Class Reference

#include <parentinfo.h>

List of all members.

Public Member Functions

void DeterminBorders (CControlList *pControlList)
void Annotate (HDC hdc)
CEdge ** GetHorizontalEdges ()
CEdge ** GetVerticalEdges ()
void Resize (int width, int height)
 CParentInfo ()
virtual ~CParentInfo ()
void Init (HWND h)
LONG GetWidth () const
LONG GetHeight () const
LONG GetLeft () const
LONG GetTop () const
LONG GetRight () const
LONG GetBottom () const
void DeterminSize ()
HWND GetWindow () const
 PROPERTY (LONG, RightBorder)
 PROPERTY (LONG, LeftBorder)
 PROPERTY (LONG, TopBorder)
 PROPERTY (LONG, BottomBorder)
CEdgeAddEdge (int Position, int Axis, BOOL Flexible=false, int Offset=0)
CEdgeAddEdge (CGuide *pGuide, int Offset=0)
void ConstructBorders ()
CEdgeFindCloseEdge (CEdge &Fixed, int Offset)
CEdgeGetLeftEdge ()
CEdgeGetRightEdge ()
CEdgeGetTopEdge ()
CEdgeGetBottomEdge ()
int GetNumHoriz () const
int GetNumVert () const
 PROPERTY (DIMENSION, MinimumSize)

Private Attributes

DIMENSION m_MinimumSize
RECT m_Size
HWND m_hWnd
LONG m_RightBorder
LONG m_LeftBorder
LONG m_TopBorder
LONG m_BottomBorder
CEdgeCache m_Edges
CEdgem_pLeftEdge
CEdgem_pRightEdge
CEdgem_pTopEdge
CEdgem_pBottomEdge


Constructor & Destructor Documentation

CParentInfo::CParentInfo  ) 
 

Definition at line 15 of file parentinfo.cpp.

References m_pBottomEdge, m_pLeftEdge, m_pRightEdge, m_pTopEdge, and NULL.

00016 { 00017 SetRightBorder(0); 00018 SetLeftBorder(0); 00019 SetTopBorder(0); 00020 SetBottomBorder(0); 00021 m_pTopEdge=NULL; 00022 m_pBottomEdge=NULL; 00023 m_pLeftEdge=NULL; 00024 m_pRightEdge=NULL; 00025 }

CParentInfo::~CParentInfo  )  [virtual]
 

Definition at line 41 of file parentinfo.cpp.

00042 { 00043 00044 }


Member Function Documentation

CEdge * CParentInfo::AddEdge CGuide pGuide,
int  Offset = 0
 

Definition at line 171 of file parentinfo.cpp.

References AddEdge(), CEdgeCache::Create(), m_Edges, and Offset.

00172 { 00173 // TRACE(L"Associating another edge %03d from 0x%08x\n", Offset , Edge); 00174 return m_Edges.Create( pGuide, Offset); 00175 }

CEdge * CParentInfo::AddEdge int  Position,
int  Axis,
BOOL  Flexible = false,
int  Offset = 0
 

Definition at line 75 of file parentinfo.cpp.

References ABS, AddEdge(), CEdgeCache::Create(), CEdge::GetAxis(), CEdgeCache::GetEdge(), CEdge::GetGuide(), CEdge::GetPosition(), L, m_Edges, NULL, and TRACE.

Referenced by AddEdge(), ConstructBorders(), CResizeControlGeneric::DeterminBottomAttatchments(), CResizeControlGeneric::DeterminLeftAttatchments(), CResizeControlGeneric::DeterminRightAttatchments(), and CResizeControlGeneric::DeterminTopAttatchments().

00076 { 00077 int i=0; 00078 CEdge * pEdge; 00079 CGuide * pClosest=NULL; 00080 int closest=0xffff; 00081 00082 // 00083 // First see if the edge is what we wanted 00084 // 00085 while( pEdge=m_Edges.GetEdge(i++) ) 00086 { 00087 if(pEdge->GetPosition() == Position ) 00088 { 00089 if( pEdge->GetAxis() == Axis ) 00090 { 00091 TRACE(L"Guide REUSE:: %03d, %02d\n",Position, Axis); 00092 return pEdge; 00093 } 00094 } 00095 } 00096 00097 i=0; 00098 while ( pEdge=m_Edges.GetEdge(i++)) 00099 { 00100 CGuide * pGuide=pEdge->GetGuide(); 00101 00102 if(pGuide->GetAxis() == Axis ) 00103 { 00104 // if( pEdge->GetFlexible() == Flexible ) 00105 { 00106 int distance=Position -pGuide->GetPosition() ; 00107 if( ABS(distance) <= Slop ) 00108 { 00109 if( Slop == 0 ) 00110 return pEdge; 00111 00112 // 00113 // Within the range, but is it the best? 00114 // 00115 if(closest==0xffff) 00116 { 00117 closest=distance; 00118 pClosest=pGuide; 00119 } 00120 00121 if( ABS(distance)<=ABS(closest) ) 00122 { 00123 pClosest=pGuide; 00124 closest=distance; 00125 } 00126 } 00127 } 00128 } 00129 } 00130 00131 if(pClosest) 00132 { 00133 // 00134 // Create a new edge with the same guide, different offset. 00135 // 00136 closest = Position - pClosest->GetPosition(); 00137 TRACE(L"Guide CLOSE:: %03d, %02d, closest %d, actual pos %03d\n",pClosest->GetPosition(), pClosest->GetAxis(), closest, Position); 00138 return m_Edges.Create( pClosest, closest); 00139 } 00140 00141 TRACE(L"Guide NEW :: %03d, %02d\n",Position, Axis); 00142 return m_Edges.Create(Position, Axis, Flexible, 0); 00143 }

void CParentInfo::Annotate HDC  hdc  ) 
 

Definition at line 252 of file parentinfo.cpp.

References Annotate(), CEdgeCache::GetEdge(), GetHeight(), CEdge::GetPosition(), GetWidth(), CEdge::IsHorizontal(), m_Edges, and NULL.

Referenced by Annotate().

00253 { 00254 int i=0; 00255 CEdge * pEdge; 00256 int iWidth=GetWidth(); 00257 int iHeight=GetHeight(); 00258 HPEN hpen = CreatePen( PS_SOLID, 1, RGB( 0xff,0x00,0x00) ); 00259 HGDIOBJ holdPen= SelectObject( hdc, hpen); 00260 while( pEdge=m_Edges.GetEdge(i++) ) 00261 { 00262 if( pEdge->IsHorizontal() ) 00263 { 00264 MoveToEx( hdc, 0, pEdge->GetPosition(), NULL ); 00265 LineTo( hdc, iWidth , pEdge->GetPosition() ); 00266 } 00267 else 00268 { 00269 MoveToEx( hdc, pEdge->GetPosition(), 0, NULL ); 00270 LineTo( hdc, pEdge->GetPosition(), iHeight ); 00271 } 00272 } 00273 SelectObject(hdc, holdPen); 00274 DeleteObject(hpen); 00275 }

void CParentInfo::ConstructBorders  ) 
 

Definition at line 184 of file parentinfo.cpp.

References AddEdge(), BOTTOM_AT, FALSE, GetHeight(), GetWidth(), LEFT_AT, m_pBottomEdge, m_pLeftEdge, m_pRightEdge, m_pTopEdge, RIGHT_AT, TOP_AT, and TRUE.

Referenced by DeterminBorders().

00185 { 00186 m_pLeftEdge=AddEdge( GetLeftBorder(), LEFT_AT, FALSE ); 00187 m_pRightEdge=AddEdge( GetWidth() - GetRightBorder(), RIGHT_AT, TRUE ); 00188 00189 m_pTopEdge=AddEdge( GetTopBorder(), TOP_AT, FALSE ); 00190 m_pBottomEdge=AddEdge( GetHeight() - GetBottomBorder(), BOTTOM_AT, TRUE ); 00191 }

void CParentInfo::DeterminBorders CControlList pControlList  ) 
 

Definition at line 282 of file parentinfo.cpp.

References BORDER, ConstructBorders(), DeterminBorders(), CControlList::GetControl(), L, and TRACE.

Referenced by DeterminBorders(), and CResizeDlg::WalkControls().

00283 { 00284 CResizeControl * pC; 00285 int i=0; 00286 00287 // 00288 // Now walk and see if we have any borders - this is a lame way to do it. 00289 // 00290 #define BORDER(Edge) if( pC->Get##Edge##Gap() < Get##Edge##Border() ) \ 00291 Set##Edge##Border(pC->Get##Edge##Gap()); 00292 00293 i=0; 00294 while( pC=pControlList->GetControl(i++) ) 00295 { 00296 if( pC->GetRightGap() < GetRightBorder() ) 00297 SetRightBorder(pC->GetRightGap()); 00298 } 00299 TRACE(L"Right border is %d\n", GetRightBorder() ); 00300 00301 i=0; 00302 while( pC=pControlList->GetControl(i++) ) 00303 { 00304 BORDER(Left); 00305 } 00306 TRACE(L"Left border is %d\n", GetLeftBorder() ); 00307 00308 i=0; 00309 while( pC=pControlList->GetControl(i++) ) 00310 { 00311 BORDER(Top); 00312 } 00313 TRACE(L"Top border is %d\n", GetTopBorder() ); 00314 00315 i=0; 00316 while( pC=pControlList->GetControl(i++) ) 00317 { 00318 BORDER(Bottom); 00319 } 00320 TRACE(L"Bottom border is %d\n", GetBottomBorder() ); 00321 00322 // 00323 // Now add these edges to the parent info. 00324 // or should the be add these guides to the parent info? 00325 // 00326 ConstructBorders(); 00327 }

void CParentInfo::DeterminSize  ) 
 

Definition at line 54 of file parentinfo.cpp.

References DIMENSION, GetClientRect(), GetHeight(), GetWidth(), GetWindow(), GetWindowRect(), tagDIMENSION::Height, L, m_Size, TRACE, and tagDIMENSION::Width.

Referenced by Init().

00055 { 00056 GetClientRect( GetWindow(), &m_Size); 00057 RECT r; 00058 GetWindowRect( GetWindow(), &r); 00059 DIMENSION d; 00060 d.Width= r.right - r.left; 00061 d.Height = r.bottom - r.top; 00062 SetMinimumSize(d); 00063 TRACE(L"ParentDimensions : %d by %d \n", 00064 GetWidth(), 00065 GetHeight()); 00066 }

CEdge & CParentInfo::FindCloseEdge CEdge Fixed,
int  Offset
 

Definition at line 149 of file parentinfo.cpp.

References ABS, FindCloseEdge(), Fixed, CEdge::GetAxis(), CEdgeCache::GetEdge(), CEdge::GetPosition(), m_Edges, and Offset.

Referenced by FindCloseEdge().

00150 { 00151 int i=0; 00152 CEdge * pEdge; 00153 while ( pEdge=m_Edges.GetEdge(i++) ) 00154 { 00155 if(pEdge->GetAxis() == Fixed.GetAxis() ) 00156 { 00157 int distance=Fixed.GetPosition() -pEdge->GetPosition() ; 00158 if( ABS(distance) <= Offset ) 00159 { 00160 return *pEdge; 00161 } 00162 } 00163 } 00164 return Fixed; 00165 }

LONG CParentInfo::GetBottom  )  const [inline]
 

Definition at line 40 of file parentinfo.h.

References m_Size.

Referenced by CResizeDlg::FindControls().

00040 { return m_Size.bottom; }

CEdge* CParentInfo::GetBottomEdge  )  [inline]
 

Definition at line 58 of file parentinfo.h.

References m_pBottomEdge.

00058 { return m_pBottomEdge; }

LONG CParentInfo::GetHeight  )  const [inline]
 

Definition at line 35 of file parentinfo.h.

References m_Size.

Referenced by Annotate(), ConstructBorders(), CResizeControlGeneric::DeterminLocation(), DeterminSize(), CScaleDlg::DoChangePos(), CResizeDlg::DoInitDialog(), CResizeControlGeneric::GetBottomGap(), Init(), CScaleDlg::ResizeControls(), and CResizeDlg::SpecialRowCol().

00035 { return m_Size.bottom-m_Size.top; }

CEdge ** CParentInfo::GetHorizontalEdges  ) 
 

Definition at line 234 of file parentinfo.cpp.

References CEdgeCache::GetEdge(), CEdge::IsHorizontal(), L, m_Edges, and TRACE.

Referenced by CResizeDlg::FindCommonGuides().

00235 { 00236 int iCount=m_Edges.GetNumHoriz(); 00237 CEdge ** ppEdges= new CEdge *[iCount]; 00238 CEdge * pEdge; 00239 int i=0,iDest=0; 00240 while( pEdge = m_Edges.GetEdge(i++) ) 00241 { 00242 if(pEdge->IsHorizontal()) 00243 ppEdges[iDest++] = pEdge; 00244 #ifdef _DEBUG 00245 if( iDest > iCount ) 00246 TRACE(L"Horiz edge count is off %d vs %d\n", iDest, iCount); 00247 #endif 00248 } 00249 return ppEdges; 00250 }

LONG CParentInfo::GetLeft  )  const [inline]
 

Definition at line 37 of file parentinfo.h.

References m_Size.

Referenced by CResizeControlGeneric::DeterminLocation(), and CResizeDlg::FindControls().

00037 { return m_Size.left; }

CEdge* CParentInfo::GetLeftEdge  )  [inline]
 

Definition at line 55 of file parentinfo.h.

References m_pLeftEdge.

Referenced by CResizeControlGeneric::Resize().

00055 { return m_pLeftEdge; }

int CParentInfo::GetNumHoriz  )  const [inline]
 

Definition at line 60 of file parentinfo.h.

References m_Edges.

Referenced by CResizeDlg::FindCommonGuides().

00060 { return m_Edges.GetNumHoriz(); }

int CParentInfo::GetNumVert  )  const [inline]
 

Definition at line 61 of file parentinfo.h.

References m_Edges.

Referenced by CResizeDlg::FindCommonGuides().

00061 { return m_Edges.GetNumVert(); }

LONG CParentInfo::GetRight  )  const [inline]
 

Definition at line 39 of file parentinfo.h.

References m_Size.

Referenced by CResizeDlg::FindControls(), and CResizeControlGeneric::GetRightGap().

00039 { return m_Size.right; }

CEdge* CParentInfo::GetRightEdge  )  [inline]
 

Definition at line 56 of file parentinfo.h.

References m_pRightEdge.

00056 { return m_pRightEdge; }

LONG CParentInfo::GetTop  )  const [inline]
 

Definition at line 38 of file parentinfo.h.

References m_Size.

Referenced by CResizeControlGeneric::DeterminLocation(), and CResizeDlg::FindControls().

00038 { return m_Size.top; }

CEdge* CParentInfo::GetTopEdge  )  [inline]
 

Definition at line 57 of file parentinfo.h.

References m_pTopEdge.

00057 { return m_pTopEdge; }

CEdge ** CParentInfo::GetVerticalEdges  ) 
 

Definition at line 210 of file parentinfo.cpp.

References CEdgeCache::GetEdge(), CEdge::IsVertical(), L, m_Edges, and TRACE.

Referenced by CResizeDlg::FindCommonGuides().

00211 { 00212 int iCount=m_Edges.GetNumVert(); 00213 CEdge ** ppEdges= (CEdge**)new (CEdge*[iCount]); 00214 CEdge * pEdge; 00215 int i=0,iDest=0; 00216 while( pEdge = m_Edges.GetEdge(i++) ) 00217 { 00218 if(pEdge->IsVertical() ) 00219 ppEdges[iDest++] = pEdge; 00220 #ifdef _DEBUG 00221 if( iDest > iCount ) 00222 TRACE(L"Vertical edge count is off %d vs %d\n", iDest, iCount); 00223 #endif 00224 } 00225 return ppEdges; 00226 }

LONG CParentInfo::GetWidth  )  const [inline]
 

Definition at line 34 of file parentinfo.h.

References m_Size.

Referenced by Annotate(), ConstructBorders(), CResizeControlGeneric::DeterminLocation(), DeterminSize(), CScaleDlg::DoChangePos(), CResizeDlg::DoInitDialog(), Init(), CScaleDlg::ResizeControls(), and CResizeDlg::SpecialRowCol().

00034 { return m_Size.right-m_Size.left; }

HWND CParentInfo::GetWindow  )  const [inline]
 

Definition at line 43 of file parentinfo.h.

References m_hWnd.

Referenced by CResizeControlGeneric::DeterminLocation(), and DeterminSize().

00043 { return m_hWnd;}

void CParentInfo::Init HWND  h  ) 
 

Definition at line 29 of file parentinfo.cpp.

References DeterminSize(), GetHeight(), GetWidth(), Init(), and m_hWnd.

Referenced by Init(), and CResizeDlg::WalkControls().

00030 { 00031 m_hWnd=h; 00032 DeterminSize(); 00033 SetRightBorder( GetWidth() ); 00034 SetLeftBorder( GetWidth() ); 00035 SetTopBorder( GetHeight() ); 00036 SetBottomBorder( GetHeight() ); 00037 }

CParentInfo::PROPERTY DIMENSION  ,
MinimumSize 
 

CParentInfo::PROPERTY LONG  ,
BottomBorder 
 

CParentInfo::PROPERTY LONG  ,
TopBorder 
 

CParentInfo::PROPERTY LONG  ,
LeftBorder 
 

CParentInfo::PROPERTY LONG  ,
RightBorder 
 

void CParentInfo::Resize int  width,
int  height
 

Definition at line 198 of file parentinfo.cpp.

References m_pBottomEdge, m_pRightEdge, Resize(), and CEdge::SetPosition().

Referenced by Resize().

00199 { 00200 m_pRightEdge->SetPosition( width - GetRightBorder() ); 00201 m_pBottomEdge->SetPosition( height - GetBottomBorder() ); 00202 }


Member Data Documentation

LONG CParentInfo::m_BottomBorder [private]
 

Definition at line 73 of file parentinfo.h.

CEdgeCache CParentInfo::m_Edges [private]
 

Definition at line 78 of file parentinfo.h.

Referenced by AddEdge(), Annotate(), FindCloseEdge(), GetHorizontalEdges(), GetNumHoriz(), GetNumVert(), and GetVerticalEdges().

HWND CParentInfo::m_hWnd [private]
 

Definition at line 68 of file parentinfo.h.

Referenced by GetWindow(), and Init().

LONG CParentInfo::m_LeftBorder [private]
 

Definition at line 71 of file parentinfo.h.

DIMENSION CParentInfo::m_MinimumSize [private]
 

Definition at line 66 of file parentinfo.h.

CEdge* CParentInfo::m_pBottomEdge [private]
 

Definition at line 86 of file parentinfo.h.

Referenced by ConstructBorders(), CParentInfo(), GetBottomEdge(), and Resize().

CEdge* CParentInfo::m_pLeftEdge [private]
 

Definition at line 83 of file parentinfo.h.

Referenced by ConstructBorders(), CParentInfo(), and GetLeftEdge().

CEdge* CParentInfo::m_pRightEdge [private]
 

Definition at line 84 of file parentinfo.h.

Referenced by ConstructBorders(), CParentInfo(), GetRightEdge(), and Resize().

CEdge* CParentInfo::m_pTopEdge [private]
 

Definition at line 85 of file parentinfo.h.

Referenced by ConstructBorders(), CParentInfo(), and GetTopEdge().

LONG CParentInfo::m_RightBorder [private]
 

Definition at line 70 of file parentinfo.h.

RECT CParentInfo::m_Size [private]
 

Definition at line 67 of file parentinfo.h.

Referenced by DeterminSize(), GetBottom(), GetHeight(), GetLeft(), GetRight(), GetTop(), and GetWidth().

LONG CParentInfo::m_TopBorder [private]
 

Definition at line 72 of file parentinfo.h.


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:27 2004 for test by doxygen 1.3.7