diff options
author | fcolin | 2007-02-01 13:08:29 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 13:08:29 +0000 |
commit | 3dfc319868dcadc1da4b88f126ff5c3cdab760c7 (patch) | |
tree | acf49bf65326a492aca90e344e83430a17c34fa3 /IvyProbe/ETSLayout.cpp | |
parent | 789bc690bf2a350d08514dce166f02d4888a7440 (diff) | |
download | ivy-cplusplus-3dfc319868dcadc1da4b88f126ff5c3cdab760c7.zip ivy-cplusplus-3dfc319868dcadc1da4b88f126ff5c3cdab760c7.tar.gz ivy-cplusplus-3dfc319868dcadc1da4b88f126ff5c3cdab760c7.tar.bz2 ivy-cplusplus-3dfc319868dcadc1da4b88f126ff5c3cdab760c7.tar.xz |
Utilisateur : Fcolin Date : 9/04/04 Heure : 16:31 Archivé dans $/Bus/IvyProbe Commentaire: (vss 3)
Diffstat (limited to 'IvyProbe/ETSLayout.cpp')
-rw-r--r-- | IvyProbe/ETSLayout.cpp | 368 |
1 files changed, 275 insertions, 93 deletions
diff --git a/IvyProbe/ETSLayout.cpp b/IvyProbe/ETSLayout.cpp index e7f52bb..921e129 100644 --- a/IvyProbe/ETSLayout.cpp +++ b/IvyProbe/ETSLayout.cpp @@ -4,7 +4,7 @@ // / _/ / / / / ___ ___ ____ //
// /__/ /_/ / / / // _/_ _/ //
// _________/ / / / // _/ / / //
-// __(c) 1998-9_/ /___//_/ /_/ //
+// (c) 1998-2000_/ /___//_/ /_/ //
// //
////////////////////////////////////////////
// all rights reserved //
@@ -106,12 +106,42 @@ // 1999/12/04 Erase Backgroung with GCL_HBRBACKGROUND (if available)
// 1999/12/04 itemSpaceXXX() adds a NORESIZE item instead of ABSOLUTE_XXX
// this will fix unwanted growing in secondary direction
+//
+// Version: 1.0 [1999/12/04] Initial Article on CodeProject
+//
// 1999/12/10 Erase Backgroung within TabCtrl was 'fixed' badly. Reverted to
// old working code
// 2000/02/02 When the Dialog is child of a View the class works correctly
// now [Didier BULTIAUW]
// 2000/02/15 Combo-Boxes were not working correctly (in all modes!)
-
+// 2000/02/17 aligned SpinButton Controls (with buddy) now handled
+// automatically
+// !! do not add such a control to the layout !! it is always
+// reattached to its buddy.
+// 2000/02/17 changed some cotrol class names to the defined constants
+//
+// Version: 1.1 [2000/02/17]
+//
+// 2000/02/25 Fixed auto alignment of SpinButton Controls to only affect
+// visible ones
+// 2000/02/27 Put all the classes into the namespace 'ETSLayout'
+// 2000/03/07 Fixed growing Dialog after minimizing and restoring
+// 2000/05/22 Whole Statusbar (Gripper) is not excluded anymore in EraseBkgnd()
+// instead only the triangular Gripper is excluded
+// 2000/05/31 Fix for PropertySheets with PSH_WIZARDHASFINISH [Thömmi]
+// 2000/05/31 Fix for UpDown-Controls with EditCtrl Buddy in PropertyPages.
+// These were not repositioned every time the page is being show
+// until the first resize
+// 2000/07/28 Problems with resizing ActiveX Controls fixed [Micheal Chapman]
+// 2000/07/28 Some strings were not properly wrapped with _T()
+// 2000/08/03 Check for BS_GROUPBOX was not correct as BS_GROUPBOX is more than one Bit
+// 2000/08/03 New override AddMainArea added to ETSLayoutPropertySheet in order to
+// have a hook for additional controls in a PropertySheet (besides the Tab)
+// 2000/08/03 New override AddButtons added to ETSLayoutPropertySheet in order to
+// have a hook for additional controls in the bottem pane of a PropertySheet
+// 2000/08/03 Removed the need for DECLARE_LAYOUT
+//
+// Version: 1.2 [2000/08/05]
#define OEMRESOURCE
#include <windows.h>
@@ -119,6 +149,10 @@ #include "stdafx.h"
#include "ETSLayout.h"
+using namespace ETSLayout;
+#pragma warning(disable: 4097 4610 4510 4100)
+
+
#ifndef OBM_SIZE
#define OBM_SIZE 32766
// taken from WinresRc.h
@@ -145,8 +179,8 @@ CWnd* ETSLayoutMgr::paneNull = 0; void ETSLayoutMgr::Layout(CRect& rcClient)
{
- // Does nothing, use DECLARE_LAYOUT in derived class
- // see DialogMgr.h
+ if(rcClient.Height() && rcClient.Width() && m_RootPane.IsValid()) \
+ m_RootPane->resizeTo(rcClient); \
}
@@ -374,6 +408,30 @@ void ETSLayoutMgr::UpdateLayout() else
Layout(rcClient);
+ // Take special care of SpinButtons (Up-Down Controls) with Buddy set, enumerate
+ // all childs:
+ CWnd* pWndChild = GetWnd()->GetWindow(GW_CHILD);
+ TCHAR szClassName[ MAX_PATH ];
+ while(pWndChild)
+ {
+ ::GetClassName( pWndChild->GetSafeHwnd(), szClassName, MAX_PATH );
+ DWORD dwStyle = pWndChild->GetStyle();
+
+ // is it a SpinButton?
+ if( _tcscmp(szClassName, UPDOWN_CLASS)==0 && ::IsWindowVisible(pWndChild->GetSafeHwnd()) ) {
+ HWND hwndBuddy = (HWND)::SendMessage( pWndChild->GetSafeHwnd(), UDM_GETBUDDY, 0, 0);
+ if( hwndBuddy != 0 && (dwStyle&(UDS_ALIGNRIGHT|UDS_ALIGNLEFT)) != 0 )
+ {
+ // reset Buddy
+ ::SendMessage( pWndChild->GetSafeHwnd(), UDM_SETBUDDY, (WPARAM)hwndBuddy, 0);
+ }
+ }
+
+
+ pWndChild = pWndChild->GetWindow(GW_HWNDNEXT);
+ }
+
+
GetWnd()->Invalidate();
}
@@ -393,7 +451,7 @@ bool ETSLayoutMgr::Save(LPCTSTR lpstrRegKey) wp.showCmd = SW_SHOWNORMAL;
AfxGetApp()->WriteProfileBinary(lpstrRegKey,
- "WindowPlacement",
+ _T("WindowPlacement"),
reinterpret_cast<LPBYTE>(&wp), sizeof(wp));
}
}
@@ -405,7 +463,7 @@ bool ETSLayoutMgr::Load(LPCTSTR lpstrRegKey) LPBYTE pbtData = 0;
UINT nSize = 0;
if(AfxGetApp()->GetProfileBinary(lpstrRegKey,
- "WindowPlacement", &pbtData, &nSize))
+ _T("WindowPlacement"), &pbtData, &nSize))
{
WINDOWPLACEMENT* pwp =
reinterpret_cast<WINDOWPLACEMENT*>(pbtData);
@@ -427,6 +485,7 @@ void ETSLayoutMgr::EraseBkgnd(CDC* pDC) CRgn rgn;
rgn.CreateRectRgnIndirect(rcClient);
+ //TRACE("CreateRgn (%d,%d,%d,%d)\n", rcClient.left, rcClient.top, rcClient.right, rcClient.bottom );
CRgn rgnRect;
rgnRect.CreateRectRgn(0,0,0,0);
@@ -436,9 +495,8 @@ void ETSLayoutMgr::EraseBkgnd(CDC* pDC) TCHAR szClassName[ MAX_PATH ];
- CRect rcClip;
- pDC->GetClipBox(&rcClip);
-
+ pDC->SelectClipRgn(NULL);
+
while( pWndChild ) {
pWndChild->GetWindowRect(rcChild);
@@ -451,11 +509,12 @@ void ETSLayoutMgr::EraseBkgnd(CDC* pDC) // doesn't make sense for hidden children
if( dwStyle & WS_VISIBLE ) {
-
- if( _tcscmp(szClassName,"Button")==0 && (dwStyle & BS_GROUPBOX) ) {
+
+ // Fix: BS_GROUPBOX is more than one Bit, extend check to (dwStyle & BS_GROUPBOX)==BS_GROUPBOX [ET]
+ if( _tcscmp(szClassName,_T("Button"))==0 && (dwStyle & BS_GROUPBOX)==BS_GROUPBOX ) {
// it is a group-box, ignore completely
}
- else if( _tcscmp(szClassName,"SysTabControl32")==0 ) {
+ else if( _tcscmp(szClassName,WC_TABCONTROL )==0 ) {
// ignore Tab-Control's inside rect
static_cast<CTabCtrl*>(pWndChild)->AdjustRect(FALSE,rcChild);
@@ -465,6 +524,19 @@ void ETSLayoutMgr::EraseBkgnd(CDC* pDC) rgnRect.CombineRgn( &rgnRect, &rgnContent, RGN_DIFF );
rgn.CombineRgn( &rgn, &rgnRect, RGN_DIFF );
}
+ else if( _tcscmp(szClassName,STATUSCLASSNAME)==0 ) {
+
+ CPoint ptTriangleGrip[3];
+ ptTriangleGrip[0] = CPoint(rcChild.right,rcChild.top);
+ ptTriangleGrip[1] = CPoint(rcChild.right,rcChild.bottom);
+ ptTriangleGrip[2] = CPoint(rcChild.right-rcChild.Height(),rcChild.bottom);
+
+ CRgn rgnGripper;
+ rgnGripper.CreatePolygonRgn(ptTriangleGrip,3, WINDING);
+
+ rgn.CombineRgn( &rgn, &rgnGripper, RGN_DIFF );
+
+ }
else {
rgn.CombineRgn( &rgn, &rgnRect, RGN_DIFF );
}
@@ -537,7 +609,7 @@ ETSLayoutMgr::PaneItem::PaneItem(CWnd* pWnd, ETSLayoutMgr* pMgr, ETSLayoutMgr::l ::GetClassName( m_hwndCtrl, szClassName, MAX_PATH );
// special treatment for combo-boxes
- if( _tcscmp(szClassName,"ComboBox")==0 ) {
+ if( _tcscmp(szClassName,_T("ComboBox"))==0 || _tcscmp(szClassName,WC_COMBOBOXEX)==0) {
m_bComboSpecial = true;
}
}
@@ -594,7 +666,7 @@ ETSLayoutMgr::PaneItem::PaneItem( UINT nID, ETSLayoutMgr* pMgr, ETSLayoutMgr::la ::GetClassName( m_hwndCtrl, szClassName, MAX_PATH );
// special treatment for combo-boxes
- if( _tcscmp(szClassName,"ComboBox")==0 ) {
+ if( _tcscmp(szClassName,_T("ComboBox"))==0 || _tcscmp(szClassName,WC_COMBOBOXEX)==0) {
m_bComboSpecial = true;
}
}
@@ -695,7 +767,9 @@ bool ETSLayoutMgr::PaneItem::resizeTo(CRect& rcNewArea) rcNewArea.bottom = rcNewArea.top + rcWnd.Height();
}
- ::MoveWindow( m_hwndCtrl, rcNewArea.left, rcNewArea.top, rcNewArea.Width(), rcNewArea.Height(), true );
+ // FIX: ::MoveWindow would case problems with some ActiveX Controls [Micheal Chapman]
+ CWnd* pTempWnd = CWnd::FromHandle( m_hwndCtrl );
+ pTempWnd->MoveWindow( rcNewArea.left, rcNewArea.top, rcNewArea.Width(), rcNewArea.Height() );
if( m_bComboSpecial && !(dwStyle & CBS_DROPDOWN) && !(dwStyle & CBS_NOINTEGRALHEIGHT) ) {
@@ -712,7 +786,9 @@ bool ETSLayoutMgr::PaneItem::resizeTo(CRect& rcNewArea) rcNewArea.bottom = rcNewArea.top + rcWnd.Height();
- ::MoveWindow( m_hwndCtrl, rcNewArea.left, rcNewArea.top, rcNewArea.Width(), rcNewArea.Height(), true );
+ // FIX: ::MoveWindow would case problems with some ActiveX Controls [Micheal Chapman]
+ CWnd* pTempWnd = CWnd::FromHandle( m_hwndCtrl );
+ pTempWnd->MoveWindow( rcNewArea.left, rcNewArea.top, rcNewArea.Width(), rcNewArea.Height(), true );
}
}
@@ -858,8 +934,11 @@ int ETSLayoutMgr::PaneCtrl::getMaxConstrainVert() bool ETSLayoutMgr::PaneCtrl::resizeTo(CRect& rcNewArea)
{
- ::MoveWindow(m_hwndCtrl, rcNewArea.left, rcNewArea.top, rcNewArea.Width(), rcNewArea.Height(), true);
- ::RedrawWindow(m_hwndCtrl,0,0, RDW_INVALIDATE | RDW_UPDATENOW |RDW_ERASE);
+ // FIX: ::MoveWindow would case problems with some ActiveX Controls [Micheal Chapman]
+ CWnd* pTempWnd = CWnd::FromHandle( m_hwndCtrl );
+ pTempWnd->MoveWindow( rcNewArea.left, rcNewArea.top, rcNewArea.Width(), rcNewArea.Height(), true );
+
+ ::RedrawWindow(m_hwndCtrl,0,0, RDW_INVALIDATE | RDW_UPDATENOW |RDW_ERASE);
rcNewArea.top += m_sizeTopExtra;
return Pane::resizeTo(rcNewArea);
}
@@ -1276,7 +1355,7 @@ bool ETSLayoutMgr::Pane::resizeToRelative(int& availSpace, CArray<int,int>& size // At this point we should have some space left (at least not be negative with the leftover
// space) and on the other hand there's enough space for the limit-difference to be distributed
- ASSERT( availSpace >= 0 && relLeft >= relDiff);
+// ASSERT( availSpace >= 0 && relLeft >= relDiff);
// Fixup Relative:
// Distribute (if anecessary) relDiff on other (not limited) relative items/subpanes
@@ -1342,8 +1421,11 @@ bool ETSLayoutMgr::Pane::resizeToRelative(int& availSpace, CArray<int,int>& size }
}
// Distributed some relDiff-space in every iteration
- ASSERT(relDist != 0);
+// ASSERT(relDist != 0);
relDiff -= relDist;
+
+ if( relDist == 0 )
+ break;
}
// Fixup Relative: invert all negative (limited) sized to correct value
@@ -1748,7 +1830,7 @@ bool ETSLayoutMgr::Pane::resizeTo(CRect& rcNewArea) #pragma warning(disable: 4355)
ETSLayoutDialog::ETSLayoutDialog(UINT nID, CWnd* pParent /*=NULL*/, LPCTSTR strName /*=NULL*/, bool bGripper /*=true*/)
- : CDialog(nID, pParent), ETSLayoutMgr( this )
+ : CBaseDialog(nID, pParent), ETSLayoutMgr( this )
{
//{{AFX_DATA_INIT(ETSLayoutDialog)
// NOTE: the ClassWizard will add member initialization here
@@ -1796,30 +1878,34 @@ void ETSLayoutDialog::OnSize(UINT nType, int cx, int cy) void ETSLayoutDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
if(m_RootPane.IsValid()) {
+
CRect rcClient = GetRect();
+ if( rcClient.Height() > 0 || rcClient.Width() > 0 )
+ {
- CRect rcWnd;
- GetWindowRect(rcWnd);
-
- // How much do Window and Client differ
- int nDiffHorz = rcWnd.Width() - rcClient.Width();
- int nDiffVert = rcWnd.Height() - rcClient.Height();
+ CRect rcWnd;
+ GetWindowRect(rcWnd);
+
+ // How much do Window and Client differ
+ int nDiffHorz = rcWnd.Width() - rcClient.Width();
+ int nDiffVert = rcWnd.Height() - rcClient.Height();
- // Take into account that there is a border around the rootPane
- lpMMI->ptMinTrackSize = CPoint(m_RootPane->getMinConstrainHorz() + nDiffHorz + 2*m_sizeRootBorders.cx,
- m_RootPane->getMinConstrainVert() + nDiffVert + 2*m_sizeRootBorders.cy);
+ // Take into account that there is a border around the rootPane
+ lpMMI->ptMinTrackSize = CPoint(m_RootPane->getMinConstrainHorz() + nDiffHorz + 2*m_sizeRootBorders.cx,
+ m_RootPane->getMinConstrainVert() + nDiffVert + 2*m_sizeRootBorders.cy);
- int maxWidth = m_RootPane->getMaxConstrainHorz();
- int maxHeight = m_RootPane->getMaxConstrainVert();
+ int maxWidth = m_RootPane->getMaxConstrainHorz();
+ int maxHeight = m_RootPane->getMaxConstrainVert();
- if( maxWidth != -1 ) {
- lpMMI->ptMaxTrackSize.x = maxWidth + nDiffHorz + 2*m_sizeRootBorders.cx;
- lpMMI->ptMaxSize.x = maxWidth + nDiffHorz + 2*m_sizeRootBorders.cx;
- }
+ if( maxWidth != -1 ) {
+ lpMMI->ptMaxTrackSize.x = maxWidth + nDiffHorz + 2*m_sizeRootBorders.cx;
+ lpMMI->ptMaxSize.x = maxWidth + nDiffHorz + 2*m_sizeRootBorders.cx;
+ }
- if( maxHeight != -1 ) {
- lpMMI->ptMaxTrackSize.y = maxHeight + nDiffVert + 2*m_sizeRootBorders.cy;
- lpMMI->ptMaxSize.y = maxHeight + nDiffVert + 2*m_sizeRootBorders.cy;
+ if( maxHeight != -1 ) {
+ lpMMI->ptMaxTrackSize.y = maxHeight + nDiffVert + 2*m_sizeRootBorders.cy;
+ lpMMI->ptMaxSize.y = maxHeight + nDiffVert + 2*m_sizeRootBorders.cy;
+ }
}
}
}
@@ -1848,6 +1934,9 @@ BOOL ETSLayoutDialog::OnInitDialog() {
CBaseDialog::OnInitDialog();
+ // Ensure that the dialog is resizable
+ this->ModifyStyle(0, WS_THICKFRAME);
+
if(!m_strRegStore.IsEmpty()) {
Load(m_strRegStore);
}
@@ -1872,12 +1961,12 @@ BOOL ETSLayoutDialog::OnInitDialog() if(m_StatusBar.Create(m_pWnd))
{
m_StatusBar.SetIndicators(auIDStatusBar, sizeof(auIDStatusBar) / sizeof(UINT));
- m_StatusBar.SetWindowText("");
+ m_StatusBar.SetWindowText(_T(""));
m_StatusBar.SetPaneStyle( 0, SBPS_STRETCH | SBPS_NOBORDERS );
m_pWnd -> RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
}
else
- AfxMessageBox("Error - Statusbar");
+ AfxMessageBox(_T("Error - Statusbar"));
}
return TRUE; // return TRUE unless you set the focus to a control
@@ -1938,6 +2027,25 @@ LRESULT ETSLayoutDialogBar::OnInitDialog(WPARAM, LPARAM) return TRUE;
}
+void ETSLayoutDialogBar::UpdateLayout()
+{
+ ETSLayoutMgr::UpdateLayout();
+
+ if(m_RootPane.IsValid()) {
+ CRect rcClient = GetRect();
+
+ CRect rcWnd;
+ GetWindowRect(rcWnd);
+
+ // How much do Window and Client differ
+ CSize sizeDiff( rcWnd.Width() - rcClient.Width(), rcWnd.Height() - rcClient.Height());
+
+ // Take into account that there is a border around the rootPane
+// m_szMin = CSize(m_RootPane->getMinConstrainHorz() + sizeDiff.cx + 2*m_sizeRootBorders.cx,
+// m_RootPane->getMinConstrainVert() + sizeDiff.cy + 2*m_sizeRootBorders.cy);
+ }
+}
+
CSize ETSLayoutDialogBar::CalcDynamicLayout(int nLength, DWORD dwMode)
{
CSize sizeRet = CBaseDialogBar::CalcDynamicLayout(nLength, dwMode);
@@ -1955,8 +2063,8 @@ CSize ETSLayoutDialogBar::CalcDynamicLayout(int nLength, DWORD dwMode) CSize sizeDiff( rcWnd.Width() - rcClient.Width(), rcWnd.Height() - rcClient.Height());
// Take into account that there is a border around the rootPane
- sizeMin = CSize(m_RootPane->getMinConstrainHorz() + sizeDiff.cx + 2*m_sizeRootBorders.cx,
- m_RootPane->getMinConstrainVert() + sizeDiff.cy + 2*m_sizeRootBorders.cy);
+// sizeMin = CSize(m_RootPane->getMinConstrainHorz() + sizeDiff.cx + 2*m_sizeRootBorders.cx,
+// m_RootPane->getMinConstrainVert() + sizeDiff.cy + 2*m_sizeRootBorders.cy);
int maxWidth = m_RootPane->getMaxConstrainHorz();
@@ -2034,7 +2142,7 @@ IMPLEMENT_DYNAMIC(ETSLayoutFormView, CFormView) #pragma warning(disable: 4355)
ETSLayoutFormView::ETSLayoutFormView(UINT nID, LPCTSTR strName /*=NULL*/)
- : CFormView(nID), ETSLayoutMgr( this )
+ : CBaseFormView(nID), ETSLayoutMgr( this )
{
if(strName)
m_strRegStore = strName;
@@ -2155,18 +2263,21 @@ ETSLayoutFormView::~ETSLayoutFormView() ETSLayoutPropertyPage::ETSLayoutPropertyPage( ) : ETSLayoutMgr( this )
{
m_bLockMove = false;
+ m_bResetBuddyOnNextTimeVisible = true;
}
ETSLayoutPropertyPage::ETSLayoutPropertyPage( UINT nIDTemplate, UINT nIDCaption /*= 0*/ )
: CBasePropertyPage(nIDTemplate, nIDCaption), ETSLayoutMgr( this )
{
m_bLockMove = false;
+ m_bResetBuddyOnNextTimeVisible = true;
}
ETSLayoutPropertyPage::ETSLayoutPropertyPage( LPCTSTR lpszTemplateName, UINT nIDCaption /*= 0*/ )
- : CPropertyPage(lpszTemplateName, nIDCaption), ETSLayoutMgr( this )
+ : CBasePropertyPage(lpszTemplateName, nIDCaption), ETSLayoutMgr( this )
{
m_bLockMove = false;
+ m_bResetBuddyOnNextTimeVisible = true;
}
#pragma warning(default: 4355)
@@ -2182,6 +2293,7 @@ BEGIN_MESSAGE_MAP(ETSLayoutPropertyPage, CPropertyPage) ON_WM_ERASEBKGND()
ON_WM_WINDOWPOSCHANGING()
ON_WM_DESTROY()
+ ON_WM_WINDOWPOSCHANGED()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -2190,6 +2302,54 @@ END_MESSAGE_MAP() // Behandlungsroutinen für Nachrichten ETSLayoutPropertyPage
+
+void ETSLayoutPropertyPage::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
+{
+ CBasePropertyPage::OnWindowPosChanged(lpwndpos);
+
+ // This code is needed in order to reset the buddy after this page has
+ // been activated. At least on Win2k this is not done thru normal resizing,
+ // as the page is not visible when first layouted. And without the page
+ // being visible it's not possible to tell if the attached buddy is visible
+ // or not (at least I don't know any way to do so)
+
+ if( ::IsWindowVisible( GetWnd()->GetSafeHwnd() ) )
+ {
+ if( m_bResetBuddyOnNextTimeVisible )
+ {
+ // Take special care of SpinButtons (Up-Down Controls) with Buddy set, enumerate
+ // all childs:
+ CWnd* pWndChild = GetWnd()->GetWindow(GW_CHILD);
+ TCHAR szClassName[ MAX_PATH ];
+ while(pWndChild)
+ {
+ ::GetClassName( pWndChild->GetSafeHwnd(), szClassName, MAX_PATH );
+ DWORD dwStyle = pWndChild->GetStyle();
+
+ // is it a SpinButton?
+ if( _tcscmp(szClassName, UPDOWN_CLASS)==0 && ::IsWindowVisible(pWndChild->GetSafeHwnd()) ) {
+ HWND hwndBuddy = (HWND)::SendMessage( pWndChild->GetSafeHwnd(), UDM_GETBUDDY, 0, 0);
+ if( hwndBuddy != 0 && (dwStyle&(UDS_ALIGNRIGHT|UDS_ALIGNLEFT)) != 0 )
+ {
+ // reset Buddy
+ ::SendMessage( pWndChild->GetSafeHwnd(), UDM_SETBUDDY, (WPARAM)hwndBuddy, 0);
+ }
+ }
+
+
+ pWndChild = pWndChild->GetWindow(GW_HWNDNEXT);
+ }
+
+ m_bResetBuddyOnNextTimeVisible = false;
+ }
+ }
+ else
+ {
+ // has been hidden again
+ m_bResetBuddyOnNextTimeVisible = true;
+ }
+}
+
void ETSLayoutPropertyPage::OnWindowPosChanging( WINDOWPOS* lpwndpos )
{
// In WizardMode the System calls SetWindowPos with the
@@ -2372,7 +2532,7 @@ int ETSLayoutPropertySheet::OnCreate(LPCREATESTRUCT lpCreateStruct) if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
return -1;
- ModifyStyle(0,WS_THICKFRAME| WS_SYSMENU |WS_CLIPCHILDREN);
+ ModifyStyle(0,WS_THICKFRAME| WS_SYSMENU);
return 0;
}
@@ -2383,7 +2543,8 @@ void ETSLayoutPropertySheet::Resize(int cx, int cy) {
UpdateLayout();
- if(IsWizard())
+ // Fix for PSH_WIZARDHASFINISH [Thömmi]
+ if (IsWizard() && !(m_psh.dwFlags & PSH_WIZARDHASFINISH) )
{
// manual reposition of the FINISH button
// can not be done with normaly layouting because it
@@ -2462,18 +2623,76 @@ long _PropertySheetIDs[] = {
ID_WIZBACK,
ID_WIZNEXT,
+ ID_WIZFINISH,
IDOK,
IDCANCEL,
ID_APPLY_NOW,
IDHELP
};
+void ETSLayoutPropertySheet::AddMainArea(CPane paneRoot, CPaneBase itemTab)
+{
+ // the default is: Whole main Area is covered by the TabCtrl
+ paneRoot << itemTab;
+}
+
+void ETSLayoutPropertySheet::AddButtons(CPane paneBottom)
+{
+ // first item greedy to keep others right
+ paneBottom->addItem (paneNull, GREEDY);
+
+
+ // add all Controls to the layouting
+ bool bFirst = true;
+ for(int i = 0; i < (sizeof(_PropertySheetIDs) / sizeof(long)) ; i++)
+ {
+ // Prevent movement of finish button, if it is not shown explicitly [Thömmi]
+ if( IsWizard()
+ && _PropertySheetIDs[i] == ID_WIZFINISH
+ && !(m_psh.dwFlags & PSH_WIZARDHASFINISH) )
+ {
+ continue;
+ }
+
+ CWnd* pWnd = GetDlgItem(_PropertySheetIDs[i]);
+
+ if(pWnd)
+ {
+
+ if(!(m_psh.dwFlags & PSH_HASHELP) && _PropertySheetIDs[i] == IDHELP)
+ {
+ // don't insert
+ continue;
+ }
+
+ if((m_psh.dwFlags & PSH_NOAPPLYNOW) && _PropertySheetIDs[i] == ID_APPLY_NOW)
+ {
+ // don't insert
+ continue;
+ }
+
+ // space before first one and between BACK & NEXT
+ if( IsWizard() )
+ {
+ if( !bFirst && !(_PropertySheetIDs[i]==ID_WIZNEXT) )
+ {
+ paneBottom->addItem(paneNull, NORESIZE,12,0,0,0);
+ }
+ }
+
+ pWnd->ShowWindow(true);
+ paneBottom->addItem(_PropertySheetIDs[i], NORESIZE);
+ bFirst = false;
+ }
+ }
+
+}
BOOL ETSLayoutPropertySheet::OnInitDialog()
{
BOOL bRet = CPropertySheet::OnInitDialog();
- ASSERT(!m_RootPane);
+ //ASSERT(!m_RootPane);
// Save initial rect
GetWindowRect(&m_rcStart);
@@ -2489,7 +2708,7 @@ BOOL ETSLayoutPropertySheet::OnInitDialog() // Add Tabcontrol to root pane
m_ItemTab = item( GetTabControl(), GREEDY, 0, 0, 0, 0);
- m_RootPane << m_ItemTab;
+ AddMainArea(m_RootPane, m_ItemTab);
// Tabcontrol is invisible in WizardMode
if(IsWizard())
@@ -2508,48 +2727,11 @@ BOOL ETSLayoutPropertySheet::OnInitDialog() // No spaces in WizardMode in order to keep BACK & NEXT together
CPane bottomPane = pane(HORIZONTAL, ABSOLUTE_VERT, IsWizard() ? 0 : 5);
- // first item greedy to keep others right
- bottomPane->addItem (paneNull, GREEDY);
-
-
- // add all Controls to the layouting
- bool bFirst = true;
- for(int i = 0; i < (sizeof(_PropertySheetIDs) / sizeof(long)) ; i++)
- {
- CWnd* pWnd = GetDlgItem(_PropertySheetIDs[i]);
-
- if(pWnd)
- {
-
- if(!(m_psh.dwFlags & PSH_HASHELP) && _PropertySheetIDs[i] == IDHELP)
- {
- // don't insert
- continue;
- }
-
- if((m_psh.dwFlags & PSH_NOAPPLYNOW) && _PropertySheetIDs[i] == ID_APPLY_NOW)
- {
- // don't insert
- continue;
- }
-
- // space before first one and between BACK & NEXT
- if( IsWizard() )
- {
- if( !bFirst && !(_PropertySheetIDs[i]==ID_WIZNEXT) )
- {
- bottomPane->addItem(paneNull, NORESIZE,12,0,0,0);
- }
- }
-
- pWnd->ShowWindow(true);
- bottomPane->addItem(_PropertySheetIDs[i], NORESIZE);
- bFirst = false;
- }
- }
-
- // add bottom (button) pane
- m_RootPane << bottomPane;
+ AddButtons(bottomPane);
+ // add bottom (button) pane if any controls were added
+ if(bottomPane->m_paneItems.GetSize() > 0) {
+ m_RootPane << bottomPane;
+ }
}
@@ -2563,12 +2745,12 @@ BOOL ETSLayoutPropertySheet::OnInitDialog() {
m_StatusBar.SetIndicators(auIDStatusBar,
sizeof(auIDStatusBar) / sizeof(UINT));
- m_StatusBar.SetWindowText("");
+ m_StatusBar.SetWindowText(_T(""));
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
}
else
{
- AfxMessageBox("Error - Statusbar");
+ AfxMessageBox(_T("Error - Statusbar"));
}
}
|