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

CScaleDlg Class Reference

#include <resizedlg.h>

Inheritance diagram for CScaleDlg:

CResizeDlg CDlg List of all members.

Public Member Functions

 CScaleDlg (int DlgID, HWND hWndParent, HINSTANCE hInst)
virtual ~CScaleDlg ()

Protected Member Functions

void DoChangePos (WINDOWPOS *lpwp)
void DeterminWeights ()
void ResizeControls (WORD width, WORD height)

Protected Attributes

LONG m_dwInitFontSize

Private Types

typedef CResizeDlg BASECLASS

Private Attributes

int dwLastCX
int dwLastCY

Member Typedef Documentation

typedef CResizeDlg CScaleDlg::BASECLASS [private]
 

Reimplemented from CResizeDlg.

Definition at line 104 of file resizedlg.h.

Referenced by CScaleDlg().


Constructor & Destructor Documentation

CScaleDlg::CScaleDlg int  DlgID,
HWND  hWndParent,
HINSTANCE  hInst
 

Definition at line 1114 of file resizedlg.cpp.

References BASECLASS, CScaleDlg(), and hInst.

Referenced by CScaleDlg().

01115 : BASECLASS(DlgID, hWndParent, hInst) 01116 { 01117 }

CScaleDlg::~CScaleDlg  )  [virtual]
 

Definition at line 1119 of file resizedlg.cpp.

01120 { 01121 01122 }


Member Function Documentation

void CScaleDlg::DeterminWeights  )  [protected, virtual]
 

Reimplemented from CResizeDlg.

Definition at line 1207 of file resizedlg.cpp.

References CDlg::GetWindow(), lf, m_dwInitFontSize, and SendMessage().

01208 { 01209 SetRowWeight(1); 01210 SetColWeight(1); 01211 HFONT hFont=(HFONT)SendMessage( GetWindow(), WM_GETFONT, 0,0 ); 01212 LOGFONT lf; 01213 GetObject( hFont, sizeof(lf), &lf); 01214 m_dwInitFontSize = lf.lfHeight; 01215 }

void CScaleDlg::DoChangePos WINDOWPOS *  lpwp  )  [protected, virtual]
 

Reimplemented from CResizeDlg.

Definition at line 1217 of file resizedlg.cpp.

References DoChangePos(), dwLastCX, dwLastCY, FALSE, CParentInfo::GetHeight(), and CParentInfo::GetWidth().

Referenced by DoChangePos().

01218 { 01219 // Lock the apsect ratio. 01220 if((lpwp->flags & SWP_NOSIZE) == FALSE) 01221 { 01222 if( dwLastCX != lpwp->cx ) 01223 dwLastCY = lpwp->cy = (lpwp->cx * m_ParentInfo.GetHeight()) / m_ParentInfo.GetWidth(); 01224 01225 if( dwLastCY != lpwp->cy ) 01226 dwLastCX = lpwp->cx = (lpwp->cy * m_ParentInfo.GetWidth()) / m_ParentInfo.GetHeight(); 01227 } 01228 }

void CScaleDlg::ResizeControls WORD  width,
WORD  height
[protected, virtual]
 

Reimplemented from CResizeDlg.

Definition at line 1127 of file resizedlg.cpp.

References BeginDeferWindowPos(), BOOL, DeferWindowPos, EndDeferWindowPos(), CControlList::GetControlCount(), CParentInfo::GetHeight(), CDPA::GetPointer(), CParentInfo::GetWidth(), CDlg::GetWindow(), lf, m_dwInitFontSize, NULL, ResizeControls(), and SendMessage().

Referenced by ResizeControls().

01128 { 01129 // 01130 // Perhaps we just scale the fontsize information too? 01131 // 01132 int OrigW = m_ParentInfo.GetRightBorder(); 01133 OrigW = m_ParentInfo.GetWidth(); 01134 int OrigH = m_ParentInfo.GetBottomBorder(); 01135 OrigH = m_ParentInfo.GetHeight(); 01136 01137 // 01138 // SetDialogFont 01139 // 01140 HFONT hFont=(HFONT)SendMessage( GetWindow(), WM_GETFONT, 0,0 ); 01141 LOGFONT lf; 01142 GetObject( (HGDIOBJ)hFont, sizeof(lf), &lf); 01143 int scalew= width * 100 / OrigW; 01144 int scaleh=height * 100 / OrigH; 01145 int scale=scalew; 01146 01147 if( scalew < scaleh ) 01148 scale=scaleh; 01149 01150 lf.lfHeight = m_dwInitFontSize * scale / 100; 01151 HFONT hNewFont=CreateFontIndirect( &lf ); 01152 01153 HWND hCurrent; 01154 HWND hFirst; 01155 hCurrent=hFirst=::GetWindow(GetWindow(),GW_CHILD); 01156 if( hFirst ) 01157 { 01158 do { 01159 SendMessage( hCurrent, WM_SETFONT, (WPARAM)hNewFont, 1 ); 01160 } while (hCurrent=::GetWindow(hCurrent,GW_HWNDNEXT)); 01161 } 01162 01163 // newX=origX * width / origParentWidth 01164 // 01165 // Now setup the information for all of the controls, as to which cell they are in. 01166 // 01167 HDWP hdwp = BeginDeferWindowPos( m_ControlList.GetControlCount() +1 ); // 1 for the gripper 01168 int i=0; 01169 CResizeControl * pC; 01170 while( pC=(CResizeControl *) m_ControlList.GetPointer(i++) ) 01171 { 01172 int x=pC->GetLeftGap(); // GetLeftEdge()->GetPosition(); 01173 int y=pC->GetTopGap(); // GetTopEdge()->GetPosition(); 01174 int w=OrigW - pC->GetRightGap() - x; // GetRightEdge()-GetPosition() - x; 01175 int h=OrigH - pC->GetBottomGap() - y; // BottomEdge()-GetPosition() -y; 01176 01177 int newx=x * width / OrigW; 01178 int newy=y * height / OrigH; 01179 01180 int neww=w * width / OrigW; 01181 int newh=h * height / OrigH; 01182 01183 01184 BOOL bMove=false; 01185 if( (newx != x) || (newy != y)) 01186 bMove=true; 01187 01188 BOOL bSize=false; 01189 if( (newh != h) || (neww != w)) 01190 bSize=true; 01191 01192 hdwp = DeferWindowPos( hdwp, pC->GetControl(), NULL, 01193 newx, newy, neww , newh, 01194 (bMove ? 0: SWP_NOMOVE) | (bSize ? 0: SWP_NOSIZE) | SWP_NOZORDER ); 01195 01196 } 01197 01198 // 01199 // Move the gripper 01200 // 01201 SetGripperPos(hdwp); 01202 01203 EndDeferWindowPos( hdwp ); 01204 01205 }


Member Data Documentation

int CScaleDlg::dwLastCX [private]
 

Definition at line 115 of file resizedlg.h.

Referenced by DoChangePos().

int CScaleDlg::dwLastCY [private]
 

Definition at line 116 of file resizedlg.h.

Referenced by DoChangePos().

LONG CScaleDlg::m_dwInitFontSize [protected]
 

Definition at line 111 of file resizedlg.h.

Referenced by DeterminWeights(), and ResizeControls().


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