Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authortetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
committertetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
commita9b7bf3fb3e1334d8defd05ca4cfae870b4912e5 (patch)
tree2dab453d94d5e003379a6cc895eceb84c80e23ec /src/ui
parentaafd49a91f7c2fa9c7103971c16fa6e1b29e8bfd (diff)
astyle formatting cleanup to make the sourcecode more accessible
switch used: astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren http://astyle.sourceforge.net/ git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1783 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/CmdUI/CmdUI.cpp157
-rw-r--r--src/ui/CmdUI/CmdUI.h38
-rw-r--r--src/ui/LCDUI/LCDAnimatedBitmap.cpp8
-rw-r--r--src/ui/LCDUI/LCDAnimatedBitmap.h6
-rw-r--r--src/ui/LCDUI/LCDBase.cpp2
-rw-r--r--src/ui/LCDUI/LCDBase.h18
-rw-r--r--src/ui/LCDUI/LCDBitmap.cpp6
-rw-r--r--src/ui/LCDUI/LCDBitmap.h6
-rw-r--r--src/ui/LCDUI/LCDCollection.cpp14
-rw-r--r--src/ui/LCDUI/LCDCollection.h8
-rw-r--r--src/ui/LCDUI/LCDGfx.cpp50
-rw-r--r--src/ui/LCDUI/LCDGfx.h34
-rw-r--r--src/ui/LCDUI/LCDManager.cpp6
-rw-r--r--src/ui/LCDUI/LCDManager.h8
-rw-r--r--src/ui/LCDUI/LCDOutput.cpp152
-rw-r--r--src/ui/LCDUI/LCDOutput.h8
-rw-r--r--src/ui/LCDUI/LCDProgressBar.cpp162
-rw-r--r--src/ui/LCDUI/LCDProgressBar.h18
-rw-r--r--src/ui/LCDUI/LCDScrollingText.cpp72
-rw-r--r--src/ui/LCDUI/LCDScrollingText.h8
-rw-r--r--src/ui/LCDUI/LCDText.cpp34
-rw-r--r--src/ui/LCDUI/LCDText.h8
-rw-r--r--src/ui/ResizableLib/ResizableDialog.cpp158
-rw-r--r--src/ui/ResizableLib/ResizableDialog.h68
-rw-r--r--src/ui/ResizableLib/ResizableGrip.cpp402
-rw-r--r--src/ui/ResizableLib/ResizableGrip.h80
-rw-r--r--src/ui/ResizableLib/ResizableLayout.cpp850
-rw-r--r--src/ui/ResizableLib/ResizableLayout.h304
-rw-r--r--src/ui/ResizableLib/ResizableMinMax.cpp52
-rw-r--r--src/ui/ResizableLib/ResizableMinMax.h40
-rw-r--r--src/ui/ResizableLib/ResizableMsgSupport.h34
-rw-r--r--src/ui/ResizableLib/ResizablePage.cpp40
-rw-r--r--src/ui/ResizableLib/ResizablePage.h38
-rw-r--r--src/ui/ResizableLib/ResizableSheet.cpp430
-rw-r--r--src/ui/ResizableLib/ResizableSheet.h101
-rw-r--r--src/ui/ResizableLib/ResizableState.cpp116
-rw-r--r--src/ui/ResizableLib/ResizableState.h16
-rw-r--r--src/ui/TreePropSheet/PropPageFrame.cpp100
-rw-r--r--src/ui/TreePropSheet/PropPageFrame.h462
-rw-r--r--src/ui/TreePropSheet/PropPageFrameDefault.cpp461
-rw-r--r--src/ui/TreePropSheet/PropPageFrameDefault.h86
-rw-r--r--src/ui/TreePropSheet/TreePropSheet.cpp1422
-rw-r--r--src/ui/TreePropSheet/TreePropSheet.h706
-rw-r--r--src/ui/sizecbar/scbarcf.cpp80
-rw-r--r--src/ui/sizecbar/scbarcf.h4
-rw-r--r--src/ui/sizecbar/scbarg.cpp49
-rw-r--r--src/ui/sizecbar/scbarg.h14
-rw-r--r--src/ui/sizecbar/sizecbar.cpp484
-rw-r--r--src/ui/sizecbar/sizecbar.h39
49 files changed, 3753 insertions, 3706 deletions
diff --git a/src/ui/CmdUI/CmdUI.cpp b/src/ui/CmdUI/CmdUI.cpp
index c1bf6d16d..53f7b41ad 100644
--- a/src/ui/CmdUI/CmdUI.cpp
+++ b/src/ui/CmdUI/CmdUI.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -35,12 +35,12 @@ CCmdUIDialog::CCmdUIDialog()
}
CCmdUIDialog::CCmdUIDialog(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
- : CDialog(nIDTemplate, pParent)
+ : CDialog(nIDTemplate, pParent)
{
}
CCmdUIDialog::CCmdUIDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
- : CDialog(lpszTemplateName, pParentWnd)
+ : CDialog(lpszTemplateName, pParentWnd)
{
}
@@ -50,19 +50,19 @@ CCmdUIDialog::~CCmdUIDialog()
LRESULT CCmdUIDialog::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
- LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
+ LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
- if(message == WM_INITDIALOG)
- {
- SendMessage(WM_KICKIDLE);
- }
+ if(message == WM_INITDIALOG)
+ {
+ SendMessage(WM_KICKIDLE);
+ }
- return(ret);
+ return(ret);
}
BEGIN_MESSAGE_MAP(CCmdUIDialog, CDialog)
- ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
- ON_WM_INITMENUPOPUP()
+ ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
+ ON_WM_INITMENUPOPUP()
END_MESSAGE_MAP()
@@ -70,14 +70,14 @@ END_MESSAGE_MAP()
void CCmdUIDialog::OnKickIdle()
{
- UpdateDialogControls(this, false);
+ UpdateDialogControls(this, false);
- // TODO: maybe we should send this call to modeless child cdialogs too
+ // TODO: maybe we should send this call to modeless child cdialogs too
}
// Q242577
-void CCmdUIDialog::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
+void CCmdUIDialog::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
ASSERT(pPopupMenu != NULL);
// Check the enabled state of various menu items.
@@ -90,69 +90,69 @@ void CCmdUIDialog::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
// Determine if menu is popup in top-level menu and set m_pOther to
// it if so (m_pParentMenu == NULL indicates that it is secondary popup).
HMENU hParentMenu;
- if (AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
+ if(AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
state.m_pParentMenu = pPopupMenu; // Parent == child for tracking popup.
- else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
+ else if((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
{
CWnd* pParent = this;
- // Child windows don't have menus--need to go to the top!
- if (pParent != NULL &&
+ // Child windows don't have menus--need to go to the top!
+ if(pParent != NULL &&
(hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
{
- int nIndexMax = ::GetMenuItemCount(hParentMenu);
- for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
- {
- if (::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
+ int nIndexMax = ::GetMenuItemCount(hParentMenu);
+ for(int nIndex = 0; nIndex < nIndexMax; nIndex++)
{
- // When popup is found, m_pParentMenu is containing menu.
- state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
- break;
+ if(::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
+ {
+ // When popup is found, m_pParentMenu is containing menu.
+ state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
+ break;
+ }
}
- }
}
}
state.m_nIndexMax = pPopupMenu->GetMenuItemCount();
- for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
- state.m_nIndex++)
+ for(state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
+ state.m_nIndex++)
{
state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex);
- if (state.m_nID == 0)
- continue; // Menu separator or invalid cmd - ignore it.
+ if(state.m_nID == 0)
+ continue; // Menu separator or invalid cmd - ignore it.
ASSERT(state.m_pOther == NULL);
ASSERT(state.m_pMenu != NULL);
- if (state.m_nID == (UINT)-1)
+ if(state.m_nID == (UINT) - 1)
{
- // Possibly a popup menu, route to first item of that popup.
- state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
- if (state.m_pSubMenu == NULL ||
- (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
- state.m_nID == (UINT)-1)
- {
- continue; // First item of popup can't be routed to.
- }
- state.DoUpdate(this, TRUE); // Popups are never auto disabled.
+ // Possibly a popup menu, route to first item of that popup.
+ state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
+ if(state.m_pSubMenu == NULL ||
+ (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
+ state.m_nID == (UINT) - 1)
+ {
+ continue; // First item of popup can't be routed to.
+ }
+ state.DoUpdate(this, TRUE); // Popups are never auto disabled.
}
else
{
- // Normal menu item.
- // Auto enable/disable if frame window has m_bAutoMenuEnable
- // set and command is _not_ a system command.
- state.m_pSubMenu = NULL;
- state.DoUpdate(this, FALSE);
+ // Normal menu item.
+ // Auto enable/disable if frame window has m_bAutoMenuEnable
+ // set and command is _not_ a system command.
+ state.m_pSubMenu = NULL;
+ state.DoUpdate(this, FALSE);
}
// Adjust for menu deletions and additions.
UINT nCount = pPopupMenu->GetMenuItemCount();
- if (nCount < state.m_nIndexMax)
+ if(nCount < state.m_nIndexMax)
{
- state.m_nIndex -= (state.m_nIndexMax - nCount);
- while (state.m_nIndex < nCount &&
- pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
- {
- state.m_nIndex++;
- }
+ state.m_nIndex -= (state.m_nIndexMax - nCount);
+ while(state.m_nIndex < nCount &&
+ pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
+ {
+ state.m_nIndex++;
+ }
}
state.m_nIndexMax = nCount;
}
@@ -162,7 +162,7 @@ void CCmdUIDialog::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
IMPLEMENT_DYNAMIC(CCmdUIPropertyPage, CPropertyPage)
CCmdUIPropertyPage::CCmdUIPropertyPage(UINT nIDTemplate, UINT nIDCaption)
- : CPropertyPage(nIDTemplate, nIDCaption)
+ : CPropertyPage(nIDTemplate, nIDCaption)
{
}
@@ -172,28 +172,31 @@ CCmdUIPropertyPage::~CCmdUIPropertyPage()
LRESULT CCmdUIPropertyPage::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
- if(message == WM_COMMAND)
- {
- switch(HIWORD(wParam))
- {
- case BN_CLICKED: case CBN_SELCHANGE: case EN_CHANGE:
- SetModified();
- default:;
- }
- }
-
- LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
-
- if(message == WM_INITDIALOG)
- {
- SendMessage(WM_KICKIDLE);
- }
-
- return(ret);
+ if(message == WM_COMMAND)
+ {
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ case CBN_SELCHANGE:
+ case EN_CHANGE:
+ SetModified();
+ default:
+ ;
+ }
+ }
+
+ LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
+
+ if(message == WM_INITDIALOG)
+ {
+ SendMessage(WM_KICKIDLE);
+ }
+
+ return(ret);
}
BEGIN_MESSAGE_MAP(CCmdUIPropertyPage, CPropertyPage)
- ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
+ ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
END_MESSAGE_MAP()
@@ -201,8 +204,8 @@ END_MESSAGE_MAP()
void CCmdUIPropertyPage::OnKickIdle()
{
- UpdateDialogControls(this, false);
+ UpdateDialogControls(this, false);
- // TODO: maybe we should send this call to modeless child cPropertyPages too
+ // TODO: maybe we should send this call to modeless child cPropertyPages too
}
diff --git a/src/ui/CmdUI/CmdUI.h b/src/ui/CmdUI/CmdUI.h
index 1f57f574f..171fd3f62 100644
--- a/src/ui/CmdUI/CmdUI.h
+++ b/src/ui/CmdUI/CmdUI.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,22 +27,22 @@
class CCmdUIDialog : public CDialog
{
- DECLARE_DYNAMIC(CCmdUIDialog)
+ DECLARE_DYNAMIC(CCmdUIDialog)
public:
- CCmdUIDialog();
- CCmdUIDialog(UINT nIDTemplate, CWnd* pParent = NULL);
- CCmdUIDialog(LPCTSTR lpszTemplateName, CWnd* pParent = NULL);
- virtual ~CCmdUIDialog();
+ CCmdUIDialog();
+ CCmdUIDialog(UINT nIDTemplate, CWnd* pParent = NULL);
+ CCmdUIDialog(LPCTSTR lpszTemplateName, CWnd* pParent = NULL);
+ virtual ~CCmdUIDialog();
protected:
- virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+ virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
public:
- afx_msg void OnKickIdle();
- afx_msg void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu);
+ afx_msg void OnKickIdle();
+ afx_msg void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu);
};
@@ -50,18 +50,18 @@ public:
class CCmdUIPropertyPage : public CPropertyPage
{
- DECLARE_DYNAMIC(CCmdUIPropertyPage)
+ DECLARE_DYNAMIC(CCmdUIPropertyPage)
public:
- CCmdUIPropertyPage(UINT nIDTemplate, UINT nIDCaption = 0); // standard constructor
- virtual ~CCmdUIPropertyPage();
+ CCmdUIPropertyPage(UINT nIDTemplate, UINT nIDCaption = 0); // standard constructor
+ virtual ~CCmdUIPropertyPage();
protected:
- virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+ virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
public:
- afx_msg void OnKickIdle();
+ afx_msg void OnKickIdle();
};
diff --git a/src/ui/LCDUI/LCDAnimatedBitmap.cpp b/src/ui/LCDUI/LCDAnimatedBitmap.cpp
index 497fa40dd..0f309b08d 100644
--- a/src/ui/LCDUI/LCDAnimatedBitmap.cpp
+++ b/src/ui/LCDUI/LCDAnimatedBitmap.cpp
@@ -5,7 +5,7 @@
// The CLCDAnimatedBitmap class draws animated bitmaps onto the LCD.
// An animated bitmap consists of a tiled bitmap representing the
// animation. The tile size is set with the SetSubpicWidth.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -142,16 +142,16 @@ void CLCDAnimatedBitmap::OnDraw(CLCDGfx &rGfx)
m_dwElapsedTime %= m_dwRate;
m_dwLastUpdate = GetTickCount();
}
-
+
// stolen from: CLCDBitmap::OnDraw(rGfx);
if(m_hBitmap)
{
HDC hCompatibleDC = CreateCompatibleDC(rGfx.GetHDC());
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hCompatibleDC, m_hBitmap);
-
+
// get
BitBlt(rGfx.GetHDC(), 0, 0, m_Size.cx, m_Size.cy, hCompatibleDC, xoffs, 0, m_dwROP);
-
+
// restores
SelectObject(hCompatibleDC, hOldBitmap);
DeleteDC(hCompatibleDC);
diff --git a/src/ui/LCDUI/LCDAnimatedBitmap.h b/src/ui/LCDUI/LCDAnimatedBitmap.h
index 492959cd1..ee0386aaf 100644
--- a/src/ui/LCDUI/LCDAnimatedBitmap.h
+++ b/src/ui/LCDUI/LCDAnimatedBitmap.h
@@ -5,14 +5,14 @@
// The CLCDAnimatedBitmap class draws animated bitmaps onto the LCD.
// An animated bitmap consists of a tiled bitmap representing the
// animation. The tile size is set with the SetSubpicWidth.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDANIMATEDBITMAP_H_INCLUDED_
-#define _LCDANIMATEDBITMAP_H_INCLUDED_
+#ifndef _LCDANIMATEDBITMAP_H_INCLUDED_
+#define _LCDANIMATEDBITMAP_H_INCLUDED_
#include "LCDBase.h"
#include "LCDBitmap.h"
diff --git a/src/ui/LCDUI/LCDBase.cpp b/src/ui/LCDUI/LCDBase.cpp
index 4b4c585d9..07f6863ac 100644
--- a/src/ui/LCDUI/LCDBase.cpp
+++ b/src/ui/LCDUI/LCDBase.cpp
@@ -3,7 +3,7 @@
// LCDBase.cpp
//
// The CLCDBase class is the generic base class for all lcd ui objects
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
diff --git a/src/ui/LCDUI/LCDBase.h b/src/ui/LCDUI/LCDBase.h
index dbf677cc7..78372b7a1 100644
--- a/src/ui/LCDUI/LCDBase.h
+++ b/src/ui/LCDUI/LCDBase.h
@@ -3,7 +3,7 @@
// LCDBase.h
//
// The CLCDBase class is the generic base class for all lcd ui objects
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -37,9 +37,15 @@ public:
virtual void SetSize(SIZE& size);
virtual void SetSize(int nCX, int nCY);
virtual SIZE& GetSize(void);
-
- virtual int GetWidth(void) { return GetSize().cx; }
- virtual int GetHeight(void) { return GetSize().cy; };
+
+ virtual int GetWidth(void)
+ {
+ return GetSize().cx;
+ }
+ virtual int GetHeight(void)
+ {
+ return GetSize().cy;
+ };
virtual void Show(BOOL bShow);
virtual BOOL IsVisible();
@@ -60,12 +66,12 @@ public:
virtual const LGObjectType GetObjectType();
virtual void SetObjectType(const LGObjectType type);
-
+
public:
virtual void OnDraw(CLCDGfx &rGfx) = 0;
virtual void OnUpdate(DWORD dwTimestamp);
-protected:
+protected:
SIZE m_Size;
POINT m_Origin;
BOOL m_bVisible;
diff --git a/src/ui/LCDUI/LCDBitmap.cpp b/src/ui/LCDUI/LCDBitmap.cpp
index 559a88a5b..eacdf64b1 100644
--- a/src/ui/LCDUI/LCDBitmap.cpp
+++ b/src/ui/LCDUI/LCDBitmap.cpp
@@ -3,7 +3,7 @@
// LCDBitmap.cpp
//
// The CLCDBitmap class draws bitmaps onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -74,9 +74,9 @@ void CLCDBitmap::OnDraw(CLCDGfx &rGfx)
{
HDC hCompatibleDC = CreateCompatibleDC(rGfx.GetHDC());
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hCompatibleDC, m_hBitmap);
-
+
BitBlt(rGfx.GetHDC(), 0, 0, m_Size.cx, m_Size.cy, hCompatibleDC, m_ptLogical.x, m_ptLogical.y, m_dwROP);
-
+
// restores
SelectObject(hCompatibleDC, hOldBitmap);
DeleteDC(hCompatibleDC);
diff --git a/src/ui/LCDUI/LCDBitmap.h b/src/ui/LCDUI/LCDBitmap.h
index 1ac1a6103..2396f8dda 100644
--- a/src/ui/LCDUI/LCDBitmap.h
+++ b/src/ui/LCDUI/LCDBitmap.h
@@ -3,14 +3,14 @@
// LCDBitmap.h
//
// The CLCDBitmap class draws bitmaps onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDBITMAP_H_INCLUDED_
-#define _LCDBITMAP_H_INCLUDED_
+#ifndef _LCDBITMAP_H_INCLUDED_
+#define _LCDBITMAP_H_INCLUDED_
#include "LCDBase.h"
diff --git a/src/ui/LCDUI/LCDCollection.cpp b/src/ui/LCDUI/LCDCollection.cpp
index edba28599..e2dff3bf3 100644
--- a/src/ui/LCDUI/LCDCollection.cpp
+++ b/src/ui/LCDUI/LCDCollection.cpp
@@ -3,7 +3,7 @@
// LCDCollection.cpp
//
// The CLCDCollection class is a generic collection of CLCDBase objects.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -59,7 +59,7 @@ BOOL CLCDCollection::RemoveObject(CLCDBase* pObject)
LCD_OBJECT_LIST::iterator it = m_Objects.begin();
while(it != m_Objects.end())
{
- if (*it == pObject)
+ if(*it == pObject)
{
m_Objects.erase(it);
break;
@@ -84,7 +84,7 @@ void CLCDCollection::OnDraw(CLCDGfx &rGfx)
CLCDBase *pObject = *it;
LCDUIASSERT(NULL != pObject);
- if (!pObject->IsVisible())
+ if(!pObject->IsVisible())
{
++it;
continue;
@@ -94,7 +94,7 @@ void CLCDCollection::OnDraw(CLCDGfx &rGfx)
HRGN hRgn = CreateRectRgn(pObject->GetOrigin().x, pObject->GetOrigin().y,
pObject->GetOrigin().x + pObject->GetWidth(),
pObject->GetOrigin().y + pObject->GetHeight());
-
+
// ensure that controls only draw within their specified region
SelectClipRgn(rGfx.GetHDC(), hRgn);
@@ -122,9 +122,9 @@ void CLCDCollection::OnDraw(CLCDGfx &rGfx)
// restore the viewport origin
SetViewportOrgEx(rGfx.GetHDC(),
- ptPrevViewportOrg.x,
- ptPrevViewportOrg.y,
- NULL);
+ ptPrevViewportOrg.x,
+ ptPrevViewportOrg.y,
+ NULL);
// restore the viewport origin offset
OffsetViewportOrgEx(rGfx.GetHDC(), 0, 0, NULL);
diff --git a/src/ui/LCDUI/LCDCollection.h b/src/ui/LCDUI/LCDCollection.h
index 0f4547222..45cc16791 100644
--- a/src/ui/LCDUI/LCDCollection.h
+++ b/src/ui/LCDUI/LCDCollection.h
@@ -3,14 +3,14 @@
// LCDCollection.h
//
// The CLCDCollection class is a generic collection of CLCDBase objects.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDCOLLECTION_H_INCLUDED_
-#define _LCDCOLLECTION_H_INCLUDED_
+#ifndef _LCDCOLLECTION_H_INCLUDED_
+#define _LCDCOLLECTION_H_INCLUDED_
#include "LCDBase.h"
@@ -33,7 +33,7 @@ public:
virtual void ResetUpdate(void);
virtual void Show(BOOL bShow);
-
+
public:
virtual void OnDraw(CLCDGfx &rGfx);
virtual void OnUpdate(DWORD dwTimestamp);
diff --git a/src/ui/LCDUI/LCDGfx.cpp b/src/ui/LCDUI/LCDGfx.cpp
index 450f394b5..f284ae754 100644
--- a/src/ui/LCDUI/LCDGfx.cpp
+++ b/src/ui/LCDUI/LCDGfx.cpp
@@ -4,7 +4,7 @@
//
// The CLCDGfx class abstracts GDI/bitmap details. It is used in the
// OnDraw event.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -22,14 +22,14 @@
//************************************************************************
CLCDGfx::CLCDGfx(void)
-: m_nWidth(0),
- m_nHeight(0),
- m_pLCDScreen(NULL),
- m_pBitmapInfo(NULL),
- m_hDC(NULL),
- m_hBitmap(NULL),
- m_hPrevBitmap(NULL),
- m_pBitmapBits(NULL)
+ : m_nWidth(0),
+ m_nHeight(0),
+ m_pLCDScreen(NULL),
+ m_pBitmapInfo(NULL),
+ m_hDC(NULL),
+ m_hBitmap(NULL),
+ m_hPrevBitmap(NULL),
+ m_pBitmapBits(NULL)
{
}
@@ -64,7 +64,7 @@ HRESULT CLCDGfx::Initialize(int nWidth, int nHeight)
Shutdown();
return E_FAIL;
}
-
+
int nBMISize = sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD);
m_pBitmapInfo = (BITMAPINFO *) DNew BYTE [nBMISize];
if(NULL == m_pBitmapInfo)
@@ -73,7 +73,7 @@ HRESULT CLCDGfx::Initialize(int nWidth, int nHeight)
Shutdown();
return E_OUTOFMEMORY;
}
-
+
ZeroMemory(m_pBitmapInfo, nBMISize);
m_pBitmapInfo->bmiHeader.biSize = sizeof(m_pBitmapInfo->bmiHeader);
m_pBitmapInfo->bmiHeader.biWidth = m_nWidth;
@@ -81,15 +81,15 @@ HRESULT CLCDGfx::Initialize(int nWidth, int nHeight)
m_pBitmapInfo->bmiHeader.biPlanes = 1;
m_pBitmapInfo->bmiHeader.biBitCount = 8;
m_pBitmapInfo->bmiHeader.biCompression = BI_RGB;
- m_pBitmapInfo->bmiHeader.biSizeImage =
- (m_nWidth *
- m_nHeight *
- m_pBitmapInfo->bmiHeader.biBitCount) / 8;
+ m_pBitmapInfo->bmiHeader.biSizeImage =
+ (m_nWidth *
+ m_nHeight *
+ m_pBitmapInfo->bmiHeader.biBitCount) / 8;
m_pBitmapInfo->bmiHeader.biXPelsPerMeter = 3200;
m_pBitmapInfo->bmiHeader.biYPelsPerMeter = 3200;
m_pBitmapInfo->bmiHeader.biClrUsed = 256;
m_pBitmapInfo->bmiHeader.biClrImportant = 256;
-
+
for(int nColor = 0; nColor < 256; ++nColor)
{
m_pBitmapInfo->bmiColors[nColor].rgbRed = (BYTE)((nColor > 128) ? 255 : 0);
@@ -97,7 +97,7 @@ HRESULT CLCDGfx::Initialize(int nWidth, int nHeight)
m_pBitmapInfo->bmiColors[nColor].rgbBlue = (BYTE)((nColor > 128) ? 255 : 0);
m_pBitmapInfo->bmiColors[nColor].rgbReserved = 0;
}
-
+
m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, NULL, 0);
if(NULL == m_hBitmap)
{
@@ -105,7 +105,7 @@ HRESULT CLCDGfx::Initialize(int nWidth, int nHeight)
Shutdown();
return E_FAIL;
}
-
+
m_pLCDScreen = DNew lgLcdBitmap160x43x1;
if(NULL == m_pLCDScreen)
{
@@ -131,7 +131,7 @@ void CLCDGfx::Shutdown(void)
delete m_pLCDScreen;
m_pLCDScreen = NULL;
}
-
+
if(NULL != m_hBitmap)
{
DeleteObject(m_hBitmap);
@@ -141,13 +141,13 @@ void CLCDGfx::Shutdown(void)
LCDUIASSERT(NULL == m_hPrevBitmap);
m_hPrevBitmap = NULL;
-
+
if(NULL != m_pBitmapInfo)
{
delete [] m_pBitmapInfo;
m_pBitmapInfo = NULL;
}
-
+
if(NULL != m_hDC)
{
DeleteDC(m_hDC);
@@ -253,10 +253,10 @@ void CLCDGfx::DrawText(int nX, int nY, LPCTSTR sText)
{
// map mode text, with transparency
int nOldMapMode = SetMapMode(m_hDC, MM_TEXT);
- int nOldBkMode = SetBkMode(m_hDC, TRANSPARENT);
-
+ int nOldBkMode = SetBkMode(m_hDC, TRANSPARENT);
+
::TextOut(m_hDC, nX, nY, sText, (int)_tcslen(sText));
-
+
// restores
SetMapMode(m_hDC, nOldMapMode);
SetBkMode(m_hDC, nOldBkMode);
@@ -310,7 +310,7 @@ lgLcdBitmap160x43x1 *CLCDGfx::GetLCDScreen(void)
m_pLCDScreen->hdr.Format = LGLCD_BMP_FORMAT_160x43x1;
memcpy(m_pLCDScreen->pixels, m_pBitmapBits, m_nWidth * m_nHeight);
}
-
+
return m_pLCDScreen;
}
diff --git a/src/ui/LCDUI/LCDGfx.h b/src/ui/LCDUI/LCDGfx.h
index 880e825d6..d1353fc1a 100644
--- a/src/ui/LCDUI/LCDGfx.h
+++ b/src/ui/LCDUI/LCDGfx.h
@@ -4,20 +4,20 @@
//
// The CLCDGfx class abstracts GDI/bitmap details. It is used in the
// OnDraw event.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDGFX_H_INCLUDED_
-#define _LCDGFX_H_INCLUDED_
+#ifndef _LCDGFX_H_INCLUDED_
+#define _LCDGFX_H_INCLUDED_
#include <windows.h>
#include <tchar.h>
#include <lglcd/lglcd.h>
-#if _MSC_VER >= 1400
+#if _MSC_VER >= 1400
#define LCDUI_tcsncpy(x, y, z) _tcsncpy_s(x, _countof(x), y, z)
#define LCDUI_tcscpy(x, y) _tcscpy_s(x, _countof(x), y)
#else
@@ -26,21 +26,21 @@
#endif
#ifndef LCDUITRACE
- // .NET compiler uses __noop intrinsic
- #if _MSC_VER > 1300
- #define LCDUITRACE __noop
- #else
- #define LCDUITRACE (void)0
- #endif
+// .NET compiler uses __noop intrinsic
+#if _MSC_VER > 1300
+#define LCDUITRACE __noop
+#else
+#define LCDUITRACE (void)0
+#endif
#endif
#ifndef LCDUIASSERT
- // .NET compiler uses __noop intrinsic
- #if _MSC_VER > 1300
- #define LCDUIASSERT __noop
- #else
- #define LCDUIASSERT (void)0
- #endif
+// .NET compiler uses __noop intrinsic
+#if _MSC_VER > 1300
+#define LCDUIASSERT __noop
+#else
+#define LCDUIASSERT (void)0
+#endif
#endif
@@ -66,7 +66,7 @@ public:
lgLcdBitmap160x43x1 *GetLCDScreen(void);
BITMAPINFO *GetBitmapInfo(void);
HBITMAP GetHBITMAP(void);
-
+
protected:
int m_nWidth;
int m_nHeight;
diff --git a/src/ui/LCDUI/LCDManager.cpp b/src/ui/LCDUI/LCDManager.cpp
index 3d83b9165..e9a3ab9fe 100644
--- a/src/ui/LCDUI/LCDManager.cpp
+++ b/src/ui/LCDUI/LCDManager.cpp
@@ -4,7 +4,7 @@
//
// The CLCDManager class is the representation of a "Screen". LCD UI class
// objects are added here.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -129,10 +129,10 @@ HRESULT CLCDManager::Draw(void)
// invoke LCD UI Elements
OnDraw(m_Gfx);
-
+
// select it back out of it
m_Gfx.EndDraw();
-
+
return S_OK;
}
diff --git a/src/ui/LCDUI/LCDManager.h b/src/ui/LCDUI/LCDManager.h
index c564b74da..822f034f4 100644
--- a/src/ui/LCDUI/LCDManager.h
+++ b/src/ui/LCDUI/LCDManager.h
@@ -4,14 +4,14 @@
//
// The CLCDManager class is the representation of a "Screen". LCD UI class
// objects are added here.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDMANAGER_H_INCLUDED_
-#define _LCDMANAGER_H_INCLUDED_
+#ifndef _LCDMANAGER_H_INCLUDED_
+#define _LCDMANAGER_H_INCLUDED_
#include "LCDCollection.h"
@@ -36,7 +36,7 @@ public:
void SetExpiration(DWORD dwMilliseconds);
virtual BOOL HasExpired(void);
-
+
private:
CLCDGfx m_Gfx;
diff --git a/src/ui/LCDUI/LCDOutput.cpp b/src/ui/LCDUI/LCDOutput.cpp
index e9a0dcd27..56339780d 100644
--- a/src/ui/LCDUI/LCDOutput.cpp
+++ b/src/ui/LCDUI/LCDOutput.cpp
@@ -2,9 +2,9 @@
//
// LCDOutput.cpp
//
-// The CLCDOutput class manages LCD hardware enumeration and screen
+// The CLCDOutput class manages LCD hardware enumeration and screen
// management.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -36,12 +36,12 @@ CLCDOutput::CLCDOutput()
ZeroMemory(&m_lcdConnectCtxEx, sizeof(m_lcdConnectCtxEx));
m_bDisplayLocked = FALSE;
m_bSetAsForeground = FALSE;
-
+
// Setup default device families
- m_dwDeviceFamiliesSupported = LGLCD_DEVICE_FAMILY_KEYBOARD_G15 |
- LGLCD_DEVICE_FAMILY_JACKBOX |
- LGLCD_DEVICE_FAMILY_SPEAKERS_Z10;
- m_dwDeviceFamiliesSupportedReserved1 = 0;
+ m_dwDeviceFamiliesSupported = LGLCD_DEVICE_FAMILY_KEYBOARD_G15 |
+ LGLCD_DEVICE_FAMILY_JACKBOX |
+ LGLCD_DEVICE_FAMILY_SPEAKERS_Z10;
+ m_dwDeviceFamiliesSupportedReserved1 = 0;
m_pLastBitmap = DNew lgLcdBitmap160x43x1;
ClearBitmap(m_pLastBitmap);
@@ -82,7 +82,7 @@ HRESULT CLCDOutput::Initialize()
//************************************************************************
HRESULT CLCDOutput::Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow)
-{
+{
UNREFERENCED_PARAMETER(bUseWindow);
@@ -107,7 +107,7 @@ HRESULT CLCDOutput::Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow)
{
// need to call lgLcdInit once
res = lgLcdInit();
- if (ERROR_SUCCESS != res)
+ if(ERROR_SUCCESS != res)
{
InterlockedDecrement(&lInitCount);
LCDUITRACE(_T("WARNING: lgLcdInit failed\n"));
@@ -127,7 +127,7 @@ HRESULT CLCDOutput::Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow)
m_lcdConnectCtxEx.onNotify.notifyContext = NULL;
// if user passed in the context, fill it up
- if (NULL != pContext)
+ if(NULL != pContext)
{
memcpy(&m_lcdConnectCtxEx, pContext, sizeof(lgLcdConnectContext));
}
@@ -143,7 +143,7 @@ HRESULT CLCDOutput::Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow)
//************************************************************************
HRESULT CLCDOutput::Initialize(lgLcdConnectContextEx* pContextEx, BOOL bUseWindow)
-{
+{
UNREFERENCED_PARAMETER(bUseWindow);
@@ -168,7 +168,7 @@ HRESULT CLCDOutput::Initialize(lgLcdConnectContextEx* pContextEx, BOOL bUseWindo
{
// need to call lgLcdInit once
res = lgLcdInit();
- if (ERROR_SUCCESS != res)
+ if(ERROR_SUCCESS != res)
{
InterlockedDecrement(&lInitCount);
LCDUITRACE(_T("WARNING: lgLcdInit failed\n"));
@@ -176,14 +176,14 @@ HRESULT CLCDOutput::Initialize(lgLcdConnectContextEx* pContextEx, BOOL bUseWindo
}
}
-
+
m_lcdConnectCtxEx.appFriendlyName = _T("My App");
m_lcdConnectCtxEx.isPersistent = FALSE;
m_lcdConnectCtxEx.isAutostartable = FALSE;
m_lcdConnectCtxEx.connection = LGLCD_INVALID_CONNECTION;
// if user passed in the context, fill it up
- if (NULL != pContextEx)
+ if(NULL != pContextEx)
{
memcpy(&m_lcdConnectCtxEx, pContextEx, sizeof(lgLcdConnectContextEx));
}
@@ -217,10 +217,10 @@ void CLCDOutput::Shutdown(void)
HRESULT CLCDOutput::Draw()
{
DWORD dwPriorityToUse = LGLCD_ASYNC_UPDATE(m_nPriority);
-
- if ( (NULL == m_pActiveScreen) ||
- (LGLCD_INVALID_DEVICE == m_hDevice) ||
- (LGLCD_PRIORITY_IDLE_NO_SHOW == dwPriorityToUse) )
+
+ if((NULL == m_pActiveScreen) ||
+ (LGLCD_INVALID_DEVICE == m_hDevice) ||
+ (LGLCD_PRIORITY_IDLE_NO_SHOW == dwPriorityToUse))
{
// don't submit the bitmap
return S_OK;
@@ -228,14 +228,14 @@ HRESULT CLCDOutput::Draw()
// Render the active screen
m_pActiveScreen->Draw();
-
+
// Get the active bitmap
lgLcdBitmap160x43x1* pScreen = m_pActiveScreen->GetLCDScreen();
// Only submit if the bitmap needs to be updated
// (If the priority or bitmap have changed)
DWORD res = ERROR_SUCCESS;
- if (DoesBitmapNeedUpdate(pScreen))
+ if(DoesBitmapNeedUpdate(pScreen))
{
res = lgLcdUpdateBitmap(m_hDevice, &pScreen->hdr, dwPriorityToUse);
HandleErrorFromAPI(res);
@@ -256,18 +256,18 @@ HRESULT CLCDOutput::Draw()
void CLCDOutput::Update(DWORD dwTimestamp)
{
- if (m_pActiveScreen)
+ if(m_pActiveScreen)
{
m_pActiveScreen->Update(dwTimestamp);
}
// check for expiration
- if (m_pActiveScreen && m_pActiveScreen->HasExpired())
+ if(m_pActiveScreen && m_pActiveScreen->HasExpired())
{
m_pActiveScreen = NULL;
- //m_nPriority = LGLCD_PRIORITY_FYI; -> needs to go so that if a
- // program sets priority to LGLCD_PRIORITY_BACKGROUND, that
- // priority sticks.
+ //m_nPriority = LGLCD_PRIORITY_FYI; -> needs to go so that if a
+ // program sets priority to LGLCD_PRIORITY_BACKGROUND, that
+ // priority sticks.
OnScreenExpired(m_pActiveScreen);
@@ -281,12 +281,12 @@ void CLCDOutput::Update(DWORD dwTimestamp)
CLCDManager *pMgr = *it;
LCDUIASSERT(NULL != pMgr);
- if (!pMgr->HasExpired())
+ if(!pMgr->HasExpired())
{
ActivateScreen(pMgr);
- //m_nPriority = LGLCD_PRIORITY_FYI; -> needs to go so that if a
- // program sets priority to LGLCD_PRIORITY_BACKGROUND, that
- // priority sticks.
+ //m_nPriority = LGLCD_PRIORITY_FYI; -> needs to go so that if a
+ // program sets priority to LGLCD_PRIORITY_BACKGROUND, that
+ // priority sticks.
break;
}
@@ -294,18 +294,18 @@ void CLCDOutput::Update(DWORD dwTimestamp)
}
// if no screen found, empty the screen at idle priority
- if (NULL == m_pActiveScreen)
+ if(NULL == m_pActiveScreen)
{
- if (LGLCD_INVALID_DEVICE != m_hDevice)
+ if(LGLCD_INVALID_DEVICE != m_hDevice)
{
lgLcdUpdateBitmap(m_hDevice, &CLCDManager::GetLCDScreen()->hdr,
- LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_IDLE_NO_SHOW));
+ LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_IDLE_NO_SHOW));
}
}
}
// check for lcd devices
- if (LGLCD_INVALID_DEVICE == m_hDevice)
+ if(LGLCD_INVALID_DEVICE == m_hDevice)
{
EnumerateDevices();
}
@@ -324,14 +324,14 @@ BOOL CLCDOutput::HasHardwareChanged(void)
{
// ping to see whether we're still alive
DWORD dwButtonState = 0;
-
+
DWORD res = lgLcdReadSoftButtons(m_hDevice, &dwButtonState);
HandleErrorFromAPI(res);
}
// check for lcd devices
- if (LGLCD_INVALID_DEVICE == m_hDevice)
+ if(LGLCD_INVALID_DEVICE == m_hDevice)
{
EnumerateDevices();
}
@@ -381,23 +381,23 @@ void CLCDOutput::ReadButtons()
if(IsOpened())
{
DWORD dwButtonState = 0;
-
+
DWORD res = lgLcdReadSoftButtons(m_hDevice, &dwButtonState);
- if (ERROR_SUCCESS != res)
+ if(ERROR_SUCCESS != res)
{
LCDUITRACE(_T("lgLcdReadSoftButtons failed: unplug?\n"));
HandleErrorFromAPI(res);
}
-
- if (m_dwButtonState == dwButtonState)
+
+ if(m_dwButtonState == dwButtonState)
return;
-
+
// handle the buttons
HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON0);
HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON1);
HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON2);
HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON3);
-
+
m_dwButtonState = dwButtonState;
}
}
@@ -411,12 +411,12 @@ void CLCDOutput::ReadButtons()
void CLCDOutput::HandleButtonState(DWORD dwButtonState, DWORD dwButton)
{
- if ( (m_dwButtonState & dwButton) && !(dwButtonState & dwButton) )
+ if((m_dwButtonState & dwButton) && !(dwButtonState & dwButton))
{
LCDUITRACE(_T("Button 0x%x released\n"), dwButton);
OnLCDButtonUp(dwButton);
}
- if ( !(m_dwButtonState & dwButton) && (dwButtonState & dwButton) )
+ if(!(m_dwButtonState & dwButton) && (dwButtonState & dwButton))
{
LCDUITRACE(_T("Button 0x%x pressed\n"), dwButton);
OnLCDButtonDown(dwButton);
@@ -432,7 +432,7 @@ void CLCDOutput::HandleButtonState(DWORD dwButtonState, DWORD dwButton)
void CLCDOutput::OnLCDButtonDown(int nButton)
{
- if (m_pActiveScreen)
+ if(m_pActiveScreen)
{
m_pActiveScreen->OnLCDButtonDown(nButton);
}
@@ -447,7 +447,7 @@ void CLCDOutput::OnLCDButtonDown(int nButton)
void CLCDOutput::OnLCDButtonUp(int nButton)
{
- if (m_pActiveScreen)
+ if(m_pActiveScreen)
{
m_pActiveScreen->OnLCDButtonUp(nButton);
}
@@ -462,7 +462,7 @@ void CLCDOutput::OnLCDButtonUp(int nButton)
void CLCDOutput::ActivateScreen(CLCDManager* pScreen)
{
- if (m_bLocked)
+ if(m_bLocked)
return;
m_pActiveScreen = pScreen;
}
@@ -476,7 +476,7 @@ void CLCDOutput::ActivateScreen(CLCDManager* pScreen)
void CLCDOutput::LockScreen(CLCDManager* pScreen)
{
- if (m_bLocked)
+ if(m_bLocked)
return;
m_pActiveScreen = pScreen;
@@ -531,9 +531,9 @@ BOOL CLCDOutput::AnyDeviceOfThisFamilyPresent(DWORD dwDeviceFamilyWanted, DWORD
{
lgLcdDeviceDescEx descEx;
- if (LGLCD_INVALID_CONNECTION == m_hConnection)
+ if(LGLCD_INVALID_CONNECTION == m_hConnection)
{
- if (ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
+ if(ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
{
// make sure we don't work with a stale device handle
m_hConnection = m_lcdConnectCtxEx.connection;
@@ -550,10 +550,10 @@ BOOL CLCDOutput::AnyDeviceOfThisFamilyPresent(DWORD dwDeviceFamilyWanted, DWORD
ZeroMemory(&descEx, sizeof(lgLcdDeviceDescEx));
DWORD res = ERROR_SUCCESS;
-
+
res = lgLcdEnumerateEx(m_hConnection, 0, &descEx);
- if (ERROR_SUCCESS != res)
+ if(ERROR_SUCCESS != res)
{
if(ERROR_NO_MORE_ITEMS != res)
{
@@ -563,14 +563,14 @@ BOOL CLCDOutput::AnyDeviceOfThisFamilyPresent(DWORD dwDeviceFamilyWanted, DWORD
}
// Go back to the previous device family we were using
- lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported,
+ lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported,
m_dwDeviceFamiliesSupportedReserved1);
return FALSE;
}
// Go back to what was being used
- lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported,
+ lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported,
m_dwDeviceFamiliesSupportedReserved1);
return TRUE;
@@ -587,9 +587,9 @@ void CLCDOutput::SetDeviceFamiliesSupported(DWORD dwDeviceFamiliesSupported, DWO
m_dwDeviceFamiliesSupported = dwDeviceFamiliesSupported;
m_dwDeviceFamiliesSupportedReserved1 = dwReserved1;
- if (LGLCD_INVALID_CONNECTION == m_hConnection)
+ if(LGLCD_INVALID_CONNECTION == m_hConnection)
{
- if (ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
+ if(ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
{
// make sure we don't work with a stale device handle
m_hConnection = m_lcdConnectCtxEx.connection;
@@ -602,13 +602,13 @@ void CLCDOutput::SetDeviceFamiliesSupported(DWORD dwDeviceFamiliesSupported, DWO
}
// close the lcd device before we open up another
- if (LGLCD_INVALID_DEVICE != m_hDevice)
+ if(LGLCD_INVALID_DEVICE != m_hDevice)
{
lgLcdClose(m_hDevice);
m_hDevice = LGLCD_INVALID_DEVICE;
}
-
+
// Setup the device family to use next time
lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported, m_dwDeviceFamiliesSupportedReserved1);
}
@@ -623,9 +623,9 @@ void CLCDOutput::EnumerateDevices()
{
lgLcdDeviceDescEx descEx;
- if (LGLCD_INVALID_CONNECTION == m_hConnection)
+ if(LGLCD_INVALID_CONNECTION == m_hConnection)
{
- if (ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
+ if(ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
{
// make sure we don't work with a stale device handle
m_hConnection = m_lcdConnectCtxEx.connection;
@@ -638,21 +638,21 @@ void CLCDOutput::EnumerateDevices()
}
// close the lcd device before we open up another
- if (LGLCD_INVALID_DEVICE != m_hDevice)
+ if(LGLCD_INVALID_DEVICE != m_hDevice)
{
lgLcdClose(m_hDevice);
m_hDevice = LGLCD_INVALID_DEVICE;
}
-
+
// Setup the device family to use next time
lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported, m_dwDeviceFamiliesSupportedReserved1);
-
+
ZeroMemory(&descEx, sizeof(lgLcdDeviceDescEx));
DWORD res = ERROR_SUCCESS;
-
+
res = lgLcdEnumerateEx(m_hConnection, 0, &descEx);
- if (ERROR_SUCCESS != res)
+ if(ERROR_SUCCESS != res)
{
if(ERROR_NO_MORE_ITEMS != res)
{
@@ -668,7 +668,7 @@ void CLCDOutput::EnumerateDevices()
open_ctx.connection = m_hConnection;
open_ctx.index = 0;
res = lgLcdOpen(&open_ctx);
- if (ERROR_SUCCESS != res)
+ if(ERROR_SUCCESS != res)
return;
m_hDevice = open_ctx.device;
m_dwButtonState = 0;
@@ -711,7 +711,7 @@ void CLCDOutput::HandleErrorFromAPI(DWORD dwRes)
//************************************************************************
void CLCDOutput::SetScreenPriority(DWORD priority)
{
- if (priority == m_nPriority)
+ if(priority == m_nPriority)
{
// Nothing to do
return;
@@ -723,13 +723,13 @@ void CLCDOutput::SetScreenPriority(DWORD priority)
m_nPriority = priority;
m_bPriorityHasChanged = TRUE;
- if (LGLCD_PRIORITY_IDLE_NO_SHOW == m_nPriority)
+ if(LGLCD_PRIORITY_IDLE_NO_SHOW == m_nPriority)
{
// send an empty bitmap at idle priority
- if (LGLCD_INVALID_DEVICE != m_hDevice)
+ if(LGLCD_INVALID_DEVICE != m_hDevice)
{
lgLcdUpdateBitmap(m_hDevice, &m_pLastBitmap->hdr,
- LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_IDLE_NO_SHOW));
+ LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_IDLE_NO_SHOW));
}
}
}
@@ -790,7 +790,7 @@ void CLCDOutput::OnClosingDevice(int hDevice)
{
UNREFERENCED_PARAMETER(hDevice);
LCDUITRACE(_T("CLCDOutput::OnClosingDevice\n"));
- if (IsOpened())
+ if(IsOpened())
{
lgLcdClose(m_hDevice);
m_hDevice = LGLCD_INVALID_DEVICE;
@@ -811,7 +811,7 @@ void CLCDOutput::OnDisconnecting(int hConnection)
// let's hope our device is already gone
LCDUIASSERT(!IsOpened());
- if (LGLCD_INVALID_CONNECTION != m_hConnection)
+ if(LGLCD_INVALID_CONNECTION != m_hConnection)
{
lgLcdDisconnect(m_hConnection);
m_hConnection = LGLCD_INVALID_CONNECTION;
@@ -827,7 +827,7 @@ void CLCDOutput::OnDisconnecting(int hConnection)
BOOL CLCDOutput::IsOpened()
{
- return (LGLCD_INVALID_DEVICE != m_hDevice);
+ return (LGLCD_INVALID_DEVICE != m_hDevice);
}
@@ -841,7 +841,7 @@ void CLCDOutput::SetAsForeground(BOOL bSetAsForeground)
{
/*DWORD dwSet = */bSetAsForeground ? LGLCD_LCD_FOREGROUND_APP_YES : LGLCD_LCD_FOREGROUND_APP_NO;
m_bSetAsForeground = bSetAsForeground;
- if (LGLCD_INVALID_DEVICE != m_hDevice)
+ if(LGLCD_INVALID_DEVICE != m_hDevice)
{
lgLcdSetAsLCDForegroundApp(m_hDevice, bSetAsForeground);
}
@@ -861,11 +861,11 @@ BOOL CLCDOutput::DoesBitmapNeedUpdate(lgLcdBitmap160x43x1* pCurrentBitmap)
BOOL bBitmapChanged = 0 != memcmp(pCurrentBitmap, m_pLastBitmap, sizeof(lgLcdBitmap160x43x1));
BOOL bPriorityChanged = m_bPriorityHasChanged;
- if (bBitmapChanged)
+ if(bBitmapChanged)
{
LCDUITRACE(_T("Resubmitting bitmap (bitmap changed)\n"));
}
- else if (bPriorityChanged)
+ else if(bPriorityChanged)
{
LCDUITRACE(_T("Resubmitting bitmap (priority changed)\n"));
}
@@ -888,7 +888,7 @@ BOOL CLCDOutput::DoesBitmapNeedUpdate(lgLcdBitmap160x43x1* pCurrentBitmap)
void CLCDOutput::ClearBitmap(lgLcdBitmap160x43x1* pCurrentBitmap)
{
LCDUIASSERT(NULL != pCurrentBitmap);
- if (pCurrentBitmap)
+ if(pCurrentBitmap)
{
pCurrentBitmap->hdr.Format = LGLCD_BMP_FORMAT_160x43x1;
ZeroMemory(pCurrentBitmap->pixels, sizeof(pCurrentBitmap->pixels));
diff --git a/src/ui/LCDUI/LCDOutput.h b/src/ui/LCDUI/LCDOutput.h
index 7a379aea0..e5ca106fa 100644
--- a/src/ui/LCDUI/LCDOutput.h
+++ b/src/ui/LCDUI/LCDOutput.h
@@ -4,14 +4,14 @@
//
// The CLCDOutput class manages LCD hardware enumeration and screen
// management.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _CLCDOUTPUT_H_INCLUDED_
-#define _CLCDOUTPUT_H_INCLUDED_
+#ifndef _CLCDOUTPUT_H_INCLUDED_
+#define _CLCDOUTPUT_H_INCLUDED_
#include "LCDManager.h"
#include <lglcd/lglcd.h>
@@ -85,7 +85,7 @@ protected:
protected:
CLCDManager* m_pActiveScreen;
- // list
+ // list
LCD_MGR_LIST m_LCDMgrList;
void EnumerateDevices();
diff --git a/src/ui/LCDUI/LCDProgressBar.cpp b/src/ui/LCDUI/LCDProgressBar.cpp
index 978cb2558..a1b37fbba 100644
--- a/src/ui/LCDUI/LCDProgressBar.cpp
+++ b/src/ui/LCDUI/LCDProgressBar.cpp
@@ -3,7 +3,7 @@
// LCDProgressBar.cpp
//
// The CLCDProgressBar class draws a progress bar onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -24,7 +24,7 @@ CLCDProgressBar::CLCDProgressBar()
m_Range.nMin = 0;
m_Range.nMax = 100;
m_nCursorWidth = 5;
- m_hPen = NULL;
+ m_hPen = NULL;
}
@@ -36,11 +36,11 @@ CLCDProgressBar::CLCDProgressBar()
CLCDProgressBar::~CLCDProgressBar()
{
- if (m_hPen != NULL)
- {
- ::DeleteObject(m_hPen);
- m_hPen = NULL;
- }
+ if(m_hPen != NULL)
+ {
+ ::DeleteObject(m_hPen);
+ m_hPen = NULL;
+ }
}
@@ -54,7 +54,7 @@ HRESULT CLCDProgressBar::Initialize()
{
m_hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);
- m_hPen = ::CreatePen(PS_DOT, 1, RGB(255, 255, 255));
+ m_hPen = ::CreatePen(PS_DOT, 1, RGB(255, 255, 255));
return CLCDBase::Initialize();
}
@@ -67,69 +67,69 @@ HRESULT CLCDProgressBar::Initialize()
//************************************************************************
void CLCDProgressBar::OnDraw(CLCDGfx &rGfx)
-{
- HPEN hOldPen;
-
- rGfx.ClearScreen();
-
- // draw the border
- RECT r = { 0, 0, GetWidth(), GetHeight() };
-
- FrameRect(rGfx.GetHDC(), &r, m_hBrush);
-
- // draw the progress
- switch(m_eStyle)
- {
- case STYLE_CURSOR:
- {
- int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
- (float)1, (float)(GetWidth() - m_nCursorWidth-1),
- m_Pos);
- r.left = nCursorPos;
- r.right = r.left + m_nCursorWidth;
- FillRect(rGfx.GetHDC(), &r, m_hBrush);
- }
- break;
- case STYLE_FILLED_V:
- case STYLE_FILLED_H:
- {
- int nBar = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
- 0.0f, (m_eStyle == STYLE_FILLED_H ? (float)GetWidth() : (float)GetHeight())-4,
- m_Pos);
- r.left = r.left+2;
- r.bottom = r.bottom-2;
- if (m_eStyle == STYLE_FILLED_H)
- {
- r.right = nBar+2;
- r.top = r.top+2;
- }
- else
- {
- r.right = r.right-2;
- r.top = r.bottom-nBar;
- }
-
- FillRect(rGfx.GetHDC(), &r, m_hBrush);
- }
- break;
- case STYLE_DASHED_CURSOR:
- {
- int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
- (float)1, (float)(GetWidth() - m_nCursorWidth-1),
- m_Pos);
- r.left = nCursorPos;
- r.right = r.left + m_nCursorWidth;
- FillRect(rGfx.GetHDC(), &r, m_hBrush);
- hOldPen = (HPEN)::SelectObject(rGfx.GetHDC(), m_hPen);
-
- ::MoveToEx(rGfx.GetHDC(), 0, (r.bottom - r.top)/2, NULL);
- ::LineTo(rGfx.GetHDC(), nCursorPos, (r.bottom - r.top)/2);
- ::SelectObject(rGfx.GetHDC(), hOldPen);
- }
- break;
- default:
- break;
- }
+{
+ HPEN hOldPen;
+
+ rGfx.ClearScreen();
+
+ // draw the border
+ RECT r = { 0, 0, GetWidth(), GetHeight() };
+
+ FrameRect(rGfx.GetHDC(), &r, m_hBrush);
+
+ // draw the progress
+ switch(m_eStyle)
+ {
+ case STYLE_CURSOR:
+ {
+ int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
+ (float)1, (float)(GetWidth() - m_nCursorWidth - 1),
+ m_Pos);
+ r.left = nCursorPos;
+ r.right = r.left + m_nCursorWidth;
+ FillRect(rGfx.GetHDC(), &r, m_hBrush);
+ }
+ break;
+ case STYLE_FILLED_V:
+ case STYLE_FILLED_H:
+ {
+ int nBar = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
+ 0.0f, (m_eStyle == STYLE_FILLED_H ? (float)GetWidth() : (float)GetHeight()) - 4,
+ m_Pos);
+ r.left = r.left + 2;
+ r.bottom = r.bottom - 2;
+ if(m_eStyle == STYLE_FILLED_H)
+ {
+ r.right = nBar + 2;
+ r.top = r.top + 2;
+ }
+ else
+ {
+ r.right = r.right - 2;
+ r.top = r.bottom - nBar;
+ }
+
+ FillRect(rGfx.GetHDC(), &r, m_hBrush);
+ }
+ break;
+ case STYLE_DASHED_CURSOR:
+ {
+ int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
+ (float)1, (float)(GetWidth() - m_nCursorWidth - 1),
+ m_Pos);
+ r.left = nCursorPos;
+ r.right = r.left + m_nCursorWidth;
+ FillRect(rGfx.GetHDC(), &r, m_hBrush);
+ hOldPen = (HPEN)::SelectObject(rGfx.GetHDC(), m_hPen);
+
+ ::MoveToEx(rGfx.GetHDC(), 0, (r.bottom - r.top) / 2, NULL);
+ ::LineTo(rGfx.GetHDC(), nCursorPos, (r.bottom - r.top) / 2);
+ ::SelectObject(rGfx.GetHDC(), hOldPen);
+ }
+ break;
+ default:
+ break;
+ }
}
@@ -190,7 +190,7 @@ RANGE& CLCDProgressBar::GetRange()
__int64 CLCDProgressBar::SetPos(__int64 Pos)
{
- return ( m_Pos = max(m_Range.nMin, min(Pos, m_Range.nMax)) );
+ return (m_Pos = max(m_Range.nMin, min(Pos, m_Range.nMax)));
}
@@ -225,7 +225,7 @@ void CLCDProgressBar::EnableCursor(BOOL bEnable)
void CLCDProgressBar::SetProgressStyle(ePROGRESS_STYLE eStyle)
{
- m_eStyle = eStyle;
+ m_eStyle = eStyle;
}
//************************************************************************
@@ -235,7 +235,7 @@ void CLCDProgressBar::SetProgressStyle(ePROGRESS_STYLE eStyle)
//************************************************************************
float CLCDProgressBar::Scalef(float fFromMin, float fFromMax,
- float fToMin, float fToMax, __int64 fFromValue)
+ float fToMin, float fToMax, __int64 fFromValue)
{
// normalize the input
@@ -244,7 +244,7 @@ float CLCDProgressBar::Scalef(float fFromMin, float fFromMax,
// now scale to the output
float fToRange = fToMax - fToMin;
- return ( fToMin + (fFromValueN * fToRange) );
+ return (fToMin + (fFromValueN * fToRange));
}
@@ -258,12 +258,12 @@ int CLCDProgressBar::Scale(int nFromMin, int nFromMax,
int nToMin, int nToMax, __int64 nFromValue)
{
return (int)Scalef(
- (float)nFromMin,
- (float)nFromMax,
- (float)nToMin,
- (float)nToMax,
- nFromValue
- );
+ (float)nFromMin,
+ (float)nFromMax,
+ (float)nToMin,
+ (float)nToMax,
+ nFromValue
+ );
}
diff --git a/src/ui/LCDUI/LCDProgressBar.h b/src/ui/LCDUI/LCDProgressBar.h
index 346bf6c2b..88b530095 100644
--- a/src/ui/LCDUI/LCDProgressBar.h
+++ b/src/ui/LCDUI/LCDProgressBar.h
@@ -3,14 +3,14 @@
// LCDProgressBar.h
//
// The CLCDProgressBar class draws a progress bar onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDPROGRESSBAR_H_INCLUDED_
-#define _LCDPROGRESSBAR_H_INCLUDED_
+#ifndef _LCDPROGRESSBAR_H_INCLUDED_
+#define _LCDPROGRESSBAR_H_INCLUDED_
#include "LCDBase.h"
@@ -19,15 +19,15 @@ typedef struct RANGE
__int64 nMin;
__int64 nMax;
-}RANGE, *LPRANGE;
+} RANGE, *LPRANGE;
enum ePROGRESS_STYLE { STYLE_FILLED_H, STYLE_FILLED_V, STYLE_CURSOR, STYLE_DASHED_CURSOR };
class CLCDProgressBar : public CLCDBase
{
public:
- enum ePROGRESS_STYLE { STYLE_FILLED_H, STYLE_FILLED_V, STYLE_CURSOR, STYLE_DASHED_CURSOR };
-
+ enum ePROGRESS_STYLE { STYLE_FILLED_H, STYLE_FILLED_V, STYLE_CURSOR, STYLE_DASHED_CURSOR };
+
CLCDProgressBar();
virtual ~CLCDProgressBar();
@@ -35,7 +35,7 @@ public:
virtual HRESULT Initialize(void);
virtual void OnDraw(CLCDGfx &rGfx);
virtual void ResetUpdate(void);
-
+
// CLCDProgressBar
virtual void SetRange(__int64 nMin, __int64 nMax);
virtual void SetRange(RANGE& Range);
@@ -43,7 +43,7 @@ public:
virtual __int64 SetPos(__int64 fPos);
virtual __int64 GetPos(void);
virtual void EnableCursor(BOOL bEnable);
- virtual void SetProgressStyle(ePROGRESS_STYLE eStyle);
+ virtual void SetProgressStyle(ePROGRESS_STYLE eStyle);
protected:
float Scalef(float fFromMin, float fFromMax,
@@ -56,7 +56,7 @@ private:
__int64 m_Pos;
ePROGRESS_STYLE m_eStyle;
HBRUSH m_hBrush;
- HPEN m_hPen;
+ HPEN m_hPen;
int m_nCursorWidth;
};
diff --git a/src/ui/LCDUI/LCDScrollingText.cpp b/src/ui/LCDUI/LCDScrollingText.cpp
index 880fc505a..863469bbf 100644
--- a/src/ui/LCDUI/LCDScrollingText.cpp
+++ b/src/ui/LCDUI/LCDScrollingText.cpp
@@ -3,7 +3,7 @@
// LCDScrollingText.cpp
//
// The CLCDScrollingText class draws scrolling text onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -76,7 +76,7 @@ void CLCDScrollingText::ResetUpdate(void)
m_fTotalDistance = 0;
SetLeftMargin(0);
SetLogicalOrigin(0, 0);
-
+
CLCDText::ResetUpdate();
}
@@ -151,7 +151,7 @@ CLCDScrollingText::eSCROLL_DIR CLCDScrollingText::GetScrollDirection()
void CLCDScrollingText::SetText(LPCTSTR szText)
{
- if (_tcscmp(szText, m_sText.c_str()))
+ if(_tcscmp(szText, m_sText.c_str()))
{
ResetUpdate();
}
@@ -204,26 +204,26 @@ void CLCDScrollingText::OnUpdate(DWORD dwTimestamp)
void CLCDScrollingText::OnDraw(CLCDGfx &rGfx)
{
- if (!m_nTextLength)
+ if(!m_nTextLength)
return;
// calculate the scrolling distance
- if (-1 == m_nScrollingDistance)
+ if(-1 == m_nScrollingDistance)
{
CLCDText::OnDraw(rGfx);
- if (SCROLL_VERT == m_eScrollDir)
- {
+ if(SCROLL_VERT == m_eScrollDir)
+ {
// determine how far we have to travel until scrolling stops
m_nScrollingDistance = ((GetHeight()) >= GetVExtent().cy) ?
- 0 : (GetVExtent().cy - GetHeight());
+ 0 : (GetVExtent().cy - GetHeight());
SetLogicalSize(GetVExtent().cx, GetVExtent().cy);
}
else
{
// determine how far we have to travel until scrolling stops
m_nScrollingDistance = ((GetWidth()) >= GetHExtent().cx) ?
- 0 : (GetHExtent().cx - GetWidth());
+ 0 : (GetHExtent().cx - GetWidth());
SetLogicalSize(max(GetSize().cx, GetHExtent().cx), GetHExtent().cy);
}
}
@@ -231,7 +231,7 @@ void CLCDScrollingText::OnDraw(CLCDGfx &rGfx)
switch(m_eState)
{
case STATE_START_DELAY:
- if (m_dwEllapsedTime > m_dwStartDelay)
+ if(m_dwEllapsedTime > m_dwStartDelay)
{
m_eState = STATE_SCROLL;
m_dwEllapsedTime = 0;
@@ -239,9 +239,9 @@ void CLCDScrollingText::OnDraw(CLCDGfx &rGfx)
}
break;
case STATE_END_DELAY:
- if (m_dwEllapsedTime > m_dwEndDelay)
+ if(m_dwEllapsedTime > m_dwEndDelay)
{
- if (m_bRepeat)
+ if(m_bRepeat)
{
ResetUpdate();
break;
@@ -252,34 +252,34 @@ void CLCDScrollingText::OnDraw(CLCDGfx &rGfx)
}
break;
case STATE_SCROLL:
- {
- // TODO: add some anti-aliasing on the movement
+ {
+ // TODO: add some anti-aliasing on the movement
- // how much time has ellapsed?
- // given the speed, what is the total displacement?
- float fDistance = (float)(m_dwSpeed * m_dwEllapsedTime) / 1000.0f;
- m_fTotalDistance += fDistance;
+ // how much time has ellapsed?
+ // given the speed, what is the total displacement?
+ float fDistance = (float)(m_dwSpeed * m_dwEllapsedTime) / 1000.0f;
+ m_fTotalDistance += fDistance;
- // we dont want the total distnace exceed our scrolling distance
- int nTotalOffset = min((int)m_fTotalDistance, m_nScrollingDistance);
-
- if (SCROLL_VERT == m_eScrollDir)
- {
- SetLogicalOrigin(GetLogicalOrigin().x, -1 * nTotalOffset);
- }
- else
- {
- SetLogicalOrigin(-1 * nTotalOffset, GetLogicalOrigin().y);
- }
-
- m_dwLastUpdate = GetTickCount();
+ // we dont want the total distnace exceed our scrolling distance
+ int nTotalOffset = min((int)m_fTotalDistance, m_nScrollingDistance);
- if (nTotalOffset == m_nScrollingDistance)
- {
- m_eState = STATE_END_DELAY;
- }
+ if(SCROLL_VERT == m_eScrollDir)
+ {
+ SetLogicalOrigin(GetLogicalOrigin().x, -1 * nTotalOffset);
}
- break;
+ else
+ {
+ SetLogicalOrigin(-1 * nTotalOffset, GetLogicalOrigin().y);
+ }
+
+ m_dwLastUpdate = GetTickCount();
+
+ if(nTotalOffset == m_nScrollingDistance)
+ {
+ m_eState = STATE_END_DELAY;
+ }
+ }
+ break;
case STATE_DONE:
break;
diff --git a/src/ui/LCDUI/LCDScrollingText.h b/src/ui/LCDUI/LCDScrollingText.h
index 8438c3952..b66635806 100644
--- a/src/ui/LCDUI/LCDScrollingText.h
+++ b/src/ui/LCDUI/LCDScrollingText.h
@@ -3,14 +3,14 @@
// LCDScrollingText.h
//
// The CLCDScrollingText class draws scrolling text onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDSCROLLINGTEXT_H_INCLUDED_
-#define _LCDSCROLLINGTEXT_H_INCLUDED_
+#ifndef _LCDSCROLLINGTEXT_H_INCLUDED_
+#define _LCDSCROLLINGTEXT_H_INCLUDED_
#include "LCDBase.h"
#include "LCDText.h"
@@ -24,7 +24,7 @@ public:
// CLCDBase
virtual HRESULT Initialize(void);
virtual void ResetUpdate(void);
-
+
// CLCDText
virtual void SetText(LPCTSTR szText);
diff --git a/src/ui/LCDUI/LCDText.cpp b/src/ui/LCDUI/LCDText.cpp
index e77282db2..4a55c5c68 100644
--- a/src/ui/LCDUI/LCDText.cpp
+++ b/src/ui/LCDUI/LCDText.cpp
@@ -3,7 +3,7 @@
// LCDText.cpp
//
// The CLCDText class draws simple text onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
@@ -43,7 +43,7 @@ CLCDText::CLCDText()
CLCDText::~CLCDText()
{
- if (m_hFont)
+ if(m_hFont)
{
DeleteObject(m_hFont);
m_hFont = NULL;
@@ -78,7 +78,7 @@ HRESULT CLCDText::Initialize()
void CLCDText::SetFont(LOGFONT& lf)
{
- if (m_hFont)
+ if(m_hFont)
{
DeleteObject(m_hFont);
m_hFont = NULL;
@@ -110,7 +110,7 @@ HFONT CLCDText::GetFont()
void CLCDText::SetFontFaceName(LPCTSTR szFontName)
{
// if NULL, uses the default gui font
- if (NULL == szFontName)
+ if(NULL == szFontName)
return;
LOGFONT lf;
@@ -201,7 +201,7 @@ LPCTSTR CLCDText::GetText()
void CLCDText::SetWordWrap(BOOL bEnable)
{
- if (bEnable)
+ if(bEnable)
{
m_nTextFormat |= DT_WORDBREAK;
}
@@ -308,14 +308,14 @@ void CLCDText::SetAlignment(int nAlignment)
void CLCDText::DrawText(CLCDGfx &rGfx)
{
// draw the text
- RECT rBoundary = { 0, 0,0 + GetLogicalSize().cx, 0 + GetLogicalSize().cy };
+ RECT rBoundary = { 0, 0, 0 + GetLogicalSize().cx, 0 + GetLogicalSize().cy };
DrawTextEx(rGfx.GetHDC(), (LPTSTR)m_sText.c_str(), static_cast<int>(m_nTextLength), &rBoundary, m_nTextFormat, &m_dtp);
-
+
// LCDUITRACE(_T("Drawing %s at (%d,%d)-(%d-%d) lmargin=%d, rmargin=%d\n"),
// m_sText.c_str(), m_Origin.x, m_Origin.y, GetWidth(), GetHeight(),
// m_dtp.iLeftMargin, m_dtp.iRightMargin);
- if (m_bInverted)
+ if(m_bInverted)
{
InvertRect(rGfx.GetHDC(), &rBoundary);
}
@@ -331,31 +331,31 @@ void CLCDText::DrawText(CLCDGfx &rGfx)
void CLCDText::OnDraw(CLCDGfx &rGfx)
{
- if (GetBackgroundMode() == OPAQUE)
+ if(GetBackgroundMode() == OPAQUE)
{
// clear the clipped area
RECT rcClp = { 0, 0, m_Size.cx, m_Size.cy };
FillRect(rGfx.GetHDC(), &rcClp, (HBRUSH) GetStockObject(BLACK_BRUSH));
-
+
// clear the logical area
RECT rcLog = { 0, 0, m_sizeLogical.cx, m_sizeLogical.cy };
FillRect(rGfx.GetHDC(), &rcLog, (HBRUSH) GetStockObject(BLACK_BRUSH));
}
-
- if (m_nTextLength)
+
+ if(m_nTextLength)
{
// map mode text, with transparency
int nOldMapMode = SetMapMode(rGfx.GetHDC(), MM_TEXT);
- int nOldBkMode = SetBkMode(rGfx.GetHDC(), GetBackgroundMode());
+ int nOldBkMode = SetBkMode(rGfx.GetHDC(), GetBackgroundMode());
// select current font
- HFONT hOldFont = (HFONT)SelectObject(rGfx.GetHDC(), m_hFont);
+ HFONT hOldFont = (HFONT)SelectObject(rGfx.GetHDC(), m_hFont);
// select color
COLORREF crOldTextColor = SetTextColor(rGfx.GetHDC(), m_crColor);
-
- if (m_bRecalcExtent)
+
+ if(m_bRecalcExtent)
{
int nTextFormat;
@@ -381,7 +381,7 @@ void CLCDText::OnDraw(CLCDGfx &rGfx)
m_bRecalcExtent = FALSE;
}
- if (IsVisible())
+ if(IsVisible())
{
DrawText(rGfx);
}
diff --git a/src/ui/LCDUI/LCDText.h b/src/ui/LCDUI/LCDText.h
index 3a74f746f..7db9580ee 100644
--- a/src/ui/LCDUI/LCDText.h
+++ b/src/ui/LCDUI/LCDText.h
@@ -3,14 +3,14 @@
// LCDText.h
//
// The CLCDText class draws simple text onto the LCD.
-//
+//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************
-#ifndef _LCDTEXT_H_INCLUDED_
-#define _LCDTEXT_H_INCLUDED_
+#ifndef _LCDTEXT_H_INCLUDED_
+#define _LCDTEXT_H_INCLUDED_
#include "LCDBase.h"
@@ -25,7 +25,7 @@ public:
virtual ~CLCDText();
virtual HRESULT Initialize(void);
-
+
virtual void SetFont(LOGFONT& lf);
virtual void SetFontFaceName(LPCTSTR szFontName);
virtual void SetFontPointSize(int nPointSize);
diff --git a/src/ui/ResizableLib/ResizableDialog.cpp b/src/ui/ResizableLib/ResizableDialog.cpp
index af9d16b97..ece5d1f23 100644
--- a/src/ui/ResizableLib/ResizableDialog.cpp
+++ b/src/ui/ResizableLib/ResizableDialog.cpp
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -22,25 +22,25 @@
inline void CResizableDialog::PrivateConstruct()
{
- m_bEnableSaveRestore = FALSE;
- m_dwGripTempState = 1;
+ m_bEnableSaveRestore = FALSE;
+ m_dwGripTempState = 1;
}
CResizableDialog::CResizableDialog()
{
- PrivateConstruct();
+ PrivateConstruct();
}
CResizableDialog::CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd)
- : CCmdUIDialog(nIDTemplate, pParentWnd)
+ : CCmdUIDialog(nIDTemplate, pParentWnd)
{
- PrivateConstruct();
+ PrivateConstruct();
}
CResizableDialog::CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
- : CCmdUIDialog(lpszTemplateName, pParentWnd)
+ : CCmdUIDialog(lpszTemplateName, pParentWnd)
{
- PrivateConstruct();
+ PrivateConstruct();
}
CResizableDialog::~CResizableDialog()
@@ -49,107 +49,107 @@ CResizableDialog::~CResizableDialog()
BEGIN_MESSAGE_MAP(CResizableDialog, CCmdUIDialog)
- //{{AFX_MSG_MAP(CResizableDialog)
- ON_WM_GETMINMAXINFO()
- ON_WM_SIZE()
- ON_WM_DESTROY()
- ON_WM_CREATE()
- ON_WM_ERASEBKGND()
- //}}AFX_MSG_MAP
+ //{{AFX_MSG_MAP(CResizableDialog)
+ ON_WM_GETMINMAXINFO()
+ ON_WM_SIZE()
+ ON_WM_DESTROY()
+ ON_WM_CREATE()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResizableDialog message handlers
-int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
+int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if (__super::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- // child dialogs don't want resizable border or size grip,
- // nor they can handle the min/max size constraints
- BOOL bChild = GetStyle() & WS_CHILD;
-
- if (!bChild)
- {
- // keep client area
- CRect rect;
- GetClientRect(&rect);
- // set resizable style
- ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
- // adjust size to reflect new style
- ::AdjustWindowRectEx(&rect, GetStyle(),
- ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
- SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED|
- SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);
-
- // set the initial size as the min track size
- SetMinTrackSize(rect.Size());
- }
-
- // create and init the size-grip
- if (!CreateSizeGrip(!bChild))
- return -1;
-
- return 0;
+ if(__super::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // child dialogs don't want resizable border or size grip,
+ // nor they can handle the min/max size constraints
+ BOOL bChild = GetStyle() & WS_CHILD;
+
+ if(!bChild)
+ {
+ // keep client area
+ CRect rect;
+ GetClientRect(&rect);
+ // set resizable style
+ ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
+ // adjust size to reflect new style
+ ::AdjustWindowRectEx(&rect, GetStyle(),
+ ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
+ SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED |
+ SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION);
+
+ // set the initial size as the min track size
+ SetMinTrackSize(rect.Size());
+ }
+
+ // create and init the size-grip
+ if(!CreateSizeGrip(!bChild))
+ return -1;
+
+ return 0;
}
-void CResizableDialog::OnDestroy()
+void CResizableDialog::OnDestroy()
{
- if (m_bEnableSaveRestore)
- SaveWindowRect(m_sSection, m_bRectOnly);
+ if(m_bEnableSaveRestore)
+ SaveWindowRect(m_sSection, m_bRectOnly);
- // remove child windows
- RemoveAllAnchors();
+ // remove child windows
+ RemoveAllAnchors();
- __super::OnDestroy();
+ __super::OnDestroy();
}
-void CResizableDialog::OnSize(UINT nType, int cx, int cy)
+void CResizableDialog::OnSize(UINT nType, int cx, int cy)
{
- CWnd::OnSize(nType, cx, cy);
-
- if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
- return; // arrangement not needed
-
- if (nType == SIZE_MAXIMIZED)
- HideSizeGrip(&m_dwGripTempState);
- else
- ShowSizeGrip(&m_dwGripTempState);
-
- // update grip and layout
- UpdateSizeGrip();
- ArrangeLayout();
+ CWnd::OnSize(nType, cx, cy);
+
+ if(nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
+ return; // arrangement not needed
+
+ if(nType == SIZE_MAXIMIZED)
+ HideSizeGrip(&m_dwGripTempState);
+ else
+ ShowSizeGrip(&m_dwGripTempState);
+
+ // update grip and layout
+ UpdateSizeGrip();
+ ArrangeLayout();
}
-void CResizableDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+void CResizableDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
- MinMaxInfo(lpMMI);
+ MinMaxInfo(lpMMI);
}
// NOTE: this must be called after setting the layout
// to have the dialog and its controls displayed properly
void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
{
- m_sSection = pszSection;
+ m_sSection = pszSection;
- m_bEnableSaveRestore = TRUE;
- m_bRectOnly = bRectOnly;
+ m_bEnableSaveRestore = TRUE;
+ m_bRectOnly = bRectOnly;
- // restore immediately
- LoadWindowRect(pszSection, bRectOnly);
+ // restore immediately
+ LoadWindowRect(pszSection, bRectOnly);
}
-BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC)
+BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC)
{
- // Windows XP doesn't like clipping regions ...try this!
- EraseBackground(pDC);
- return TRUE;
+ // Windows XP doesn't like clipping regions ...try this!
+ EraseBackground(pDC);
+ return TRUE;
-/* ClipChildren(pDC); // old-method (for safety)
+ /* ClipChildren(pDC); // old-method (for safety)
- return CDialog::OnEraseBkgnd(pDC);
-*/
+ return CDialog::OnEraseBkgnd(pDC);
+ */
}
diff --git a/src/ui/ResizableLib/ResizableDialog.h b/src/ui/ResizableLib/ResizableDialog.h
index c16c52fb5..3b71b5b66 100644
--- a/src/ui/ResizableLib/ResizableDialog.h
+++ b/src/ui/ResizableLib/ResizableDialog.h
@@ -13,7 +13,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -31,66 +31,66 @@
// CResizableDialog window
class CResizableDialog : public CCmdUIDialog, public CResizableLayout,
- public CResizableGrip, public CResizableMinMax,
- public CResizableState
+ public CResizableGrip, public CResizableMinMax,
+ public CResizableState
{
// Construction
public:
- CResizableDialog();
- CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL);
- CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL);
+ CResizableDialog();
+ CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL);
+ CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL);
// Attributes
private:
- // support for temporarily hiding the grip
- DWORD m_dwGripTempState;
+ // support for temporarily hiding the grip
+ DWORD m_dwGripTempState;
- // flags
- BOOL m_bEnableSaveRestore;
- BOOL m_bRectOnly;
+ // flags
+ BOOL m_bEnableSaveRestore;
+ BOOL m_bRectOnly;
- // internal status
- CString m_sSection; // section name (identifies a parent window)
+ // internal status
+ CString m_sSection; // section name (identifies a parent window)
// Operations
public:
// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CResizableDialog)
- protected:
- //}}AFX_VIRTUAL
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CResizableDialog)
+protected:
+ //}}AFX_VIRTUAL
// Implementation
public:
- virtual ~CResizableDialog();
+ virtual ~CResizableDialog();
// used internally
private:
- void PrivateConstruct();
+ void PrivateConstruct();
// callable from derived classes
protected:
- // section to use in app's profile
- void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);
+ // section to use in app's profile
+ void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);
- virtual CWnd* GetResizableWnd()
- {
- // make the layout know its parent window
- return this;
- };
+ virtual CWnd* GetResizableWnd()
+ {
+ // make the layout know its parent window
+ return this;
+ };
// Generated message map functions
protected:
- //{{AFX_MSG(CResizableDialog)
- afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnDestroy();
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
+ //{{AFX_MSG(CResizableDialog)
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnDestroy();
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/ui/ResizableLib/ResizableGrip.cpp b/src/ui/ResizableLib/ResizableGrip.cpp
index d1551ce6b..1794b7c26 100644
--- a/src/ui/ResizableLib/ResizableGrip.cpp
+++ b/src/ui/ResizableLib/ResizableGrip.cpp
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -23,7 +23,7 @@
CResizableGrip::CResizableGrip()
{
- m_nShowCount = 0;
+ m_nShowCount = 0;
}
CResizableGrip::~CResizableGrip()
@@ -33,21 +33,21 @@ CResizableGrip::~CResizableGrip()
void CResizableGrip::UpdateSizeGrip()
{
- ASSERT(::IsWindow(m_wndGrip.m_hWnd));
+ ASSERT(::IsWindow(m_wndGrip.m_hWnd));
- // size-grip goes bottom right in the client area
- // (any right-to-left adjustment should go here)
+ // size-grip goes bottom right in the client area
+ // (any right-to-left adjustment should go here)
- RECT rect;
- GetResizableWnd()->GetClientRect(&rect);
+ RECT rect;
+ GetResizableWnd()->GetClientRect(&rect);
- rect.left = rect.right - m_wndGrip.m_size.cx;
- rect.top = rect.bottom - m_wndGrip.m_size.cy;
+ rect.left = rect.right - m_wndGrip.m_size.cx;
+ rect.top = rect.bottom - m_wndGrip.m_size.cy;
- // must stay below other children
- m_wndGrip.SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, 0, 0,
- SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREPOSITION
- | (IsSizeGripVisible() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
+ // must stay below other children
+ m_wndGrip.SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, 0, 0,
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREPOSITION
+ | (IsSizeGripVisible() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
}
// pbStatus points to a variable, maintained by the caller, that
@@ -59,80 +59,80 @@ void CResizableGrip::UpdateSizeGrip()
void CResizableGrip::ShowSizeGrip(DWORD* pStatus, DWORD dwMask /*= 1*/)
{
- ASSERT(pStatus != NULL);
+ ASSERT(pStatus != NULL);
- if (!(*pStatus & dwMask))
- {
- m_nShowCount++;
- (*pStatus) |= dwMask;
- }
+ if(!(*pStatus & dwMask))
+ {
+ m_nShowCount++;
+ (*pStatus) |= dwMask;
+ }
}
void CResizableGrip::HideSizeGrip(DWORD* pStatus, DWORD dwMask /*= 1*/)
{
- ASSERT(pStatus != NULL);
+ ASSERT(pStatus != NULL);
- if (*pStatus & dwMask)
- {
- m_nShowCount--;
- (*pStatus) &= ~dwMask;
- }
+ if(*pStatus & dwMask)
+ {
+ m_nShowCount--;
+ (*pStatus) &= ~dwMask;
+ }
}
BOOL CResizableGrip::IsSizeGripVisible()
{
- // NB: visibility is effective only after an update
- return (m_nShowCount > 0);
+ // NB: visibility is effective only after an update
+ return (m_nShowCount > 0);
}
void CResizableGrip::SetSizeGripVisibility(BOOL bVisible)
{
- if (bVisible)
- m_nShowCount = 1;
- else
- m_nShowCount = 0;
+ if(bVisible)
+ m_nShowCount = 1;
+ else
+ m_nShowCount = 0;
}
BOOL CResizableGrip::SetSizeGripBkMode(int nBkMode)
{
- if (::IsWindow(m_wndGrip.m_hWnd))
- {
- if (nBkMode == OPAQUE)
- m_wndGrip.SetTransparency(FALSE);
- else if (nBkMode == TRANSPARENT)
- m_wndGrip.SetTransparency(TRUE);
- else
- return FALSE;
- return TRUE;
- }
- return FALSE;
+ if(::IsWindow(m_wndGrip.m_hWnd))
+ {
+ if(nBkMode == OPAQUE)
+ m_wndGrip.SetTransparency(FALSE);
+ else if(nBkMode == TRANSPARENT)
+ m_wndGrip.SetTransparency(TRUE);
+ else
+ return FALSE;
+ return TRUE;
+ }
+ return FALSE;
}
void CResizableGrip::SetSizeGripShape(BOOL bTriangular)
{
- m_wndGrip.SetTriangularShape(bTriangular);
+ m_wndGrip.SetTriangularShape(bTriangular);
}
BOOL CResizableGrip::CreateSizeGrip(BOOL bVisible /*= TRUE*/,
- BOOL bTriangular /*= TRUE*/, BOOL bTransparent /*= FALSE*/)
+ BOOL bTriangular /*= TRUE*/, BOOL bTransparent /*= FALSE*/)
{
- // create grip
- CRect rect(0 , 0, m_wndGrip.m_size.cx, m_wndGrip.m_size.cy);
- BOOL bRet = m_wndGrip.Create(WS_CHILD | WS_CLIPSIBLINGS
- | SBS_SIZEGRIP, rect, GetResizableWnd(), 0);
-
- if (bRet)
- {
- // set options
- m_wndGrip.SetTriangularShape(bTriangular);
- m_wndGrip.SetTransparency(bTransparent);
- SetSizeGripVisibility(bVisible);
-
- // update position
- UpdateSizeGrip();
- }
-
- return bRet;
+ // create grip
+ CRect rect(0 , 0, m_wndGrip.m_size.cx, m_wndGrip.m_size.cy);
+ BOOL bRet = m_wndGrip.Create(WS_CHILD | WS_CLIPSIBLINGS
+ | SBS_SIZEGRIP, rect, GetResizableWnd(), 0);
+
+ if(bRet)
+ {
+ // set options
+ m_wndGrip.SetTriangularShape(bTriangular);
+ m_wndGrip.SetTransparency(bTransparent);
+ SetSizeGripVisibility(bVisible);
+
+ // update position
+ UpdateSizeGrip();
+ }
+
+ return bRet;
}
/////////////////////////////////////////////////////////////////////////////
@@ -140,165 +140,165 @@ BOOL CResizableGrip::CreateSizeGrip(BOOL bVisible /*= TRUE*/,
BOOL CResizableGrip::CSizeGrip::IsRTL()
{
- return GetExStyle() & 0x00400000L/*WS_EX_LAYOUTRTL*/;
+ return GetExStyle() & 0x00400000L/*WS_EX_LAYOUTRTL*/;
}
-BOOL CResizableGrip::CSizeGrip::PreCreateWindow(CREATESTRUCT& cs)
+BOOL CResizableGrip::CSizeGrip::PreCreateWindow(CREATESTRUCT& cs)
{
- // set window size
- m_size.cx = GetSystemMetrics(SM_CXVSCROLL);
- m_size.cy = GetSystemMetrics(SM_CYHSCROLL);
-
- cs.cx = m_size.cx;
- cs.cy = m_size.cy;
-
- return CScrollBar::PreCreateWindow(cs);
+ // set window size
+ m_size.cx = GetSystemMetrics(SM_CXVSCROLL);
+ m_size.cy = GetSystemMetrics(SM_CYHSCROLL);
+
+ cs.cx = m_size.cx;
+ cs.cy = m_size.cy;
+
+ return CScrollBar::PreCreateWindow(cs);
}
LRESULT CResizableGrip::CSizeGrip::WindowProc(UINT message,
- WPARAM wParam, LPARAM lParam)
+ WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_GETDLGCODE:
- // fix to prevent the control to gain focus, using arrow keys
- // (standard grip returns DLGC_WANTARROWS, like any standard scrollbar)
- return DLGC_STATIC;
-
- case WM_NCHITTEST:
- // choose proper cursor shape
- if (IsRTL())
- return HTBOTTOMLEFT;
- else
- return HTBOTTOMRIGHT;
- break;
-
- case WM_SETTINGCHANGE:
- {
- // update grip's size
- CSize sizeOld = m_size;
- m_size.cx = GetSystemMetrics(SM_CXVSCROLL);
- m_size.cy = GetSystemMetrics(SM_CYHSCROLL);
-
- // resize transparency bitmaps
- if (m_bTransparent)
- {
- CClientDC dc(this);
-
- // destroy bitmaps
- m_bmGrip.DeleteObject();
- m_bmMask.DeleteObject();
-
- // re-create bitmaps
- m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy);
- m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL);
- }
-
- // re-calc shape
- if (m_bTriangular)
- SetTriangularShape(m_bTriangular);
-
- // reposition the grip
- CRect rect;
- GetWindowRect(rect);
- rect.InflateRect(m_size.cx - sizeOld.cx, m_size.cy - sizeOld.cy, 0, 0);
- ::MapWindowPoints(NULL, GetParent()->GetSafeHwnd(), (LPPOINT)&rect, 2);
- MoveWindow(rect, TRUE);
- }
- break;
-
- case WM_DESTROY:
- // perform clean up
- if (m_bTransparent)
- SetTransparency(FALSE);
- break;
-
- case WM_PAINT:
- if (m_bTransparent)
- {
- CPaintDC dc(this);
-
- // select bitmaps
- CBitmap *pOldGrip, *pOldMask;
-
- pOldGrip = m_dcGrip.SelectObject(&m_bmGrip);
- pOldMask = m_dcMask.SelectObject(&m_bmMask);
-
- // obtain original grip bitmap, make the mask and prepare masked bitmap
- CScrollBar::WindowProc(WM_PAINT, (WPARAM)m_dcGrip.GetSafeHdc(), lParam);
- m_dcGrip.SetBkColor(m_dcGrip.GetPixel(0, 0));
- m_dcMask.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCCOPY);
- m_dcGrip.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, 0x00220326);
-
- // draw transparently
- dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, SRCAND);
- dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCPAINT);
-
- // unselect bitmaps
- m_dcGrip.SelectObject(pOldGrip);
- m_dcMask.SelectObject(pOldMask);
-
- return 0;
- }
- break;
- }
-
- return CScrollBar::WindowProc(message, wParam, lParam);
+ switch(message)
+ {
+ case WM_GETDLGCODE:
+ // fix to prevent the control to gain focus, using arrow keys
+ // (standard grip returns DLGC_WANTARROWS, like any standard scrollbar)
+ return DLGC_STATIC;
+
+ case WM_NCHITTEST:
+ // choose proper cursor shape
+ if(IsRTL())
+ return HTBOTTOMLEFT;
+ else
+ return HTBOTTOMRIGHT;
+ break;
+
+ case WM_SETTINGCHANGE:
+ {
+ // update grip's size
+ CSize sizeOld = m_size;
+ m_size.cx = GetSystemMetrics(SM_CXVSCROLL);
+ m_size.cy = GetSystemMetrics(SM_CYHSCROLL);
+
+ // resize transparency bitmaps
+ if(m_bTransparent)
+ {
+ CClientDC dc(this);
+
+ // destroy bitmaps
+ m_bmGrip.DeleteObject();
+ m_bmMask.DeleteObject();
+
+ // re-create bitmaps
+ m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy);
+ m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL);
+ }
+
+ // re-calc shape
+ if(m_bTriangular)
+ SetTriangularShape(m_bTriangular);
+
+ // reposition the grip
+ CRect rect;
+ GetWindowRect(rect);
+ rect.InflateRect(m_size.cx - sizeOld.cx, m_size.cy - sizeOld.cy, 0, 0);
+ ::MapWindowPoints(NULL, GetParent()->GetSafeHwnd(), (LPPOINT)&rect, 2);
+ MoveWindow(rect, TRUE);
+ }
+ break;
+
+ case WM_DESTROY:
+ // perform clean up
+ if(m_bTransparent)
+ SetTransparency(FALSE);
+ break;
+
+ case WM_PAINT:
+ if(m_bTransparent)
+ {
+ CPaintDC dc(this);
+
+ // select bitmaps
+ CBitmap *pOldGrip, *pOldMask;
+
+ pOldGrip = m_dcGrip.SelectObject(&m_bmGrip);
+ pOldMask = m_dcMask.SelectObject(&m_bmMask);
+
+ // obtain original grip bitmap, make the mask and prepare masked bitmap
+ CScrollBar::WindowProc(WM_PAINT, (WPARAM)m_dcGrip.GetSafeHdc(), lParam);
+ m_dcGrip.SetBkColor(m_dcGrip.GetPixel(0, 0));
+ m_dcMask.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCCOPY);
+ m_dcGrip.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, 0x00220326);
+
+ // draw transparently
+ dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, SRCAND);
+ dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCPAINT);
+
+ // unselect bitmaps
+ m_dcGrip.SelectObject(pOldGrip);
+ m_dcMask.SelectObject(pOldMask);
+
+ return 0;
+ }
+ break;
+ }
+
+ return CScrollBar::WindowProc(message, wParam, lParam);
}
void CResizableGrip::CSizeGrip::SetTransparency(BOOL bActivate)
{
- // creates or deletes DCs and Bitmaps used for
- // implementing a transparent size grip
+ // creates or deletes DCs and Bitmaps used for
+ // implementing a transparent size grip
- if (bActivate && !m_bTransparent)
- {
- m_bTransparent = TRUE;
+ if(bActivate && !m_bTransparent)
+ {
+ m_bTransparent = TRUE;
- CClientDC dc(this);
+ CClientDC dc(this);
- // create memory DCs and bitmaps
- m_dcGrip.CreateCompatibleDC(&dc);
- m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy);
+ // create memory DCs and bitmaps
+ m_dcGrip.CreateCompatibleDC(&dc);
+ m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy);
- m_dcMask.CreateCompatibleDC(&dc);
- m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL);
- }
- else if (!bActivate && m_bTransparent)
- {
- m_bTransparent = FALSE;
+ m_dcMask.CreateCompatibleDC(&dc);
+ m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL);
+ }
+ else if(!bActivate && m_bTransparent)
+ {
+ m_bTransparent = FALSE;
- // destroy memory DCs and bitmaps
- m_dcGrip.DeleteDC();
- m_bmGrip.DeleteObject();
+ // destroy memory DCs and bitmaps
+ m_dcGrip.DeleteDC();
+ m_bmGrip.DeleteObject();
- m_dcMask.DeleteDC();
- m_bmMask.DeleteObject();
- }
+ m_dcMask.DeleteDC();
+ m_bmMask.DeleteObject();
+ }
}
void CResizableGrip::CSizeGrip::SetTriangularShape(BOOL bEnable)
{
- m_bTriangular = bEnable;
-
- if (bEnable)
- {
- // set a triangular window region
- CRect rect;
- GetWindowRect(rect);
- rect.OffsetRect(-rect.TopLeft());
- POINT arrPoints[] =
- {
- { rect.left, rect.bottom },
- { rect.right, rect.bottom },
- { rect.right, rect.top }
- };
- CRgn rgnGrip;
- rgnGrip.CreatePolygonRgn(arrPoints, 3, WINDING);
- SetWindowRgn((HRGN)rgnGrip.Detach(), IsWindowVisible());
- }
- else
- {
- SetWindowRgn((HRGN)NULL, IsWindowVisible());
- }
+ m_bTriangular = bEnable;
+
+ if(bEnable)
+ {
+ // set a triangular window region
+ CRect rect;
+ GetWindowRect(rect);
+ rect.OffsetRect(-rect.TopLeft());
+ POINT arrPoints[] =
+ {
+ { rect.left, rect.bottom },
+ { rect.right, rect.bottom },
+ { rect.right, rect.top }
+ };
+ CRgn rgnGrip;
+ rgnGrip.CreatePolygonRgn(arrPoints, 3, WINDING);
+ SetWindowRgn((HRGN)rgnGrip.Detach(), IsWindowVisible());
+ }
+ else
+ {
+ SetWindowRgn((HRGN)NULL, IsWindowVisible());
+ }
}
diff --git a/src/ui/ResizableLib/ResizableGrip.h b/src/ui/ResizableLib/ResizableGrip.h
index 0a85514b9..248a60331 100644
--- a/src/ui/ResizableLib/ResizableGrip.h
+++ b/src/ui/ResizableLib/ResizableGrip.h
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -21,61 +21,61 @@
#pragma once
#endif // _MSC_VER > 1000
-class CResizableGrip
+class CResizableGrip
{
private:
- class CSizeGrip : public CScrollBar
- {
- public:
- CSizeGrip()
- {
- m_bTransparent = FALSE;
- m_bTriangular = FALSE;
- m_size.cx = 0;
- m_size.cy = 0;
- }
+ class CSizeGrip : public CScrollBar
+ {
+ public:
+ CSizeGrip()
+ {
+ m_bTransparent = FALSE;
+ m_bTriangular = FALSE;
+ m_size.cx = 0;
+ m_size.cy = 0;
+ }
- void SetTriangularShape(BOOL bEnable);
- void SetTransparency(BOOL bActivate);
+ void SetTriangularShape(BOOL bEnable);
+ void SetTransparency(BOOL bActivate);
- BOOL IsRTL(); // right-to-left layout support
+ BOOL IsRTL(); // right-to-left layout support
- virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- SIZE m_size; // holds grip size
+ SIZE m_size; // holds grip size
- protected:
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ protected:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- BOOL m_bTriangular; // triangular shape active
- BOOL m_bTransparent; // transparency active
+ BOOL m_bTriangular; // triangular shape active
+ BOOL m_bTransparent; // transparency active
- // memory DCs and bitmaps for transparent grip
- CDC m_dcGrip, m_dcMask;
- CBitmap m_bmGrip, m_bmMask;
- };
+ // memory DCs and bitmaps for transparent grip
+ CDC m_dcGrip, m_dcMask;
+ CBitmap m_bmGrip, m_bmMask;
+ };
- CSizeGrip m_wndGrip; // grip control
- int m_nShowCount; // support for hiding the grip
+ CSizeGrip m_wndGrip; // grip control
+ int m_nShowCount; // support for hiding the grip
protected:
- // create a size grip, with options
- BOOL CreateSizeGrip(BOOL bVisible = TRUE,
- BOOL bTriangular = TRUE, BOOL bTransparent = FALSE);
+ // create a size grip, with options
+ BOOL CreateSizeGrip(BOOL bVisible = TRUE,
+ BOOL bTriangular = TRUE, BOOL bTransparent = FALSE);
- BOOL IsSizeGripVisible(); // TRUE if grip is set to be visible
- void SetSizeGripVisibility(BOOL bVisible); // set default visibility
- void UpdateSizeGrip(); // update the grip's visibility and position
- void ShowSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp show the size grip
- void HideSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp hide the size grip
- BOOL SetSizeGripBkMode(int nBkMode); // like CDC::SetBkMode
- void SetSizeGripShape(BOOL bTriangular);
+ BOOL IsSizeGripVisible(); // TRUE if grip is set to be visible
+ void SetSizeGripVisibility(BOOL bVisible); // set default visibility
+ void UpdateSizeGrip(); // update the grip's visibility and position
+ void ShowSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp show the size grip
+ void HideSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp hide the size grip
+ BOOL SetSizeGripBkMode(int nBkMode); // like CDC::SetBkMode
+ void SetSizeGripShape(BOOL bTriangular);
- virtual CWnd* GetResizableWnd() = 0;
+ virtual CWnd* GetResizableWnd() = 0;
public:
- CResizableGrip();
- virtual ~CResizableGrip();
+ CResizableGrip();
+ virtual ~CResizableGrip();
};
#endif // !defined(AFX_RESIZABLEGRIP_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableLayout.cpp b/src/ui/ResizableLib/ResizableLayout.cpp
index 750404b02..b972b7055 100644
--- a/src/ui/ResizableLib/ResizableLayout.cpp
+++ b/src/ui/ResizableLib/ResizableLayout.cpp
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -33,484 +33,484 @@
void CResizableLayout::AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR)
{
- CWnd* pParent = GetResizableWnd();
+ CWnd* pParent = GetResizableWnd();
- // child window must be valid
- ASSERT(::IsWindow(hWnd));
- // must be child of parent window
+ // child window must be valid
+ ASSERT(::IsWindow(hWnd));
+ // must be child of parent window
// ASSERT(::IsChild(pParent->GetSafeHwnd(), hWnd));
- // top-left anchor must be valid
- ASSERT(sizeTypeTL != NOANCHOR);
-
- // get control's window class
- CString sClassName;
- GetClassName(hWnd, sClassName.GetBufferSetLength(MAX_PATH), MAX_PATH);
- sClassName.ReleaseBuffer();
-
- // get parent window's rect
- CRect rectParent;
- GetTotalClientRect(&rectParent);
- // and child control's rect
- CRect rectChild;
- ::GetWindowRect(hWnd, &rectChild);
- ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2);
-
- // adjust position, if client area has been scrolled
- rectChild.OffsetRect(-rectParent.TopLeft());
-
- // go calculate margins
- CSize sizeMarginTL, sizeMarginBR;
-
- if (sizeTypeBR == NOANCHOR)
- sizeTypeBR = sizeTypeTL;
-
- // calculate margin for the top-left corner
-
- sizeMarginTL.cx = rectChild.left - rectParent.Width() * sizeTypeTL.cx / 100;
- sizeMarginTL.cy = rectChild.top - rectParent.Height() * sizeTypeTL.cy / 100;
-
- // calculate margin for the bottom-right corner
-
- sizeMarginBR.cx = rectChild.right - rectParent.Width() * sizeTypeBR.cx / 100;
- sizeMarginBR.cy = rectChild.bottom - rectParent.Height() * sizeTypeBR.cy / 100;
-
- // prepare the structure
- LayoutInfo layout(hWnd, sizeTypeTL, sizeMarginTL,
- sizeTypeBR, sizeMarginBR, sClassName);
-
- // initialize resize properties (overridable)
- InitResizeProperties(layout);
-
- // must not be already there!
- // (this is probably due to a duplicate call to AddAnchor)
- POSITION pos;
- ASSERT(!m_mapLayout.Lookup(hWnd, pos));
-
- // add to the list and the map
- pos = m_listLayout.AddTail(layout);
- m_mapLayout.SetAt(hWnd, pos);
+ // top-left anchor must be valid
+ ASSERT(sizeTypeTL != NOANCHOR);
+
+ // get control's window class
+ CString sClassName;
+ GetClassName(hWnd, sClassName.GetBufferSetLength(MAX_PATH), MAX_PATH);
+ sClassName.ReleaseBuffer();
+
+ // get parent window's rect
+ CRect rectParent;
+ GetTotalClientRect(&rectParent);
+ // and child control's rect
+ CRect rectChild;
+ ::GetWindowRect(hWnd, &rectChild);
+ ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2);
+
+ // adjust position, if client area has been scrolled
+ rectChild.OffsetRect(-rectParent.TopLeft());
+
+ // go calculate margins
+ CSize sizeMarginTL, sizeMarginBR;
+
+ if(sizeTypeBR == NOANCHOR)
+ sizeTypeBR = sizeTypeTL;
+
+ // calculate margin for the top-left corner
+
+ sizeMarginTL.cx = rectChild.left - rectParent.Width() * sizeTypeTL.cx / 100;
+ sizeMarginTL.cy = rectChild.top - rectParent.Height() * sizeTypeTL.cy / 100;
+
+ // calculate margin for the bottom-right corner
+
+ sizeMarginBR.cx = rectChild.right - rectParent.Width() * sizeTypeBR.cx / 100;
+ sizeMarginBR.cy = rectChild.bottom - rectParent.Height() * sizeTypeBR.cy / 100;
+
+ // prepare the structure
+ LayoutInfo layout(hWnd, sizeTypeTL, sizeMarginTL,
+ sizeTypeBR, sizeMarginBR, sClassName);
+
+ // initialize resize properties (overridable)
+ InitResizeProperties(layout);
+
+ // must not be already there!
+ // (this is probably due to a duplicate call to AddAnchor)
+ POSITION pos;
+ ASSERT(!m_mapLayout.Lookup(hWnd, pos));
+
+ // add to the list and the map
+ pos = m_listLayout.AddTail(layout);
+ m_mapLayout.SetAt(hWnd, pos);
}
void CResizableLayout::AddAnchorCallback(UINT nCallbackID)
{
- // one callback control cannot rely upon another callback control's
- // size and/or position (they're updated all together at the end)
- // it can however use a non-callback control, which is updated before
-
- // add to the list
- LayoutInfo layout;
- layout.nCallbackID = nCallbackID;
- m_listLayoutCB.AddTail(layout);
+ // one callback control cannot rely upon another callback control's
+ // size and/or position (they're updated all together at the end)
+ // it can however use a non-callback control, which is updated before
+
+ // add to the list
+ LayoutInfo layout;
+ layout.nCallbackID = nCallbackID;
+ m_listLayoutCB.AddTail(layout);
}
BOOL CResizableLayout::ArrangeLayoutCallback(CResizableLayout::LayoutInfo& /*layout*/)
{
- ASSERT(FALSE);
- // must be overridden, if callback is used
-
- return FALSE; // no output data
+ ASSERT(FALSE);
+ // must be overridden, if callback is used
+
+ return FALSE; // no output data
}
void CResizableLayout::ArrangeLayout()
{
- // common vars
- UINT uFlags;
- LayoutInfo layout;
- CRect rectParent, rectChild;
- GetTotalClientRect(&rectParent); // get parent window's rect
- int count = m_listLayout.GetCount();
- int countCB = m_listLayoutCB.GetCount();
-
- // reposition child windows
- HDWP hdwp = ::BeginDeferWindowPos(count + countCB);
-
- POSITION pos = m_listLayout.GetHeadPosition();
- while (pos != NULL)
- {
- // get layout info
- layout = m_listLayout.GetNext(pos);
-
- // calculate new child's position, size and flags for SetWindowPos
- CalcNewChildPosition(layout, rectParent, rectChild, uFlags);
-
- // only if size or position changed
- if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE))
- {
- hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left,
- rectChild.top, rectChild.Width(), rectChild.Height(), uFlags);
- }
- }
-
- // for callback items you may use GetAnchorPosition to know the
- // new position and size of a non-callback item after resizing
-
- pos = m_listLayoutCB.GetHeadPosition();
- while (pos != NULL)
- {
- // get layout info
- layout = m_listLayoutCB.GetNext(pos);
- // request layout data
- if (!ArrangeLayoutCallback(layout))
- continue;
-
- // calculate new child's position, size and flags for SetWindowPos
- CalcNewChildPosition(layout, rectParent, rectChild, uFlags);
-
- // only if size or position changed
- if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE))
- {
- hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left,
- rectChild.top, rectChild.Width(), rectChild.Height(), uFlags);
- }
- }
-
- // finally move all the windows at once
- ::EndDeferWindowPos(hdwp);
+ // common vars
+ UINT uFlags;
+ LayoutInfo layout;
+ CRect rectParent, rectChild;
+ GetTotalClientRect(&rectParent); // get parent window's rect
+ int count = m_listLayout.GetCount();
+ int countCB = m_listLayoutCB.GetCount();
+
+ // reposition child windows
+ HDWP hdwp = ::BeginDeferWindowPos(count + countCB);
+
+ POSITION pos = m_listLayout.GetHeadPosition();
+ while(pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayout.GetNext(pos);
+
+ // calculate new child's position, size and flags for SetWindowPos
+ CalcNewChildPosition(layout, rectParent, rectChild, uFlags);
+
+ // only if size or position changed
+ if((uFlags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE))
+ {
+ hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left,
+ rectChild.top, rectChild.Width(), rectChild.Height(), uFlags);
+ }
+ }
+
+ // for callback items you may use GetAnchorPosition to know the
+ // new position and size of a non-callback item after resizing
+
+ pos = m_listLayoutCB.GetHeadPosition();
+ while(pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayoutCB.GetNext(pos);
+ // request layout data
+ if(!ArrangeLayoutCallback(layout))
+ continue;
+
+ // calculate new child's position, size and flags for SetWindowPos
+ CalcNewChildPosition(layout, rectParent, rectChild, uFlags);
+
+ // only if size or position changed
+ if((uFlags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE))
+ {
+ hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left,
+ rectChild.top, rectChild.Width(), rectChild.Height(), uFlags);
+ }
+ }
+
+ // finally move all the windows at once
+ ::EndDeferWindowPos(hdwp);
}
void CResizableLayout::ClipChildWindow(const CResizableLayout::LayoutInfo& layout,
- CRgn* pRegion)
+ CRgn* pRegion)
{
- // obtain window position
- CRect rect;
- ::GetWindowRect(layout.hWnd, &rect);
- ::MapWindowPoints(NULL, GetResizableWnd()->m_hWnd, (LPPOINT)&rect, 2);
-
- // use window region if any
- CRgn rgn;
- rgn.CreateRectRgn(0,0,0,0);
- switch (::GetWindowRgn(layout.hWnd, rgn))
- {
- case COMPLEXREGION:
- case SIMPLEREGION:
- rgn.OffsetRgn(rect.TopLeft());
- break;
-
- default:
- rgn.SetRectRgn(&rect);
- }
-
- // get the clipping property
- BOOL bClipping = layout.properties.bAskClipping ?
- LikesClipping(layout) : layout.properties.bCachedLikesClipping;
-
- // modify region accordingly
- if (bClipping)
- pRegion->CombineRgn(pRegion, &rgn, RGN_DIFF);
- else
- pRegion->CombineRgn(pRegion, &rgn, RGN_OR);
+ // obtain window position
+ CRect rect;
+ ::GetWindowRect(layout.hWnd, &rect);
+ ::MapWindowPoints(NULL, GetResizableWnd()->m_hWnd, (LPPOINT)&rect, 2);
+
+ // use window region if any
+ CRgn rgn;
+ rgn.CreateRectRgn(0, 0, 0, 0);
+ switch(::GetWindowRgn(layout.hWnd, rgn))
+ {
+ case COMPLEXREGION:
+ case SIMPLEREGION:
+ rgn.OffsetRgn(rect.TopLeft());
+ break;
+
+ default:
+ rgn.SetRectRgn(&rect);
+ }
+
+ // get the clipping property
+ BOOL bClipping = layout.properties.bAskClipping ?
+ LikesClipping(layout) : layout.properties.bCachedLikesClipping;
+
+ // modify region accordingly
+ if(bClipping)
+ pRegion->CombineRgn(pRegion, &rgn, RGN_DIFF);
+ else
+ pRegion->CombineRgn(pRegion, &rgn, RGN_OR);
}
void CResizableLayout::GetClippingRegion(CRgn* pRegion)
{
- CWnd* pWnd = GetResizableWnd();
-
- // System's default clipping area is screen's size,
- // not enough for max track size, for example:
- // if screen is 1024 x 768 and resizing border is 4 pixels,
- // maximized size is 1024+4*2=1032 x 768+4*2=776,
- // but max track size is 4 pixels bigger 1036 x 780 (don't ask me why!)
- // So, if you resize the window to maximum size, the last 4 pixels
- // are clipped out by the default clipping region, that gets created
- // as soon as you call clipping functions (my guess).
-
- // reset clipping region to the whole client area
- CRect rect;
- pWnd->GetClientRect(&rect);
- pRegion->CreateRectRgnIndirect(&rect);
-
- // clip only anchored controls
- LayoutInfo layout;
- POSITION pos = m_listLayout.GetHeadPosition();
- while (pos != NULL)
- {
- // get layout info
- layout = m_listLayout.GetNext(pos);
-
- if (::IsWindowVisible(layout.hWnd))
- ClipChildWindow(layout, pRegion);
- }
- pos = m_listLayoutCB.GetHeadPosition();
- while (pos != NULL)
- {
- // get layout info
- layout = m_listLayoutCB.GetNext(pos);
- // request data
- if (!ArrangeLayoutCallback(layout))
- continue;
-
- if (::IsWindowVisible(layout.hWnd))
- ClipChildWindow(layout, pRegion);
- }
-
- // fix for RTL layouts (1 pixel of horz offset)
- if (pWnd->GetExStyle() & 0x00400000L/*WS_EX_LAYOUTRTL*/)
- pRegion->OffsetRgn(-1,0);
+ CWnd* pWnd = GetResizableWnd();
+
+ // System's default clipping area is screen's size,
+ // not enough for max track size, for example:
+ // if screen is 1024 x 768 and resizing border is 4 pixels,
+ // maximized size is 1024+4*2=1032 x 768+4*2=776,
+ // but max track size is 4 pixels bigger 1036 x 780 (don't ask me why!)
+ // So, if you resize the window to maximum size, the last 4 pixels
+ // are clipped out by the default clipping region, that gets created
+ // as soon as you call clipping functions (my guess).
+
+ // reset clipping region to the whole client area
+ CRect rect;
+ pWnd->GetClientRect(&rect);
+ pRegion->CreateRectRgnIndirect(&rect);
+
+ // clip only anchored controls
+ LayoutInfo layout;
+ POSITION pos = m_listLayout.GetHeadPosition();
+ while(pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayout.GetNext(pos);
+
+ if(::IsWindowVisible(layout.hWnd))
+ ClipChildWindow(layout, pRegion);
+ }
+ pos = m_listLayoutCB.GetHeadPosition();
+ while(pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayoutCB.GetNext(pos);
+ // request data
+ if(!ArrangeLayoutCallback(layout))
+ continue;
+
+ if(::IsWindowVisible(layout.hWnd))
+ ClipChildWindow(layout, pRegion);
+ }
+
+ // fix for RTL layouts (1 pixel of horz offset)
+ if(pWnd->GetExStyle() & 0x00400000L/*WS_EX_LAYOUTRTL*/)
+ pRegion->OffsetRgn(-1, 0);
}
void CResizableLayout::EraseBackground(CDC* pDC)
{
- HWND hWnd = GetResizableWnd()->GetSafeHwnd();
-
- // retrieve the background brush
- HBRUSH hBrush = NULL;
-
- // is this a dialog box?
- // (using class atom is quickier than using the class name)
- ATOM atomWndClass = (ATOM)::GetClassLong(hWnd, GCW_ATOM);
- if (atomWndClass == (ATOM)0x8002)
- {
- // send a message to the dialog box
- hBrush = (HBRUSH)::SendMessage(hWnd, WM_CTLCOLORDLG,
- (WPARAM)pDC->GetSafeHdc(), (LPARAM)hWnd);
- }
- else
- {
- // take the background brush from the window's class
+ HWND hWnd = GetResizableWnd()->GetSafeHwnd();
+
+ // retrieve the background brush
+ HBRUSH hBrush = NULL;
+
+ // is this a dialog box?
+ // (using class atom is quickier than using the class name)
+ ATOM atomWndClass = (ATOM)::GetClassLong(hWnd, GCW_ATOM);
+ if(atomWndClass == (ATOM)0x8002)
+ {
+ // send a message to the dialog box
+ hBrush = (HBRUSH)::SendMessage(hWnd, WM_CTLCOLORDLG,
+ (WPARAM)pDC->GetSafeHdc(), (LPARAM)hWnd);
+ }
+ else
+ {
+ // take the background brush from the window's class
#ifdef _WIN64
- hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND);
+ hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND);
#else
- hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCL_HBRBACKGROUND);
+ hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCL_HBRBACKGROUND);
#endif
- }
+ }
- // fill the clipped background
- CRgn rgn;
- GetClippingRegion(&rgn);
+ // fill the clipped background
+ CRgn rgn;
+ GetClippingRegion(&rgn);
- ::FillRgn(pDC->GetSafeHdc(), rgn, hBrush);
+ ::FillRgn(pDC->GetSafeHdc(), rgn, hBrush);
}
// support legacy code (will disappear in future versions)
void CResizableLayout::ClipChildren(CDC* pDC)
{
- CRgn rgn;
- GetClippingRegion(&rgn);
- // the clipping region is in device units
- rgn.OffsetRgn(-pDC->GetWindowOrg());
- pDC->SelectClipRgn(&rgn);
+ CRgn rgn;
+ GetClippingRegion(&rgn);
+ // the clipping region is in device units
+ rgn.OffsetRgn(-pDC->GetWindowOrg());
+ pDC->SelectClipRgn(&rgn);
}
void CResizableLayout::GetTotalClientRect(LPRECT lpRect)
{
- GetResizableWnd()->GetClientRect(lpRect);
+ GetResizableWnd()->GetClientRect(lpRect);
}
BOOL CResizableLayout::NeedsRefresh(const CResizableLayout::LayoutInfo& layout,
- const CRect& rectOld, const CRect& rectNew)
+ const CRect& rectOld, const CRect& rectNew)
{
- if (layout.bMsgSupport)
- {
- REFRESHPROPERTY refresh;
- refresh.rcOld = rectOld;
- refresh.rcNew = rectNew;
- if (Send_NeedsRefresh(layout.hWnd, &refresh))
- return refresh.bNeedsRefresh;
- }
-
- int nDiffWidth = (rectNew.Width() - rectOld.Width());
- int nDiffHeight = (rectNew.Height() - rectOld.Height());
-
- // is the same size?
- if (nDiffWidth == 0 && nDiffHeight == 0)
- return FALSE;
-
- // optimistic, no need to refresh
- BOOL bRefresh = FALSE;
-
- // window classes that need refresh when resized
- if (layout.sWndClass == WC_STATIC)
- {
- DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE);
-
- switch (style & SS_TYPEMASK)
- {
- case SS_LEFT:
- case SS_CENTER:
- case SS_RIGHT:
- // word-wrapped text
- bRefresh = bRefresh || (nDiffWidth != 0);
- // vertically centered text
- if (style & SS_CENTERIMAGE)
- bRefresh = bRefresh || (nDiffHeight != 0);
- break;
-
- case SS_LEFTNOWORDWRAP:
- // text with ellipsis
- if (style & SS_ELLIPSISMASK)
- bRefresh = bRefresh || (nDiffWidth != 0);
- // vertically centered text
- if (style & SS_CENTERIMAGE)
- bRefresh = bRefresh || (nDiffHeight != 0);
- break;
-
- case SS_ENHMETAFILE:
- case SS_BITMAP:
- case SS_ICON:
- // images
- case SS_BLACKFRAME:
- case SS_GRAYFRAME:
- case SS_WHITEFRAME:
- case SS_ETCHEDFRAME:
- // and frames
- bRefresh = TRUE;
- break;
- }
- }
-
- // window classes that don't redraw client area correctly
- // when the hor scroll pos changes due to a resizing
- BOOL bHScroll = FALSE;
- if (layout.sWndClass == WC_LISTBOX)
- bHScroll = TRUE;
-
- // fix for horizontally scrollable windows
- if (bHScroll && (nDiffWidth > 0))
- {
- // get max scroll position
- SCROLLINFO info;
- info.cbSize = sizeof(SCROLLINFO);
- info.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
- if (::GetScrollInfo(layout.hWnd, SB_HORZ, &info))
- {
- // subtract the page size
- info.nMax -= __max(info.nPage-1,0);
- }
-
- // resizing will cause the text to scroll on the right
- // because the scrollbar is going beyond the right limit
- if ((info.nMax > 0) && (info.nPos + nDiffWidth > info.nMax))
- {
- // needs repainting, due to horiz scrolling
- bRefresh = TRUE;
- }
- }
-
- return bRefresh;
+ if(layout.bMsgSupport)
+ {
+ REFRESHPROPERTY refresh;
+ refresh.rcOld = rectOld;
+ refresh.rcNew = rectNew;
+ if(Send_NeedsRefresh(layout.hWnd, &refresh))
+ return refresh.bNeedsRefresh;
+ }
+
+ int nDiffWidth = (rectNew.Width() - rectOld.Width());
+ int nDiffHeight = (rectNew.Height() - rectOld.Height());
+
+ // is the same size?
+ if(nDiffWidth == 0 && nDiffHeight == 0)
+ return FALSE;
+
+ // optimistic, no need to refresh
+ BOOL bRefresh = FALSE;
+
+ // window classes that need refresh when resized
+ if(layout.sWndClass == WC_STATIC)
+ {
+ DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE);
+
+ switch(style & SS_TYPEMASK)
+ {
+ case SS_LEFT:
+ case SS_CENTER:
+ case SS_RIGHT:
+ // word-wrapped text
+ bRefresh = bRefresh || (nDiffWidth != 0);
+ // vertically centered text
+ if(style & SS_CENTERIMAGE)
+ bRefresh = bRefresh || (nDiffHeight != 0);
+ break;
+
+ case SS_LEFTNOWORDWRAP:
+ // text with ellipsis
+ if(style & SS_ELLIPSISMASK)
+ bRefresh = bRefresh || (nDiffWidth != 0);
+ // vertically centered text
+ if(style & SS_CENTERIMAGE)
+ bRefresh = bRefresh || (nDiffHeight != 0);
+ break;
+
+ case SS_ENHMETAFILE:
+ case SS_BITMAP:
+ case SS_ICON:
+ // images
+ case SS_BLACKFRAME:
+ case SS_GRAYFRAME:
+ case SS_WHITEFRAME:
+ case SS_ETCHEDFRAME:
+ // and frames
+ bRefresh = TRUE;
+ break;
+ }
+ }
+
+ // window classes that don't redraw client area correctly
+ // when the hor scroll pos changes due to a resizing
+ BOOL bHScroll = FALSE;
+ if(layout.sWndClass == WC_LISTBOX)
+ bHScroll = TRUE;
+
+ // fix for horizontally scrollable windows
+ if(bHScroll && (nDiffWidth > 0))
+ {
+ // get max scroll position
+ SCROLLINFO info;
+ info.cbSize = sizeof(SCROLLINFO);
+ info.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
+ if(::GetScrollInfo(layout.hWnd, SB_HORZ, &info))
+ {
+ // subtract the page size
+ info.nMax -= __max(info.nPage - 1, 0);
+ }
+
+ // resizing will cause the text to scroll on the right
+ // because the scrollbar is going beyond the right limit
+ if((info.nMax > 0) && (info.nPos + nDiffWidth > info.nMax))
+ {
+ // needs repainting, due to horiz scrolling
+ bRefresh = TRUE;
+ }
+ }
+
+ return bRefresh;
}
BOOL CResizableLayout::LikesClipping(const CResizableLayout::LayoutInfo& layout)
{
- if (layout.bMsgSupport)
- {
- CLIPPINGPROPERTY clipping;
- if (Send_LikesClipping(layout.hWnd, &clipping))
- return clipping.bLikesClipping;
- }
-
- DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE);
-
- // skip windows that wants background repainted
- if (layout.sWndClass == TOOLBARCLASSNAME && (style & TBSTYLE_TRANSPARENT))
- return FALSE;
- else if (layout.sWndClass == WC_BUTTON)
- {
- CRect rect;
- switch (style & _BS_TYPEMASK)
- {
- case BS_GROUPBOX:
- return FALSE;
-
- case BS_OWNERDRAW:
- // ownerdraw buttons must return correct hittest code
- // to notify their transparency to the system and this library
- ::GetWindowRect(layout.hWnd, &rect);
- if ( HTTRANSPARENT == ::SendMessage(layout.hWnd,
- WM_NCHITTEST, 0, MAKELPARAM(rect.left, rect.top)) )
- return FALSE;
- break;
- }
- return TRUE;
- }
- else if (layout.sWndClass == WC_STATIC)
- {
- switch (style & SS_TYPEMASK)
- {
- case SS_LEFT:
- case SS_CENTER:
- case SS_RIGHT:
- case SS_SIMPLE:
- case SS_LEFTNOWORDWRAP:
- // text
- case SS_BLACKRECT:
- case SS_GRAYRECT:
- case SS_WHITERECT:
- // filled rects
- case SS_ETCHEDHORZ:
- case SS_ETCHEDVERT:
- // etched lines
- case SS_BITMAP:
- // bitmaps
- return TRUE;
- break;
-
- case SS_ICON:
- case SS_ENHMETAFILE:
- if (style & SS_CENTERIMAGE)
- return FALSE;
- return TRUE;
- break;
-
- default:
- return FALSE;
- }
- }
-
- // assume the others like clipping
- return TRUE;
+ if(layout.bMsgSupport)
+ {
+ CLIPPINGPROPERTY clipping;
+ if(Send_LikesClipping(layout.hWnd, &clipping))
+ return clipping.bLikesClipping;
+ }
+
+ DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE);
+
+ // skip windows that wants background repainted
+ if(layout.sWndClass == TOOLBARCLASSNAME && (style & TBSTYLE_TRANSPARENT))
+ return FALSE;
+ else if(layout.sWndClass == WC_BUTTON)
+ {
+ CRect rect;
+ switch(style & _BS_TYPEMASK)
+ {
+ case BS_GROUPBOX:
+ return FALSE;
+
+ case BS_OWNERDRAW:
+ // ownerdraw buttons must return correct hittest code
+ // to notify their transparency to the system and this library
+ ::GetWindowRect(layout.hWnd, &rect);
+ if(HTTRANSPARENT == ::SendMessage(layout.hWnd,
+ WM_NCHITTEST, 0, MAKELPARAM(rect.left, rect.top)))
+ return FALSE;
+ break;
+ }
+ return TRUE;
+ }
+ else if(layout.sWndClass == WC_STATIC)
+ {
+ switch(style & SS_TYPEMASK)
+ {
+ case SS_LEFT:
+ case SS_CENTER:
+ case SS_RIGHT:
+ case SS_SIMPLE:
+ case SS_LEFTNOWORDWRAP:
+ // text
+ case SS_BLACKRECT:
+ case SS_GRAYRECT:
+ case SS_WHITERECT:
+ // filled rects
+ case SS_ETCHEDHORZ:
+ case SS_ETCHEDVERT:
+ // etched lines
+ case SS_BITMAP:
+ // bitmaps
+ return TRUE;
+ break;
+
+ case SS_ICON:
+ case SS_ENHMETAFILE:
+ if(style & SS_CENTERIMAGE)
+ return FALSE;
+ return TRUE;
+ break;
+
+ default:
+ return FALSE;
+ }
+ }
+
+ // assume the others like clipping
+ return TRUE;
}
void CResizableLayout::CalcNewChildPosition(const CResizableLayout::LayoutInfo& layout,
- const CRect &rectParent, CRect &rectChild, UINT& uFlags)
+ const CRect &rectParent, CRect &rectChild, UINT& uFlags)
{
- CWnd* pParent = GetResizableWnd();
-
- ::GetWindowRect(layout.hWnd, &rectChild);
- ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2);
-
- CRect rectNew;
-
- // calculate new top-left corner
- rectNew.left = layout.sizeMarginTL.cx + rectParent.Width() * layout.sizeTypeTL.cx / 100;
- rectNew.top = layout.sizeMarginTL.cy + rectParent.Height() * layout.sizeTypeTL.cy / 100;
-
- // calculate new bottom-right corner
- rectNew.right = layout.sizeMarginBR.cx + rectParent.Width() * layout.sizeTypeBR.cx / 100;
- rectNew.bottom = layout.sizeMarginBR.cy + rectParent.Height() * layout.sizeTypeBR.cy / 100;
-
- // adjust position, if client area has been scrolled
- rectNew.OffsetRect(rectParent.TopLeft());
-
- // get the refresh property
- BOOL bRefresh = layout.properties.bAskRefresh ?
- NeedsRefresh(layout, rectChild, rectNew) : layout.properties.bCachedNeedsRefresh;
-
- // set flags
- uFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION;
- if (bRefresh)
- uFlags |= SWP_NOCOPYBITS;
- if (rectNew.TopLeft() == rectChild.TopLeft())
- uFlags |= SWP_NOMOVE;
- if (rectNew.Size() == rectChild.Size())
- uFlags |= SWP_NOSIZE;
-
- // update rect
- rectChild = rectNew;
+ CWnd* pParent = GetResizableWnd();
+
+ ::GetWindowRect(layout.hWnd, &rectChild);
+ ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2);
+
+ CRect rectNew;
+
+ // calculate new top-left corner
+ rectNew.left = layout.sizeMarginTL.cx + rectParent.Width() * layout.sizeTypeTL.cx / 100;
+ rectNew.top = layout.sizeMarginTL.cy + rectParent.Height() * layout.sizeTypeTL.cy / 100;
+
+ // calculate new bottom-right corner
+ rectNew.right = layout.sizeMarginBR.cx + rectParent.Width() * layout.sizeTypeBR.cx / 100;
+ rectNew.bottom = layout.sizeMarginBR.cy + rectParent.Height() * layout.sizeTypeBR.cy / 100;
+
+ // adjust position, if client area has been scrolled
+ rectNew.OffsetRect(rectParent.TopLeft());
+
+ // get the refresh property
+ BOOL bRefresh = layout.properties.bAskRefresh ?
+ NeedsRefresh(layout, rectChild, rectNew) : layout.properties.bCachedNeedsRefresh;
+
+ // set flags
+ uFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION;
+ if(bRefresh)
+ uFlags |= SWP_NOCOPYBITS;
+ if(rectNew.TopLeft() == rectChild.TopLeft())
+ uFlags |= SWP_NOMOVE;
+ if(rectNew.Size() == rectChild.Size())
+ uFlags |= SWP_NOSIZE;
+
+ // update rect
+ rectChild = rectNew;
}
void CResizableLayout::InitResizeProperties(CResizableLayout::LayoutInfo &layout)
{
- // check if custom window supports this library
- // (properties must be correctly set by the window)
- layout.bMsgSupport = Send_QueryProperties(layout.hWnd, &layout.properties);
-
- // default properties
- if (!layout.bMsgSupport)
- {
- // clipping property is assumed as static
- layout.properties.bAskClipping = FALSE;
- layout.properties.bCachedLikesClipping = LikesClipping(layout);
- // refresh property is assumed as dynamic
- layout.properties.bAskRefresh = TRUE;
- }
+ // check if custom window supports this library
+ // (properties must be correctly set by the window)
+ layout.bMsgSupport = Send_QueryProperties(layout.hWnd, &layout.properties);
+
+ // default properties
+ if(!layout.bMsgSupport)
+ {
+ // clipping property is assumed as static
+ layout.properties.bAskClipping = FALSE;
+ layout.properties.bCachedLikesClipping = LikesClipping(layout);
+ // refresh property is assumed as dynamic
+ layout.properties.bAskRefresh = TRUE;
+ }
}
diff --git a/src/ui/ResizableLib/ResizableLayout.h b/src/ui/ResizableLib/ResizableLayout.h
index 0d57623db..d2cfaefc2 100644
--- a/src/ui/ResizableLib/ResizableLayout.h
+++ b/src/ui/ResizableLib/ResizableLayout.h
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -26,171 +26,171 @@
// useful compatibility constants (the only one required is NOANCHOR)
-const CSize NOANCHOR(-1,-1),
- TOP_LEFT(0,0), TOP_CENTER(50,0), TOP_RIGHT(100,0),
- MIDDLE_LEFT(0,50), MIDDLE_CENTER(50,50), MIDDLE_RIGHT(100,50),
- BOTTOM_LEFT(0,100), BOTTOM_CENTER(50,100), BOTTOM_RIGHT(100,100);
+const CSize NOANCHOR(-1, -1),
+ TOP_LEFT(0, 0), TOP_CENTER(50, 0), TOP_RIGHT(100, 0),
+ MIDDLE_LEFT(0, 50), MIDDLE_CENTER(50, 50), MIDDLE_RIGHT(100, 50),
+ BOTTOM_LEFT(0, 100), BOTTOM_CENTER(50, 100), BOTTOM_RIGHT(100, 100);
class CResizableLayout
{
protected:
- class LayoutInfo
- {
- public:
- HWND hWnd;
- UINT nCallbackID;
-
- CString sWndClass;
-
- // upper-left corner
- SIZE sizeTypeTL;
- SIZE sizeMarginTL;
-
- // bottom-right corner
- SIZE sizeTypeBR;
- SIZE sizeMarginBR;
-
- // custom window support
- BOOL bMsgSupport;
- RESIZEPROPERTIES properties;
-
- public:
- LayoutInfo() : hWnd(NULL), nCallbackID(0), bMsgSupport(FALSE)
- {
- sizeTypeTL.cx = 0;
- sizeTypeTL.cy = 0;
- sizeMarginTL.cx = 0;
- sizeMarginTL.cy = 0;
- sizeTypeBR.cx = 0;
- sizeTypeBR.cy = 0;
- sizeMarginBR.cx = 0;
- sizeMarginBR.cy = 0;
- memset(&properties, 0, sizeof properties);
- }
-
- LayoutInfo(HWND hwnd, SIZE tl_t, SIZE tl_m,
- SIZE br_t, SIZE br_m, CString classname)
- : hWnd(hwnd), nCallbackID(0),
- sWndClass(classname), bMsgSupport(FALSE),
- sizeTypeTL(tl_t), sizeMarginTL(tl_m),
- sizeTypeBR(br_t), sizeMarginBR(br_m)
- {
- memset(&properties, 0, sizeof properties);
- }
- };
+ class LayoutInfo
+ {
+ public:
+ HWND hWnd;
+ UINT nCallbackID;
+
+ CString sWndClass;
+
+ // upper-left corner
+ SIZE sizeTypeTL;
+ SIZE sizeMarginTL;
+
+ // bottom-right corner
+ SIZE sizeTypeBR;
+ SIZE sizeMarginBR;
+
+ // custom window support
+ BOOL bMsgSupport;
+ RESIZEPROPERTIES properties;
+
+ public:
+ LayoutInfo() : hWnd(NULL), nCallbackID(0), bMsgSupport(FALSE)
+ {
+ sizeTypeTL.cx = 0;
+ sizeTypeTL.cy = 0;
+ sizeMarginTL.cx = 0;
+ sizeMarginTL.cy = 0;
+ sizeTypeBR.cx = 0;
+ sizeTypeBR.cy = 0;
+ sizeMarginBR.cx = 0;
+ sizeMarginBR.cy = 0;
+ memset(&properties, 0, sizeof properties);
+ }
+
+ LayoutInfo(HWND hwnd, SIZE tl_t, SIZE tl_m,
+ SIZE br_t, SIZE br_m, CString classname)
+ : hWnd(hwnd), nCallbackID(0),
+ sWndClass(classname), bMsgSupport(FALSE),
+ sizeTypeTL(tl_t), sizeMarginTL(tl_m),
+ sizeTypeBR(br_t), sizeMarginBR(br_m)
+ {
+ memset(&properties, 0, sizeof properties);
+ }
+ };
private:
- // list of repositionable controls
- CMap<HWND, HWND, POSITION, POSITION> m_mapLayout;
- CList<LayoutInfo, LayoutInfo&> m_listLayout;
- CList<LayoutInfo, LayoutInfo&> m_listLayoutCB;
+ // list of repositionable controls
+ CMap<HWND, HWND, POSITION, POSITION> m_mapLayout;
+ CList<LayoutInfo, LayoutInfo&> m_listLayout;
+ CList<LayoutInfo, LayoutInfo&> m_listLayoutCB;
- void ClipChildWindow(const CResizableLayout::LayoutInfo &layout, CRgn* pRegion);
+ void ClipChildWindow(const CResizableLayout::LayoutInfo &layout, CRgn* pRegion);
- void CalcNewChildPosition(const CResizableLayout::LayoutInfo &layout,
- const CRect &rectParent, CRect &rectChild, UINT& uFlags);
+ void CalcNewChildPosition(const CResizableLayout::LayoutInfo &layout,
+ const CRect &rectParent, CRect &rectChild, UINT& uFlags);
protected:
- // override to initialize resize properties (clipping, refresh)
- virtual void InitResizeProperties(CResizableLayout::LayoutInfo& layout);
-
- // override to specify clipping for unsupported windows
- virtual BOOL LikesClipping(const CResizableLayout::LayoutInfo &layout);
-
- // override to specify refresh for unsupported windows
- virtual BOOL NeedsRefresh(const CResizableLayout::LayoutInfo &layout,
- const CRect &rectOld, const CRect &rectNew);
-
- // paint the background on the given DC (for XP theme's compatibility)
- void EraseBackground(CDC* pDC);
-
- // clip out child windows from the given DC (support old code)
- void ClipChildren(CDC* pDC);
-
- // get the clipping region (without clipped child windows)
- void GetClippingRegion(CRgn* pRegion);
-
- // override for scrollable or expanding parent windows
- virtual void GetTotalClientRect(LPRECT lpRect);
-
- // add anchors to a control, given its HWND
- void AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR);
-
- // add anchors to a control, given its ID
- void AddAnchor(UINT nID, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR)
- {
- AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
- sizeTypeTL, sizeTypeBR);
- }
-
- // add a callback (control ID or HWND is unknown or may change)
- void AddAnchorCallback(UINT nCallbackID);
-
- // get rect of an anchored window, given the parent's client area
- BOOL GetAnchorPosition(HWND hWnd, const CRect &rectParent,
- CRect &rectChild, UINT* lpFlags = NULL)
- {
- POSITION pos;
- if (!m_mapLayout.Lookup(hWnd, pos))
- return FALSE;
-
- UINT uTmpFlags;
- CalcNewChildPosition(m_listLayout.GetAt(pos), rectParent, rectChild,
- (lpFlags != NULL) ? (*lpFlags) : uTmpFlags);
- return TRUE;
- }
-
- // get rect of an anchored window, given the parent's client area
- BOOL GetAnchorPosition(UINT nID, const CRect &rectParent,
- CRect &rectChild, UINT* lpFlags = NULL)
- {
- return GetAnchorPosition(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
- rectParent, rectChild, lpFlags);
- }
-
- // remove an anchored control from the layout, given its HWND
- BOOL RemoveAnchor(HWND hWnd)
- {
- POSITION pos;
- if (!m_mapLayout.Lookup(hWnd, pos))
- return FALSE;
-
- m_listLayout.RemoveAt(pos);
- return m_mapLayout.RemoveKey(hWnd);
- }
-
- // remove an anchored control from the layout, given its HWND
- BOOL RemoveAnchor(UINT nID)
- {
- return RemoveAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID));
- }
-
- // reset layout content
- void RemoveAllAnchors()
- {
- m_mapLayout.RemoveAll();
- m_listLayout.RemoveAll();
- m_listLayoutCB.RemoveAll();
- }
-
- // adjust children's layout, when parent's size changes
- void ArrangeLayout();
-
- // override to provide dynamic control's layout info
- virtual BOOL ArrangeLayoutCallback(CResizableLayout::LayoutInfo& layout);
-
- // override to provide the parent window
- virtual CWnd* GetResizableWnd() = 0;
+ // override to initialize resize properties (clipping, refresh)
+ virtual void InitResizeProperties(CResizableLayout::LayoutInfo& layout);
+
+ // override to specify clipping for unsupported windows
+ virtual BOOL LikesClipping(const CResizableLayout::LayoutInfo &layout);
+
+ // override to specify refresh for unsupported windows
+ virtual BOOL NeedsRefresh(const CResizableLayout::LayoutInfo &layout,
+ const CRect &rectOld, const CRect &rectNew);
+
+ // paint the background on the given DC (for XP theme's compatibility)
+ void EraseBackground(CDC* pDC);
+
+ // clip out child windows from the given DC (support old code)
+ void ClipChildren(CDC* pDC);
+
+ // get the clipping region (without clipped child windows)
+ void GetClippingRegion(CRgn* pRegion);
+
+ // override for scrollable or expanding parent windows
+ virtual void GetTotalClientRect(LPRECT lpRect);
+
+ // add anchors to a control, given its HWND
+ void AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR);
+
+ // add anchors to a control, given its ID
+ void AddAnchor(UINT nID, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR)
+ {
+ AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
+ sizeTypeTL, sizeTypeBR);
+ }
+
+ // add a callback (control ID or HWND is unknown or may change)
+ void AddAnchorCallback(UINT nCallbackID);
+
+ // get rect of an anchored window, given the parent's client area
+ BOOL GetAnchorPosition(HWND hWnd, const CRect &rectParent,
+ CRect &rectChild, UINT* lpFlags = NULL)
+ {
+ POSITION pos;
+ if(!m_mapLayout.Lookup(hWnd, pos))
+ return FALSE;
+
+ UINT uTmpFlags;
+ CalcNewChildPosition(m_listLayout.GetAt(pos), rectParent, rectChild,
+ (lpFlags != NULL) ? (*lpFlags) : uTmpFlags);
+ return TRUE;
+ }
+
+ // get rect of an anchored window, given the parent's client area
+ BOOL GetAnchorPosition(UINT nID, const CRect &rectParent,
+ CRect &rectChild, UINT* lpFlags = NULL)
+ {
+ return GetAnchorPosition(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
+ rectParent, rectChild, lpFlags);
+ }
+
+ // remove an anchored control from the layout, given its HWND
+ BOOL RemoveAnchor(HWND hWnd)
+ {
+ POSITION pos;
+ if(!m_mapLayout.Lookup(hWnd, pos))
+ return FALSE;
+
+ m_listLayout.RemoveAt(pos);
+ return m_mapLayout.RemoveKey(hWnd);
+ }
+
+ // remove an anchored control from the layout, given its HWND
+ BOOL RemoveAnchor(UINT nID)
+ {
+ return RemoveAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID));
+ }
+
+ // reset layout content
+ void RemoveAllAnchors()
+ {
+ m_mapLayout.RemoveAll();
+ m_listLayout.RemoveAll();
+ m_listLayoutCB.RemoveAll();
+ }
+
+ // adjust children's layout, when parent's size changes
+ void ArrangeLayout();
+
+ // override to provide dynamic control's layout info
+ virtual BOOL ArrangeLayoutCallback(CResizableLayout::LayoutInfo& layout);
+
+ // override to provide the parent window
+ virtual CWnd* GetResizableWnd() = 0;
public:
- CResizableLayout() { }
+ CResizableLayout() { }
- virtual ~CResizableLayout()
- {
- // just for safety
- RemoveAllAnchors();
- }
+ virtual ~CResizableLayout()
+ {
+ // just for safety
+ RemoveAllAnchors();
+ }
};
#endif // !defined(AFX_RESIZABLELAYOUT_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableMinMax.cpp b/src/ui/ResizableLib/ResizableMinMax.cpp
index 0a19f3002..f137b8d09 100644
--- a/src/ui/ResizableLib/ResizableMinMax.cpp
+++ b/src/ui/ResizableLib/ResizableMinMax.cpp
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -23,9 +23,9 @@
CResizableMinMax::CResizableMinMax()
{
- m_bUseMinTrack = FALSE;
- m_bUseMaxTrack = FALSE;
- m_bUseMaxRect = FALSE;
+ m_bUseMinTrack = FALSE;
+ m_bUseMaxTrack = FALSE;
+ m_bUseMaxRect = FALSE;
}
CResizableMinMax::~CResizableMinMax()
@@ -35,55 +35,55 @@ CResizableMinMax::~CResizableMinMax()
void CResizableMinMax::MinMaxInfo(LPMINMAXINFO lpMMI)
{
- if (m_bUseMinTrack)
- lpMMI->ptMinTrackSize = m_ptMinTrackSize;
+ if(m_bUseMinTrack)
+ lpMMI->ptMinTrackSize = m_ptMinTrackSize;
- if (m_bUseMaxTrack)
- lpMMI->ptMaxTrackSize = m_ptMaxTrackSize;
+ if(m_bUseMaxTrack)
+ lpMMI->ptMaxTrackSize = m_ptMaxTrackSize;
- if (m_bUseMaxRect)
- {
- lpMMI->ptMaxPosition = m_ptMaxPos;
- lpMMI->ptMaxSize = m_ptMaxSize;
- }
+ if(m_bUseMaxRect)
+ {
+ lpMMI->ptMaxPosition = m_ptMaxPos;
+ lpMMI->ptMaxSize = m_ptMaxSize;
+ }
}
void CResizableMinMax::SetMaximizedRect(const CRect& rc)
{
- m_bUseMaxRect = TRUE;
+ m_bUseMaxRect = TRUE;
- m_ptMaxPos = rc.TopLeft();
- m_ptMaxSize.x = rc.Width();
- m_ptMaxSize.y = rc.Height();
+ m_ptMaxPos = rc.TopLeft();
+ m_ptMaxSize.x = rc.Width();
+ m_ptMaxSize.y = rc.Height();
}
void CResizableMinMax::ResetMaximizedRect()
{
- m_bUseMaxRect = FALSE;
+ m_bUseMaxRect = FALSE;
}
void CResizableMinMax::SetMinTrackSize(const CSize& size)
{
- m_bUseMinTrack = TRUE;
+ m_bUseMinTrack = TRUE;
- m_ptMinTrackSize.x = size.cx;
- m_ptMinTrackSize.y = size.cy;
+ m_ptMinTrackSize.x = size.cx;
+ m_ptMinTrackSize.y = size.cy;
}
void CResizableMinMax::ResetMinTrackSize()
{
- m_bUseMinTrack = FALSE;
+ m_bUseMinTrack = FALSE;
}
void CResizableMinMax::SetMaxTrackSize(const CSize& size)
{
- m_bUseMaxTrack = TRUE;
+ m_bUseMaxTrack = TRUE;
- m_ptMaxTrackSize.x = size.cx;
- m_ptMaxTrackSize.y = size.cy;
+ m_ptMaxTrackSize.x = size.cx;
+ m_ptMaxTrackSize.y = size.cy;
}
void CResizableMinMax::ResetMaxTrackSize()
{
- m_bUseMaxTrack = FALSE;
+ m_bUseMaxTrack = FALSE;
}
diff --git a/src/ui/ResizableLib/ResizableMinMax.h b/src/ui/ResizableLib/ResizableMinMax.h
index 557780323..a26eab6cd 100644
--- a/src/ui/ResizableLib/ResizableMinMax.h
+++ b/src/ui/ResizableLib/ResizableMinMax.h
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -21,33 +21,33 @@
#pragma once
#endif // _MSC_VER > 1000
-class CResizableMinMax
+class CResizableMinMax
{
// Attributes
private:
- // flags
- BOOL m_bUseMaxTrack;
- BOOL m_bUseMinTrack;
- BOOL m_bUseMaxRect;
+ // flags
+ BOOL m_bUseMaxTrack;
+ BOOL m_bUseMinTrack;
+ BOOL m_bUseMaxRect;
- POINT m_ptMinTrackSize; // min tracking size
- POINT m_ptMaxTrackSize; // max tracking size
- POINT m_ptMaxPos; // maximized position
- POINT m_ptMaxSize; // maximized size
+ POINT m_ptMinTrackSize; // min tracking size
+ POINT m_ptMaxTrackSize; // max tracking size
+ POINT m_ptMaxPos; // maximized position
+ POINT m_ptMaxSize; // maximized size
public:
- CResizableMinMax();
- virtual ~CResizableMinMax();
+ CResizableMinMax();
+ virtual ~CResizableMinMax();
protected:
- void MinMaxInfo(LPMINMAXINFO lpMMI);
-
- void SetMaximizedRect(const CRect& rc); // set window rect when maximized
- void ResetMaximizedRect(); // reset to default maximized rect
- void SetMinTrackSize(const CSize& size); // set minimum tracking size
- void ResetMinTrackSize(); // reset to default minimum tracking size
- void SetMaxTrackSize(const CSize& size); // set maximum tracking size
- void ResetMaxTrackSize(); // reset to default maximum tracking size
+ void MinMaxInfo(LPMINMAXINFO lpMMI);
+
+ void SetMaximizedRect(const CRect& rc); // set window rect when maximized
+ void ResetMaximizedRect(); // reset to default maximized rect
+ void SetMinTrackSize(const CSize& size); // set minimum tracking size
+ void ResetMinTrackSize(); // reset to default minimum tracking size
+ void SetMaxTrackSize(const CSize& size); // set maximum tracking size
+ void ResetMaxTrackSize(); // reset to default maximum tracking size
};
#endif // !defined(AFX_RESIZABLEMINMAX_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableMsgSupport.h b/src/ui/ResizableLib/ResizableMsgSupport.h
index 68d45fe9f..a27cc83bb 100644
--- a/src/ui/ResizableLib/ResizableMsgSupport.h
+++ b/src/ui/ResizableLib/ResizableMsgSupport.h
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -23,37 +23,37 @@
typedef struct tagRESIZEPROPERTIES
{
- // wether to ask for resizing properties every time
- BOOL bAskClipping;
- BOOL bAskRefresh;
- // otherwise, use the cached properties
- BOOL bCachedLikesClipping;
- BOOL bCachedNeedsRefresh;
+ // wether to ask for resizing properties every time
+ BOOL bAskClipping;
+ BOOL bAskRefresh;
+ // otherwise, use the cached properties
+ BOOL bCachedLikesClipping;
+ BOOL bCachedNeedsRefresh;
- // initialize with valid data
- tagRESIZEPROPERTIES() : bAskClipping(TRUE), bAskRefresh(TRUE) {}
+ // initialize with valid data
+ tagRESIZEPROPERTIES() : bAskClipping(TRUE), bAskRefresh(TRUE) {}
} RESIZEPROPERTIES, *PRESIZEPROPERTIES, *LPRESIZEPROPERTIES;
typedef struct tagCLIPPINGPROPERTY
{
- BOOL bLikesClipping;
+ BOOL bLikesClipping;
- // initialize with valid data
- tagCLIPPINGPROPERTY() : bLikesClipping(FALSE) {}
+ // initialize with valid data
+ tagCLIPPINGPROPERTY() : bLikesClipping(FALSE) {}
} CLIPPINGPROPERTY, *PCLIPPINGPROPERTY, *LPCLIPPINGPROPERTY;
typedef struct tagREFRESHPROPERTY
{
- BOOL bNeedsRefresh;
- RECT rcOld;
- RECT rcNew;
+ BOOL bNeedsRefresh;
+ RECT rcOld;
+ RECT rcNew;
- // initialize with valid data
- tagREFRESHPROPERTY() : bNeedsRefresh(TRUE) {}
+ // initialize with valid data
+ tagREFRESHPROPERTY() : bNeedsRefresh(TRUE) {}
} REFRESHPROPERTY, *PREFRESHPROPERTY, *LPREFRESHPROPERTY;
diff --git a/src/ui/ResizableLib/ResizablePage.cpp b/src/ui/ResizableLib/ResizablePage.cpp
index 06dcc6b96..1925c4f47 100644
--- a/src/ui/ResizableLib/ResizablePage.cpp
+++ b/src/ui/ResizableLib/ResizablePage.cpp
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -27,12 +27,12 @@ CResizablePage::CResizablePage()
}
CResizablePage::CResizablePage(UINT nIDTemplate, UINT nIDCaption)
- : CPropertyPage(nIDTemplate, nIDCaption)
+ : CPropertyPage(nIDTemplate, nIDCaption)
{
}
CResizablePage::CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption)
- : CPropertyPage(lpszTemplateName, nIDCaption)
+ : CPropertyPage(lpszTemplateName, nIDCaption)
{
}
@@ -42,31 +42,31 @@ CResizablePage::~CResizablePage()
BEGIN_MESSAGE_MAP(CResizablePage, CPropertyPage)
- //{{AFX_MSG_MAP(CResizablePage)
- ON_WM_SIZE()
- ON_WM_ERASEBKGND()
- //}}AFX_MSG_MAP
+ //{{AFX_MSG_MAP(CResizablePage)
+ ON_WM_SIZE()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResizablePage message handlers
-void CResizablePage::OnSize(UINT nType, int cx, int cy)
+void CResizablePage::OnSize(UINT nType, int cx, int cy)
{
- CWnd::OnSize(nType, cx, cy);
-
- ArrangeLayout();
+ CWnd::OnSize(nType, cx, cy);
+
+ ArrangeLayout();
}
-BOOL CResizablePage::OnEraseBkgnd(CDC* pDC)
+BOOL CResizablePage::OnEraseBkgnd(CDC* pDC)
{
- // Windows XP doesn't like clipping regions ...try this!
- EraseBackground(pDC);
- return TRUE;
-
-/* ClipChildren(pDC); // old-method (for safety)
-
- return CPropertyPage::OnEraseBkgnd(pDC);
-*/
+ // Windows XP doesn't like clipping regions ...try this!
+ EraseBackground(pDC);
+ return TRUE;
+
+ /* ClipChildren(pDC); // old-method (for safety)
+
+ return CPropertyPage::OnEraseBkgnd(pDC);
+ */
}
diff --git a/src/ui/ResizableLib/ResizablePage.h b/src/ui/ResizableLib/ResizablePage.h
index 4c8218634..c2c969b83 100644
--- a/src/ui/ResizableLib/ResizablePage.h
+++ b/src/ui/ResizableLib/ResizablePage.h
@@ -13,7 +13,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -29,13 +29,13 @@
class CResizablePage : public CPropertyPage, public CResizableLayout
{
- DECLARE_DYNCREATE(CResizablePage)
+ DECLARE_DYNCREATE(CResizablePage)
// Construction
public:
- CResizablePage();
- CResizablePage(UINT nIDTemplate, UINT nIDCaption = 0);
- CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0);
+ CResizablePage();
+ CResizablePage(UINT nIDTemplate, UINT nIDCaption = 0);
+ CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0);
// Attributes
public:
@@ -44,30 +44,30 @@ public:
public:
// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CResizablePage)
- //}}AFX_VIRTUAL
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CResizablePage)
+ //}}AFX_VIRTUAL
// Implementation
public:
- virtual ~CResizablePage();
+ virtual ~CResizablePage();
// callable from derived classes
protected:
- virtual CWnd* GetResizableWnd()
- {
- // make the layout know its parent window
- return this;
- };
+ virtual CWnd* GetResizableWnd()
+ {
+ // make the layout know its parent window
+ return this;
+ };
// Generated message map functions
protected:
- //{{AFX_MSG(CResizablePage)
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
+ //{{AFX_MSG(CResizablePage)
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/ui/ResizableLib/ResizableSheet.cpp b/src/ui/ResizableLib/ResizableSheet.cpp
index a7048b085..d7c739909 100644
--- a/src/ui/ResizableLib/ResizableSheet.cpp
+++ b/src/ui/ResizableLib/ResizableSheet.cpp
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -24,27 +24,27 @@ IMPLEMENT_DYNAMIC(CResizableSheet, CPropertySheet)
inline void CResizableSheet::PrivateConstruct()
{
- m_bEnableSaveRestore = FALSE;
- m_bSavePage = FALSE;
- m_dwGripTempState = 1;
+ m_bEnableSaveRestore = FALSE;
+ m_bSavePage = FALSE;
+ m_dwGripTempState = 1;
}
CResizableSheet::CResizableSheet()
{
- PrivateConstruct();
+ PrivateConstruct();
}
CResizableSheet::CResizableSheet(UINT nIDCaption, CWnd *pParentWnd, UINT iSelectPage)
- : CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
+ : CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
- PrivateConstruct();
+ PrivateConstruct();
}
CResizableSheet::CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd, UINT iSelectPage)
- : CPropertySheet(pszCaption, pParentWnd, iSelectPage)
+ : CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
- PrivateConstruct();
+ PrivateConstruct();
}
CResizableSheet::~CResizableSheet()
@@ -52,240 +52,240 @@ CResizableSheet::~CResizableSheet()
}
BEGIN_MESSAGE_MAP(CResizableSheet, CPropertySheet)
- //{{AFX_MSG_MAP(CResizableSheet)
- ON_WM_GETMINMAXINFO()
- ON_WM_SIZE()
- ON_WM_DESTROY()
- ON_WM_CREATE()
- ON_WM_ERASEBKGND()
- //}}AFX_MSG_MAP
- ON_NOTIFY_REFLECT_EX(PSN_SETACTIVE, OnPageChanging)
+ //{{AFX_MSG_MAP(CResizableSheet)
+ ON_WM_GETMINMAXINFO()
+ ON_WM_SIZE()
+ ON_WM_DESTROY()
+ ON_WM_CREATE()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
+ ON_NOTIFY_REFLECT_EX(PSN_SETACTIVE, OnPageChanging)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResizableSheet message handlers
-int CResizableSheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
+int CResizableSheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- // keep client area
- CRect rect;
- GetClientRect(&rect);
- // set resizable style
- ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
- // adjust size to reflect new style
- ::AdjustWindowRectEx(&rect, GetStyle(),
- ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
- SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED|
- SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);
-
- // create and init the size-grip
- if (!CreateSizeGrip())
- return -1;
-
- return 0;
+ if(CPropertySheet::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // keep client area
+ CRect rect;
+ GetClientRect(&rect);
+ // set resizable style
+ ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
+ // adjust size to reflect new style
+ ::AdjustWindowRectEx(&rect, GetStyle(),
+ ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
+ SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED |
+ SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION);
+
+ // create and init the size-grip
+ if(!CreateSizeGrip())
+ return -1;
+
+ return 0;
}
-BOOL CResizableSheet::OnInitDialog()
+BOOL CResizableSheet::OnInitDialog()
{
- BOOL bResult = CPropertySheet::OnInitDialog();
-
- // set the initial size as the min track size
- CRect rc;
- GetWindowRect(&rc);
- SetMinTrackSize(rc.Size());
+ BOOL bResult = CPropertySheet::OnInitDialog();
- // initialize layout
- PresetLayout();
+ // set the initial size as the min track size
+ CRect rc;
+ GetWindowRect(&rc);
+ SetMinTrackSize(rc.Size());
- // prevent flickering
- GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS);
+ // initialize layout
+ PresetLayout();
- return bResult;
+ // prevent flickering
+ GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS);
+
+ return bResult;
}
-void CResizableSheet::OnDestroy()
+void CResizableSheet::OnDestroy()
{
- if (m_bEnableSaveRestore)
- {
- SaveWindowRect(m_sSection, m_bRectOnly);
- SavePage();
- }
+ if(m_bEnableSaveRestore)
+ {
+ SaveWindowRect(m_sSection, m_bRectOnly);
+ SavePage();
+ }
- RemoveAllAnchors();
+ RemoveAllAnchors();
- CPropertySheet::OnDestroy();
+ CPropertySheet::OnDestroy();
}
// maps an index to a button ID and vice-versa
static UINT _propButtons[] =
{
- IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP,
- ID_WIZBACK, ID_WIZNEXT, ID_WIZFINISH
+ IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP,
+ ID_WIZBACK, ID_WIZNEXT, ID_WIZFINISH
};
-const int _propButtonsCount = sizeof(_propButtons)/sizeof(UINT);
+const int _propButtonsCount = sizeof(_propButtons) / sizeof(UINT);
// horizontal line in wizard mode
#define ID_WIZLINE ID_WIZFINISH+1
void CResizableSheet::PresetLayout()
{
- if (IsWizard()) // wizard mode
- {
- // hide tab control
- GetTabControl()->ShowWindow(SW_HIDE);
-
- AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT);
- }
- else // tab mode
- {
- AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT);
- }
-
- // add a callback for active page (which can change at run-time)
- AddAnchorCallback(1);
-
- // use *total* parent size to have correct margins
- CRect rectPage, rectSheet;
- GetTotalClientRect(&rectSheet);
-
- GetActivePage()->GetWindowRect(&rectPage);
- ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2);
-
- // pre-calculate margins
- m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft();
- m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight();
-
- // add all possible buttons, if they exist
- for (int i = 0; i < _propButtonsCount; i++)
- {
- if (NULL != GetDlgItem(_propButtons[i]))
- AddAnchor(_propButtons[i], BOTTOM_RIGHT);
- }
+ if(IsWizard()) // wizard mode
+ {
+ // hide tab control
+ GetTabControl()->ShowWindow(SW_HIDE);
+
+ AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT);
+ }
+ else // tab mode
+ {
+ AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT);
+ }
+
+ // add a callback for active page (which can change at run-time)
+ AddAnchorCallback(1);
+
+ // use *total* parent size to have correct margins
+ CRect rectPage, rectSheet;
+ GetTotalClientRect(&rectSheet);
+
+ GetActivePage()->GetWindowRect(&rectPage);
+ ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2);
+
+ // pre-calculate margins
+ m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft();
+ m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight();
+
+ // add all possible buttons, if they exist
+ for(int i = 0; i < _propButtonsCount; i++)
+ {
+ if(NULL != GetDlgItem(_propButtons[i]))
+ AddAnchor(_propButtons[i], BOTTOM_RIGHT);
+ }
}
BOOL CResizableSheet::ArrangeLayoutCallback(LayoutInfo &layout)
{
- if (layout.nCallbackID != 1) // we only added 1 callback
- return CResizableLayout::ArrangeLayoutCallback(layout);
-
- // set layout info for active page
- layout.hWnd = (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0);
- if (!::IsWindow(layout.hWnd))
- return FALSE;
-
- // set margins
- if (IsWizard()) // wizard mode
- {
- // use pre-calculated margins
- layout.sizeMarginTL = m_sizePageTL;
- layout.sizeMarginBR = m_sizePageBR;
- }
- else // tab mode
- {
- CTabCtrl* pTab = GetTabControl();
- ASSERT(pTab != NULL);
-
- // get tab position after resizing and calc page rect
- CRect rectPage, rectSheet;
- GetTotalClientRect(&rectSheet);
-
- VERIFY(GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage));
- pTab->AdjustRect(FALSE, &rectPage);
-
- // set margins
- layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft();
- layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight();
- }
-
- // set anchor types
- layout.sizeTypeTL = TOP_LEFT;
- layout.sizeTypeBR = BOTTOM_RIGHT;
-
- // use this layout info
- return TRUE;
+ if(layout.nCallbackID != 1) // we only added 1 callback
+ return CResizableLayout::ArrangeLayoutCallback(layout);
+
+ // set layout info for active page
+ layout.hWnd = (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0);
+ if(!::IsWindow(layout.hWnd))
+ return FALSE;
+
+ // set margins
+ if(IsWizard()) // wizard mode
+ {
+ // use pre-calculated margins
+ layout.sizeMarginTL = m_sizePageTL;
+ layout.sizeMarginBR = m_sizePageBR;
+ }
+ else // tab mode
+ {
+ CTabCtrl* pTab = GetTabControl();
+ ASSERT(pTab != NULL);
+
+ // get tab position after resizing and calc page rect
+ CRect rectPage, rectSheet;
+ GetTotalClientRect(&rectSheet);
+
+ VERIFY(GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage));
+ pTab->AdjustRect(FALSE, &rectPage);
+
+ // set margins
+ layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft();
+ layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight();
+ }
+
+ // set anchor types
+ layout.sizeTypeTL = TOP_LEFT;
+ layout.sizeTypeBR = BOTTOM_RIGHT;
+
+ // use this layout info
+ return TRUE;
}
-void CResizableSheet::OnSize(UINT nType, int cx, int cy)
+void CResizableSheet::OnSize(UINT nType, int cx, int cy)
{
- CWnd::OnSize(nType, cx, cy);
-
- if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
- return; // arrangement not needed
-
- if (nType == SIZE_MAXIMIZED)
- HideSizeGrip(&m_dwGripTempState);
- else
- ShowSizeGrip(&m_dwGripTempState);
-
- // update grip and layout
- UpdateSizeGrip();
- ArrangeLayout();
+ CWnd::OnSize(nType, cx, cy);
+
+ if(nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
+ return; // arrangement not needed
+
+ if(nType == SIZE_MAXIMIZED)
+ HideSizeGrip(&m_dwGripTempState);
+ else
+ ShowSizeGrip(&m_dwGripTempState);
+
+ // update grip and layout
+ UpdateSizeGrip();
+ ArrangeLayout();
}
BOOL CResizableSheet::OnPageChanging(NMHDR* /*pNotifyStruct*/, LRESULT* /*pResult*/)
{
- // update new wizard page
- // active page changes after this notification
- PostMessage(WM_SIZE);
+ // update new wizard page
+ // active page changes after this notification
+ PostMessage(WM_SIZE);
- return FALSE; // continue routing
+ return FALSE; // continue routing
}
-BOOL CResizableSheet::OnEraseBkgnd(CDC* pDC)
+BOOL CResizableSheet::OnEraseBkgnd(CDC* pDC)
{
- // Windows XP doesn't like clipping regions ...try this!
- EraseBackground(pDC);
- return TRUE;
+ // Windows XP doesn't like clipping regions ...try this!
+ EraseBackground(pDC);
+ return TRUE;
-/* ClipChildren(pDC); // old-method (for safety)
+ /* ClipChildren(pDC); // old-method (for safety)
- return CPropertySheet::OnEraseBkgnd(pDC);
-*/
+ return CPropertySheet::OnEraseBkgnd(pDC);
+ */
}
-void CResizableSheet::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+void CResizableSheet::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
- MinMaxInfo(lpMMI);
+ MinMaxInfo(lpMMI);
}
// protected members
int CResizableSheet::GetMinWidth()
{
- CWnd* pWnd = NULL;
- CRect rectWnd, rectSheet;
- GetTotalClientRect(&rectSheet);
-
- int max = 0, min = rectSheet.Width();
- // search for leftmost and rightmost button margins
- for (int i = 0; i < 7; i++)
- {
- pWnd = GetDlgItem(_propButtons[i]);
- // exclude not present or hidden buttons
- if (pWnd == NULL || !(pWnd->GetStyle() & WS_VISIBLE))
- continue;
-
- // left position is relative to the right border
- // of the parent window (negative value)
- pWnd->GetWindowRect(&rectWnd);
- ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectWnd, 2);
- int left = rectSheet.right - rectWnd.left;
- int right = rectSheet.right - rectWnd.right;
-
- if (left > max)
- max = left;
- if (right < min)
- min = right;
- }
-
- // sizing border width
- int border = GetSystemMetrics(SM_CXSIZEFRAME);
-
- // compute total width
- return max + min + 2*border;
+ CWnd* pWnd = NULL;
+ CRect rectWnd, rectSheet;
+ GetTotalClientRect(&rectSheet);
+
+ int max = 0, min = rectSheet.Width();
+ // search for leftmost and rightmost button margins
+ for(int i = 0; i < 7; i++)
+ {
+ pWnd = GetDlgItem(_propButtons[i]);
+ // exclude not present or hidden buttons
+ if(pWnd == NULL || !(pWnd->GetStyle() & WS_VISIBLE))
+ continue;
+
+ // left position is relative to the right border
+ // of the parent window (negative value)
+ pWnd->GetWindowRect(&rectWnd);
+ ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectWnd, 2);
+ int left = rectSheet.right - rectWnd.left;
+ int right = rectSheet.right - rectWnd.right;
+
+ if(left > max)
+ max = left;
+ if(right < min)
+ min = right;
+ }
+
+ // sizing border width
+ int border = GetSystemMetrics(SM_CXSIZEFRAME);
+
+ // compute total width
+ return max + min + 2 * border;
}
@@ -293,15 +293,15 @@ int CResizableSheet::GetMinWidth()
// to have the window and its controls displayed properly
void CResizableSheet::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage)
{
- m_sSection = pszSection;
- m_bSavePage = bWithPage;
+ m_sSection = pszSection;
+ m_bSavePage = bWithPage;
- m_bEnableSaveRestore = TRUE;
- m_bRectOnly = bRectOnly;
+ m_bEnableSaveRestore = TRUE;
+ m_bRectOnly = bRectOnly;
- // restore immediately
- LoadWindowRect(pszSection, bRectOnly);
- LoadPage();
+ // restore immediately
+ LoadWindowRect(pszSection, bRectOnly);
+ LoadPage();
}
// private memebers
@@ -314,36 +314,36 @@ void CResizableSheet::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL
void CResizableSheet::SavePage()
{
- if (!m_bSavePage)
- return;
+ if(!m_bSavePage)
+ return;
- // saves active page index, zero (the first) if problems
- // cannot use GetActivePage, because it always fails
+ // saves active page index, zero (the first) if problems
+ // cannot use GetActivePage, because it always fails
- CTabCtrl *pTab = GetTabControl();
- int page = 0;
+ CTabCtrl *pTab = GetTabControl();
+ int page = 0;
- if (pTab != NULL)
- page = pTab->GetCurSel();
- if (page < 0)
- page = 0;
+ if(pTab != NULL)
+ page = pTab->GetCurSel();
+ if(page < 0)
+ page = 0;
- AfxGetApp()->WriteProfileInt(m_sSection, ACTIVEPAGE, page);
+ AfxGetApp()->WriteProfileInt(m_sSection, ACTIVEPAGE, page);
}
void CResizableSheet::LoadPage()
{
- // restore active page, zero (the first) if not found
- int page = AfxGetApp()->GetProfileInt(m_sSection, ACTIVEPAGE, 0);
-
- if (m_bSavePage)
- {
- SetActivePage(page);
- ArrangeLayout(); // needs refresh
- }
+ // restore active page, zero (the first) if not found
+ int page = AfxGetApp()->GetProfileInt(m_sSection, ACTIVEPAGE, 0);
+
+ if(m_bSavePage)
+ {
+ SetActivePage(page);
+ ArrangeLayout(); // needs refresh
+ }
}
void CResizableSheet::RefreshLayout()
{
- SendMessage(WM_SIZE);
+ SendMessage(WM_SIZE);
}
diff --git a/src/ui/ResizableLib/ResizableSheet.h b/src/ui/ResizableLib/ResizableSheet.h
index c82a63798..868aeb60f 100644
--- a/src/ui/ResizableLib/ResizableSheet.h
+++ b/src/ui/ResizableLib/ResizableSheet.h
@@ -11,7 +11,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -29,84 +29,87 @@
//
class CResizableSheet : public CPropertySheet, public CResizableLayout,
- public CResizableGrip, public CResizableMinMax,
- public CResizableState
+ public CResizableGrip, public CResizableMinMax,
+ public CResizableState
{
- DECLARE_DYNAMIC(CResizableSheet)
+ DECLARE_DYNAMIC(CResizableSheet)
// Construction
public:
- CResizableSheet();
- CResizableSheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
- CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
+ CResizableSheet();
+ CResizableSheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
+ CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
// Attributes
private:
- // support for temporarily hiding the grip
- DWORD m_dwGripTempState;
+ // support for temporarily hiding the grip
+ DWORD m_dwGripTempState;
- // flags
- BOOL m_bEnableSaveRestore;
- BOOL m_bRectOnly;
- BOOL m_bSavePage;
+ // flags
+ BOOL m_bEnableSaveRestore;
+ BOOL m_bRectOnly;
+ BOOL m_bSavePage;
- // layout vars
- CSize m_sizePageTL, m_sizePageBR;
+ // layout vars
+ CSize m_sizePageTL, m_sizePageBR;
- // internal status
- CString m_sSection; // section name (identifies a parent window)
+ // internal status
+ CString m_sSection; // section name (identifies a parent window)
// Operations
public:
// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CResizableSheet)
- public:
- virtual BOOL OnInitDialog();
- //}}AFX_VIRTUAL
- protected:
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CResizableSheet)
+public:
+ virtual BOOL OnInitDialog();
+ //}}AFX_VIRTUAL
+protected:
// Implementation
public:
- void RefreshLayout();
- virtual ~CResizableSheet();
+ void RefreshLayout();
+ virtual ~CResizableSheet();
// used internally
private:
- void PresetLayout();
- void PrivateConstruct();
- void SavePage();
- void LoadPage();
+ void PresetLayout();
+ void PrivateConstruct();
+ void SavePage();
+ void LoadPage();
- BOOL IsWizard() { return (m_psh.dwFlags & PSH_WIZARD); }
+ BOOL IsWizard()
+ {
+ return (m_psh.dwFlags & PSH_WIZARD);
+ }
// callable from derived classes
protected:
- // section to use in app's profile
- void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
- BOOL bWithPage = FALSE);
- int GetMinWidth(); // minimum width to display all buttons
+ // section to use in app's profile
+ void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
+ BOOL bWithPage = FALSE);
+ int GetMinWidth(); // minimum width to display all buttons
- virtual CWnd* GetResizableWnd()
- {
- // make the layout know its parent window
- return this;
- };
+ virtual CWnd* GetResizableWnd()
+ {
+ // make the layout know its parent window
+ return this;
+ };
// Generated message map functions
protected:
- virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout);
- //{{AFX_MSG(CResizableSheet)
- afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnDestroy();
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- //}}AFX_MSG
- afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
- DECLARE_MESSAGE_MAP()
+ virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout);
+ //{{AFX_MSG(CResizableSheet)
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnDestroy();
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
+ DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/ui/ResizableLib/ResizableState.cpp b/src/ui/ResizableLib/ResizableState.cpp
index 748038d1a..8ea464d03 100644
--- a/src/ui/ResizableLib/ResizableState.cpp
+++ b/src/ui/ResizableLib/ResizableState.cpp
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -41,65 +41,65 @@ CResizableState::~CResizableState()
BOOL CResizableState::SaveWindowRect(LPCTSTR pszSection, BOOL bRectOnly)
{
- CString data;
- WINDOWPLACEMENT wp;
-
- ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
- wp.length = sizeof(WINDOWPLACEMENT);
- if (!GetResizableWnd()->GetWindowPlacement(&wp))
- return FALSE;
-
- RECT& rc = wp.rcNormalPosition; // alias
-
- if (bRectOnly) // save size/pos only (normal state)
- {
- // use screen coordinates
- GetResizableWnd()->GetWindowRect(&rc);
-
- data.Format(PLACEMENT_FMT, rc.left, rc.top,
- rc.right, rc.bottom, SW_NORMAL, 0);
- }
- else // save also min/max state
- {
- // use workspace coordinates
- data.Format(PLACEMENT_FMT, rc.left, rc.top,
- rc.right, rc.bottom, wp.showCmd, wp.flags);
- }
-
- return AfxGetApp()->WriteProfileString(pszSection, PLACEMENT_ENT, data);
+ CString data;
+ WINDOWPLACEMENT wp;
+
+ ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
+ wp.length = sizeof(WINDOWPLACEMENT);
+ if(!GetResizableWnd()->GetWindowPlacement(&wp))
+ return FALSE;
+
+ RECT& rc = wp.rcNormalPosition; // alias
+
+ if(bRectOnly) // save size/pos only (normal state)
+ {
+ // use screen coordinates
+ GetResizableWnd()->GetWindowRect(&rc);
+
+ data.Format(PLACEMENT_FMT, rc.left, rc.top,
+ rc.right, rc.bottom, SW_NORMAL, 0);
+ }
+ else // save also min/max state
+ {
+ // use workspace coordinates
+ data.Format(PLACEMENT_FMT, rc.left, rc.top,
+ rc.right, rc.bottom, wp.showCmd, wp.flags);
+ }
+
+ return AfxGetApp()->WriteProfileString(pszSection, PLACEMENT_ENT, data);
}
BOOL CResizableState::LoadWindowRect(LPCTSTR pszSection, BOOL bRectOnly)
{
- CString data;
- WINDOWPLACEMENT wp;
-
- data = AfxGetApp()->GetProfileString(pszSection, PLACEMENT_ENT);
-
- if (data.IsEmpty()) // never saved before
- return FALSE;
-
- ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
- wp.length = sizeof(WINDOWPLACEMENT);
- if (!GetResizableWnd()->GetWindowPlacement(&wp))
- return FALSE;
-
- RECT& rc = wp.rcNormalPosition; // alias
-
- if (_stscanf(data, PLACEMENT_FMT, &rc.left, &rc.top,
- &rc.right, &rc.bottom, &wp.showCmd, &wp.flags) == 6)
- {
- if (bRectOnly) // restore size/pos only
- {
- CRect rect(rc);
- return GetResizableWnd()->SetWindowPos(NULL, rect.left, rect.top,
- rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER |
- SWP_NOREPOSITION);
- }
- else // restore also min/max state
- {
- return GetResizableWnd()->SetWindowPlacement(&wp);
- }
- }
- return FALSE;
+ CString data;
+ WINDOWPLACEMENT wp;
+
+ data = AfxGetApp()->GetProfileString(pszSection, PLACEMENT_ENT);
+
+ if(data.IsEmpty()) // never saved before
+ return FALSE;
+
+ ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
+ wp.length = sizeof(WINDOWPLACEMENT);
+ if(!GetResizableWnd()->GetWindowPlacement(&wp))
+ return FALSE;
+
+ RECT& rc = wp.rcNormalPosition; // alias
+
+ if(_stscanf(data, PLACEMENT_FMT, &rc.left, &rc.top,
+ &rc.right, &rc.bottom, &wp.showCmd, &wp.flags) == 6)
+ {
+ if(bRectOnly) // restore size/pos only
+ {
+ CRect rect(rc);
+ return GetResizableWnd()->SetWindowPos(NULL, rect.left, rect.top,
+ rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER |
+ SWP_NOREPOSITION);
+ }
+ else // restore also min/max state
+ {
+ return GetResizableWnd()->SetWindowPlacement(&wp);
+ }
+ }
+ return FALSE;
}
diff --git a/src/ui/ResizableLib/ResizableState.h b/src/ui/ResizableLib/ResizableState.h
index 1e5e7c35f..0bc8c47a9 100644
--- a/src/ui/ResizableLib/ResizableState.h
+++ b/src/ui/ResizableLib/ResizableState.h
@@ -6,7 +6,7 @@
// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
//
// The contents of this file are subject to the Artistic License (the "License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
@@ -21,18 +21,18 @@
#pragma once
#endif // _MSC_VER > 1000
-class CResizableState
+class CResizableState
{
protected:
- // non-zero if successful
- BOOL LoadWindowRect(LPCTSTR pszSection, BOOL bRectOnly);
- BOOL SaveWindowRect(LPCTSTR pszSection, BOOL bRectOnly);
+ // non-zero if successful
+ BOOL LoadWindowRect(LPCTSTR pszSection, BOOL bRectOnly);
+ BOOL SaveWindowRect(LPCTSTR pszSection, BOOL bRectOnly);
- virtual CWnd* GetResizableWnd() = 0;
+ virtual CWnd* GetResizableWnd() = 0;
public:
- CResizableState();
- virtual ~CResizableState();
+ CResizableState();
+ virtual ~CResizableState();
};
#endif // !defined(AFX_RESIZABLESTATE_H__INCLUDED_)
diff --git a/src/ui/TreePropSheet/PropPageFrame.cpp b/src/ui/TreePropSheet/PropPageFrame.cpp
index 30f9f048b..aff9d0eec 100644
--- a/src/ui/TreePropSheet/PropPageFrame.cpp
+++ b/src/ui/TreePropSheet/PropPageFrame.cpp
@@ -29,10 +29,10 @@ namespace TreePropSheet
//-------------------------------------------------------------------
CPropPageFrame::CPropPageFrame()
-: m_bShowCaption(FALSE),
- m_nCaptionHeight(0),
- m_hCaptionIcon(NULL),
- m_dwMsgFormat(DT_CENTER|DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE)
+ : m_bShowCaption(FALSE),
+ m_nCaptionHeight(0),
+ m_hCaptionIcon(NULL),
+ m_dwMsgFormat(DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE)
{
}
@@ -48,69 +48,69 @@ CPropPageFrame::~CPropPageFrame()
void CPropPageFrame::ShowCaption(BOOL bEnable)
{
- m_bShowCaption = bEnable;
- SafeUpdateWindow(CalcCaptionArea());
+ m_bShowCaption = bEnable;
+ SafeUpdateWindow(CalcCaptionArea());
}
BOOL CPropPageFrame::GetShowCaption() const
{
- return m_bShowCaption;
+ return m_bShowCaption;
}
void CPropPageFrame::SetCaption(LPCTSTR lpszCaption, HICON hIcon /*= NULL*/)
{
- m_strCaption = lpszCaption;
- m_hCaptionIcon = hIcon;
- SafeUpdateWindow(CalcCaptionArea());
+ m_strCaption = lpszCaption;
+ m_hCaptionIcon = hIcon;
+ SafeUpdateWindow(CalcCaptionArea());
}
CString CPropPageFrame::GetCaption(HICON *pIcon /* = NULL */) const
{
- if (pIcon)
- *pIcon = m_hCaptionIcon;
- return m_strCaption;
+ if(pIcon)
+ *pIcon = m_hCaptionIcon;
+ return m_strCaption;
}
void CPropPageFrame::SetCaptionHeight(int nCaptionHeight)
{
- m_nCaptionHeight = nCaptionHeight;
- SafeUpdateWindow(CalcCaptionArea());
+ m_nCaptionHeight = nCaptionHeight;
+ SafeUpdateWindow(CalcCaptionArea());
}
int CPropPageFrame::GetCaptionHeight() const
{
- return m_nCaptionHeight;
+ return m_nCaptionHeight;
}
void CPropPageFrame::SetMsgText(LPCTSTR lpszMsg)
{
- m_strMsg = lpszMsg;
- SafeUpdateWindow(CalcMsgArea());
+ m_strMsg = lpszMsg;
+ SafeUpdateWindow(CalcMsgArea());
}
CString CPropPageFrame::GetMsgText() const
{
- return m_strMsg;
+ return m_strMsg;
}
void CPropPageFrame::SetMsgFormat(DWORD dwFormat)
{
- m_dwMsgFormat = dwFormat;
- SafeUpdateWindow(CalcMsgArea());
+ m_dwMsgFormat = dwFormat;
+ SafeUpdateWindow(CalcMsgArea());
}
DWORD CPropPageFrame::GetMsgFormat() const
{
- return m_dwMsgFormat;
+ return m_dwMsgFormat;
}
@@ -119,55 +119,55 @@ DWORD CPropPageFrame::GetMsgFormat() const
void CPropPageFrame::Draw(CDC *pDc)
{
- if (GetShowCaption())
- DrawCaption(pDc, CalcCaptionArea(), m_strCaption, m_hCaptionIcon);
- DrawMsg(pDc, CalcMsgArea(), m_strMsg, m_dwMsgFormat);
+ if(GetShowCaption())
+ DrawCaption(pDc, CalcCaptionArea(), m_strCaption, m_hCaptionIcon);
+ DrawMsg(pDc, CalcMsgArea(), m_strMsg, m_dwMsgFormat);
}
CRect CPropPageFrame::CalcMsgArea()
{
- ASSERT(IsWindow(GetWnd()->GetSafeHwnd()));
+ ASSERT(IsWindow(GetWnd()->GetSafeHwnd()));
- CRect rectMsg;
- GetWnd()->GetClientRect(rectMsg);
- if (GetShowCaption())
- rectMsg.top+= GetCaptionHeight();
+ CRect rectMsg;
+ GetWnd()->GetClientRect(rectMsg);
+ if(GetShowCaption())
+ rectMsg.top += GetCaptionHeight();
- return rectMsg;
+ return rectMsg;
}
-void CPropPageFrame::DrawMsg(CDC *pDc, CRect rect, LPCTSTR lpszMsg, DWORD dwFormat)
+void CPropPageFrame::DrawMsg(CDC *pDc, CRect rect, LPCTSTR lpszMsg, DWORD dwFormat)
{
- CFont *pPrevFont = dynamic_cast<CFont*>(pDc->SelectStockObject(DEFAULT_GUI_FONT));
- int nPrevBkMode = pDc->SetBkMode(TRANSPARENT);
+ CFont *pPrevFont = dynamic_cast<CFont*>(pDc->SelectStockObject(DEFAULT_GUI_FONT));
+ int nPrevBkMode = pDc->SetBkMode(TRANSPARENT);
- pDc->DrawText(GetMsgText(), rect, GetMsgFormat());
+ pDc->DrawText(GetMsgText(), rect, GetMsgFormat());
- pDc->SetBkMode(nPrevBkMode);
- pDc->SelectObject(pPrevFont);
+ pDc->SetBkMode(nPrevBkMode);
+ pDc->SelectObject(pPrevFont);
}
CRect CPropPageFrame::CalcCaptionArea()
{
- ASSERT(IsWindow(GetWnd()->GetSafeHwnd()));
+ ASSERT(IsWindow(GetWnd()->GetSafeHwnd()));
- CRect rectCaption;
- GetWnd()->GetClientRect(rectCaption);
- if (!GetShowCaption())
- rectCaption.bottom = rectCaption.top;
- else
- rectCaption.bottom = rectCaption.top+GetCaptionHeight();
+ CRect rectCaption;
+ GetWnd()->GetClientRect(rectCaption);
+ if(!GetShowCaption())
+ rectCaption.bottom = rectCaption.top;
+ else
+ rectCaption.bottom = rectCaption.top + GetCaptionHeight();
- return rectCaption;
+ return rectCaption;
}
-void CPropPageFrame::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon)
+void CPropPageFrame::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon)
{
- // should be implemented by specialized classes
+ // should be implemented by specialized classes
}
@@ -176,10 +176,10 @@ void CPropPageFrame::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICO
void CPropPageFrame::SafeUpdateWindow(LPCRECT lpRect /* = NULL */)
{
- if (!IsWindow(GetWnd()->GetSafeHwnd()))
- return;
+ if(!IsWindow(GetWnd()->GetSafeHwnd()))
+ return;
- GetWnd()->InvalidateRect(lpRect, TRUE);
+ GetWnd()->InvalidateRect(lpRect, TRUE);
}
diff --git a/src/ui/TreePropSheet/PropPageFrame.h b/src/ui/TreePropSheet/PropPageFrame.h
index 9c8c63f5d..af284e64f 100644
--- a/src/ui/TreePropSheet/PropPageFrame.h
+++ b/src/ui/TreePropSheet/PropPageFrame.h
@@ -31,21 +31,21 @@ namespace TreePropSheet
/**
-An object of an CPropertyPageFrame-derived class is used by
+An object of an CPropertyPageFrame-derived class is used by
CTreePropSheet to display a frame for the property pages.
-Derived classes have to implement at least the Create() and the
+Derived classes have to implement at least the Create() and the
GetWnd() method, which
returns a pointer to the CWnd-obect of the window, that has been
created by the call to the Create() method. An implementation can
provide the CWnd-object by using it as a property or by deriving
-from CWnd or a more specialiced class. This way has been choosen
+from CWnd or a more specialiced class. This way has been choosen
instead of deriving CPropPageFrame from CWnd, to allow derived class
-to derive from more specialized classes than CWnd
+to derive from more specialized classes than CWnd
(i.e. CStatic, etc.). From the WM_PAINT-handler of your derived class
you have to call the Draw()-method.
-Most implementations will also implement the DrawCaption() and
+Most implementations will also implement the DrawCaption() and
DrawMsg() methods, to provide custom drawing functionality.
@author Sven Wiegand
@@ -54,244 +54,244 @@ class /*AFX_EXT_CLASS*/ CPropPageFrame
{
// Construction/Destruction
public:
- CPropPageFrame();
- virtual ~CPropPageFrame();
+ CPropPageFrame();
+ virtual ~CPropPageFrame();
// Operations
public:
- /**
- Has to create a window with the specified properties.
-
- @param dwWindowStyle
- Standard window styles, to apply to the window to create.
- @param rect
- Position and size of the window to create.
- @param pwndParent
- Parent window. (Never be NULL).
- @param nID
- Window id.
-
- @return
- TRUE on success, FALSE otherwise.
- */
- virtual BOOL Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID) = 0;
-
- /**
- Returns a pointer to the window object, that represents the frame.
- */
- virtual CWnd* GetWnd() = 0;
-
- /**
- Enables or disables page caption.
-
- This default implementation calls the SafeUpdateWindow() method
- with the caption rectangle, to force it to be redrawn.
- */
- virtual void ShowCaption(BOOL bEnable);
-
- /**
- Returns TRUE if captions are enabled, FALSE otherwise.
- */
- BOOL GetShowCaption() const;
-
- /**
- Sets the height of the caption in pixels. This value is ignored
- until the caption is enabled by ShowCaption(TRUE).
-
- This default implementation calls the SafeUpdateWindow() method
- with the caption rectangle, to force it to be redrawn.
- */
- virtual void SetCaptionHeight(int nCaptionHeight);
-
- /**
- Returns the caption height, that has been most recently set by a
- call to the SetCaptionHeight() method.
- */
- int GetCaptionHeight() const;
-
- /**
- Sets caption text an icon.
-
- This default implementation calls the SafeUpdateWindow() method
- with the caption rectangle, to force it to be redrawn.
-
- @param lpszCaption
- Text to display for the caption.
- @param hIcon
- Icon to display for the caption.
- */
- virtual void SetCaption(LPCTSTR lpszCaption, HICON hIcon = NULL);
-
- /**
- Returns the caption, that has been set most recently using the
- SetCaption() method.
-
- @param pIcon
- Pointer to a HICON variable, that should receive the handle of
- the currently set icon or NULL, if there is no icon or a NULL
- pointer, if the caller is not interested in the icon.
-
- @return
- The text that has been set most recently using the SetCaption()
- method.
- */
- CString GetCaption(HICON *pIcon = NULL) const;
-
- /**
- Sets the text to display.
-
- This default implementation calls the SafeUpdateWindow() method
- with the message rectangle, to force it to be redrawn.
- */
- virtual void SetMsgText(LPCTSTR lpszMsg);
-
- /**
- Returns the text currently displayed.
- */
- CString GetMsgText() const;
-
- /**
- Specifies the format to draw the text with, set by SetMsgText().
-
- This default implementation calls the SafeUpdateWindow() method
- with the message rectangle, to force it to be redrawn.
-
- @param dwFormat
- Combination of the DT_* flags, specified by the Win32 function
- DrawText().
- */
- virtual void SetMsgFormat(DWORD dwFormat);
-
- /**
- Returns the format to draw the text with, set by SetMsgText().
-
- @see SetMsgFormat()
- */
- DWORD GetMsgFormat() const;
+ /**
+ Has to create a window with the specified properties.
+
+ @param dwWindowStyle
+ Standard window styles, to apply to the window to create.
+ @param rect
+ Position and size of the window to create.
+ @param pwndParent
+ Parent window. (Never be NULL).
+ @param nID
+ Window id.
+
+ @return
+ TRUE on success, FALSE otherwise.
+ */
+ virtual BOOL Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID) = 0;
+
+ /**
+ Returns a pointer to the window object, that represents the frame.
+ */
+ virtual CWnd* GetWnd() = 0;
+
+ /**
+ Enables or disables page caption.
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the caption rectangle, to force it to be redrawn.
+ */
+ virtual void ShowCaption(BOOL bEnable);
+
+ /**
+ Returns TRUE if captions are enabled, FALSE otherwise.
+ */
+ BOOL GetShowCaption() const;
+
+ /**
+ Sets the height of the caption in pixels. This value is ignored
+ until the caption is enabled by ShowCaption(TRUE).
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the caption rectangle, to force it to be redrawn.
+ */
+ virtual void SetCaptionHeight(int nCaptionHeight);
+
+ /**
+ Returns the caption height, that has been most recently set by a
+ call to the SetCaptionHeight() method.
+ */
+ int GetCaptionHeight() const;
+
+ /**
+ Sets caption text an icon.
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the caption rectangle, to force it to be redrawn.
+
+ @param lpszCaption
+ Text to display for the caption.
+ @param hIcon
+ Icon to display for the caption.
+ */
+ virtual void SetCaption(LPCTSTR lpszCaption, HICON hIcon = NULL);
+
+ /**
+ Returns the caption, that has been set most recently using the
+ SetCaption() method.
+
+ @param pIcon
+ Pointer to a HICON variable, that should receive the handle of
+ the currently set icon or NULL, if there is no icon or a NULL
+ pointer, if the caller is not interested in the icon.
+
+ @return
+ The text that has been set most recently using the SetCaption()
+ method.
+ */
+ CString GetCaption(HICON *pIcon = NULL) const;
+
+ /**
+ Sets the text to display.
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the message rectangle, to force it to be redrawn.
+ */
+ virtual void SetMsgText(LPCTSTR lpszMsg);
+
+ /**
+ Returns the text currently displayed.
+ */
+ CString GetMsgText() const;
+
+ /**
+ Specifies the format to draw the text with, set by SetMsgText().
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the message rectangle, to force it to be redrawn.
+
+ @param dwFormat
+ Combination of the DT_* flags, specified by the Win32 function
+ DrawText().
+ */
+ virtual void SetMsgFormat(DWORD dwFormat);
+
+ /**
+ Returns the format to draw the text with, set by SetMsgText().
+
+ @see SetMsgFormat()
+ */
+ DWORD GetMsgFormat() const;
// Overridable implementation helpers
protected:
- /**
- Draws the whole frame including caption (if enabled) and message.
-
- This method calculates the rectangles for the message area and
- the caption area using the CalcMsgArea() and the CalcCaptionArea()
- methods, draws then the caption calling the DrawCaption() method
- (only if caption is enabled) and afterwards the message calling
- the DrawMsg() method.
-
- You should call this method from the WM_PAINT-handler of your
- derived class.
-
- @param pDc
- Device context to draw in.
- */
- virtual void Draw(CDC *pDc);
-
- /**
- Calculates the area, the message, set by SetMsgText() should be
- displayed in. The returned rectangle (client coordinates) will be
- passed to DrawMsg().
-
- This default implementation calls the CalcCaptionArea() method,
- substracts the returned rectangle from the client area and returns
- the result.
- */
- virtual CRect CalcMsgArea();
-
- /**
- Draws the message with the specified format.
-
- This default implementation draws the given msg using the specified
- properties.
-
- @param pDc
- Device context to draw in.
- @param rect
- Rectangle to draw the message in.
- @param lpszMsg
- Message to draw.
- @param dwFormat.
- Combination of the DT_* flags, specified by the Win32 function
- DrawText() to draw the message with.
- */
- virtual void DrawMsg(CDC *pDc, CRect rect, LPCTSTR lpszMsg, DWORD dwFormat);
-
- /**
- Calculates the caption area. The caption area is the rectangular
- range, the current page's caption should be drawn in.
-
- The caption can be enabled or disabled using the ShowCaption()
- method. This method should return an empty rect, if the caption
- is disabled. If the caption is enabled the height of the rect
- should be as large, as specified by the latest call to the
- SetCaptionHeight() method.
-
- The rectangle, returned by this method will be passed to the
- DrawCaption() method to draw the caption.
-
- If the caption is enabled currently, this default implementation
- returns a rectangle, that has the width of the client area and
- the height, specified by the latest call to SetCaptionHeight(),
- starting and y-position 0. If the caption is disabled at the
- moment, this method returns an empty rectangle with the width of
- the client area.
- */
- virtual CRect CalcCaptionArea();
-
- /**
- Draws the caption.
-
- This default implementation draws nothing.
-
- @param pDc
- Device context to draw in.
- @param rect
- Rectangle to draw the caption in.
- @param lpszCaption
- Text to display in the caption.
- @param hIcon
- Icon to display in the caption.
- */
- virtual void DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon);
+ /**
+ Draws the whole frame including caption (if enabled) and message.
+
+ This method calculates the rectangles for the message area and
+ the caption area using the CalcMsgArea() and the CalcCaptionArea()
+ methods, draws then the caption calling the DrawCaption() method
+ (only if caption is enabled) and afterwards the message calling
+ the DrawMsg() method.
+
+ You should call this method from the WM_PAINT-handler of your
+ derived class.
+
+ @param pDc
+ Device context to draw in.
+ */
+ virtual void Draw(CDC *pDc);
+
+ /**
+ Calculates the area, the message, set by SetMsgText() should be
+ displayed in. The returned rectangle (client coordinates) will be
+ passed to DrawMsg().
+
+ This default implementation calls the CalcCaptionArea() method,
+ substracts the returned rectangle from the client area and returns
+ the result.
+ */
+ virtual CRect CalcMsgArea();
+
+ /**
+ Draws the message with the specified format.
+
+ This default implementation draws the given msg using the specified
+ properties.
+
+ @param pDc
+ Device context to draw in.
+ @param rect
+ Rectangle to draw the message in.
+ @param lpszMsg
+ Message to draw.
+ @param dwFormat.
+ Combination of the DT_* flags, specified by the Win32 function
+ DrawText() to draw the message with.
+ */
+ virtual void DrawMsg(CDC *pDc, CRect rect, LPCTSTR lpszMsg, DWORD dwFormat);
+
+ /**
+ Calculates the caption area. The caption area is the rectangular
+ range, the current page's caption should be drawn in.
+
+ The caption can be enabled or disabled using the ShowCaption()
+ method. This method should return an empty rect, if the caption
+ is disabled. If the caption is enabled the height of the rect
+ should be as large, as specified by the latest call to the
+ SetCaptionHeight() method.
+
+ The rectangle, returned by this method will be passed to the
+ DrawCaption() method to draw the caption.
+
+ If the caption is enabled currently, this default implementation
+ returns a rectangle, that has the width of the client area and
+ the height, specified by the latest call to SetCaptionHeight(),
+ starting and y-position 0. If the caption is disabled at the
+ moment, this method returns an empty rectangle with the width of
+ the client area.
+ */
+ virtual CRect CalcCaptionArea();
+
+ /**
+ Draws the caption.
+
+ This default implementation draws nothing.
+
+ @param pDc
+ Device context to draw in.
+ @param rect
+ Rectangle to draw the caption in.
+ @param lpszCaption
+ Text to display in the caption.
+ @param hIcon
+ Icon to display in the caption.
+ */
+ virtual void DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon);
// Implementation helpers
protected:
- /**
- If the m_hWnd property of the CWnd-object returend by GetWnd()
- specifies a valid window, this method will invalidate the specified
- rectangle, to schedule it for repaint, otherwise the method will
- return without doing anything.
-
- @param lpRect
- Pointer to the rectangular area, that should be marked for
- repainting or NULL, if the whole client area should be marked
- for repainting.
- */
- void SafeUpdateWindow(LPCRECT lpRect = NULL);
+ /**
+ If the m_hWnd property of the CWnd-object returend by GetWnd()
+ specifies a valid window, this method will invalidate the specified
+ rectangle, to schedule it for repaint, otherwise the method will
+ return without doing anything.
+
+ @param lpRect
+ Pointer to the rectangular area, that should be marked for
+ repainting or NULL, if the whole client area should be marked
+ for repainting.
+ */
+ void SafeUpdateWindow(LPCRECT lpRect = NULL);
// Properties
private:
- /** TRUE if the caption should be drawn, FALSE otherwise. */
- BOOL m_bShowCaption;
-
- /** Height of the caption in pixels, if it is enabled. */
- int m_nCaptionHeight;
-
- /** Text to display in the caption. */
- CString m_strCaption;
-
- /**
- Icon to display in the caption or NULL if no icon should be
- displayed.
- */
- HICON m_hCaptionIcon;
-
- /** Message text to display. */
- CString m_strMsg;
-
- /** Style to use when drawing the message text m_strMsg. */
- DWORD m_dwMsgFormat;
+ /** TRUE if the caption should be drawn, FALSE otherwise. */
+ BOOL m_bShowCaption;
+
+ /** Height of the caption in pixels, if it is enabled. */
+ int m_nCaptionHeight;
+
+ /** Text to display in the caption. */
+ CString m_strCaption;
+
+ /**
+ Icon to display in the caption or NULL if no icon should be
+ displayed.
+ */
+ HICON m_hCaptionIcon;
+
+ /** Message text to display. */
+ CString m_strMsg;
+
+ /** Style to use when drawing the message text m_strMsg. */
+ DWORD m_dwMsgFormat;
};
diff --git a/src/ui/TreePropSheet/PropPageFrameDefault.cpp b/src/ui/TreePropSheet/PropPageFrameDefault.cpp
index a0da46b5d..07ed52c5c 100644
--- a/src/ui/TreePropSheet/PropPageFrameDefault.cpp
+++ b/src/ui/TreePropSheet/PropPageFrameDefault.cpp
@@ -43,19 +43,22 @@ namespace TreePropSheet
#define THEMEAPIPTR(f) _##f m_p##f
#ifdef XPSUPPORT
- #define THEMECALL(f) return (*m_p##f)
- #define GETTHEMECALL(f) m_p##f = (_##f)GetProcAddress(m_hThemeLib, #f)
+#define THEMECALL(f) return (*m_p##f)
+#define GETTHEMECALL(f) m_p##f = (_##f)GetProcAddress(m_hThemeLib, #f)
#else
- void ThemeDummy(...) {ASSERT(FALSE);}
- #define HTHEME void*
- #define TABP_PANE 0
- #define THEMECALL(f) return 0; ThemeDummy
- #define GETTHEMECALL(f) m_p##f = NULL
+void ThemeDummy(...)
+{
+ ASSERT(FALSE);
+}
+#define HTHEME void*
+#define TABP_PANE 0
+#define THEMECALL(f) return 0; ThemeDummy
+#define GETTHEMECALL(f) m_p##f = NULL
#endif
/**
-Helper class for loading the uxtheme DLL and providing their
+Helper class for loading the uxtheme DLL and providing their
functions.
One global object of this class exists.
@@ -66,56 +69,66 @@ class CThemeLib
{
// construction/destruction
public:
- CThemeLib();
- ~CThemeLib();
+ CThemeLib();
+ ~CThemeLib();
// operations
public:
- /**
- Returns TRUE if the call wrappers are available, FALSE otherwise.
- */
- BOOL IsAvailable() const;
+ /**
+ Returns TRUE if the call wrappers are available, FALSE otherwise.
+ */
+ BOOL IsAvailable() const;
// call wrappers
public:
- BOOL IsThemeActive() const
- {THEMECALL(IsThemeActive)();}
-
- HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList) const
- {THEMECALL(OpenThemeData)(hwnd, pszClassList);}
-
- HRESULT CloseThemeData(HTHEME hTheme) const
- {THEMECALL(CloseThemeData)(hTheme);}
-
- HRESULT GetThemeBackgroundContentRect(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, OUT RECT *pContentRect) const
- {THEMECALL(GetThemeBackgroundContentRect)(hTheme, hdc, iPartId, iStateId, pBoundingRect, pContentRect);}
-
- HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect) const
- {THEMECALL(DrawThemeBackground)(hTheme, hdc, iPartId, iStateId, pRect, pClipRect);}
+ BOOL IsThemeActive() const
+ {
+ THEMECALL(IsThemeActive)();
+ }
+
+ HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList) const
+ {
+ THEMECALL(OpenThemeData)(hwnd, pszClassList);
+ }
+
+ HRESULT CloseThemeData(HTHEME hTheme) const
+ {
+ THEMECALL(CloseThemeData)(hTheme);
+ }
+
+ HRESULT GetThemeBackgroundContentRect(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, OUT RECT *pContentRect) const
+ {
+ THEMECALL(GetThemeBackgroundContentRect)(hTheme, hdc, iPartId, iStateId, pBoundingRect, pContentRect);
+ }
+
+ HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect) const
+ {
+ THEMECALL(DrawThemeBackground)(hTheme, hdc, iPartId, iStateId, pRect, pClipRect);
+ }
// function pointers
private:
#ifdef XPSUPPORT
- THEMEAPITYPE_(BOOL, IsThemeActive)();
- THEMEAPIPTR(IsThemeActive);
+ THEMEAPITYPE_(BOOL, IsThemeActive)();
+ THEMEAPIPTR(IsThemeActive);
- THEMEAPITYPE_(HTHEME, OpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
- THEMEAPIPTR(OpenThemeData);
+ THEMEAPITYPE_(HTHEME, OpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
+ THEMEAPIPTR(OpenThemeData);
- THEMEAPITYPE(CloseThemeData)(HTHEME hTheme);
- THEMEAPIPTR(CloseThemeData);
+ THEMEAPITYPE(CloseThemeData)(HTHEME hTheme);
+ THEMEAPIPTR(CloseThemeData);
- THEMEAPITYPE(GetThemeBackgroundContentRect)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, OUT RECT *pContentRect);
- THEMEAPIPTR(GetThemeBackgroundContentRect);
+ THEMEAPITYPE(GetThemeBackgroundContentRect)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, OUT RECT *pContentRect);
+ THEMEAPIPTR(GetThemeBackgroundContentRect);
- THEMEAPITYPE(DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
- THEMEAPIPTR(DrawThemeBackground);
+ THEMEAPITYPE(DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
+ THEMEAPIPTR(DrawThemeBackground);
#endif
// properties
private:
- /** instance handle to the library or NULL. */
- HINSTANCE m_hThemeLib;
+ /** instance handle to the library or NULL. */
+ HINSTANCE m_hThemeLib;
};
/**
@@ -125,32 +138,32 @@ static CThemeLib g_ThemeLib;
CThemeLib::CThemeLib()
-: m_hThemeLib(NULL)
+ : m_hThemeLib(NULL)
{
#ifdef XPSUPPORT
- m_hThemeLib = LoadLibrary(_T("uxtheme.dll"));
- if (!m_hThemeLib)
- return;
-
- GETTHEMECALL(IsThemeActive);
- GETTHEMECALL(OpenThemeData);
- GETTHEMECALL(CloseThemeData);
- GETTHEMECALL(GetThemeBackgroundContentRect);
- GETTHEMECALL(DrawThemeBackground);
+ m_hThemeLib = LoadLibrary(_T("uxtheme.dll"));
+ if(!m_hThemeLib)
+ return;
+
+ GETTHEMECALL(IsThemeActive);
+ GETTHEMECALL(OpenThemeData);
+ GETTHEMECALL(CloseThemeData);
+ GETTHEMECALL(GetThemeBackgroundContentRect);
+ GETTHEMECALL(DrawThemeBackground);
#endif
}
CThemeLib::~CThemeLib()
{
- if (m_hThemeLib)
- FreeLibrary(m_hThemeLib);
+ if(m_hThemeLib)
+ FreeLibrary(m_hThemeLib);
}
BOOL CThemeLib::IsAvailable() const
{
- return m_hThemeLib!=NULL;
+ return m_hThemeLib != NULL;
}
@@ -159,10 +172,10 @@ BOOL CThemeLib::IsAvailable() const
//-------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CPropPageFrameDefault, CWnd)
- //{{AFX_MSG_MAP(CPropPageFrameDefault)
- ON_WM_PAINT()
- ON_WM_ERASEBKGND()
- //}}AFX_MSG_MAP
+ //{{AFX_MSG_MAP(CPropPageFrameDefault)
+ ON_WM_PAINT()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -173,8 +186,8 @@ CPropPageFrameDefault::CPropPageFrameDefault()
CPropPageFrameDefault::~CPropPageFrameDefault()
{
- if (m_Images.GetSafeHandle())
- m_Images.DeleteImageList();
+ if(m_Images.GetSafeHandle())
+ m_Images.DeleteImageList();
}
@@ -183,144 +196,144 @@ CPropPageFrameDefault::~CPropPageFrameDefault()
BOOL CPropPageFrameDefault::Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID)
{
- return CWnd::Create(
- AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW, AfxGetApp()->LoadStandardCursor(IDC_ARROW), GetSysColorBrush(COLOR_3DFACE)),
- _T("Page Frame"),
- dwWindowStyle, rect, pwndParent, nID);
+ return CWnd::Create(
+ AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, AfxGetApp()->LoadStandardCursor(IDC_ARROW), GetSysColorBrush(COLOR_3DFACE)),
+ _T("Page Frame"),
+ dwWindowStyle, rect, pwndParent, nID);
}
CWnd* CPropPageFrameDefault::GetWnd()
{
- return static_cast<CWnd*>(this);
+ return static_cast<CWnd*>(this);
}
void CPropPageFrameDefault::SetCaption(LPCTSTR lpszCaption, HICON hIcon /*= NULL*/)
{
- CPropPageFrame::SetCaption(lpszCaption, hIcon);
-
- // build image list
- if (m_Images.GetSafeHandle())
- m_Images.DeleteImageList();
- if (hIcon)
- {
- ICONINFO ii;
- if (!GetIconInfo(hIcon, &ii))
- return;
-
- CBitmap bmMask;
- bmMask.Attach(ii.hbmMask);
- if (ii.hbmColor) DeleteObject(ii.hbmColor);
-
- BITMAP bm;
- bmMask.GetBitmap(&bm);
-
- if (!m_Images.Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32|ILC_MASK, 0, 1))
- return;
-
- if (m_Images.Add(hIcon) == -1)
- m_Images.DeleteImageList();
- }
+ CPropPageFrame::SetCaption(lpszCaption, hIcon);
+
+ // build image list
+ if(m_Images.GetSafeHandle())
+ m_Images.DeleteImageList();
+ if(hIcon)
+ {
+ ICONINFO ii;
+ if(!GetIconInfo(hIcon, &ii))
+ return;
+
+ CBitmap bmMask;
+ bmMask.Attach(ii.hbmMask);
+ if(ii.hbmColor) DeleteObject(ii.hbmColor);
+
+ BITMAP bm;
+ bmMask.GetBitmap(&bm);
+
+ if(!m_Images.Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32 | ILC_MASK, 0, 1))
+ return;
+
+ if(m_Images.Add(hIcon) == -1)
+ m_Images.DeleteImageList();
+ }
}
CRect CPropPageFrameDefault::CalcMsgArea()
{
- CRect rect;
- GetClientRect(rect);
- if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
- {
- HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
- if (hTheme)
- {
- CRect rectContent;
- CDC *pDc = GetDC();
- g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent);
- ReleaseDC(pDc);
- g_ThemeLib.CloseThemeData(hTheme);
-
- if (GetShowCaption())
- rectContent.top = rect.top+GetCaptionHeight()+1;
- rect = rectContent;
- }
- }
- else if (GetShowCaption())
- rect.top+= GetCaptionHeight()+1;
-
- return rect;
+ CRect rect;
+ GetClientRect(rect);
+ if(g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
+ {
+ HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
+ if(hTheme)
+ {
+ CRect rectContent;
+ CDC *pDc = GetDC();
+ g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent);
+ ReleaseDC(pDc);
+ g_ThemeLib.CloseThemeData(hTheme);
+
+ if(GetShowCaption())
+ rectContent.top = rect.top + GetCaptionHeight() + 1;
+ rect = rectContent;
+ }
+ }
+ else if(GetShowCaption())
+ rect.top += GetCaptionHeight() + 1;
+
+ return rect;
}
CRect CPropPageFrameDefault::CalcCaptionArea()
{
- CRect rect;
- GetClientRect(rect);
- if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
- {
- HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
- if (hTheme)
- {
- CRect rectContent;
- CDC *pDc = GetDC();
- g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent);
- ReleaseDC(pDc);
- g_ThemeLib.CloseThemeData(hTheme);
-
- if (GetShowCaption())
- rectContent.bottom = rect.top+GetCaptionHeight();
- else
- rectContent.bottom = rectContent.top;
-
- rect = rectContent;
- }
- }
- else
- {
- if (GetShowCaption())
- rect.bottom = rect.top+GetCaptionHeight();
- else
- rect.bottom = rect.top;
- }
-
- return rect;
+ CRect rect;
+ GetClientRect(rect);
+ if(g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
+ {
+ HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
+ if(hTheme)
+ {
+ CRect rectContent;
+ CDC *pDc = GetDC();
+ g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent);
+ ReleaseDC(pDc);
+ g_ThemeLib.CloseThemeData(hTheme);
+
+ if(GetShowCaption())
+ rectContent.bottom = rect.top + GetCaptionHeight();
+ else
+ rectContent.bottom = rectContent.top;
+
+ rect = rectContent;
+ }
+ }
+ else
+ {
+ if(GetShowCaption())
+ rect.bottom = rect.top + GetCaptionHeight();
+ else
+ rect.bottom = rect.top;
+ }
+
+ return rect;
}
void CPropPageFrameDefault::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon)
{
- COLORREF clrLeft = GetSysColor(COLOR_INACTIVECAPTION);
- COLORREF clrRight = pDc->GetPixel(rect.right-1, rect.top);
- FillGradientRectH(pDc, rect, clrLeft, clrRight);
-
- // draw icon
- if (hIcon && m_Images.GetSafeHandle() && m_Images.GetImageCount() == 1)
- {
- IMAGEINFO ii;
- m_Images.GetImageInfo(0, &ii);
- CPoint pt(3, rect.CenterPoint().y - (ii.rcImage.bottom-ii.rcImage.top)/2);
- m_Images.Draw(pDc, 0, pt, ILD_TRANSPARENT);
- rect.left+= (ii.rcImage.right-ii.rcImage.left) + 3;
- }
-
- // draw text
- rect.left+= 2;
-
- COLORREF clrPrev = pDc->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT));
- int nBkStyle = pDc->SetBkMode(TRANSPARENT);
- CFont *pFont = (CFont*)pDc->SelectStockObject(SYSTEM_FONT);
-
- CFont* pSysFont = pDc->GetCurrentFont();
- LOGFONT lf;
- pSysFont->GetLogFont(&lf);
- lf.lfHeight = rect.Height();
- lf.lfWidth = 0;
- _tcscpy(lf.lfFaceName, _T("Arial"));
- CFont f;
- f.CreateFontIndirect(&lf);
- pDc->SelectObject(&f);
-
- pDc->DrawText(lpszCaption, rect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
-
- pDc->SetTextColor(clrPrev);
- pDc->SetBkMode(nBkStyle);
- pDc->SelectObject(pFont);
+ COLORREF clrLeft = GetSysColor(COLOR_INACTIVECAPTION);
+ COLORREF clrRight = pDc->GetPixel(rect.right - 1, rect.top);
+ FillGradientRectH(pDc, rect, clrLeft, clrRight);
+
+ // draw icon
+ if(hIcon && m_Images.GetSafeHandle() && m_Images.GetImageCount() == 1)
+ {
+ IMAGEINFO ii;
+ m_Images.GetImageInfo(0, &ii);
+ CPoint pt(3, rect.CenterPoint().y - (ii.rcImage.bottom - ii.rcImage.top) / 2);
+ m_Images.Draw(pDc, 0, pt, ILD_TRANSPARENT);
+ rect.left += (ii.rcImage.right - ii.rcImage.left) + 3;
+ }
+
+ // draw text
+ rect.left += 2;
+
+ COLORREF clrPrev = pDc->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT));
+ int nBkStyle = pDc->SetBkMode(TRANSPARENT);
+ CFont *pFont = (CFont*)pDc->SelectStockObject(SYSTEM_FONT);
+
+ CFont* pSysFont = pDc->GetCurrentFont();
+ LOGFONT lf;
+ pSysFont->GetLogFont(&lf);
+ lf.lfHeight = rect.Height();
+ lf.lfWidth = 0;
+ _tcscpy(lf.lfFaceName, _T("Arial"));
+ CFont f;
+ f.CreateFontIndirect(&lf);
+ pDc->SelectObject(&f);
+
+ pDc->DrawText(lpszCaption, rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+
+ pDc->SetTextColor(clrPrev);
+ pDc->SetBkMode(nBkStyle);
+ pDc->SelectObject(pFont);
}
@@ -329,65 +342,65 @@ void CPropPageFrameDefault::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaptio
void CPropPageFrameDefault::FillGradientRectH(CDC *pDc, const RECT &rect, COLORREF clrLeft, COLORREF clrRight)
{
- // pre calculation
- int nSteps = rect.right-rect.left;
- int nRRange = GetRValue(clrRight)-GetRValue(clrLeft);
- int nGRange = GetGValue(clrRight)-GetGValue(clrLeft);
- int nBRange = GetBValue(clrRight)-GetBValue(clrLeft);
-
- double dRStep = (double)nRRange/(double)nSteps;
- double dGStep = (double)nGRange/(double)nSteps;
- double dBStep = (double)nBRange/(double)nSteps;
-
- double dR = (double)GetRValue(clrLeft);
- double dG = (double)GetGValue(clrLeft);
- double dB = (double)GetBValue(clrLeft);
-
- CPen *pPrevPen = NULL;
- for (int x = rect.left; x <= rect.right; ++x)
- {
- CPen Pen(PS_SOLID, 1, RGB((BYTE)dR, (BYTE)dG, (BYTE)dB));
- pPrevPen = pDc->SelectObject(&Pen);
- pDc->MoveTo(x, rect.top);
- pDc->LineTo(x, rect.bottom);
- pDc->SelectObject(pPrevPen);
-
- dR+= dRStep;
- dG+= dGStep;
- dB+= dBStep;
- }
+ // pre calculation
+ int nSteps = rect.right - rect.left;
+ int nRRange = GetRValue(clrRight) - GetRValue(clrLeft);
+ int nGRange = GetGValue(clrRight) - GetGValue(clrLeft);
+ int nBRange = GetBValue(clrRight) - GetBValue(clrLeft);
+
+ double dRStep = (double)nRRange / (double)nSteps;
+ double dGStep = (double)nGRange / (double)nSteps;
+ double dBStep = (double)nBRange / (double)nSteps;
+
+ double dR = (double)GetRValue(clrLeft);
+ double dG = (double)GetGValue(clrLeft);
+ double dB = (double)GetBValue(clrLeft);
+
+ CPen *pPrevPen = NULL;
+ for(int x = rect.left; x <= rect.right; ++x)
+ {
+ CPen Pen(PS_SOLID, 1, RGB((BYTE)dR, (BYTE)dG, (BYTE)dB));
+ pPrevPen = pDc->SelectObject(&Pen);
+ pDc->MoveTo(x, rect.top);
+ pDc->LineTo(x, rect.bottom);
+ pDc->SelectObject(pPrevPen);
+
+ dR += dRStep;
+ dG += dGStep;
+ dB += dBStep;
+ }
}
/////////////////////////////////////////////////////////////////////
// message handlers
-void CPropPageFrameDefault::OnPaint()
+void CPropPageFrameDefault::OnPaint()
{
- CPaintDC dc(this);
- Draw(&dc);
+ CPaintDC dc(this);
+ Draw(&dc);
}
-BOOL CPropPageFrameDefault::OnEraseBkgnd(CDC* pDC)
+BOOL CPropPageFrameDefault::OnEraseBkgnd(CDC* pDC)
{
- if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
- {
- HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
- if (hTheme)
- {
- CRect rect;
- GetClientRect(rect);
- g_ThemeLib.DrawThemeBackground(hTheme, pDC->m_hDC, TABP_PANE, 0, rect, NULL);
-
- g_ThemeLib.CloseThemeData(hTheme);
- }
- return TRUE;
- }
- else
- {
- return CWnd::OnEraseBkgnd(pDC);
- }
+ if(g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
+ {
+ HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
+ if(hTheme)
+ {
+ CRect rect;
+ GetClientRect(rect);
+ g_ThemeLib.DrawThemeBackground(hTheme, pDC->m_hDC, TABP_PANE, 0, rect, NULL);
+
+ g_ThemeLib.CloseThemeData(hTheme);
+ }
+ return TRUE;
+ }
+ else
+ {
+ return CWnd::OnEraseBkgnd(pDC);
+ }
}
} //namespace TreePropSheet
diff --git a/src/ui/TreePropSheet/PropPageFrameDefault.h b/src/ui/TreePropSheet/PropPageFrameDefault.h
index 0e0523151..20c0341e4 100644
--- a/src/ui/TreePropSheet/PropPageFrameDefault.h
+++ b/src/ui/TreePropSheet/PropPageFrameDefault.h
@@ -40,71 +40,71 @@ styled systems and older windows versions (without themes).
@author Sven Wiegand
*/
class /*AFX_EXT_CLASS*/ CPropPageFrameDefault : public CWnd,
- public CPropPageFrame
+ public CPropPageFrame
{
// construction/destruction
public:
- CPropPageFrameDefault();
- virtual ~CPropPageFrameDefault();
+ CPropPageFrameDefault();
+ virtual ~CPropPageFrameDefault();
// operations
public:
// overridings
public:
- virtual BOOL Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID);
- virtual CWnd* GetWnd();
- virtual void SetCaption(LPCTSTR lpszCaption, HICON hIcon = NULL);
+ virtual BOOL Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID);
+ virtual CWnd* GetWnd();
+ virtual void SetCaption(LPCTSTR lpszCaption, HICON hIcon = NULL);
+
-
protected:
- virtual CRect CalcMsgArea();
- virtual CRect CalcCaptionArea();
- virtual void DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon);
+ virtual CRect CalcMsgArea();
+ virtual CRect CalcCaptionArea();
+ virtual void DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon);
// Implementation helpers
protected:
- /**
- Fills a rectangular area with a gradient color starting at the left
- side with the color clrLeft and ending at the right sight with the
- color clrRight.
-
- @param pDc
- Device context to draw the rectangle in.
- @param rect
- Rectangular area to fill.
- @param clrLeft
- Color on the left side.
- @param clrRight
- Color on the right side.
- */
- void FillGradientRectH(CDC *pDc, const RECT &rect, COLORREF clrLeft, COLORREF clrRight);
-
- /**
- Returns TRUE if Windows XP theme support is available, FALSE
- otherwise.
- */
- BOOL ThemeSupport() const;
+ /**
+ Fills a rectangular area with a gradient color starting at the left
+ side with the color clrLeft and ending at the right sight with the
+ color clrRight.
+
+ @param pDc
+ Device context to draw the rectangle in.
+ @param rect
+ Rectangular area to fill.
+ @param clrLeft
+ Color on the left side.
+ @param clrRight
+ Color on the right side.
+ */
+ void FillGradientRectH(CDC *pDc, const RECT &rect, COLORREF clrLeft, COLORREF clrRight);
+
+ /**
+ Returns TRUE if Windows XP theme support is available, FALSE
+ otherwise.
+ */
+ BOOL ThemeSupport() const;
protected:
- //{{AFX_VIRTUAL(CPropPageFrameDefault)
- //}}AFX_VIRTUAL
+ //{{AFX_VIRTUAL(CPropPageFrameDefault)
+ //}}AFX_VIRTUAL
// message handlers
protected:
- //{{AFX_MSG(CPropPageFrameDefault)
- afx_msg void OnPaint();
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
+ //{{AFX_MSG(CPropPageFrameDefault)
+ afx_msg void OnPaint();
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
// attributes
protected:
- /**
- Image list that contains only the current icon or nothing if there
- is no icon.
- */
- CImageList m_Images;
+ /**
+ Image list that contains only the current icon or nothing if there
+ is no icon.
+ */
+ CImageList m_Images;
};
diff --git a/src/ui/TreePropSheet/TreePropSheet.cpp b/src/ui/TreePropSheet/TreePropSheet.cpp
index 687226860..6e1e9f2fc 100644
--- a/src/ui/TreePropSheet/TreePropSheet.cpp
+++ b/src/ui/TreePropSheet/TreePropSheet.cpp
@@ -31,19 +31,19 @@ namespace TreePropSheet
//-------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CTreePropSheet, CPropertySheet)
- //{{AFX_MSG_MAP(CTreePropSheet)
- ON_WM_DESTROY()
- //}}AFX_MSG_MAP
- ON_MESSAGE(PSM_ADDPAGE, OnAddPage)
- ON_MESSAGE(PSM_REMOVEPAGE, OnRemovePage)
- ON_MESSAGE(PSM_SETCURSEL, OnSetCurSel)
- ON_MESSAGE(PSM_SETCURSELID, OnSetCurSelId)
- ON_MESSAGE(PSM_ISDIALOGMESSAGE, OnIsDialogMessage)
-
- ON_NOTIFY(TVN_SELCHANGINGA, s_unPageTreeId, OnPageTreeSelChanging)
- ON_NOTIFY(TVN_SELCHANGINGW, s_unPageTreeId, OnPageTreeSelChanging)
- ON_NOTIFY(TVN_SELCHANGEDA, s_unPageTreeId, OnPageTreeSelChanged)
- ON_NOTIFY(TVN_SELCHANGEDW, s_unPageTreeId, OnPageTreeSelChanged)
+ //{{AFX_MSG_MAP(CTreePropSheet)
+ ON_WM_DESTROY()
+ //}}AFX_MSG_MAP
+ ON_MESSAGE(PSM_ADDPAGE, OnAddPage)
+ ON_MESSAGE(PSM_REMOVEPAGE, OnRemovePage)
+ ON_MESSAGE(PSM_SETCURSEL, OnSetCurSel)
+ ON_MESSAGE(PSM_SETCURSELID, OnSetCurSelId)
+ ON_MESSAGE(PSM_ISDIALOGMESSAGE, OnIsDialogMessage)
+
+ ON_NOTIFY(TVN_SELCHANGINGA, s_unPageTreeId, OnPageTreeSelChanging)
+ ON_NOTIFY(TVN_SELCHANGINGW, s_unPageTreeId, OnPageTreeSelChanging)
+ ON_NOTIFY(TVN_SELCHANGEDA, s_unPageTreeId, OnPageTreeSelChanged)
+ ON_NOTIFY(TVN_SELCHANGEDW, s_unPageTreeId, OnPageTreeSelChanged)
END_MESSAGE_MAP()
IMPLEMENT_DYNAMIC(CTreePropSheet, CPropertySheet)
@@ -51,47 +51,47 @@ IMPLEMENT_DYNAMIC(CTreePropSheet, CPropertySheet)
const UINT CTreePropSheet::s_unPageTreeId = 0x7EEE;
CTreePropSheet::CTreePropSheet()
-: m_bPageTreeSelChangedActive(FALSE),
- m_bTreeViewMode(TRUE),
- m_bPageCaption(FALSE),
- m_bTreeImages(FALSE),
- m_nPageTreeWidth(150),
- m_pwndPageTree(NULL),
- m_pFrame(NULL)
+ : m_bPageTreeSelChangedActive(FALSE),
+ m_bTreeViewMode(TRUE),
+ m_bPageCaption(FALSE),
+ m_bTreeImages(FALSE),
+ m_nPageTreeWidth(150),
+ m_pwndPageTree(NULL),
+ m_pFrame(NULL)
{}
CTreePropSheet::CTreePropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
-: CPropertySheet(nIDCaption, pParentWnd, iSelectPage),
- m_bPageTreeSelChangedActive(FALSE),
- m_bTreeViewMode(TRUE),
- m_bPageCaption(FALSE),
- m_bTreeImages(FALSE),
- m_nPageTreeWidth(150),
- m_pwndPageTree(NULL),
- m_pFrame(NULL)
+ : CPropertySheet(nIDCaption, pParentWnd, iSelectPage),
+ m_bPageTreeSelChangedActive(FALSE),
+ m_bTreeViewMode(TRUE),
+ m_bPageCaption(FALSE),
+ m_bTreeImages(FALSE),
+ m_nPageTreeWidth(150),
+ m_pwndPageTree(NULL),
+ m_pFrame(NULL)
{
}
CTreePropSheet::CTreePropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
-: CPropertySheet(pszCaption, pParentWnd, iSelectPage),
- m_bPageTreeSelChangedActive(FALSE),
- m_bTreeViewMode(TRUE),
- m_bPageCaption(FALSE),
- m_bTreeImages(FALSE),
- m_nPageTreeWidth(150),
- m_pwndPageTree(NULL),
- m_pFrame(NULL)
+ : CPropertySheet(pszCaption, pParentWnd, iSelectPage),
+ m_bPageTreeSelChangedActive(FALSE),
+ m_bTreeViewMode(TRUE),
+ m_bPageCaption(FALSE),
+ m_bTreeImages(FALSE),
+ m_nPageTreeWidth(150),
+ m_pwndPageTree(NULL),
+ m_pFrame(NULL)
{
}
CTreePropSheet::~CTreePropSheet()
{
- if(m_Images.GetSafeHandle()) m_Images.DeleteImageList();
- delete m_pwndPageTree, m_pwndPageTree = NULL;
- delete m_pFrame, m_pFrame = NULL;
+ if(m_Images.GetSafeHandle()) m_Images.DeleteImageList();
+ delete m_pwndPageTree, m_pwndPageTree = NULL;
+ delete m_pFrame, m_pFrame = NULL;
}
/////////////////////////////////////////////////////////////////////
@@ -99,93 +99,93 @@ CTreePropSheet::~CTreePropSheet()
BOOL CTreePropSheet::SetTreeViewMode(BOOL bTreeViewMode /* = TRUE */, BOOL bPageCaption /* = FALSE */, BOOL bTreeImages /* = FALSE */)
{
- if (IsWindow(m_hWnd))
- {
- // needs to becalled, before the window has been created
- ASSERT(FALSE);
- return FALSE;
- }
+ if(IsWindow(m_hWnd))
+ {
+ // needs to becalled, before the window has been created
+ ASSERT(FALSE);
+ return FALSE;
+ }
- m_bTreeViewMode = bTreeViewMode;
- if (m_bTreeViewMode)
- {
- m_bPageCaption = bPageCaption;
- m_bTreeImages = bTreeImages;
- }
+ m_bTreeViewMode = bTreeViewMode;
+ if(m_bTreeViewMode)
+ {
+ m_bPageCaption = bPageCaption;
+ m_bTreeImages = bTreeImages;
+ }
- return TRUE;
+ return TRUE;
}
BOOL CTreePropSheet::SetTreeWidth(int nWidth)
{
- if (IsWindow(m_hWnd))
- {
- // needs to be called, before the window is created.
- ASSERT(FALSE);
- return FALSE;
- }
+ if(IsWindow(m_hWnd))
+ {
+ // needs to be called, before the window is created.
+ ASSERT(FALSE);
+ return FALSE;
+ }
- m_nPageTreeWidth = nWidth;
+ m_nPageTreeWidth = nWidth;
- return TRUE;
+ return TRUE;
}
void CTreePropSheet::SetEmptyPageText(LPCTSTR lpszEmptyPageText)
{
- m_strEmptyPageMessage = lpszEmptyPageText;
+ m_strEmptyPageMessage = lpszEmptyPageText;
}
DWORD CTreePropSheet::SetEmptyPageTextFormat(DWORD dwFormat)
{
- DWORD dwPrevFormat = m_pFrame->GetMsgFormat();
- m_pFrame->SetMsgFormat(dwFormat);
- return dwPrevFormat;
+ DWORD dwPrevFormat = m_pFrame->GetMsgFormat();
+ m_pFrame->SetMsgFormat(dwFormat);
+ return dwPrevFormat;
}
BOOL CTreePropSheet::SetTreeDefaultImages(CImageList *pImages)
{
- if (pImages->GetImageCount() != 2)
- {
- ASSERT(FALSE);
- return FALSE;
- }
+ if(pImages->GetImageCount() != 2)
+ {
+ ASSERT(FALSE);
+ return FALSE;
+ }
- if (m_DefaultImages.GetSafeHandle())
- m_DefaultImages.DeleteImageList();
- m_DefaultImages.Create(pImages);
+ if(m_DefaultImages.GetSafeHandle())
+ m_DefaultImages.DeleteImageList();
+ m_DefaultImages.Create(pImages);
- // update, if necessary
- if (IsWindow(m_hWnd))
- RefillPageTree();
-
- return TRUE;
+ // update, if necessary
+ if(IsWindow(m_hWnd))
+ RefillPageTree();
+
+ return TRUE;
}
BOOL CTreePropSheet::SetTreeDefaultImages(UINT unBitmapID, int cx, COLORREF crMask)
{
- if (m_DefaultImages.GetSafeHandle())
- m_DefaultImages.DeleteImageList();
- if (!m_DefaultImages.Create(unBitmapID, cx, 0, crMask))
- return FALSE;
+ if(m_DefaultImages.GetSafeHandle())
+ m_DefaultImages.DeleteImageList();
+ if(!m_DefaultImages.Create(unBitmapID, cx, 0, crMask))
+ return FALSE;
- if (m_DefaultImages.GetImageCount() != 2)
- {
- m_DefaultImages.DeleteImageList();
- return FALSE;
- }
+ if(m_DefaultImages.GetImageCount() != 2)
+ {
+ m_DefaultImages.DeleteImageList();
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
CTreeCtrl* CTreePropSheet::GetPageTreeControl()
{
- return m_pwndPageTree;
+ return m_pwndPageTree;
}
@@ -194,42 +194,42 @@ CTreeCtrl* CTreePropSheet::GetPageTreeControl()
BOOL CTreePropSheet::SetPageIcon(CPropertyPage *pPage, HICON hIcon)
{
- pPage->m_psp.dwFlags|= PSP_USEHICON;
- pPage->m_psp.hIcon = hIcon;
- return TRUE;
+ pPage->m_psp.dwFlags |= PSP_USEHICON;
+ pPage->m_psp.hIcon = hIcon;
+ return TRUE;
}
BOOL CTreePropSheet::SetPageIcon(CPropertyPage *pPage, UINT unIconId)
{
- HICON hIcon = AfxGetApp()->LoadIcon(unIconId);
- if (!hIcon)
- return FALSE;
+ HICON hIcon = AfxGetApp()->LoadIcon(unIconId);
+ if(!hIcon)
+ return FALSE;
- return SetPageIcon(pPage, hIcon);
+ return SetPageIcon(pPage, hIcon);
}
BOOL CTreePropSheet::SetPageIcon(CPropertyPage *pPage, CImageList &Images, int nImage)
{
- HICON hIcon = Images.ExtractIcon(nImage);
- if (!hIcon)
- return FALSE;
+ HICON hIcon = Images.ExtractIcon(nImage);
+ if(!hIcon)
+ return FALSE;
- return SetPageIcon(pPage, hIcon);
+ return SetPageIcon(pPage, hIcon);
}
BOOL CTreePropSheet::DestroyPageIcon(CPropertyPage *pPage)
{
- if (!pPage || !(pPage->m_psp.dwFlags&PSP_USEHICON) || !pPage->m_psp.hIcon)
- return FALSE;
+ if(!pPage || !(pPage->m_psp.dwFlags & PSP_USEHICON) || !pPage->m_psp.hIcon)
+ return FALSE;
- DestroyIcon(pPage->m_psp.hIcon);
- pPage->m_psp.dwFlags&= ~PSP_USEHICON;
- pPage->m_psp.hIcon = NULL;
+ DestroyIcon(pPage->m_psp.hIcon);
+ pPage->m_psp.dwFlags &= ~PSP_USEHICON;
+ pPage->m_psp.hIcon = NULL;
- return TRUE;
+ return TRUE;
}
@@ -238,21 +238,21 @@ BOOL CTreePropSheet::DestroyPageIcon(CPropertyPage *pPage)
CString CTreePropSheet::GenerateEmptyPageMessage(LPCTSTR lpszEmptyPageMessage, LPCTSTR lpszCaption)
{
- CString strMsg;
- strMsg.Format(lpszEmptyPageMessage, lpszCaption);
- return strMsg;
+ CString strMsg;
+ strMsg.Format(lpszEmptyPageMessage, lpszCaption);
+ return strMsg;
}
CTreeCtrl* CTreePropSheet::CreatePageTreeObject()
{
- return DNew CTreeCtrl;
+ return DNew CTreeCtrl;
}
CPropPageFrame* CTreePropSheet::CreatePageFrame()
{
- return DNew CPropPageFrameDefault;
+ return DNew CPropPageFrameDefault;
}
@@ -261,722 +261,722 @@ CPropPageFrame* CTreePropSheet::CreatePageFrame()
void CTreePropSheet::MoveChildWindows(int nDx, int nDy)
{
- CWnd *pWnd = GetWindow(GW_CHILD);
- while (pWnd)
- {
- CRect rect;
- pWnd->GetWindowRect(rect);
- rect.OffsetRect(nDx, nDy);
- ScreenToClient(rect);
- pWnd->MoveWindow(rect);
+ CWnd *pWnd = GetWindow(GW_CHILD);
+ while(pWnd)
+ {
+ CRect rect;
+ pWnd->GetWindowRect(rect);
+ rect.OffsetRect(nDx, nDy);
+ ScreenToClient(rect);
+ pWnd->MoveWindow(rect);
- pWnd = pWnd->GetNextWindow();
- }
+ pWnd = pWnd->GetNextWindow();
+ }
}
void CTreePropSheet::RefillPageTree()
{
- if (!IsWindow(m_hWnd))
- return;
-
- m_pwndPageTree->DeleteAllItems();
-
- CTabCtrl *pTabCtrl = GetTabControl();
- if (!IsWindow(pTabCtrl->GetSafeHwnd()))
- {
- ASSERT(FALSE);
- return;
- }
-
- const int nPageCount = pTabCtrl->GetItemCount();
-
- // rebuild image list
- if (m_bTreeImages)
- {
- for (int i = m_Images.GetImageCount()-1; i >= 0; --i)
- m_Images.Remove(i);
-
- // add page images
- CImageList *pPageImages = pTabCtrl->GetImageList();
- if (pPageImages)
- {
- for (int nImage = 0; nImage < pPageImages->GetImageCount(); ++nImage)
- {
- HICON hIcon = pPageImages->ExtractIcon(nImage);
- m_Images.Add(hIcon);
- DestroyIcon(hIcon);
- }
- }
-
- // add default images
- if (m_DefaultImages.GetSafeHandle())
- {
- HICON hIcon;
-
- // add default images
- hIcon = m_DefaultImages.ExtractIcon(0);
- if (hIcon)
- {
- m_Images.Add(hIcon);
- DestroyIcon(hIcon);
- }
- hIcon = m_DefaultImages.ExtractIcon(1);
- {
- m_Images.Add(hIcon);
- DestroyIcon(hIcon);
- }
- }
- }
-
- // insert tree items
- for (int nPage = 0; nPage < nPageCount; ++nPage)
- {
- // Get title and image of the page
- CString strPagePath;
-
- TCITEM ti;
- ZeroMemory(&ti, sizeof(ti));
- ti.mask = TCIF_TEXT|TCIF_IMAGE;
- ti.cchTextMax = MAX_PATH;
- ti.pszText = strPagePath.GetBuffer(ti.cchTextMax);
- ASSERT(ti.pszText);
- if (!ti.pszText)
- return;
-
- pTabCtrl->GetItem(nPage, &ti);
- strPagePath.ReleaseBuffer();
-
- // Create an item in the tree for the page
- HTREEITEM hItem = CreatePageTreeItem(ti.pszText);
- ASSERT(hItem);
- if (hItem)
- {
- m_pwndPageTree->SetItemData(hItem, nPage);
-
- // set image
- if (m_bTreeImages)
- {
- int nImage = ti.iImage;
- if (nImage < 0 || nImage >= m_Images.GetImageCount())
- nImage = m_DefaultImages.GetSafeHandle()? m_Images.GetImageCount()-1 : -1;
-
- m_pwndPageTree->SetItemImage(hItem, nImage, nImage);
- }
- }
- }
+ if(!IsWindow(m_hWnd))
+ return;
+
+ m_pwndPageTree->DeleteAllItems();
+
+ CTabCtrl *pTabCtrl = GetTabControl();
+ if(!IsWindow(pTabCtrl->GetSafeHwnd()))
+ {
+ ASSERT(FALSE);
+ return;
+ }
+
+ const int nPageCount = pTabCtrl->GetItemCount();
+
+ // rebuild image list
+ if(m_bTreeImages)
+ {
+ for(int i = m_Images.GetImageCount() - 1; i >= 0; --i)
+ m_Images.Remove(i);
+
+ // add page images
+ CImageList *pPageImages = pTabCtrl->GetImageList();
+ if(pPageImages)
+ {
+ for(int nImage = 0; nImage < pPageImages->GetImageCount(); ++nImage)
+ {
+ HICON hIcon = pPageImages->ExtractIcon(nImage);
+ m_Images.Add(hIcon);
+ DestroyIcon(hIcon);
+ }
+ }
+
+ // add default images
+ if(m_DefaultImages.GetSafeHandle())
+ {
+ HICON hIcon;
+
+ // add default images
+ hIcon = m_DefaultImages.ExtractIcon(0);
+ if(hIcon)
+ {
+ m_Images.Add(hIcon);
+ DestroyIcon(hIcon);
+ }
+ hIcon = m_DefaultImages.ExtractIcon(1);
+ {
+ m_Images.Add(hIcon);
+ DestroyIcon(hIcon);
+ }
+ }
+ }
+
+ // insert tree items
+ for(int nPage = 0; nPage < nPageCount; ++nPage)
+ {
+ // Get title and image of the page
+ CString strPagePath;
+
+ TCITEM ti;
+ ZeroMemory(&ti, sizeof(ti));
+ ti.mask = TCIF_TEXT | TCIF_IMAGE;
+ ti.cchTextMax = MAX_PATH;
+ ti.pszText = strPagePath.GetBuffer(ti.cchTextMax);
+ ASSERT(ti.pszText);
+ if(!ti.pszText)
+ return;
+
+ pTabCtrl->GetItem(nPage, &ti);
+ strPagePath.ReleaseBuffer();
+
+ // Create an item in the tree for the page
+ HTREEITEM hItem = CreatePageTreeItem(ti.pszText);
+ ASSERT(hItem);
+ if(hItem)
+ {
+ m_pwndPageTree->SetItemData(hItem, nPage);
+
+ // set image
+ if(m_bTreeImages)
+ {
+ int nImage = ti.iImage;
+ if(nImage < 0 || nImage >= m_Images.GetImageCount())
+ nImage = m_DefaultImages.GetSafeHandle() ? m_Images.GetImageCount() - 1 : -1;
+
+ m_pwndPageTree->SetItemImage(hItem, nImage, nImage);
+ }
+ }
+ }
}
HTREEITEM CTreePropSheet::CreatePageTreeItem(LPCTSTR lpszPath, HTREEITEM hParent /* = TVI_ROOT */)
{
- CString strPath(lpszPath);
- CString strTopMostItem(SplitPageTreePath(strPath));
-
- // Check if an item with the given text does already exist
- HTREEITEM hItem = NULL;
- HTREEITEM hChild = m_pwndPageTree->GetChildItem(hParent);
- while (hChild)
- {
- if (m_pwndPageTree->GetItemText(hChild) == strTopMostItem)
- {
- hItem = hChild;
- break;
- }
- hChild = m_pwndPageTree->GetNextItem(hChild, TVGN_NEXT);
- }
-
- // If item with that text does not already exist, create a new one
- if (!hItem)
- {
- hItem = m_pwndPageTree->InsertItem(strTopMostItem, hParent);
- m_pwndPageTree->SetItemData(hItem, -1);
- if (!strPath.IsEmpty() && m_bTreeImages && m_DefaultImages.GetSafeHandle())
- // set folder image
- m_pwndPageTree->SetItemImage(hItem, m_Images.GetImageCount()-2, m_Images.GetImageCount()-2);
- }
- if (!hItem)
- {
- ASSERT(FALSE);
- return NULL;
- }
-
- if (strPath.IsEmpty())
- return hItem;
- else
- return CreatePageTreeItem(strPath, hItem);
+ CString strPath(lpszPath);
+ CString strTopMostItem(SplitPageTreePath(strPath));
+
+ // Check if an item with the given text does already exist
+ HTREEITEM hItem = NULL;
+ HTREEITEM hChild = m_pwndPageTree->GetChildItem(hParent);
+ while(hChild)
+ {
+ if(m_pwndPageTree->GetItemText(hChild) == strTopMostItem)
+ {
+ hItem = hChild;
+ break;
+ }
+ hChild = m_pwndPageTree->GetNextItem(hChild, TVGN_NEXT);
+ }
+
+ // If item with that text does not already exist, create a new one
+ if(!hItem)
+ {
+ hItem = m_pwndPageTree->InsertItem(strTopMostItem, hParent);
+ m_pwndPageTree->SetItemData(hItem, -1);
+ if(!strPath.IsEmpty() && m_bTreeImages && m_DefaultImages.GetSafeHandle())
+ // set folder image
+ m_pwndPageTree->SetItemImage(hItem, m_Images.GetImageCount() - 2, m_Images.GetImageCount() - 2);
+ }
+ if(!hItem)
+ {
+ ASSERT(FALSE);
+ return NULL;
+ }
+
+ if(strPath.IsEmpty())
+ return hItem;
+ else
+ return CreatePageTreeItem(strPath, hItem);
}
CString CTreePropSheet::SplitPageTreePath(CString &strRest)
{
- int nSeperatorPos = 0;
- while (TRUE)
- {
- nSeperatorPos = strRest.Find(_T("::"), nSeperatorPos);
- if (nSeperatorPos == -1)
- {
- CString strItem(strRest);
- strRest.Empty();
- return strItem;
- }
- else if (nSeperatorPos>0)
- {
- // if there is an odd number of backslashes infront of the
- // seperator, than do not interpret it as separator
- int nBackslashCount = 0;
- for (int nPos = nSeperatorPos-1; nPos >= 0 && strRest[nPos]==_T('\\'); --nPos, ++nBackslashCount);
- if (nBackslashCount%2 == 0)
- break;
- else
- ++nSeperatorPos;
- }
- }
-
- CString strItem(strRest.Left(nSeperatorPos));
- strItem.Replace(_T("\\::"), _T("::"));
- strItem.Replace(_T("\\\\"), _T("\\"));
- strRest = strRest.Mid(nSeperatorPos+2);
- return strItem;
+ int nSeperatorPos = 0;
+ while(TRUE)
+ {
+ nSeperatorPos = strRest.Find(_T("::"), nSeperatorPos);
+ if(nSeperatorPos == -1)
+ {
+ CString strItem(strRest);
+ strRest.Empty();
+ return strItem;
+ }
+ else if(nSeperatorPos > 0)
+ {
+ // if there is an odd number of backslashes infront of the
+ // seperator, than do not interpret it as separator
+ int nBackslashCount = 0;
+ for(int nPos = nSeperatorPos - 1; nPos >= 0 && strRest[nPos] == _T('\\'); --nPos, ++nBackslashCount);
+ if(nBackslashCount % 2 == 0)
+ break;
+ else
+ ++nSeperatorPos;
+ }
+ }
+
+ CString strItem(strRest.Left(nSeperatorPos));
+ strItem.Replace(_T("\\::"), _T("::"));
+ strItem.Replace(_T("\\\\"), _T("\\"));
+ strRest = strRest.Mid(nSeperatorPos + 2);
+ return strItem;
}
BOOL CTreePropSheet::KillActiveCurrentPage()
{
- HWND hCurrentPage = PropSheet_GetCurrentPageHwnd(m_hWnd);
- if (!IsWindow(hCurrentPage))
- {
- ASSERT(FALSE);
- return TRUE;
- }
+ HWND hCurrentPage = PropSheet_GetCurrentPageHwnd(m_hWnd);
+ if(!IsWindow(hCurrentPage))
+ {
+ ASSERT(FALSE);
+ return TRUE;
+ }
- // Check if the current page is really active (if page is invisible
- // an virtual empty page is the active one.
- if (!::IsWindowVisible(hCurrentPage))
- return TRUE;
+ // Check if the current page is really active (if page is invisible
+ // an virtual empty page is the active one.
+ if(!::IsWindowVisible(hCurrentPage))
+ return TRUE;
- // Try to deactivate current page
- PSHNOTIFY pshn;
- pshn.hdr.code = PSN_KILLACTIVE;
- pshn.hdr.hwndFrom = m_hWnd;
- pshn.hdr.idFrom = GetDlgCtrlID();
- pshn.lParam = 0;
- if (::SendMessage(hCurrentPage, WM_NOTIFY, pshn.hdr.idFrom, (LPARAM)&pshn))
- // current page does not allow page change
- return FALSE;
+ // Try to deactivate current page
+ PSHNOTIFY pshn;
+ pshn.hdr.code = PSN_KILLACTIVE;
+ pshn.hdr.hwndFrom = m_hWnd;
+ pshn.hdr.idFrom = GetDlgCtrlID();
+ pshn.lParam = 0;
+ if(::SendMessage(hCurrentPage, WM_NOTIFY, pshn.hdr.idFrom, (LPARAM)&pshn))
+ // current page does not allow page change
+ return FALSE;
- // Hide the page
- ::ShowWindow(hCurrentPage, SW_HIDE);
+ // Hide the page
+ ::ShowWindow(hCurrentPage, SW_HIDE);
- return TRUE;
+ return TRUE;
}
HTREEITEM CTreePropSheet::GetPageTreeItem(int nPage, HTREEITEM hRoot /* = TVI_ROOT */)
{
- // Special handling for root case
- if (hRoot == TVI_ROOT)
- hRoot = m_pwndPageTree->GetNextItem(NULL, TVGN_ROOT);
-
- // Check parameters
- if (nPage < 0 || nPage >= GetPageCount())
- {
- ASSERT(FALSE);
- return NULL;
- }
-
- if (hRoot == NULL)
- {
- ASSERT(FALSE);
- return NULL;
- }
-
- // we are performing a simple linear search here, because we are
- // expecting only little data
- HTREEITEM hItem = hRoot;
- while (hItem)
- {
- if ((signed)m_pwndPageTree->GetItemData(hItem) == nPage)
- return hItem;
- if (m_pwndPageTree->ItemHasChildren(hItem))
- {
- HTREEITEM hResult = GetPageTreeItem(nPage, m_pwndPageTree->GetNextItem(hItem, TVGN_CHILD));
- if (hResult)
- return hResult;
- }
-
- hItem = m_pwndPageTree->GetNextItem(hItem, TVGN_NEXT);
- }
-
- // we've found nothing, if we arrive here
- return hItem;
+ // Special handling for root case
+ if(hRoot == TVI_ROOT)
+ hRoot = m_pwndPageTree->GetNextItem(NULL, TVGN_ROOT);
+
+ // Check parameters
+ if(nPage < 0 || nPage >= GetPageCount())
+ {
+ ASSERT(FALSE);
+ return NULL;
+ }
+
+ if(hRoot == NULL)
+ {
+ ASSERT(FALSE);
+ return NULL;
+ }
+
+ // we are performing a simple linear search here, because we are
+ // expecting only little data
+ HTREEITEM hItem = hRoot;
+ while(hItem)
+ {
+ if((signed)m_pwndPageTree->GetItemData(hItem) == nPage)
+ return hItem;
+ if(m_pwndPageTree->ItemHasChildren(hItem))
+ {
+ HTREEITEM hResult = GetPageTreeItem(nPage, m_pwndPageTree->GetNextItem(hItem, TVGN_CHILD));
+ if(hResult)
+ return hResult;
+ }
+
+ hItem = m_pwndPageTree->GetNextItem(hItem, TVGN_NEXT);
+ }
+
+ // we've found nothing, if we arrive here
+ return hItem;
}
BOOL CTreePropSheet::SelectPageTreeItem(int nPage)
{
- HTREEITEM hItem = GetPageTreeItem(nPage);
- if (!hItem)
- return FALSE;
+ HTREEITEM hItem = GetPageTreeItem(nPage);
+ if(!hItem)
+ return FALSE;
- return m_pwndPageTree->SelectItem(hItem);
+ return m_pwndPageTree->SelectItem(hItem);
}
BOOL CTreePropSheet::SelectCurrentPageTreeItem()
{
- CTabCtrl *pTab = GetTabControl();
- if (!IsWindow(pTab->GetSafeHwnd()))
- return FALSE;
+ CTabCtrl *pTab = GetTabControl();
+ if(!IsWindow(pTab->GetSafeHwnd()))
+ return FALSE;
- return SelectPageTreeItem(pTab->GetCurSel());
+ return SelectPageTreeItem(pTab->GetCurSel());
}
void CTreePropSheet::UpdateCaption()
{
- HWND hPage = PropSheet_GetCurrentPageHwnd(GetSafeHwnd());
- BOOL bRealPage = IsWindow(hPage) && ::IsWindowVisible(hPage);
- HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
- if (!hItem)
- return;
- CString strCaption = m_pwndPageTree->GetItemText(hItem);
-
- // if empty page, then update empty page message
- if (!bRealPage)
- m_pFrame->SetMsgText(GenerateEmptyPageMessage(m_strEmptyPageMessage, strCaption));
-
- // if no captions are displayed, cancel here
- if (!m_pFrame->GetShowCaption())
- return;
-
- // get tab control, to the the images from
- CTabCtrl *pTabCtrl = GetTabControl();
- if (!IsWindow(pTabCtrl->GetSafeHwnd()))
- {
- ASSERT(FALSE);
- return;
- }
-
- if (m_bTreeImages)
- {
- // get image from tree
- int nImage;
- m_pwndPageTree->GetItemImage(hItem, nImage, nImage);
- HICON hIcon = m_Images.ExtractIcon(nImage);
- m_pFrame->SetCaption(strCaption, hIcon);
- if (hIcon)
- DestroyIcon(hIcon);
- }
- else if (bRealPage)
- {
- // get image from hidden (original) tab provided by the original
- // implementation
- CImageList *pImages = pTabCtrl->GetImageList();
- if (pImages)
- {
- TCITEM ti;
- ZeroMemory(&ti, sizeof(ti));
- ti.mask = TCIF_IMAGE;
-
- HICON hIcon = NULL;
- if (pTabCtrl->GetItem((int)m_pwndPageTree->GetItemData(hItem), &ti))
- hIcon = pImages->ExtractIcon(ti.iImage);
-
- m_pFrame->SetCaption(strCaption, hIcon);
- if (hIcon)
- DestroyIcon(hIcon);
- }
- else
- m_pFrame->SetCaption(strCaption);
- }
- else
- m_pFrame->SetCaption(strCaption);
+ HWND hPage = PropSheet_GetCurrentPageHwnd(GetSafeHwnd());
+ BOOL bRealPage = IsWindow(hPage) && ::IsWindowVisible(hPage);
+ HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
+ if(!hItem)
+ return;
+ CString strCaption = m_pwndPageTree->GetItemText(hItem);
+
+ // if empty page, then update empty page message
+ if(!bRealPage)
+ m_pFrame->SetMsgText(GenerateEmptyPageMessage(m_strEmptyPageMessage, strCaption));
+
+ // if no captions are displayed, cancel here
+ if(!m_pFrame->GetShowCaption())
+ return;
+
+ // get tab control, to the the images from
+ CTabCtrl *pTabCtrl = GetTabControl();
+ if(!IsWindow(pTabCtrl->GetSafeHwnd()))
+ {
+ ASSERT(FALSE);
+ return;
+ }
+
+ if(m_bTreeImages)
+ {
+ // get image from tree
+ int nImage;
+ m_pwndPageTree->GetItemImage(hItem, nImage, nImage);
+ HICON hIcon = m_Images.ExtractIcon(nImage);
+ m_pFrame->SetCaption(strCaption, hIcon);
+ if(hIcon)
+ DestroyIcon(hIcon);
+ }
+ else if(bRealPage)
+ {
+ // get image from hidden (original) tab provided by the original
+ // implementation
+ CImageList *pImages = pTabCtrl->GetImageList();
+ if(pImages)
+ {
+ TCITEM ti;
+ ZeroMemory(&ti, sizeof(ti));
+ ti.mask = TCIF_IMAGE;
+
+ HICON hIcon = NULL;
+ if(pTabCtrl->GetItem((int)m_pwndPageTree->GetItemData(hItem), &ti))
+ hIcon = pImages->ExtractIcon(ti.iImage);
+
+ m_pFrame->SetCaption(strCaption, hIcon);
+ if(hIcon)
+ DestroyIcon(hIcon);
+ }
+ else
+ m_pFrame->SetCaption(strCaption);
+ }
+ else
+ m_pFrame->SetCaption(strCaption);
}
void CTreePropSheet::ActivatePreviousPage()
{
- if (!IsWindow(m_hWnd))
- return;
-
- if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
- {
- // normal tab property sheet. Simply use page index
- int nPageIndex = GetActiveIndex();
- if (nPageIndex<0 || nPageIndex>=GetPageCount())
- return;
-
- int nPrevIndex = (nPageIndex==0)? GetPageCount()-1 : nPageIndex-1;
- SetActivePage(nPrevIndex);
- }
- else
- {
- // property sheet with page tree.
- // we need a more sophisticated handling here, than simply using
- // the page index, because we won't skip empty pages.
- // so we have to walk the page tree
- HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
- ASSERT(hItem);
- if (!hItem)
- return;
-
- HTREEITEM hPrevItem = NULL;
- if (hPrevItem=m_pwndPageTree->GetPrevSiblingItem(hItem))
- {
- while (m_pwndPageTree->ItemHasChildren(hPrevItem))
- {
- hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
- while (m_pwndPageTree->GetNextSiblingItem(hPrevItem))
- hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);
- }
- }
- else
- hPrevItem=m_pwndPageTree->GetParentItem(hItem);
-
- if (!hPrevItem)
- {
- // no prev item, so cycle to the last item
- hPrevItem = m_pwndPageTree->GetRootItem();
-
- while (TRUE)
- {
- while (m_pwndPageTree->GetNextSiblingItem(hPrevItem))
- hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);
-
- if (m_pwndPageTree->ItemHasChildren(hPrevItem))
- hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
- else
- break;
- }
- }
-
- if (hPrevItem)
- m_pwndPageTree->SelectItem(hPrevItem);
- }
+ if(!IsWindow(m_hWnd))
+ return;
+
+ if(!IsWindow(m_pwndPageTree->GetSafeHwnd()))
+ {
+ // normal tab property sheet. Simply use page index
+ int nPageIndex = GetActiveIndex();
+ if(nPageIndex < 0 || nPageIndex >= GetPageCount())
+ return;
+
+ int nPrevIndex = (nPageIndex == 0) ? GetPageCount() - 1 : nPageIndex - 1;
+ SetActivePage(nPrevIndex);
+ }
+ else
+ {
+ // property sheet with page tree.
+ // we need a more sophisticated handling here, than simply using
+ // the page index, because we won't skip empty pages.
+ // so we have to walk the page tree
+ HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
+ ASSERT(hItem);
+ if(!hItem)
+ return;
+
+ HTREEITEM hPrevItem = NULL;
+ if(hPrevItem = m_pwndPageTree->GetPrevSiblingItem(hItem))
+ {
+ while(m_pwndPageTree->ItemHasChildren(hPrevItem))
+ {
+ hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
+ while(m_pwndPageTree->GetNextSiblingItem(hPrevItem))
+ hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);
+ }
+ }
+ else
+ hPrevItem = m_pwndPageTree->GetParentItem(hItem);
+
+ if(!hPrevItem)
+ {
+ // no prev item, so cycle to the last item
+ hPrevItem = m_pwndPageTree->GetRootItem();
+
+ while(TRUE)
+ {
+ while(m_pwndPageTree->GetNextSiblingItem(hPrevItem))
+ hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);
+
+ if(m_pwndPageTree->ItemHasChildren(hPrevItem))
+ hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
+ else
+ break;
+ }
+ }
+
+ if(hPrevItem)
+ m_pwndPageTree->SelectItem(hPrevItem);
+ }
}
void CTreePropSheet::ActivateNextPage()
{
- if (!IsWindow(m_hWnd))
- return;
-
- if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
- {
- // normal tab property sheet. Simply use page index
- int nPageIndex = GetActiveIndex();
- if (nPageIndex<0 || nPageIndex>=GetPageCount())
- return;
-
- int nNextIndex = (nPageIndex==GetPageCount()-1)? 0 : nPageIndex+1;
- SetActivePage(nNextIndex);
- }
- else
- {
- // property sheet with page tree.
- // we need a more sophisticated handling here, than simply using
- // the page index, because we won't skip empty pages.
- // so we have to walk the page tree
- HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
- ASSERT(hItem);
- if (!hItem)
- return;
-
- HTREEITEM hNextItem = NULL;
- if (hNextItem=m_pwndPageTree->GetChildItem(hItem))
- ;
- else if (hNextItem=m_pwndPageTree->GetNextSiblingItem(hItem))
- ;
- else if (m_pwndPageTree->GetParentItem(hItem))
- {
- while (!hNextItem)
- {
- hItem = m_pwndPageTree->GetParentItem(hItem);
- if (!hItem)
- break;
-
- hNextItem = m_pwndPageTree->GetNextSiblingItem(hItem);
- }
- }
-
- if (!hNextItem)
- // no next item -- so cycle to the first item
- hNextItem = m_pwndPageTree->GetRootItem();
-
- if (hNextItem)
- m_pwndPageTree->SelectItem(hNextItem);
- }
+ if(!IsWindow(m_hWnd))
+ return;
+
+ if(!IsWindow(m_pwndPageTree->GetSafeHwnd()))
+ {
+ // normal tab property sheet. Simply use page index
+ int nPageIndex = GetActiveIndex();
+ if(nPageIndex < 0 || nPageIndex >= GetPageCount())
+ return;
+
+ int nNextIndex = (nPageIndex == GetPageCount() - 1) ? 0 : nPageIndex + 1;
+ SetActivePage(nNextIndex);
+ }
+ else
+ {
+ // property sheet with page tree.
+ // we need a more sophisticated handling here, than simply using
+ // the page index, because we won't skip empty pages.
+ // so we have to walk the page tree
+ HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
+ ASSERT(hItem);
+ if(!hItem)
+ return;
+
+ HTREEITEM hNextItem = NULL;
+ if(hNextItem = m_pwndPageTree->GetChildItem(hItem))
+ ;
+ else if(hNextItem = m_pwndPageTree->GetNextSiblingItem(hItem))
+ ;
+ else if(m_pwndPageTree->GetParentItem(hItem))
+ {
+ while(!hNextItem)
+ {
+ hItem = m_pwndPageTree->GetParentItem(hItem);
+ if(!hItem)
+ break;
+
+ hNextItem = m_pwndPageTree->GetNextSiblingItem(hItem);
+ }
+ }
+
+ if(!hNextItem)
+ // no next item -- so cycle to the first item
+ hNextItem = m_pwndPageTree->GetRootItem();
+
+ if(hNextItem)
+ m_pwndPageTree->SelectItem(hNextItem);
+ }
}
/////////////////////////////////////////////////////////////////////
// Overridings
-BOOL CTreePropSheet::OnInitDialog()
-{
- if (m_bTreeViewMode)
- {
- // be sure, there are no stacked tabs, because otherwise the
- // page caption will be to large in tree view mode
- EnableStackedTabs(FALSE);
-
- // Initialize image list.
- if (m_DefaultImages.GetSafeHandle())
- {
- IMAGEINFO ii;
- m_DefaultImages.GetImageInfo(0, &ii);
- if (ii.hbmImage) DeleteObject(ii.hbmImage);
- if (ii.hbmMask) DeleteObject(ii.hbmMask);
- m_Images.Create(ii.rcImage.right-ii.rcImage.left, ii.rcImage.bottom-ii.rcImage.top, ILC_COLOR32|ILC_MASK, 0, 1);
- }
- else
- m_Images.Create(16, 16, ILC_COLOR32|ILC_MASK, 0, 1);
- }
-
- // perform default implementation
- BOOL bResult = __super::OnInitDialog();
-
- if (!m_bTreeViewMode)
- // stop here, if we would like to use tabs
- return bResult;
-
- // Get tab control...
- CTabCtrl *pTab = GetTabControl();
- if (!IsWindow(pTab->GetSafeHwnd()))
- {
- ASSERT(FALSE);
- return bResult;
- }
-
- // ... and hide it
- pTab->ShowWindow(SW_HIDE);
- pTab->EnableWindow(FALSE);
-
- // Place another (empty) tab ctrl, to get a frame instead
- CRect rectFrame;
- pTab->GetWindowRect(rectFrame);
- ScreenToClient(rectFrame);
-
- m_pFrame = CreatePageFrame();
- if (!m_pFrame)
- {
- ASSERT(FALSE);
- AfxThrowMemoryException();
- }
- m_pFrame->Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF);
- m_pFrame->ShowCaption(m_bPageCaption);
-
- // Lets make place for the tree ctrl
- const int nTreeWidth = m_nPageTreeWidth;
- const int nTreeSpace = 5;
-
- CRect rectSheet;
- GetWindowRect(rectSheet);
- rectSheet.right+= nTreeWidth;
- SetWindowPos(NULL, -1, -1, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER|SWP_NOMOVE);
- CenterWindow();
-
- MoveChildWindows(nTreeWidth, 0);
-
- // Lets calculate the rectangle for the tree ctrl
- CRect rectTree(rectFrame);
- rectTree.right = rectTree.left + nTreeWidth - nTreeSpace;
-
- // calculate caption height
- CTabCtrl wndTabCtrl;
- wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234);
- wndTabCtrl.InsertItem(0, _T(""));
- CRect rectFrameCaption;
- wndTabCtrl.GetItemRect(0, rectFrameCaption);
- wndTabCtrl.DestroyWindow();
- m_pFrame->SetCaptionHeight(rectFrameCaption.Height());
-
- // if no caption should be displayed, make the window smaller in
- // height
- if (!m_bPageCaption)
- {
- // make frame smaller
- m_pFrame->GetWnd()->GetWindowRect(rectFrame);
- ScreenToClient(rectFrame);
- rectFrame.top+= rectFrameCaption.Height();
- m_pFrame->GetWnd()->MoveWindow(rectFrame);
-
- // move all child windows up
- MoveChildWindows(0, -rectFrameCaption.Height());
-
- // modify rectangle for the tree ctrl
- rectTree.bottom-= rectFrameCaption.Height();
-
- // make us smaller
- CRect rect;
- GetWindowRect(rect);
- rect.top+= rectFrameCaption.Height()/2;
- rect.bottom-= rectFrameCaption.Height()-rectFrameCaption.Height()/2;
+BOOL CTreePropSheet::OnInitDialog()
+{
+ if(m_bTreeViewMode)
+ {
+ // be sure, there are no stacked tabs, because otherwise the
+ // page caption will be to large in tree view mode
+ EnableStackedTabs(FALSE);
+
+ // Initialize image list.
+ if(m_DefaultImages.GetSafeHandle())
+ {
+ IMAGEINFO ii;
+ m_DefaultImages.GetImageInfo(0, &ii);
+ if(ii.hbmImage) DeleteObject(ii.hbmImage);
+ if(ii.hbmMask) DeleteObject(ii.hbmMask);
+ m_Images.Create(ii.rcImage.right - ii.rcImage.left, ii.rcImage.bottom - ii.rcImage.top, ILC_COLOR32 | ILC_MASK, 0, 1);
+ }
+ else
+ m_Images.Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1);
+ }
+
+ // perform default implementation
+ BOOL bResult = __super::OnInitDialog();
+
+ if(!m_bTreeViewMode)
+ // stop here, if we would like to use tabs
+ return bResult;
+
+ // Get tab control...
+ CTabCtrl *pTab = GetTabControl();
+ if(!IsWindow(pTab->GetSafeHwnd()))
+ {
+ ASSERT(FALSE);
+ return bResult;
+ }
+
+ // ... and hide it
+ pTab->ShowWindow(SW_HIDE);
+ pTab->EnableWindow(FALSE);
+
+ // Place another (empty) tab ctrl, to get a frame instead
+ CRect rectFrame;
+ pTab->GetWindowRect(rectFrame);
+ ScreenToClient(rectFrame);
+
+ m_pFrame = CreatePageFrame();
+ if(!m_pFrame)
+ {
+ ASSERT(FALSE);
+ AfxThrowMemoryException();
+ }
+ m_pFrame->Create(WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF);
+ m_pFrame->ShowCaption(m_bPageCaption);
+
+ // Lets make place for the tree ctrl
+ const int nTreeWidth = m_nPageTreeWidth;
+ const int nTreeSpace = 5;
+
+ CRect rectSheet;
+ GetWindowRect(rectSheet);
+ rectSheet.right += nTreeWidth;
+ SetWindowPos(NULL, -1, -1, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER | SWP_NOMOVE);
+ CenterWindow();
+
+ MoveChildWindows(nTreeWidth, 0);
+
+ // Lets calculate the rectangle for the tree ctrl
+ CRect rectTree(rectFrame);
+ rectTree.right = rectTree.left + nTreeWidth - nTreeSpace;
+
+ // calculate caption height
+ CTabCtrl wndTabCtrl;
+ wndTabCtrl.Create(WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, rectFrame, this, 0x1234);
+ wndTabCtrl.InsertItem(0, _T(""));
+ CRect rectFrameCaption;
+ wndTabCtrl.GetItemRect(0, rectFrameCaption);
+ wndTabCtrl.DestroyWindow();
+ m_pFrame->SetCaptionHeight(rectFrameCaption.Height());
+
+ // if no caption should be displayed, make the window smaller in
+ // height
+ if(!m_bPageCaption)
+ {
+ // make frame smaller
+ m_pFrame->GetWnd()->GetWindowRect(rectFrame);
+ ScreenToClient(rectFrame);
+ rectFrame.top += rectFrameCaption.Height();
+ m_pFrame->GetWnd()->MoveWindow(rectFrame);
+
+ // move all child windows up
+ MoveChildWindows(0, -rectFrameCaption.Height());
+
+ // modify rectangle for the tree ctrl
+ rectTree.bottom -= rectFrameCaption.Height();
+
+ // make us smaller
+ CRect rect;
+ GetWindowRect(rect);
+ rect.top += rectFrameCaption.Height() / 2;
+ rect.bottom -= rectFrameCaption.Height() - rectFrameCaption.Height() / 2;
// if (GetParent())
// GetParent()->ScreenToClient(rect);
- MoveWindow(rect);
- }
-
- // finally create tht tree control
- const DWORD dwTreeStyle = TVS_SHOWSELALWAYS|TVS_TRACKSELECT|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS;
- m_pwndPageTree = CreatePageTreeObject();
- if (!m_pwndPageTree)
- {
- ASSERT(FALSE);
- AfxThrowMemoryException();
- }
-
- // MFC7-support here (Thanks to Rainer Wollgarten)
- #if _MFC_VER >= 0x0700
- {
- m_pwndPageTree->CreateEx(
- WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY,
- WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle,
- rectTree, this, s_unPageTreeId);
- }
- #else
- {
- m_pwndPageTree->CreateEx(
- WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY,
- _T("SysTreeView32"), _T("PageTree"),
- WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle,
- rectTree, this, s_unPageTreeId);
- }
- #endif
-
- if (m_bTreeImages)
- {
- m_pwndPageTree->SetImageList(&m_Images, TVSIL_NORMAL);
- m_pwndPageTree->SetImageList(&m_Images, TVSIL_STATE);
- }
-
- // Fill the tree ctrl
- RefillPageTree();
-
- // Select item for the current page
- if (pTab->GetCurSel() > -1)
- SelectPageTreeItem(pTab->GetCurSel());
-
- return bResult;
-}
-
-
-void CTreePropSheet::OnDestroy()
-{
- __super::OnDestroy();
-
- if(m_pwndPageTree && m_pwndPageTree->m_hWnd)
- m_pwndPageTree->DestroyWindow();
-
- if(m_pFrame && m_pFrame->GetWnd()->m_hWnd)
- m_pFrame->GetWnd()->DestroyWindow();
+ MoveWindow(rect);
+ }
+
+ // finally create tht tree control
+ const DWORD dwTreeStyle = TVS_SHOWSELALWAYS | TVS_TRACKSELECT | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;
+ m_pwndPageTree = CreatePageTreeObject();
+ if(!m_pwndPageTree)
+ {
+ ASSERT(FALSE);
+ AfxThrowMemoryException();
+ }
+
+ // MFC7-support here (Thanks to Rainer Wollgarten)
+#if _MFC_VER >= 0x0700
+ {
+ m_pwndPageTree->CreateEx(
+ WS_EX_CLIENTEDGE | WS_EX_NOPARENTNOTIFY,
+ WS_TABSTOP | WS_CHILD | WS_VISIBLE | dwTreeStyle,
+ rectTree, this, s_unPageTreeId);
+ }
+#else
+ {
+ m_pwndPageTree->CreateEx(
+ WS_EX_CLIENTEDGE | WS_EX_NOPARENTNOTIFY,
+ _T("SysTreeView32"), _T("PageTree"),
+ WS_TABSTOP | WS_CHILD | WS_VISIBLE | dwTreeStyle,
+ rectTree, this, s_unPageTreeId);
+ }
+#endif
+
+ if(m_bTreeImages)
+ {
+ m_pwndPageTree->SetImageList(&m_Images, TVSIL_NORMAL);
+ m_pwndPageTree->SetImageList(&m_Images, TVSIL_STATE);
+ }
+
+ // Fill the tree ctrl
+ RefillPageTree();
+
+ // Select item for the current page
+ if(pTab->GetCurSel() > -1)
+ SelectPageTreeItem(pTab->GetCurSel());
+
+ return bResult;
+}
+
+
+void CTreePropSheet::OnDestroy()
+{
+ __super::OnDestroy();
+
+ if(m_pwndPageTree && m_pwndPageTree->m_hWnd)
+ m_pwndPageTree->DestroyWindow();
+
+ if(m_pFrame && m_pFrame->GetWnd()->m_hWnd)
+ m_pFrame->GetWnd()->DestroyWindow();
}
LRESULT CTreePropSheet::OnAddPage(WPARAM wParam, LPARAM lParam)
{
- LRESULT lResult = DefWindowProc(PSM_ADDPAGE, wParam, lParam);
- if (!m_bTreeViewMode)
- return lResult;
+ LRESULT lResult = DefWindowProc(PSM_ADDPAGE, wParam, lParam);
+ if(!m_bTreeViewMode)
+ return lResult;
- RefillPageTree();
- SelectCurrentPageTreeItem();
+ RefillPageTree();
+ SelectCurrentPageTreeItem();
- return lResult;
+ return lResult;
}
LRESULT CTreePropSheet::OnRemovePage(WPARAM wParam, LPARAM lParam)
{
- LRESULT lResult = DefWindowProc(PSM_REMOVEPAGE, wParam, lParam);
- if (!m_bTreeViewMode)
- return lResult;
+ LRESULT lResult = DefWindowProc(PSM_REMOVEPAGE, wParam, lParam);
+ if(!m_bTreeViewMode)
+ return lResult;
- RefillPageTree();
- SelectCurrentPageTreeItem();
+ RefillPageTree();
+ SelectCurrentPageTreeItem();
- return lResult;
+ return lResult;
}
LRESULT CTreePropSheet::OnSetCurSel(WPARAM wParam, LPARAM lParam)
{
- LRESULT lResult = DefWindowProc(PSM_SETCURSEL, wParam, lParam);
- if (!m_bTreeViewMode)
- return lResult;
+ LRESULT lResult = DefWindowProc(PSM_SETCURSEL, wParam, lParam);
+ if(!m_bTreeViewMode)
+ return lResult;
- SelectCurrentPageTreeItem();
- UpdateCaption();
- return lResult;
+ SelectCurrentPageTreeItem();
+ UpdateCaption();
+ return lResult;
}
LRESULT CTreePropSheet::OnSetCurSelId(WPARAM wParam, LPARAM lParam)
{
- LRESULT lResult = DefWindowProc(PSM_SETCURSEL, wParam, lParam);
- if (!m_bTreeViewMode)
- return lResult;
+ LRESULT lResult = DefWindowProc(PSM_SETCURSEL, wParam, lParam);
+ if(!m_bTreeViewMode)
+ return lResult;
- SelectCurrentPageTreeItem();
- UpdateCaption();
- return lResult;
+ SelectCurrentPageTreeItem();
+ UpdateCaption();
+ return lResult;
}
void CTreePropSheet::OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult)
{
- *plResult = 0;
- if (m_bPageTreeSelChangedActive)
- return;
- else
- m_bPageTreeSelChangedActive = TRUE;
+ *plResult = 0;
+ if(m_bPageTreeSelChangedActive)
+ return;
+ else
+ m_bPageTreeSelChangedActive = TRUE;
- NMTREEVIEW *pTvn = reinterpret_cast<NMTREEVIEW*>(pNotifyStruct);
- int nPage = m_pwndPageTree->GetItemData(pTvn->itemNew.hItem);
- BOOL bResult;
- if (nPage<0 || (unsigned)nPage>=m_pwndPageTree->GetCount())
- bResult = KillActiveCurrentPage();
- else
- bResult = SetActivePage(nPage);
+ NMTREEVIEW *pTvn = reinterpret_cast<NMTREEVIEW*>(pNotifyStruct);
+ int nPage = m_pwndPageTree->GetItemData(pTvn->itemNew.hItem);
+ BOOL bResult;
+ if(nPage < 0 || (unsigned)nPage >= m_pwndPageTree->GetCount())
+ bResult = KillActiveCurrentPage();
+ else
+ bResult = SetActivePage(nPage);
- if (!bResult)
- // prevent selection to change
- *plResult = TRUE;
+ if(!bResult)
+ // prevent selection to change
+ *plResult = TRUE;
- // Set focus to tree ctrl (I guess that's what the user expects)
- m_pwndPageTree->SetFocus();
+ // Set focus to tree ctrl (I guess that's what the user expects)
+ m_pwndPageTree->SetFocus();
- m_bPageTreeSelChangedActive = FALSE;
+ m_bPageTreeSelChangedActive = FALSE;
- return;
+ return;
}
void CTreePropSheet::OnPageTreeSelChanged(NMHDR *pNotifyStruct, LRESULT *plResult)
{
- *plResult = 0;
+ *plResult = 0;
- UpdateCaption();
+ UpdateCaption();
- return;
+ return;
}
LRESULT CTreePropSheet::OnIsDialogMessage(WPARAM wParam, LPARAM lParam)
{
- MSG *pMsg = reinterpret_cast<MSG*>(lParam);
- if (pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_TAB && GetKeyState(VK_CONTROL)&0x8000)
- {
- if (GetKeyState(VK_SHIFT)&0x8000)
- ActivatePreviousPage();
- else
- ActivateNextPage();
- return TRUE;
- }
+ MSG *pMsg = reinterpret_cast<MSG*>(lParam);
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB && GetKeyState(VK_CONTROL) & 0x8000)
+ {
+ if(GetKeyState(VK_SHIFT) & 0x8000)
+ ActivatePreviousPage();
+ else
+ ActivateNextPage();
+ return TRUE;
+ }
- return __super::DefWindowProc(PSM_ISDIALOGMESSAGE, wParam, lParam);
+ return __super::DefWindowProc(PSM_ISDIALOGMESSAGE, wParam, lParam);
}
} //namespace TreePropSheet
diff --git a/src/ui/TreePropSheet/TreePropSheet.h b/src/ui/TreePropSheet/TreePropSheet.h
index ba98a396e..6bc46a2ef 100644
--- a/src/ui/TreePropSheet/TreePropSheet.h
+++ b/src/ui/TreePropSheet/TreePropSheet.h
@@ -34,15 +34,15 @@ namespace TreePropSheet
{
/**
-A property sheet, which can use a tree control instead of a tab
+A property sheet, which can use a tree control instead of a tab
control, to give the user access to the different pages.
-You can use it exactly the same way, as a CPropertySheet object.
+You can use it exactly the same way, as a CPropertySheet object.
Simply create CPropertyPage objects and add them via AddPage() to
the sheet. If you would like to use the tree view mode (default),
you can specify the path of the pages in the tree, by their name:
-The names of the pages can contain
-double colons ("::"), which will specify the path of that page in the
+The names of the pages can contain
+double colons ("::"), which will specify the path of that page in the
tree control. I.e. if you have three pages with the following names:
1. _T("Appearance::Toolbars")
2. _T("Appearance::Menus")
@@ -57,12 +57,12 @@ Appearance
Directories
\endverbatim
-If you would like to use a double colon, which should not be
+If you would like to use a double colon, which should not be
interpreted as a path seperator, prefix it with a backslash ("\\::").
To disable tree view mode and use the standard tabbed mode, call
the SetTreeViewMode() method. This also allows you, to enable page
-captions and tree images for tree view mode. If you would like to
+captions and tree images for tree view mode. If you would like to
have images in the tree, but not all of your pages specify images or
there are tree view items, which are not attached to a page (only
parent items for real page items), you have to set default images
@@ -79,397 +79,397 @@ via SetEmptyPageText().
class /*AFX_EXT_CLASS*/ CTreePropSheet : public CPropertySheet
{
- DECLARE_DYNAMIC(CTreePropSheet)
+ DECLARE_DYNAMIC(CTreePropSheet)
// Construction/Destruction
public:
- CTreePropSheet();
- CTreePropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
- CTreePropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
- virtual ~CTreePropSheet();
+ CTreePropSheet();
+ CTreePropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+ CTreePropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+ virtual ~CTreePropSheet();
// Operations
public:
- /**
- Call this method, if you would like to use a tree control to browse
- the pages, instead of the tab control.
-
- This method needs to becalled, before DoModal() or Create(). If the
- window has already been created, the method will fail.
-
- @param bTreeViewMode
- Pass TRUE to provide a tree view control instead of a tab control
- to browse the pages, pass FALSE to use the normal tab control.
- @param bPageCaption
- TRUE if a caption should be displayed for each page. The caption
- contains the page title and an icon if specified with the page.
- Ignored if bTreeViewMode is FALSE.
- @param bTreeImages
- TRUE if the page icons should be displayed in the page tree,
- FALSE if there should be no icons in the page tree. Ignored if
- bTreeViewMode is FALSE. If not all of your pages are containing
- icons, or if there will be empty pages (parent nodes without a
- related page, you need to call SetTreeDefaultImages() to avoid
- display errors.
-
- @return
- TRUE on success or FALSE, if the window has already been created.
- */
- BOOL SetTreeViewMode(BOOL bTreeViewMode = TRUE, BOOL bPageCaption = FALSE, BOOL bTreeImages = FALSE);
-
- /**
- Specifies the width of the tree control, when the sheet is in tree
- view mode. The default value (if this method is not called) is 150
- pixels.
-
- This method needs to be called, before DoModeal() or Create().
- Otherwise it will fail.
-
- @param nWidth
- The width in pixels for the page tree.
-
- @return
- TRUE on success, FALSE otherwise (if the window has already been
- created).
- */
- BOOL SetTreeWidth(int nWidth);
-
- /**
- Specifies the text to be drawn on empty pages (pages for tree view
- items, that are not related to a page, because they are only
- parents for other items). This is only needed in tree view mode.
-
- The specified text can contains a single "%s" placeholder which
- will be replaced with the title of the empty page.
- */
- void SetEmptyPageText(LPCTSTR lpszEmptyPageText);
-
- /**
- Allows you to specify, how the empty page message (see
- SetEmptyPageText()) should be drawn.
-
- @param dwFormat
- A combination of the DT_* flags available for the Win32-API
- function DrawText(), that should be used to draw the text.
- The default value is:
- \code
- DT_CENTER|DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE
- \endcode
-
- @return
- The previous format.
- */
- DWORD SetEmptyPageTextFormat(DWORD dwFormat);
-
- //@{
- /**
- Defines the images, that should be used for pages without icons and
- for empty parent nodes. The list contains exactly to images:
- 1. An image that should be used for parent tree nodes, without a
- page asignd.
- 2. An image that should be used for pages, which are not specifying
- any icons.
- Standard image size is 16x16 Pixels, but if you call this method
- before creating the sheet, the size of image 0 in this list will
- be assumed as your preferred image size and all other icons must
- have the same size.
-
- @param pImages
- Pointer to an image list with exactly to images, that should be
- used as default images. The images are copied to an internal
- list, so that the given list can be deleted after this call.
- @param unBitmapID
- Resource identifier for the bitmap, that contains the default
- images. The resource should contain exactly to images.
- @param cx
- Width of a singe image in pixels.
- @param crMask
- Color that should be interpreted as transparent.
-
- @return
- TRUE on success, FALSE otherwise.
- */
- BOOL SetTreeDefaultImages(CImageList *pImages);
- BOOL SetTreeDefaultImages(UINT unBitmapID, int cx, COLORREF crMask);
- //@}
-
- /**
- Returns a pointer to the tree control, when the sheet is in
- tree view mode, NULL otherwise.
- */
- CTreeCtrl* GetPageTreeControl();
+ /**
+ Call this method, if you would like to use a tree control to browse
+ the pages, instead of the tab control.
+
+ This method needs to becalled, before DoModal() or Create(). If the
+ window has already been created, the method will fail.
+
+ @param bTreeViewMode
+ Pass TRUE to provide a tree view control instead of a tab control
+ to browse the pages, pass FALSE to use the normal tab control.
+ @param bPageCaption
+ TRUE if a caption should be displayed for each page. The caption
+ contains the page title and an icon if specified with the page.
+ Ignored if bTreeViewMode is FALSE.
+ @param bTreeImages
+ TRUE if the page icons should be displayed in the page tree,
+ FALSE if there should be no icons in the page tree. Ignored if
+ bTreeViewMode is FALSE. If not all of your pages are containing
+ icons, or if there will be empty pages (parent nodes without a
+ related page, you need to call SetTreeDefaultImages() to avoid
+ display errors.
+
+ @return
+ TRUE on success or FALSE, if the window has already been created.
+ */
+ BOOL SetTreeViewMode(BOOL bTreeViewMode = TRUE, BOOL bPageCaption = FALSE, BOOL bTreeImages = FALSE);
+
+ /**
+ Specifies the width of the tree control, when the sheet is in tree
+ view mode. The default value (if this method is not called) is 150
+ pixels.
+
+ This method needs to be called, before DoModeal() or Create().
+ Otherwise it will fail.
+
+ @param nWidth
+ The width in pixels for the page tree.
+
+ @return
+ TRUE on success, FALSE otherwise (if the window has already been
+ created).
+ */
+ BOOL SetTreeWidth(int nWidth);
+
+ /**
+ Specifies the text to be drawn on empty pages (pages for tree view
+ items, that are not related to a page, because they are only
+ parents for other items). This is only needed in tree view mode.
+
+ The specified text can contains a single "%s" placeholder which
+ will be replaced with the title of the empty page.
+ */
+ void SetEmptyPageText(LPCTSTR lpszEmptyPageText);
+
+ /**
+ Allows you to specify, how the empty page message (see
+ SetEmptyPageText()) should be drawn.
+
+ @param dwFormat
+ A combination of the DT_* flags available for the Win32-API
+ function DrawText(), that should be used to draw the text.
+ The default value is:
+ \code
+ DT_CENTER|DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE
+ \endcode
+
+ @return
+ The previous format.
+ */
+ DWORD SetEmptyPageTextFormat(DWORD dwFormat);
+
+ //@{
+ /**
+ Defines the images, that should be used for pages without icons and
+ for empty parent nodes. The list contains exactly to images:
+ 1. An image that should be used for parent tree nodes, without a
+ page asignd.
+ 2. An image that should be used for pages, which are not specifying
+ any icons.
+ Standard image size is 16x16 Pixels, but if you call this method
+ before creating the sheet, the size of image 0 in this list will
+ be assumed as your preferred image size and all other icons must
+ have the same size.
+
+ @param pImages
+ Pointer to an image list with exactly to images, that should be
+ used as default images. The images are copied to an internal
+ list, so that the given list can be deleted after this call.
+ @param unBitmapID
+ Resource identifier for the bitmap, that contains the default
+ images. The resource should contain exactly to images.
+ @param cx
+ Width of a singe image in pixels.
+ @param crMask
+ Color that should be interpreted as transparent.
+
+ @return
+ TRUE on success, FALSE otherwise.
+ */
+ BOOL SetTreeDefaultImages(CImageList *pImages);
+ BOOL SetTreeDefaultImages(UINT unBitmapID, int cx, COLORREF crMask);
+ //@}
+
+ /**
+ Returns a pointer to the tree control, when the sheet is in
+ tree view mode, NULL otherwise.
+ */
+ CTreeCtrl* GetPageTreeControl();
// Public helpers
public:
- //@{
- /**
- This helper allows you to easily set the icon of a property page.
-
- This static method does nothing more, than extracting the specified
- image as an icon from the given image list and assign the
- icon-handle to the hIcon property of the pages PROPSHEETPAGE
- structure (m_psp) and modify the structures flags, so that the
- image will be recognized.
-
- You need to call this method for a page, before adding the page
- to a property sheet.
-
- @important
- If you are using the CImageList-version, you are responsible for
- destroying the extracted icon with DestroyIcon() or the static
- DestroyPageIcon() method.
-
- @see DestroyPageIcon()
-
- @param pPage
- Property page to set the image for.
- @param hIcon
- Handle to icon that should be set for the page.
- @param unIconId
- Ressource identifier for the icon to set.
- @param Images
- Reference of the image list to extract the icon from.
- @param nImage
- Zero based index of the image in pImages, that should be used
- as an icon.
-
- @return
- TRUE on success, FALSE if an error occured.
- */
- static BOOL SetPageIcon(CPropertyPage *pPage, HICON hIcon);
- static BOOL SetPageIcon(CPropertyPage *pPage, UINT unIconId);
- static BOOL SetPageIcon(CPropertyPage *pPage, CImageList &Images, int nImage);
- //@}
-
- /**
- Checks, if the PSP_USEHICON flag is set in the PROPSHEETPAGE struct;
- If this is the case, the flag will be removed and the icon
- specified by the hIcon attribute of the PROPSHEETPAGE struct will
- be destroyed using DestroyIcon().
-
- @note
- You only have to call DestroyIcon() for icons, that have been
- created using CreateIconIndirect() (i.e. used by
- CImageList::ExtractIcon()).
-
- @return
- TRUE on success, FALSE if the PSP_USEHICON flag was not set or
- if the icon handle was NULL.
- */
- static BOOL DestroyPageIcon(CPropertyPage *pPage);
+ //@{
+ /**
+ This helper allows you to easily set the icon of a property page.
+
+ This static method does nothing more, than extracting the specified
+ image as an icon from the given image list and assign the
+ icon-handle to the hIcon property of the pages PROPSHEETPAGE
+ structure (m_psp) and modify the structures flags, so that the
+ image will be recognized.
+
+ You need to call this method for a page, before adding the page
+ to a property sheet.
+
+ @important
+ If you are using the CImageList-version, you are responsible for
+ destroying the extracted icon with DestroyIcon() or the static
+ DestroyPageIcon() method.
+
+ @see DestroyPageIcon()
+
+ @param pPage
+ Property page to set the image for.
+ @param hIcon
+ Handle to icon that should be set for the page.
+ @param unIconId
+ Ressource identifier for the icon to set.
+ @param Images
+ Reference of the image list to extract the icon from.
+ @param nImage
+ Zero based index of the image in pImages, that should be used
+ as an icon.
+
+ @return
+ TRUE on success, FALSE if an error occured.
+ */
+ static BOOL SetPageIcon(CPropertyPage *pPage, HICON hIcon);
+ static BOOL SetPageIcon(CPropertyPage *pPage, UINT unIconId);
+ static BOOL SetPageIcon(CPropertyPage *pPage, CImageList &Images, int nImage);
+ //@}
+
+ /**
+ Checks, if the PSP_USEHICON flag is set in the PROPSHEETPAGE struct;
+ If this is the case, the flag will be removed and the icon
+ specified by the hIcon attribute of the PROPSHEETPAGE struct will
+ be destroyed using DestroyIcon().
+
+ @note
+ You only have to call DestroyIcon() for icons, that have been
+ created using CreateIconIndirect() (i.e. used by
+ CImageList::ExtractIcon()).
+
+ @return
+ TRUE on success, FALSE if the PSP_USEHICON flag was not set or
+ if the icon handle was NULL.
+ */
+ static BOOL DestroyPageIcon(CPropertyPage *pPage);
// Overridable implementation helpers
protected:
- /**
- Will be called to generate the message, that should be displayed on
- an empty page, when the sheet is in tree view mode
+ /**
+ Will be called to generate the message, that should be displayed on
+ an empty page, when the sheet is in tree view mode
- This default implementation simply returns lpszEmptyPageMessage
- with the optional "%s" placeholder replaced by lpszCaption.
+ This default implementation simply returns lpszEmptyPageMessage
+ with the optional "%s" placeholder replaced by lpszCaption.
- @param lpszEmptyPageMessage
- The string, set by SetEmptyPageMessage(). This string may contain
- a "%s" placeholder.
- @param lpszCaption
- The title of the empty page.
- */
- virtual CString GenerateEmptyPageMessage(LPCTSTR lpszEmptyPageMessage, LPCTSTR lpszCaption);
+ @param lpszEmptyPageMessage
+ The string, set by SetEmptyPageMessage(). This string may contain
+ a "%s" placeholder.
+ @param lpszCaption
+ The title of the empty page.
+ */
+ virtual CString GenerateEmptyPageMessage(LPCTSTR lpszEmptyPageMessage, LPCTSTR lpszCaption);
- /**
- Will be called during creation process, to create the CTreeCtrl
- object (the object, not the window!).
+ /**
+ Will be called during creation process, to create the CTreeCtrl
+ object (the object, not the window!).
- Allows you to inject your own CTreeCtrl-derived classes.
+ Allows you to inject your own CTreeCtrl-derived classes.
- This default implementation simply creates a CTreeCtrl with new
- and returns it.
- */
- virtual CTreeCtrl* CreatePageTreeObject();
+ This default implementation simply creates a CTreeCtrl with new
+ and returns it.
+ */
+ virtual CTreeCtrl* CreatePageTreeObject();
- /**
- Will be called during creation process, to create the object, that
- is responsible for drawing the frame around the pages, drawing the
- empty page message and the caption.
+ /**
+ Will be called during creation process, to create the object, that
+ is responsible for drawing the frame around the pages, drawing the
+ empty page message and the caption.
- Allows you to inject your own CPropPageFrame-derived classes.
+ Allows you to inject your own CPropPageFrame-derived classes.
- This default implementation simply creates a CPropPageFrameTab with
- new and returns it.
- */
- virtual CPropPageFrame* CreatePageFrame();
+ This default implementation simply creates a CPropPageFrameTab with
+ new and returns it.
+ */
+ virtual CPropPageFrame* CreatePageFrame();
// Implementation helpers
protected:
- /**
- Moves all childs by the specified amount of pixels.
-
- @param nDx
- Pixels to move the childs in horizontal direction (can be
- negative).
- @param nDy
- Pixels to move the childs in vertical direction (can be
- negative).
- */
- void MoveChildWindows(int nDx, int nDy);
-
- /**
- Refills the tree that contains the entries for the several pages.
- */
- void RefillPageTree();
-
- /**
- Creates the specified path in the page tree and returns the handle
- of the most child item created.
-
- @param lpszPath
- Path of the item to create (see description of this class).
- @param hParentItem
- Handle of the item under which the path should be created or
- TVI_ROOT to start from the root.
- */
- HTREEITEM CreatePageTreeItem(LPCTSTR lpszPath, HTREEITEM hParent = TVI_ROOT);
-
- /**
- Splits the given path into the topmost item and the rest. See
- description of this class for detailed path information.
-
- I.e. when given the string "Appearance::Toolbars::Customize", the
- method will return "Appearance" and after the call strRest will
- be "Toolbars::Customize".
- */
- CString SplitPageTreePath(CString &strRest);
-
- /**
- Tries to deactivate the current page, and hides it if successfull,
- so that an empty page becomes visible.
-
- @return
- TRUE if the current page has been deactivated successfully,
- FALSE if the currently active page prevents a page change.
- */
- BOOL KillActiveCurrentPage();
-
- /**
- Returns the page tree item, that representates the specified page
- or NULL, if no such icon exists.
-
- @param nPage
- Zero based page index, for which the item to retrieve.
- @param hRoot
- Item to start the search at or TVI_ROOT to search the whole
- tree.
- */
- HTREEITEM GetPageTreeItem(int nPage, HTREEITEM hRoot = TVI_ROOT);
-
- /**
- Selects and shows the item, representing the specified page.
-
- @param nPage
- Zero based page index.
-
- @return
- TRUE on success, FALSE if no item does exist for the specified
- page.
- */
- BOOL SelectPageTreeItem(int nPage);
-
- /**
- Selects and shows the tree item for the currently active page.
-
- @return
- TRUE on success, FALSE if no item exists for the currently active
- page or if it was not possible to get information about the
- currently active page.
- */
- BOOL SelectCurrentPageTreeItem();
-
- /**
- Updates the caption for the currently selected page (if the caption
- is enabled).
- */
- void UpdateCaption();
-
- /**
- Activates the previous page in the page order or the last one, if
- the current one is the first.
-
- This method does never fail.
- */
- void ActivatePreviousPage();
-
- /**
- Activates the next page in the page order or the first one, if the
- current one is the last.
-
- This method does never fail.
- */
- void ActivateNextPage();
+ /**
+ Moves all childs by the specified amount of pixels.
+
+ @param nDx
+ Pixels to move the childs in horizontal direction (can be
+ negative).
+ @param nDy
+ Pixels to move the childs in vertical direction (can be
+ negative).
+ */
+ void MoveChildWindows(int nDx, int nDy);
+
+ /**
+ Refills the tree that contains the entries for the several pages.
+ */
+ void RefillPageTree();
+
+ /**
+ Creates the specified path in the page tree and returns the handle
+ of the most child item created.
+
+ @param lpszPath
+ Path of the item to create (see description of this class).
+ @param hParentItem
+ Handle of the item under which the path should be created or
+ TVI_ROOT to start from the root.
+ */
+ HTREEITEM CreatePageTreeItem(LPCTSTR lpszPath, HTREEITEM hParent = TVI_ROOT);
+
+ /**
+ Splits the given path into the topmost item and the rest. See
+ description of this class for detailed path information.
+
+ I.e. when given the string "Appearance::Toolbars::Customize", the
+ method will return "Appearance" and after the call strRest will
+ be "Toolbars::Customize".
+ */
+ CString SplitPageTreePath(CString &strRest);
+
+ /**
+ Tries to deactivate the current page, and hides it if successfull,
+ so that an empty page becomes visible.
+
+ @return
+ TRUE if the current page has been deactivated successfully,
+ FALSE if the currently active page prevents a page change.
+ */
+ BOOL KillActiveCurrentPage();
+
+ /**
+ Returns the page tree item, that representates the specified page
+ or NULL, if no such icon exists.
+
+ @param nPage
+ Zero based page index, for which the item to retrieve.
+ @param hRoot
+ Item to start the search at or TVI_ROOT to search the whole
+ tree.
+ */
+ HTREEITEM GetPageTreeItem(int nPage, HTREEITEM hRoot = TVI_ROOT);
+
+ /**
+ Selects and shows the item, representing the specified page.
+
+ @param nPage
+ Zero based page index.
+
+ @return
+ TRUE on success, FALSE if no item does exist for the specified
+ page.
+ */
+ BOOL SelectPageTreeItem(int nPage);
+
+ /**
+ Selects and shows the tree item for the currently active page.
+
+ @return
+ TRUE on success, FALSE if no item exists for the currently active
+ page or if it was not possible to get information about the
+ currently active page.
+ */
+ BOOL SelectCurrentPageTreeItem();
+
+ /**
+ Updates the caption for the currently selected page (if the caption
+ is enabled).
+ */
+ void UpdateCaption();
+
+ /**
+ Activates the previous page in the page order or the last one, if
+ the current one is the first.
+
+ This method does never fail.
+ */
+ void ActivatePreviousPage();
+
+ /**
+ Activates the next page in the page order or the first one, if the
+ current one is the last.
+
+ This method does never fail.
+ */
+ void ActivateNextPage();
// Overridings
protected:
- //{{AFX_VIRTUAL(CTreePropSheet)
- public:
- virtual BOOL OnInitDialog();
- //}}AFX_VIRTUAL
+ //{{AFX_VIRTUAL(CTreePropSheet)
+public:
+ virtual BOOL OnInitDialog();
+ //}}AFX_VIRTUAL
// Message handlers
protected:
- //{{AFX_MSG(CTreePropSheet)
- afx_msg void OnDestroy();
- //}}AFX_MSG
- afx_msg LRESULT OnAddPage(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnRemovePage(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnSetCurSel(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnSetCurSelId(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnIsDialogMessage(WPARAM wParam, LPARAM lParam);
-
- afx_msg void OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult);
- afx_msg void OnPageTreeSelChanged(NMHDR *pNotifyStruct, LRESULT *plResult);
- DECLARE_MESSAGE_MAP()
+ //{{AFX_MSG(CTreePropSheet)
+ afx_msg void OnDestroy();
+ //}}AFX_MSG
+ afx_msg LRESULT OnAddPage(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnRemovePage(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnSetCurSel(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnSetCurSelId(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnIsDialogMessage(WPARAM wParam, LPARAM lParam);
+
+ afx_msg void OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult);
+ afx_msg void OnPageTreeSelChanged(NMHDR *pNotifyStruct, LRESULT *plResult);
+ DECLARE_MESSAGE_MAP()
// Properties
private:
- /** TRUE if we should use the tree control instead of the tab ctrl. */
- BOOL m_bTreeViewMode;
+ /** TRUE if we should use the tree control instead of the tab ctrl. */
+ BOOL m_bTreeViewMode;
- /** The tree control */
- CTreeCtrl *m_pwndPageTree;
+ /** The tree control */
+ CTreeCtrl *m_pwndPageTree;
- /** The frame around the pages */
- CPropPageFrame *m_pFrame;
+ /** The frame around the pages */
+ CPropPageFrame *m_pFrame;
- /**
- TRUE, if a tree item selection by OnPageTreeSelChanged() is
- performed currently.
- */
- BOOL m_bPageTreeSelChangedActive;
+ /**
+ TRUE, if a tree item selection by OnPageTreeSelChanged() is
+ performed currently.
+ */
+ BOOL m_bPageTreeSelChangedActive;
- /** TRUE if a page caption should be displayed, FALSE otherwise. */
- BOOL m_bPageCaption;
+ /** TRUE if a page caption should be displayed, FALSE otherwise. */
+ BOOL m_bPageCaption;
- /** TRUE if images should be displayed in the tree. */
- BOOL m_bTreeImages;
+ /** TRUE if images should be displayed in the tree. */
+ BOOL m_bTreeImages;
- /** Images to be displayed in the tree control. */
- CImageList m_Images;
+ /** Images to be displayed in the tree control. */
+ CImageList m_Images;
- /** Default images. */
- CImageList m_DefaultImages;
+ /** Default images. */
+ CImageList m_DefaultImages;
- /**
- Message to be displayed on empty pages. May contain a "%s"
- placeholder which will be replaced by the caption of the empty
- page.
- */
- CString m_strEmptyPageMessage;
+ /**
+ Message to be displayed on empty pages. May contain a "%s"
+ placeholder which will be replaced by the caption of the empty
+ page.
+ */
+ CString m_strEmptyPageMessage;
- /** The width of the page tree control in pixels. */
- int m_nPageTreeWidth;
+ /** The width of the page tree control in pixels. */
+ int m_nPageTreeWidth;
// Static Properties
private:
- /** The id of the tree view control, that shows the pages. */
- static const UINT s_unPageTreeId;
+ /** The id of the tree view control, that shows the pages. */
+ static const UINT s_unPageTreeId;
};
diff --git a/src/ui/sizecbar/scbarcf.cpp b/src/ui/sizecbar/scbarcf.cpp
index 776555c15..98d464f88 100644
--- a/src/ui/sizecbar/scbarcf.cpp
+++ b/src/ui/sizecbar/scbarcf.cpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////
//
// CSizingControlBarCF Version 2.43
-//
+//
// Created: Dec 21, 1998 Last Modified: August 03, 2000
//
// See the official site at www.datamekanix.com for documentation and
@@ -10,7 +10,7 @@
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
//
-// This code is free for personal and commercial use, providing this
+// This code is free for personal and commercial use, providing this
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
@@ -46,7 +46,7 @@ int CALLBACK EnumFontFamProc(ENUMLOGFONT FAR *lpelf,
return 0;
}
-
+
CSizingControlBarCF::CSizingControlBarCF()
{
m_bActive = FALSE;
@@ -55,11 +55,11 @@ CSizingControlBarCF::CSizingControlBarCF()
dc.CreateCompatibleDC(NULL);
m_sFontFace = (::EnumFontFamilies(dc.m_hDC,
- _T("Tahoma"), (FONTENUMPROC) EnumFontFamProc, 0) == 0) ?
- _T("Tahoma") : _T("Arial");
+ _T("Tahoma"), (FONTENUMPROC) EnumFontFamProc, 0) == 0) ?
+ _T("Tahoma") : _T("Arial");
dc.DeleteDC();
-
+
}
BEGIN_MESSAGE_MAP(CSizingControlBarCF, baseCSizingControlBarCF)
@@ -72,7 +72,7 @@ void CSizingControlBarCF::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHnd
{
baseCSizingControlBarCF::OnUpdateCmdUI(pTarget, bDisableIfNoHndler);
- if (!HasGripper())
+ if(!HasGripper())
return;
BOOL bNeedPaint = FALSE;
@@ -82,10 +82,10 @@ void CSizingControlBarCF::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHnd
m_bActive = (pFocus->GetSafeHwnd() && IsChild(pFocus));
- if (m_bActive != bActiveOld)
+ if(m_bActive != bActiveOld)
bNeedPaint = TRUE;
- if (bNeedPaint)
+ if(bNeedPaint)
SendMessage(WM_NCPAINT);
}
@@ -98,21 +98,23 @@ void CSizingControlBarCF::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHnd
void CSizingControlBarCF::NcPaintGripper(CDC* pDC, CRect rcClient)
{
- if (!HasGripper())
+ if(!HasGripper())
return;
// compute the caption rectangle
BOOL bHorz = IsHorzDocked();
CRect rcGrip = rcClient;
CRect rcBtn = m_biHide.GetRect();
- if (bHorz)
- { // right side gripper
+ if(bHorz)
+ {
+ // right side gripper
rcGrip.left -= m_cyGripper + 1;
rcGrip.right = rcGrip.left + 11;
rcGrip.top = rcBtn.bottom + 3;
}
else
- { // gripper at top
+ {
+ // gripper at top
rcGrip.top -= m_cyGripper + 1;
rcGrip.bottom = rcGrip.top + 11;
rcGrip.right = rcBtn.left - 3;
@@ -122,28 +124,28 @@ void CSizingControlBarCF::NcPaintGripper(CDC* pDC, CRect rcClient)
// draw the caption background
//CBrush br;
COLORREF clrCptn = m_bActive ?
- ::GetSysColor(COLOR_ACTIVECAPTION) :
- ::GetSysColor(COLOR_INACTIVECAPTION);
+ ::GetSysColor(COLOR_ACTIVECAPTION) :
+ ::GetSysColor(COLOR_INACTIVECAPTION);
// query gradient info (usually TRUE for Win98/Win2k)
BOOL bGradient = FALSE;
::SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &bGradient, 0);
-
- if (!bGradient)
+
+ if(!bGradient)
pDC->FillSolidRect(&rcGrip, clrCptn); // solid color
else
{
// gradient from left to right or from bottom to top
// get second gradient color (the right end)
COLORREF clrCptnRight = m_bActive ?
- ::GetSysColor(COLOR_GRADIENTACTIVECAPTION) :
- ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION);
+ ::GetSysColor(COLOR_GRADIENTACTIVECAPTION) :
+ ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION);
// this will make 2^6 = 64 fountain steps
int nShift = 6;
int nSteps = 1 << nShift;
- for (int i = 0; i < nSteps; i++)
+ for(int i = 0; i < nSteps; i++)
{
// do a little alpha blending
int nR = (GetRValue(clrCptn) * (nSteps - i) +
@@ -157,22 +159,22 @@ void CSizingControlBarCF::NcPaintGripper(CDC* pDC, CRect rcClient)
// then paint with the resulting color
CRect r2 = rcGrip;
- if (bHorz)
+ if(bHorz)
{
- r2.bottom = rcGrip.bottom -
- ((i * rcGrip.Height()) >> nShift);
- r2.top = rcGrip.bottom -
- (((i + 1) * rcGrip.Height()) >> nShift);
- if (r2.Height() > 0)
+ r2.bottom = rcGrip.bottom -
+ ((i * rcGrip.Height()) >> nShift);
+ r2.top = rcGrip.bottom -
+ (((i + 1) * rcGrip.Height()) >> nShift);
+ if(r2.Height() > 0)
pDC->FillSolidRect(r2, cr);
}
else
{
- r2.left = rcGrip.left +
- ((i * rcGrip.Width()) >> nShift);
- r2.right = rcGrip.left +
- (((i + 1) * rcGrip.Width()) >> nShift);
- if (r2.Width() > 0)
+ r2.left = rcGrip.left +
+ ((i * rcGrip.Width()) >> nShift);
+ r2.right = rcGrip.left +
+ (((i + 1) * rcGrip.Width()) >> nShift);
+ if(r2.Width() > 0)
pDC->FillSolidRect(r2, cr);
}
}
@@ -185,17 +187,17 @@ void CSizingControlBarCF::NcPaintGripper(CDC* pDC, CRect rcClient)
LOGFONT lf;
BOOL bFont = font.CreatePointFont(pointsize, m_sFontFace);
- if (bFont)
+ if(bFont)
{
// get the text color
COLORREF clrCptnText = m_bActive ?
- ::GetSysColor(COLOR_CAPTIONTEXT) :
- ::GetSysColor(COLOR_INACTIVECAPTIONTEXT);
+ ::GetSysColor(COLOR_CAPTIONTEXT) :
+ ::GetSysColor(COLOR_INACTIVECAPTIONTEXT);
int nOldBkMode = pDC->SetBkMode(TRANSPARENT);
COLORREF clrOldText = pDC->SetTextColor(clrCptnText);
- if (bHorz)
+ if(bHorz)
{
// rotate text 90 degrees CCW if horizontally docked
font.GetLogFont(&lf);
@@ -203,17 +205,17 @@ void CSizingControlBarCF::NcPaintGripper(CDC* pDC, CRect rcClient)
lf.lfEscapement = 900;
font.CreateFontIndirect(&lf);
}
-
+
CFont* pOldFont = pDC->SelectObject(&font);
CString sTitle;
GetWindowText(sTitle);
CPoint ptOrg = bHorz ?
- CPoint(rcGrip.left - 1, rcGrip.bottom - 3) :
- CPoint(rcGrip.left + 3, rcGrip.top - 1);
+ CPoint(rcGrip.left - 1, rcGrip.bottom - 3) :
+ CPoint(rcGrip.left + 3, rcGrip.top - 1);
pDC->ExtTextOut(ptOrg.x, ptOrg.y,
- ETO_CLIPPED, rcGrip, sTitle, NULL);
+ ETO_CLIPPED, rcGrip, sTitle, NULL);
pDC->SelectObject(pOldFont);
pDC->SetBkMode(nOldBkMode);
diff --git a/src/ui/sizecbar/scbarcf.h b/src/ui/sizecbar/scbarcf.h
index 3fb36bfcf..8ab1f7b67 100644
--- a/src/ui/sizecbar/scbarcf.h
+++ b/src/ui/sizecbar/scbarcf.h
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////
//
// CSizingControlBarCF Version 2.43
-//
+//
// Created: Dec 21, 1998 Last Modified: August 03, 2000
//
// See the official site at www.datamekanix.com for documentation and
@@ -10,7 +10,7 @@
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
//
-// This code is free for personal and commercial use, providing this
+// This code is free for personal and commercial use, providing this
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
diff --git a/src/ui/sizecbar/scbarg.cpp b/src/ui/sizecbar/scbarg.cpp
index 50453e395..594026541 100644
--- a/src/ui/sizecbar/scbarg.cpp
+++ b/src/ui/sizecbar/scbarg.cpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////
//
// CSizingControlBarG Version 2.43
-//
+//
// Created: Jan 24, 1998 Last Modified: August 03, 2000
//
// See the official site at www.datamekanix.com for documentation and
@@ -10,7 +10,7 @@
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
//
-// This code is free for personal and commercial use, providing this
+// This code is free for personal and commercial use, providing this
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
@@ -64,7 +64,7 @@ END_MESSAGE_MAP()
void CSizingControlBarG::OnNcLButtonUp(UINT nHitTest, CPoint point)
{
- if (nHitTest == HTCLOSE)
+ if(nHitTest == HTCLOSE)
m_pDockSite->ShowControlBar(this, FALSE, FALSE); // hide
baseCSizingControlBarG::OnNcLButtonUp(nHitTest, point);
@@ -77,7 +77,7 @@ void CSizingControlBarG::NcCalcClient(LPRECT pRc, UINT nDockBarID)
// subtract edges
baseCSizingControlBarG::NcCalcClient(pRc, nDockBarID);
- if (!HasGripper())
+ if(!HasGripper())
return;
CRect rc(pRc); // the client rect as calculated by the base class
@@ -85,14 +85,14 @@ void CSizingControlBarG::NcCalcClient(LPRECT pRc, UINT nDockBarID)
BOOL bHorz = (nDockBarID == AFX_IDW_DOCKBAR_TOP) ||
(nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
- if (bHorz)
+ if(bHorz)
rc.DeflateRect(m_cyGripper, 0, 0, 0);
else
rc.DeflateRect(0, m_cyGripper, 0, 0);
// set position for the "x" (hide bar) button
CPoint ptOrgBtn;
- if (bHorz)
+ if(bHorz)
ptOrgBtn = CPoint(rc.left - 13, rc.top);
else
ptOrgBtn = CPoint(rc.right - 12, rc.top - 13);
@@ -104,7 +104,7 @@ void CSizingControlBarG::NcCalcClient(LPRECT pRc, UINT nDockBarID)
void CSizingControlBarG::NcPaintGripper(CDC* pDC, CRect rcClient)
{
- if (!HasGripper())
+ if(!HasGripper())
return;
// paints a simple "two raised lines" gripper
@@ -114,26 +114,28 @@ void CSizingControlBarG::NcPaintGripper(CDC* pDC, CRect rcClient)
BOOL bHorz = IsHorzDocked();
gripper.DeflateRect(1, 1);
- if (bHorz)
- { // gripper at left
+ if(bHorz)
+ {
+ // gripper at left
gripper.left -= m_cyGripper;
gripper.right = gripper.left + 3;
gripper.top = rcbtn.bottom + 3;
}
else
- { // gripper at top
+ {
+ // gripper at top
gripper.top -= m_cyGripper;
gripper.bottom = gripper.top + 3;
gripper.right = rcbtn.left - 3;
}
pDC->Draw3dRect(gripper, ::GetSysColor(COLOR_BTNHIGHLIGHT),
- ::GetSysColor(COLOR_BTNSHADOW));
+ ::GetSysColor(COLOR_BTNSHADOW));
gripper.OffsetRect(bHorz ? 3 : 0, bHorz ? 0 : 3);
pDC->Draw3dRect(gripper, ::GetSysColor(COLOR_BTNHIGHLIGHT),
- ::GetSysColor(COLOR_BTNSHADOW));
+ ::GetSysColor(COLOR_BTNSHADOW));
m_biHide.Paint(pDC);
}
@@ -144,12 +146,12 @@ LRESULT CSizingControlBarG::OnNcHitTest(CPoint point)
GetWindowRect(rcBar);
LRESULT nRet = baseCSizingControlBarG::OnNcHitTest(point);
- if (nRet != HTCLIENT)
+ if(nRet != HTCLIENT)
return nRet;
CRect rc = m_biHide.GetRect();
rc.OffsetRect(rcBar.TopLeft());
- if (rc.PtInRect(point))
+ if(rc.PtInRect(point))
return HTCLOSE;
return HTCLIENT;
@@ -159,12 +161,12 @@ LRESULT CSizingControlBarG::OnNcHitTest(CPoint point)
// CSizingControlBarG implementation helpers
void CSizingControlBarG::OnUpdateCmdUI(CFrameWnd* pTarget,
- BOOL bDisableIfNoHndler)
+ BOOL bDisableIfNoHndler)
{
UNUSED_ALWAYS(bDisableIfNoHndler);
UNUSED_ALWAYS(pTarget);
- if (!HasGripper())
+ if(!HasGripper())
return;
BOOL bNeedPaint = FALSE;
@@ -183,7 +185,7 @@ void CSizingControlBarG::OnUpdateCmdUI(CFrameWnd* pTarget,
bNeedPaint |= (m_biHide.bPushed ^ bWasPushed) ||
(m_biHide.bRaised ^ bWasRaised);
- if (bNeedPaint)
+ if(bNeedPaint)
SendMessage(WM_NCPAINT);
}
@@ -200,13 +202,12 @@ void CSCBButton::Paint(CDC* pDC)
{
CRect rc = GetRect();
- if (bPushed)
+ if(bPushed)
pDC->Draw3dRect(rc, ::GetSysColor(COLOR_BTNSHADOW),
- ::GetSysColor(COLOR_BTNHIGHLIGHT));
- else
- if (bRaised)
- pDC->Draw3dRect(rc, ::GetSysColor(COLOR_BTNHIGHLIGHT),
- ::GetSysColor(COLOR_BTNSHADOW));
+ ::GetSysColor(COLOR_BTNHIGHLIGHT));
+ else if(bRaised)
+ pDC->Draw3dRect(rc, ::GetSysColor(COLOR_BTNHIGHLIGHT),
+ ::GetSysColor(COLOR_BTNSHADOW));
COLORREF clrOldTextColor = pDC->GetTextColor();
pDC->SetTextColor(::GetSysColor(COLOR_BTNTEXT));
@@ -228,7 +229,7 @@ BOOL CSizingControlBarG::HasGripper() const
{
#if defined(_SCB_MINIFRAME_CAPTION) || !defined(_SCB_REPLACE_MINIFRAME)
// if the miniframe has a caption, don't display the gripper
- if (IsFloating())
+ if(IsFloating())
return FALSE;
#endif //_SCB_MINIFRAME_CAPTION
diff --git a/src/ui/sizecbar/scbarg.h b/src/ui/sizecbar/scbarg.h
index 316633565..1e73983ee 100644
--- a/src/ui/sizecbar/scbarg.h
+++ b/src/ui/sizecbar/scbarg.h
@@ -10,7 +10,7 @@
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
//
-// This code is free for personal and commercial use, providing this
+// This code is free for personal and commercial use, providing this
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
@@ -43,8 +43,14 @@ class CSCBButton
public:
CSCBButton();
- void Move(CPoint ptTo) {ptOrg = ptTo; };
- CRect GetRect() { return CRect(ptOrg, CSize(11, 11)); };
+ void Move(CPoint ptTo)
+ {
+ ptOrg = ptTo;
+ };
+ CRect GetRect()
+ {
+ return CRect(ptOrg, CSize(11, 11));
+ };
void Paint(CDC* pDC);
BOOL bPushed;
@@ -88,7 +94,7 @@ public:
// Implementation
public:
virtual ~CSizingControlBarG();
-
+
protected:
// implementation helpers
virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
diff --git a/src/ui/sizecbar/sizecbar.cpp b/src/ui/sizecbar/sizecbar.cpp
index 7f459adca..c286bbdf7 100644
--- a/src/ui/sizecbar/sizecbar.cpp
+++ b/src/ui/sizecbar/sizecbar.cpp
@@ -10,7 +10,7 @@
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
//
-// This code is free for personal and commercial use, providing this
+// This code is free for personal and commercial use, providing this
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
@@ -38,7 +38,7 @@
// Acknowledgements:
// o Thanks to Harlan R. Seymour for his continuous support during
// development of this code.
-// o Thanks to Dundas Software for the opportunity
+// o Thanks to Dundas Software for the opportunity
// to test this code on real-life applications.
// o Some ideas for the gripper came from the CToolBarEx flat toolbar
// by Joerg Koenig. Thanks, Joerg!
@@ -126,20 +126,20 @@ BOOL CSizingControlBar::Create(LPCTSTR lpszWindowName,
ASSERT_VALID(pParentWnd);
// cannot be both fixed and dynamic
// (CBRS_SIZE_DYNAMIC is used for resizng when floating)
- ASSERT (!((dwStyle & CBRS_SIZE_FIXED) &&
- (dwStyle & CBRS_SIZE_DYNAMIC)));
+ ASSERT(!((dwStyle & CBRS_SIZE_FIXED) &&
+ (dwStyle & CBRS_SIZE_DYNAMIC)));
m_dwStyle = dwStyle & CBRS_ALL; // save the control bar styles
// register and create the window - skip CControlBar::Create()
CString wndclass = ::AfxRegisterWndClass(CS_DBLCLKS,
- ::LoadCursor(NULL, IDC_ARROW),
- ::GetSysColorBrush(COLOR_BTNFACE), 0);
+ ::LoadCursor(NULL, IDC_ARROW),
+ ::GetSysColorBrush(COLOR_BTNFACE), 0);
dwStyle &= ~CBRS_ALL; // keep only the generic window styles
dwStyle |= WS_CLIPCHILDREN; // prevents flashing
- if (!CWnd::Create(wndclass, lpszWindowName, dwStyle,
- CRect(0, 0, 0, 0), pParentWnd, nID))
+ if(!CWnd::Create(wndclass, lpszWindowName, dwStyle,
+ CRect(0, 0, 0, 0), pParentWnd, nID))
return FALSE;
return TRUE;
@@ -151,18 +151,18 @@ BOOL CSizingControlBar::Create(LPCTSTR lpszWindowName,
void CSizingControlBar::EnableDocking(DWORD dwDockStyle)
{
// must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
- ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
+ ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY | CBRS_FLOAT_MULTI)) == 0);
// cannot have the CBRS_FLOAT_MULTI style
ASSERT((dwDockStyle & CBRS_FLOAT_MULTI) == 0);
// the bar must have CBRS_SIZE_DYNAMIC style
ASSERT((m_dwStyle & CBRS_SIZE_DYNAMIC) != 0);
m_dwDockStyle = dwDockStyle;
- if (m_pDockContext == NULL)
+ if(m_pDockContext == NULL)
m_pDockContext = DNew CSCBDockContext(this);
// permanently wire the bar's owner to its current parent
- if (m_hWndOwner == NULL)
+ if(m_hWndOwner == NULL)
m_hWndOwner = ::GetParent(m_hWnd);
}
#endif
@@ -170,16 +170,16 @@ void CSizingControlBar::EnableDocking(DWORD dwDockStyle)
/////////////////////////////////////////////////////////////////////////
// CSizingControlBar message handlers
-int CSizingControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
+int CSizingControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if (baseCSizingControlBar::OnCreate(lpCreateStruct) == -1)
+ if(baseCSizingControlBar::OnCreate(lpCreateStruct) == -1)
return -1;
// query SPI_GETDRAGFULLWINDOWS system parameter
// OnSettingChange() will update m_bDragShowContent
m_bDragShowContent = FALSE;
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0,
- &m_bDragShowContent, 0);
+ &m_bDragShowContent, 0);
// uncomment this line if you want raised borders
// m_dwSCBStyle |= SCBS_SHOWEDGES;
@@ -194,8 +194,8 @@ LRESULT CSizingControlBar::OnSetText(WPARAM wParam, LPARAM lParam)
LRESULT lResult = CWnd::Default();
- if (IsFloating() &&
- GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)))
+ if(IsFloating() &&
+ GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)))
{
m_pDockBar->SetWindowText((LPCTSTR) lParam); // update dockbar
GetParentFrame()->DelayRecalcLayout(); // refresh miniframe
@@ -212,13 +212,13 @@ const BOOL CSizingControlBar::IsFloating() const
const BOOL CSizingControlBar::IsHorzDocked() const
{
return (m_nDockBarID == AFX_IDW_DOCKBAR_TOP ||
- m_nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
+ m_nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
}
const BOOL CSizingControlBar::IsVertDocked() const
{
return (m_nDockBarID == AFX_IDW_DOCKBAR_LEFT ||
- m_nDockBarID == AFX_IDW_DOCKBAR_RIGHT);
+ m_nDockBarID == AFX_IDW_DOCKBAR_RIGHT);
}
const BOOL CSizingControlBar::IsSideTracking() const
@@ -227,19 +227,19 @@ const BOOL CSizingControlBar::IsSideTracking() const
ASSERT(m_bTracking && !IsFloating());
return (m_htEdge == HTLEFT || m_htEdge == HTRIGHT) ?
- IsHorzDocked() : IsVertDocked();
+ IsHorzDocked() : IsVertDocked();
}
CSize CSizingControlBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
{
- if (bStretch) // the bar is stretched (is not the child of a dockbar)
- if (bHorz)
+ if(bStretch) // the bar is stretched (is not the child of a dockbar)
+ if(bHorz)
return CSize(32767, m_szHorz.cy);
else
return CSize(m_szVert.cx, 32767);
// dirty cast - we need access to protected CDockBar members
- CSCBDockBar* pDockBar = static_cast<CSCBDockBar*> (m_pDockBar);
+ CSCBDockBar* pDockBar = static_cast<CSCBDockBar*>(m_pDockBar);
// force imediate RecalcDelayShow() for all sizing bars on the row
// with delayShow/delayHide flags set to avoid IsVisible() problems
@@ -247,27 +247,27 @@ CSize CSizingControlBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
GetRowSizingBars(arrSCBars);
AFX_SIZEPARENTPARAMS layout;
layout.hDWP = pDockBar->m_bLayoutQuery ?
- NULL : ::BeginDeferWindowPos(arrSCBars.GetSize());
- for (int i = 0; i < arrSCBars.GetSize(); i++)
- if (arrSCBars[i]->m_nStateFlags & (delayHide|delayShow))
+ NULL : ::BeginDeferWindowPos(arrSCBars.GetSize());
+ for(int i = 0; i < arrSCBars.GetSize(); i++)
+ if(arrSCBars[i]->m_nStateFlags & (delayHide | delayShow))
arrSCBars[i]->RecalcDelayShow(&layout);
- if (layout.hDWP != NULL)
+ if(layout.hDWP != NULL)
::EndDeferWindowPos(layout.hDWP);
// get available length
CRect rc = pDockBar->m_rectLayout;
- if (rc.IsRectEmpty())
+ if(rc.IsRectEmpty())
m_pDockSite->GetClientRect(&rc);
int nLengthTotal = bHorz ? rc.Width() + 2 : rc.Height() - 2;
- if (IsVisible() && !IsFloating() &&
- m_bParentSizing && arrSCBars[0] == this)
- if (NegotiateSpace(nLengthTotal, (bHorz != FALSE)))
+ if(IsVisible() && !IsFloating() &&
+ m_bParentSizing && arrSCBars[0] == this)
+ if(NegotiateSpace(nLengthTotal, (bHorz != FALSE)))
AlignControlBars();
m_bParentSizing = FALSE;
- if (bHorz)
+ if(bHorz)
return CSize(max(m_szMinHorz.cx, m_szHorz.cx),
max(m_szMinHorz.cy, m_szHorz.cy));
@@ -277,22 +277,22 @@ CSize CSizingControlBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
CSize CSizingControlBar::CalcDynamicLayout(int nLength, DWORD dwMode)
{
- if (dwMode & (LM_HORZDOCK | LM_VERTDOCK)) // docked ?
+ if(dwMode & (LM_HORZDOCK | LM_VERTDOCK)) // docked ?
{
- if (nLength == -1)
+ if(nLength == -1)
m_bParentSizing = TRUE;
return baseCSizingControlBar::CalcDynamicLayout(nLength, dwMode);
}
- if (dwMode & LM_MRUWIDTH) return m_szFloat;
- if (dwMode & LM_COMMIT) return m_szFloat; // already committed
+ if(dwMode & LM_MRUWIDTH) return m_szFloat;
+ if(dwMode & LM_COMMIT) return m_szFloat; // already committed
#ifndef _SCB_REPLACE_MINIFRAME
// check for dialgonal resizing hit test
int nHitTest = m_pDockContext->m_nHitTest;
- if (IsFloating() &&
- (nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT ||
+ if(IsFloating() &&
+ (nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT ||
nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT))
{
CPoint ptCursor;
@@ -301,25 +301,25 @@ CSize CSizingControlBar::CalcDynamicLayout(int nLength, DWORD dwMode)
CRect rFrame, rBar;
GetParentFrame()->GetWindowRect(&rFrame);
GetWindowRect(&rBar);
-
- if (nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT)
+
+ if(nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT)
{
m_szFloat.cx = rFrame.left + rBar.Width() - ptCursor.x;
- m_pDockContext->m_rectFrameDragHorz.left =
+ m_pDockContext->m_rectFrameDragHorz.left =
min(ptCursor.x, rFrame.left + rBar.Width() - m_szMinFloat.cx);
}
- if (nHitTest == HTTOPLEFT || nHitTest == HTTOPRIGHT)
+ if(nHitTest == HTTOPLEFT || nHitTest == HTTOPRIGHT)
{
m_szFloat.cy = rFrame.top + rBar.Height() - ptCursor.y;
m_pDockContext->m_rectFrameDragHorz.top =
min(ptCursor.y, rFrame.top + rBar.Height() - m_szMinFloat.cy);
}
- if (nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT)
+ if(nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT)
m_szFloat.cx = rBar.Width() + ptCursor.x - rFrame.right;
- if (nHitTest == HTBOTTOMLEFT || nHitTest == HTBOTTOMRIGHT)
+ if(nHitTest == HTBOTTOMLEFT || nHitTest == HTBOTTOMRIGHT)
m_szFloat.cy = rBar.Height() + ptCursor.y - rFrame.bottom;
}
else
@@ -342,8 +342,8 @@ void CSizingControlBar::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
// find on which side are we docked
m_nDockBarID = GetParent()->GetDlgCtrlID();
- if (!IsFloating())
- if (lpwndpos->flags & SWP_SHOWWINDOW)
+ if(!IsFloating())
+ if(lpwndpos->flags & SWP_SHOWWINDOW)
m_bKeepSize = TRUE;
}
@@ -352,7 +352,7 @@ void CSizingControlBar::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
//
void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
{
- if (m_pDockBar != NULL)
+ if(m_pDockBar != NULL)
{
// start the drag
ASSERT(m_pDockContext != NULL);
@@ -365,7 +365,7 @@ void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
void CSizingControlBar::OnLButtonDblClk(UINT nFlags, CPoint point)
{
- if (m_pDockBar != NULL)
+ if(m_pDockBar != NULL)
{
// toggle docking
ASSERT(m_pDockContext != NULL);
@@ -375,20 +375,20 @@ void CSizingControlBar::OnLButtonDblClk(UINT nFlags, CPoint point)
CWnd::OnLButtonDblClk(nFlags, point);
}
-void CSizingControlBar::OnNcLButtonDown(UINT nHitTest, CPoint point)
+void CSizingControlBar::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
UNUSED_ALWAYS(point);
- if (m_bTracking || IsFloating())
+ if(m_bTracking || IsFloating())
return;
- if ((nHitTest >= HTSIZEFIRST) && (nHitTest <= HTSIZELAST))
+ if((nHitTest >= HTSIZEFIRST) && (nHitTest <= HTSIZELAST))
StartTracking(nHitTest, point); // sizing edge hit
}
void CSizingControlBar::OnLButtonUp(UINT nFlags, CPoint point)
{
- if (m_bTracking)
+ if(m_bTracking)
StopTracking();
baseCSizingControlBar::OnLButtonUp(nFlags, point);
@@ -396,7 +396,7 @@ void CSizingControlBar::OnLButtonUp(UINT nFlags, CPoint point)
void CSizingControlBar::OnRButtonDown(UINT nFlags, CPoint point)
{
- if (m_bTracking)
+ if(m_bTracking)
StopTracking();
baseCSizingControlBar::OnRButtonDown(nFlags, point);
@@ -404,7 +404,7 @@ void CSizingControlBar::OnRButtonDown(UINT nFlags, CPoint point)
void CSizingControlBar::OnMouseMove(UINT nFlags, CPoint point)
{
- if (m_bTracking)
+ if(m_bTracking)
{
CPoint ptScreen = point;
ClientToScreen(&ptScreen);
@@ -417,7 +417,7 @@ void CSizingControlBar::OnMouseMove(UINT nFlags, CPoint point)
void CSizingControlBar::OnCaptureChanged(CWnd *pWnd)
{
- if (m_bTracking && (pWnd != this))
+ if(m_bTracking && (pWnd != this))
StopTracking();
baseCSizingControlBar::OnCaptureChanged(pWnd);
@@ -430,14 +430,14 @@ void CSizingControlBar::OnNcCalcSize(BOOL bCalcValidRects,
#ifndef _SCB_REPLACE_MINIFRAME
// Enable diagonal resizing for floating miniframe
- if (IsFloating())
+ if(IsFloating())
{
CFrameWnd* pFrame = GetParentFrame();
- if (pFrame != NULL &&
- pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
+ if(pFrame != NULL &&
+ pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
{
DWORD dwStyle = ::GetWindowLong(pFrame->m_hWnd, GWL_STYLE);
- if ((dwStyle & MFS_4THICKFRAME) != 0)
+ if((dwStyle & MFS_4THICKFRAME) != 0)
{
pFrame->ModifyStyle(MFS_4THICKFRAME, 0); // clear
GetParent()->ModifyStyle(0, WS_CLIPCHILDREN);
@@ -450,17 +450,17 @@ void CSizingControlBar::OnNcCalcSize(BOOL bCalcValidRects,
m_dwSCBStyle &= ~SCBS_EDGEALL;
// add resizing edges between bars on the same row
- if (!IsFloating() && m_pDockBar != NULL)
+ if(!IsFloating() && m_pDockBar != NULL)
{
CSCBArray arrSCBars;
int nThis;
GetRowSizingBars(arrSCBars, nThis);
BOOL bHorz = IsHorzDocked();
- if (nThis > 0)
+ if(nThis > 0)
m_dwSCBStyle |= bHorz ? SCBS_EDGELEFT : SCBS_EDGETOP;
- if (nThis < arrSCBars.GetUpperBound())
+ if(nThis < arrSCBars.GetUpperBound())
m_dwSCBStyle |= bHorz ? SCBS_EDGERIGHT : SCBS_EDGEBOTTOM;
}
@@ -472,7 +472,7 @@ void CSizingControlBar::NcCalcClient(LPRECT pRc, UINT nDockBarID)
CRect rc(pRc);
rc.DeflateRect(3, 5, 3, 3);
- if (nDockBarID != AFX_IDW_DOCKBAR_FLOAT)
+ if(nDockBarID != AFX_IDW_DOCKBAR_FLOAT)
rc.DeflateRect(2, 0, 2, 2);
switch(nDockBarID)
@@ -492,7 +492,7 @@ void CSizingControlBar::NcCalcClient(LPRECT pRc, UINT nDockBarID)
}
// make room for edges only if they will be painted
- if (m_dwSCBStyle & SCBS_SHOWEDGES)
+ if(m_dwSCBStyle & SCBS_SHOWEDGES)
rc.DeflateRect(
(m_dwSCBStyle & SCBS_EDGELEFT) ? m_cxEdge : 0,
(m_dwSCBStyle & SCBS_EDGETOP) ? m_cxEdge : 0,
@@ -516,7 +516,7 @@ void CSizingControlBar::OnNcPaint()
CDC mdc;
mdc.CreateCompatibleDC(&dc);
-
+
CBitmap bm;
bm.CreateCompatibleBitmap(&dc, rcBar.Width(), rcBar.Height());
CBitmap* pOldBm = mdc.SelectObject(&bm);
@@ -528,19 +528,19 @@ void CSizingControlBar::OnNcPaint()
// erase the NC background
#ifdef _WIN64
mdc.FillRect(rcDraw, CBrush::FromHandle(
- (HBRUSH) GetClassLong(m_hWnd, GCLP_HBRBACKGROUND)));
+ (HBRUSH) GetClassLong(m_hWnd, GCLP_HBRBACKGROUND)));
#else
mdc.FillRect(rcDraw, CBrush::FromHandle(
- (HBRUSH) GetClassLong(m_hWnd, GCL_HBRBACKGROUND)));
+ (HBRUSH) GetClassLong(m_hWnd, GCL_HBRBACKGROUND)));
#endif
- if (m_dwSCBStyle & SCBS_SHOWEDGES)
+ if(m_dwSCBStyle & SCBS_SHOWEDGES)
{
CRect rcEdge; // paint the sizing edges
- for (int i = 0; i < 4; i++)
- if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
+ for(int i = 0; i < 4; i++)
+ if(GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
mdc.Draw3dRect(rcEdge, ::GetSysColor(COLOR_BTNHIGHLIGHT),
- ::GetSysColor(COLOR_BTNSHADOW));
+ ::GetSysColor(COLOR_BTNSHADOW));
}
NcPaintGripper(&mdc, rcClient);
@@ -575,10 +575,10 @@ LRESULT CSizingControlBar::OnNcHitTest(CPoint point)
CRect rcBar, rcEdge;
GetWindowRect(rcBar);
- if (!IsFloating())
- for (int i = 0; i < 4; i++)
- if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
- if (rcEdge.PtInRect(point))
+ if(!IsFloating())
+ for(int i = 0; i < 4; i++)
+ if(GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
+ if(rcEdge.PtInRect(point))
return GetEdgeHTCode(i);
return HTCLIENT;
@@ -590,18 +590,18 @@ void CSizingControlBar::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
m_bDragShowContent = FALSE;
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0,
- &m_bDragShowContent, 0); // update
+ &m_bDragShowContent, 0); // update
}
void CSizingControlBar::OnSize(UINT nType, int cx, int cy)
{
UNUSED_ALWAYS(nType);
-
- if ((m_dwSCBStyle & SCBS_SIZECHILD) != 0)
+
+ if((m_dwSCBStyle & SCBS_SIZECHILD) != 0)
{
// automatic child resizing - only one child is allowed
CWnd* pWnd = GetWindow(GW_CHILD);
- if (pWnd != NULL)
+ if(pWnd != NULL)
{
pWnd->MoveWindow(0, 0, cx, cy);
ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
@@ -623,7 +623,7 @@ void CSizingControlBar::StartTracking(UINT nHitTest, CPoint point)
SetCapture();
// make sure no updates are pending
- if (!m_bDragShowContent)
+ if(!m_bDragShowContent)
RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
m_htEdge = nHitTest;
@@ -638,28 +638,28 @@ void CSizingControlBar::StartTracking(UINT nHitTest, CPoint point)
GetWindowRect(rcBar);
GetEdgeRect(rcBar, m_htEdge, rcEdge);
m_nTrackEdgeOfs = m_nTrackPosOld -
- (bHorzTracking ? rcEdge.CenterPoint().x : rcEdge.CenterPoint().y);
-
+ (bHorzTracking ? rcEdge.CenterPoint().x : rcEdge.CenterPoint().y);
+
CSCBArray arrSCBars;
int nThis;
GetRowSizingBars(arrSCBars, nThis);
m_nTrackPosMin = m_nTrackPosMax = m_nTrackPosOld;
- if (!IsSideTracking())
+ if(!IsSideTracking())
{
// calc minwidth as the max minwidth of the sizing bars on row
int nMinWidth = bHorz ? m_szMinHorz.cy : m_szMinVert.cx;
- for (int i = 0; i < arrSCBars.GetSize(); i++)
- nMinWidth = max(nMinWidth, bHorz ?
- arrSCBars[i]->m_szMinHorz.cy :
- arrSCBars[i]->m_szMinVert.cx);
+ for(int i = 0; i < arrSCBars.GetSize(); i++)
+ nMinWidth = max(nMinWidth, bHorz ?
+ arrSCBars[i]->m_szMinHorz.cy :
+ arrSCBars[i]->m_szMinVert.cx);
int nExcessWidth = (bHorz ? m_szHorz.cy : m_szVert.cx) - nMinWidth;
// the control bar cannot grow with more than the width of
// remaining client area of the mainframe
CRect rcT;
m_pDockSite->RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST,
- reposQuery, &rcT, NULL, TRUE);
+ reposQuery, &rcT, NULL, TRUE);
int nMaxWidth = bHorz ? rcT.Height() - 2 : rcT.Width() - 2;
BOOL bTopOrLeft = m_htEdge == HTTOP || m_htEdge == HTLEFT;
@@ -672,18 +672,18 @@ void CSizingControlBar::StartTracking(UINT nHitTest, CPoint point)
// side tracking:
// max size is the actual size plus the amount the other
// sizing bars can be decreased until they reach their minsize
- if (m_htEdge == HTBOTTOM || m_htEdge == HTRIGHT)
+ if(m_htEdge == HTBOTTOM || m_htEdge == HTRIGHT)
nThis++;
- for (int i = 0; i < arrSCBars.GetSize(); i++)
+ for(int i = 0; i < arrSCBars.GetSize(); i++)
{
CSizingControlBar* pBar = arrSCBars[i];
- int nExcessWidth = bHorz ?
- pBar->m_szHorz.cx - pBar->m_szMinHorz.cx :
- pBar->m_szVert.cy - pBar->m_szMinVert.cy;
+ int nExcessWidth = bHorz ?
+ pBar->m_szHorz.cx - pBar->m_szMinHorz.cx :
+ pBar->m_szVert.cy - pBar->m_szMinVert.cy;
- if (i < nThis)
+ if(i < nThis)
m_nTrackPosMin -= nExcessWidth;
else
m_nTrackPosMax += nExcessWidth;
@@ -714,30 +714,38 @@ void CSizingControlBar::OnTrackUpdateSize(CPoint& point)
int nDelta = nTrackPos - m_nTrackPosOld;
- if (nDelta == 0)
+ if(nDelta == 0)
return; // no pos change
OnTrackInvertTracker(); // erase tracker
m_nTrackPosOld = nTrackPos;
-
+
BOOL bHorz = IsHorzDocked();
CSize sizeNew = bHorz ? m_szHorz : m_szVert;
- switch (m_htEdge)
+ switch(m_htEdge)
{
- case HTLEFT: sizeNew -= CSize(nDelta, 0); break;
- case HTTOP: sizeNew -= CSize(0, nDelta); break;
- case HTRIGHT: sizeNew += CSize(nDelta, 0); break;
- case HTBOTTOM: sizeNew += CSize(0, nDelta); break;
+ case HTLEFT:
+ sizeNew -= CSize(nDelta, 0);
+ break;
+ case HTTOP:
+ sizeNew -= CSize(0, nDelta);
+ break;
+ case HTRIGHT:
+ sizeNew += CSize(nDelta, 0);
+ break;
+ case HTBOTTOM:
+ sizeNew += CSize(0, nDelta);
+ break;
}
CSCBArray arrSCBars;
int nThis;
GetRowSizingBars(arrSCBars, nThis);
- if (!IsSideTracking())
- for (int i = 0; i < arrSCBars.GetSize(); i++)
+ if(!IsSideTracking())
+ for(int i = 0; i < arrSCBars.GetSize(); i++)
{
CSizingControlBar* pBar = arrSCBars[i];
// make same width (or height)
@@ -748,11 +756,11 @@ void CSizingControlBar::OnTrackUpdateSize(CPoint& point)
{
int nGrowingBar = nThis;
BOOL bBefore = m_htEdge == HTTOP || m_htEdge == HTLEFT;
- if (bBefore && nDelta > 0)
+ if(bBefore && nDelta > 0)
nGrowingBar--;
- if (!bBefore && nDelta < 0)
+ if(!bBefore && nDelta < 0)
nGrowingBar++;
- if (nGrowingBar != nThis)
+ if(nGrowingBar != nThis)
bBefore = !bBefore;
// nGrowing is growing
@@ -764,13 +772,13 @@ void CSizingControlBar::OnTrackUpdateSize(CPoint& point)
int nFirst = bBefore ? nGrowingBar - 1 : nGrowingBar + 1;
int nLimit = bBefore ? -1 : arrSCBars.GetSize();
- for (int i = nFirst; nDelta != 0 && i != nLimit; i += (bBefore ? -1 : 1))
+ for(int i = nFirst; nDelta != 0 && i != nLimit; i += (bBefore ? -1 : 1))
{
CSizingControlBar* pBar = arrSCBars[i];
-
+
int nDeltaT = min(nDelta,
- (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) -
- (bHorz ? pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy));
+ (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) -
+ (bHorz ? pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy));
(bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) -= nDeltaT;
nDelta -= nDeltaT;
@@ -779,7 +787,7 @@ void CSizingControlBar::OnTrackUpdateSize(CPoint& point)
OnTrackInvertTracker(); // redraw tracker at new pos
- if (m_bDragShowContent)
+ if(m_bDragShowContent)
m_pDockSite->DelayRecalcLayout();
}
@@ -787,7 +795,7 @@ void CSizingControlBar::OnTrackInvertTracker()
{
ASSERT(m_bTracking);
- if (m_bDragShowContent)
+ if(m_bDragShowContent)
return; // don't show tracker if DragFullWindows is on
BOOL bHorz = IsHorzDocked();
@@ -796,10 +804,10 @@ void CSizingControlBar::OnTrackInvertTracker()
m_pDockBar->GetWindowRect(rcDock);
m_pDockSite->GetWindowRect(rcFrame);
VERIFY(GetEdgeRect(rcBar, m_htEdge, rc));
- if (!IsSideTracking())
- rc = bHorz ?
- CRect(rcDock.left + 1, rc.top, rcDock.right - 1, rc.bottom) :
- CRect(rc.left, rcDock.top + 1, rc.right, rcDock.bottom - 1);
+ if(!IsSideTracking())
+ rc = bHorz ?
+ CRect(rcDock.left + 1, rc.top, rcDock.right - 1, rc.bottom) :
+ CRect(rc.left, rcDock.top + 1, rc.right, rcDock.bottom - 1);
BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
int nOfs = m_nTrackPosOld - m_nTrackEdgeOfs;
@@ -808,12 +816,12 @@ void CSizingControlBar::OnTrackInvertTracker()
rc.OffsetRect(-rcFrame.TopLeft());
CDC *pDC = m_pDockSite->GetDCEx(NULL,
- DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);
+ DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);
CBrush* pBrush = CDC::GetHalftoneBrush();
CBrush* pBrushOld = pDC->SelectObject(pBrush);
pDC->PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATINVERT);
-
+
pDC->SelectObject(pBrushOld);
m_pDockSite->ReleaseDC(pDC);
}
@@ -822,29 +830,29 @@ BOOL CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
CRect& rcEdge)
{
rcEdge = rcWnd;
- if (m_dwSCBStyle & SCBS_SHOWEDGES)
+ if(m_dwSCBStyle & SCBS_SHOWEDGES)
rcEdge.DeflateRect(1, 1);
BOOL bHorz = IsHorzDocked();
- switch (nHitTest)
+ switch(nHitTest)
{
case HTLEFT:
- if (!(m_dwSCBStyle & SCBS_EDGELEFT)) return FALSE;
+ if(!(m_dwSCBStyle & SCBS_EDGELEFT)) return FALSE;
rcEdge.right = rcEdge.left + m_cxEdge;
- rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
+ rcEdge.DeflateRect(0, bHorz ? m_cxEdge : 0);
break;
case HTTOP:
- if (!(m_dwSCBStyle & SCBS_EDGETOP)) return FALSE;
+ if(!(m_dwSCBStyle & SCBS_EDGETOP)) return FALSE;
rcEdge.bottom = rcEdge.top + m_cxEdge;
rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
break;
case HTRIGHT:
- if (!(m_dwSCBStyle & SCBS_EDGERIGHT)) return FALSE;
+ if(!(m_dwSCBStyle & SCBS_EDGERIGHT)) return FALSE;
rcEdge.left = rcEdge.right - m_cxEdge;
- rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
+ rcEdge.DeflateRect(0, bHorz ? m_cxEdge : 0);
break;
case HTBOTTOM:
- if (!(m_dwSCBStyle & SCBS_EDGEBOTTOM)) return FALSE;
+ if(!(m_dwSCBStyle & SCBS_EDGEBOTTOM)) return FALSE;
rcEdge.top = rcEdge.bottom - m_cxEdge;
rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
break;
@@ -856,10 +864,10 @@ BOOL CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
UINT CSizingControlBar::GetEdgeHTCode(int nEdge)
{
- if (nEdge == 0) return HTLEFT;
- if (nEdge == 1) return HTTOP;
- if (nEdge == 2) return HTRIGHT;
- if (nEdge == 3) return HTBOTTOM;
+ if(nEdge == 0) return HTLEFT;
+ if(nEdge == 1) return HTTOP;
+ if(nEdge == 2) return HTRIGHT;
+ if(nEdge == 3) return HTBOTTOM;
ASSERT(FALSE); // invalid edge code
return HTNOWHERE;
}
@@ -874,11 +882,11 @@ void CSizingControlBar::GetRowInfo(int& nFirst, int& nLast, int& nThis)
int i, nBars = m_pDockBar->m_arrBars.GetSize();
// find the first and the last bar in row
- for (nFirst = -1, i = nThis - 1; i >= 0 && nFirst == -1; i--)
- if (m_pDockBar->m_arrBars[i] == NULL)
+ for(nFirst = -1, i = nThis - 1; i >= 0 && nFirst == -1; i--)
+ if(m_pDockBar->m_arrBars[i] == NULL)
nFirst = i + 1;
- for (nLast = -1, i = nThis + 1; i < nBars && nLast == -1; i++)
- if (m_pDockBar->m_arrBars[i] == NULL)
+ for(nLast = -1, i = nThis + 1; i < nBars && nLast == -1; i++)
+ if(m_pDockBar->m_arrBars[i] == NULL)
nLast = i - 1;
ASSERT((nLast != -1) && (nFirst != -1));
@@ -898,14 +906,14 @@ void CSizingControlBar::GetRowSizingBars(CSCBArray& arrSCBars, int& nThis)
GetRowInfo(nFirstT, nLastT, nThisT);
nThis = -1;
- for (int i = nFirstT; i <= nLastT; i++)
+ for(int i = nFirstT; i <= nLastT; i++)
{
- CSizingControlBar* pBar = static_cast<CSizingControlBar*> (m_pDockBar->m_arrBars[i]);
- if (HIWORD(pBar) == 0) continue; // placeholder
- if (!pBar->IsVisible()) continue;
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ CSizingControlBar* pBar = static_cast<CSizingControlBar*>(m_pDockBar->m_arrBars[i]);
+ if(HIWORD(pBar) == 0) continue; // placeholder
+ if(!pBar->IsVisible()) continue;
+ if(pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
{
- if (pBar == this)
+ if(pBar == this)
nThis = arrSCBars.GetSize();
arrSCBars.Add(pBar);
@@ -926,18 +934,18 @@ BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
int nWidthMax = 0;
CSizingControlBar* pBar;
- for (int i = nFirst; i <= nLast; i++)
+ for(int i = nFirst; i <= nLast; i++)
{
- pBar = static_cast<CSizingControlBar*> (m_pDockBar->m_arrBars[i]);
- if (HIWORD(pBar) == 0) continue; // placeholder
- if (!pBar->IsVisible()) continue;
- BOOL bIsSizingBar =
+ pBar = static_cast<CSizingControlBar*>(m_pDockBar->m_arrBars[i]);
+ if(HIWORD(pBar) == 0) continue; // placeholder
+ if(!pBar->IsVisible()) continue;
+ BOOL bIsSizingBar =
pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar));
int nLengthBar; // minimum length of the bar
- if (bIsSizingBar)
+ if(bIsSizingBar)
nLengthBar = bHorz ? pBar->m_szMinHorz.cx - 2 :
- pBar->m_szMinVert.cy - 2;
+ pBar->m_szMinVert.cy - 2;
else
{
CRect rcBar;
@@ -946,20 +954,20 @@ BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
}
nLengthMin += nLengthBar;
- if (nLengthMin > nLengthTotal)
+ if(nLengthMin > nLengthTotal)
{
// split the row after fixed bar
- if (i < nThis)
+ if(i < nThis)
{
m_pDockBar->m_arrBars.InsertAt(i + 1,
- (CControlBar*) NULL);
+ (CControlBar*) NULL);
return FALSE;
}
-
+
// only this sizebar remains on the row, adjust it to minsize
- if (i == nThis)
+ if(i == nThis)
{
- if (bHorz)
+ if(bHorz)
m_szHorz.cx = m_szMinHorz.cx;
else
m_szVert.cy = m_szMinVert.cy;
@@ -973,12 +981,12 @@ BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
break;
}
- if (bIsSizingBar)
+ if(bIsSizingBar)
{
- nLengthActual += bHorz ? pBar->m_szHorz.cx - 2 :
- pBar->m_szVert.cy - 2;
+ nLengthActual += bHorz ? pBar->m_szHorz.cx - 2 :
+ pBar->m_szVert.cy - 2;
nWidthMax = max(nWidthMax, bHorz ? pBar->m_szHorz.cy :
- pBar->m_szVert.cx);
+ pBar->m_szVert.cx);
}
else
nLengthAvail -= nLengthBar;
@@ -990,13 +998,13 @@ BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
int nDelta = nLengthAvail - nLengthActual;
// return faster when there is only one sizing bar per row (this one)
- if (nNumBars == 1)
+ if(nNumBars == 1)
{
ASSERT(arrSCBars[0] == this);
- if (nDelta == 0)
+ if(nDelta == 0)
return TRUE;
-
+
m_bKeepSize = FALSE;
(bHorz ? m_szHorz.cx : m_szVert.cy) += nDelta;
@@ -1004,26 +1012,26 @@ BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
}
// make all the bars the same width
- for (int i = 0; i < nNumBars; i++)
- if (bHorz)
+ for(int i = 0; i < nNumBars; i++)
+ if(bHorz)
arrSCBars[i]->m_szHorz.cy = nWidthMax;
else
arrSCBars[i]->m_szVert.cx = nWidthMax;
// distribute the difference between the bars,
// but don't shrink them below their minsizes
- while (nDelta != 0)
+ while(nDelta != 0)
{
int nDeltaOld = nDelta;
- for (int i = 0; i < nNumBars; i++)
+ for(int i = 0; i < nNumBars; i++)
{
pBar = arrSCBars[i];
int nLMin = bHorz ?
- pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy;
+ pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy;
int nL = bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy;
- if ((nL == nLMin) && (nDelta < 0) || // already at min length
- pBar->m_bKeepSize) // or wants to keep its size
+ if((nL == nLMin) && (nDelta < 0) || // already at min length
+ pBar->m_bKeepSize) // or wants to keep its size
continue;
// sign of nDelta
@@ -1031,11 +1039,11 @@ BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
(bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) += nDelta2;
nDelta -= nDelta2;
- if (nDelta == 0) break;
+ if(nDelta == 0) break;
}
// clear m_bKeepSize flags
- if ((nDeltaOld == nDelta) || (nDelta == 0))
- for (int i = 0; i < nNumBars; i++)
+ if((nDeltaOld == nDelta) || (nDelta == 0))
+ for(int i = 0; i < nNumBars; i++)
arrSCBars[i]->m_bKeepSize = FALSE;
}
@@ -1054,24 +1062,24 @@ void CSizingControlBar::AlignControlBars()
CRect rc, rcDock;
m_pDockBar->GetWindowRect(&rcDock);
- for (int i = nFirst; i <= nLast; i++)
+ for(int i = nFirst; i <= nLast; i++)
{
CSizingControlBar* pBar = static_cast<CSizingControlBar*>(m_pDockBar->m_arrBars[i]);
- if (HIWORD(pBar) == 0) continue; // placeholder
- if (!pBar->IsVisible()) continue;
+ if(HIWORD(pBar) == 0) continue; // placeholder
+ if(!pBar->IsVisible()) continue;
pBar->GetWindowRect(&rc);
rc.OffsetRect(-rcDock.TopLeft());
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ if(pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
rc = CRect(rc.TopLeft(),
- bHorz ? pBar->m_szHorz : pBar->m_szVert);
+ bHorz ? pBar->m_szHorz : pBar->m_szVert);
- if ((bHorz ? rc.left : rc.top) != nAlign)
+ if((bHorz ? rc.left : rc.top) != nAlign)
{
- if (!bHorz)
+ if(!bHorz)
rc.OffsetRect(0, nAlign - rc.top - 2);
- else if (m_nDockBarID == AFX_IDW_DOCKBAR_TOP)
+ else if(m_nDockBarID == AFX_IDW_DOCKBAR_TOP)
rc.OffsetRect(nAlign - rc.left, -2);
else
rc.OffsetRect(nAlign - rc.left, 0);
@@ -1081,7 +1089,7 @@ void CSizingControlBar::AlignControlBars()
nAlign += (bHorz ? rc.Width() : rc.Height()) - 2;
}
- if (bNeedRecalc)
+ if(bNeedRecalc)
m_pDockSite->DelayRecalcLayout();
}
@@ -1103,16 +1111,16 @@ void CSizingControlBar::LoadState(LPCTSTR lpszProfileName)
state.LoadState(lpszProfileName);
UINT nID = GetDlgCtrlID();
- for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
+ for(int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
{
CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
ASSERT(pInfo != NULL);
- if (!pInfo->m_bFloating)
+ if(!pInfo->m_bFloating)
continue;
-
+
// this is a floating dockbar - check the ID array
- for (int j = 0; j < pInfo->m_arrBarID.GetSize(); j++)
- if ((DWORD) pInfo->m_arrBarID[j] == nID)
+ for(int j = 0; j < pInfo->m_arrBarID.GetSize(); j++)
+ if((DWORD) pInfo->m_arrBarID[j] == nID)
{
// found this bar - offset origin and save settings
pInfo->m_pointPos.x++;
@@ -1127,22 +1135,22 @@ void CSizingControlBar::LoadState(LPCTSTR lpszProfileName)
TCHAR szSection[256];
wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
- GetDlgCtrlID());
+ GetDlgCtrlID());
m_szHorz.cx = max(m_szMinHorz.cx, (int) pApp->GetProfileInt(
- szSection, _T("sizeHorzCX"), m_szHorz.cx));
+ szSection, _T("sizeHorzCX"), m_szHorz.cx));
m_szHorz.cy = max(m_szMinHorz.cy, (int) pApp->GetProfileInt(
- szSection, _T("sizeHorzCY"), m_szHorz.cy));
+ szSection, _T("sizeHorzCY"), m_szHorz.cy));
m_szVert.cx = max(m_szMinVert.cx, (int) pApp->GetProfileInt(
- szSection, _T("sizeVertCX"), m_szVert.cx));
+ szSection, _T("sizeVertCX"), m_szVert.cx));
m_szVert.cy = max(m_szMinVert.cy, (int) pApp->GetProfileInt(
- szSection, _T("sizeVertCY"), m_szVert.cy));
+ szSection, _T("sizeVertCY"), m_szVert.cy));
m_szFloat.cx = max(m_szMinFloat.cx, (int) pApp->GetProfileInt(
- szSection, _T("sizeFloatCX"), m_szFloat.cx));
+ szSection, _T("sizeFloatCX"), m_szFloat.cx));
m_szFloat.cy = max(m_szMinFloat.cy, (int) pApp->GetProfileInt(
- szSection, _T("sizeFloatCY"), m_szFloat.cy));
+ szSection, _T("sizeFloatCY"), m_szFloat.cy));
}
void CSizingControlBar::SaveState(LPCTSTR lpszProfileName)
@@ -1156,7 +1164,7 @@ void CSizingControlBar::SaveState(LPCTSTR lpszProfileName)
TCHAR szSection[256];
wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
- GetDlgCtrlID());
+ GetDlgCtrlID());
pApp->WriteProfileInt(szSection, _T("sizeHorzCX"), m_szHorz.cx);
pApp->WriteProfileInt(szSection, _T("sizeHorzCY"), m_szHorz.cy);
@@ -1172,11 +1180,11 @@ void CSizingControlBar::GlobalLoadState(CFrameWnd* pFrame,
LPCTSTR lpszProfileName)
{
POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- while (pos != NULL)
+ while(pos != NULL)
{
- CSizingControlBar* pBar = static_cast<CSizingControlBar*> (pFrame->m_listControlBars.GetNext(pos));
+ CSizingControlBar* pBar = static_cast<CSizingControlBar*>(pFrame->m_listControlBars.GetNext(pos));
ASSERT(pBar != NULL);
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ if(pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
pBar->LoadState(lpszProfileName);
}
}
@@ -1185,11 +1193,11 @@ void CSizingControlBar::GlobalSaveState(CFrameWnd* pFrame,
LPCTSTR lpszProfileName)
{
POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- while (pos != NULL)
+ while(pos != NULL)
{
- CSizingControlBar* pBar = static_cast<CSizingControlBar*> (pFrame->m_listControlBars.GetNext(pos));
+ CSizingControlBar* pBar = static_cast<CSizingControlBar*>(pFrame->m_listControlBars.GetNext(pos));
ASSERT(pBar != NULL);
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ if(pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
pBar->SaveState(lpszProfileName);
}
}
@@ -1202,9 +1210,9 @@ void CSizingControlBar::GlobalSaveState(CFrameWnd* pFrame,
static void AdjustRectangle(CRect& rect, CPoint pt)
{
int nXOffset = (pt.x < rect.left) ? (pt.x - rect.left) :
- (pt.x > rect.right) ? (pt.x - rect.right) : 0;
+ (pt.x > rect.right) ? (pt.x - rect.right) : 0;
int nYOffset = (pt.y < rect.top) ? (pt.y - rect.top) :
- (pt.y > rect.bottom) ? (pt.y - rect.bottom) : 0;
+ (pt.y > rect.bottom) ? (pt.y - rect.bottom) : 0;
rect.OffsetRect(nXOffset, nYOffset);
}
@@ -1233,13 +1241,13 @@ void CSCBDockContext::StartDrag(CPoint pt)
#ifdef _MAC
CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz,
- WS_THICKFRAME, WS_EX_FORCESIZEBOX);
+ WS_THICKFRAME, WS_EX_FORCESIZEBOX);
#else
CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz, WS_THICKFRAME);
#endif
m_rectFrameDragHorz.DeflateRect(2, 2);
m_rectFrameDragVert = m_rectFrameDragHorz;
-
+
// adjust rectangles so that point is inside
AdjustRectangle(m_rectDragHorz, pt);
AdjustRectangle(m_rectDragVert, pt);
@@ -1273,42 +1281,42 @@ BOOL CSCBMiniDockFrameWnd::Create(CWnd* pParent, DWORD dwBarStyle)
// RecalcLayout will be called once something is docked
m_bInRecalcLayout = TRUE;
- DWORD dwStyle = WS_POPUP|WS_CAPTION|WS_SYSMENU|MFS_MOVEFRAME|
- MFS_4THICKFRAME|MFS_SYNCACTIVE|MFS_BLOCKSYSMENU|
- FWS_SNAPTOBARS;
+ DWORD dwStyle = WS_POPUP | WS_CAPTION | WS_SYSMENU | MFS_MOVEFRAME |
+ MFS_4THICKFRAME | MFS_SYNCACTIVE | MFS_BLOCKSYSMENU |
+ FWS_SNAPTOBARS;
- if (dwBarStyle & CBRS_SIZE_DYNAMIC)
+ if(dwBarStyle & CBRS_SIZE_DYNAMIC)
dwStyle &= ~MFS_MOVEFRAME;
DWORD dwExStyle = 0;
#ifdef _MAC
- if (dwBarStyle & CBRS_SIZE_DYNAMIC)
+ if(dwBarStyle & CBRS_SIZE_DYNAMIC)
dwExStyle |= WS_EX_FORCESIZEBOX;
else
- dwStyle &= ~(MFS_MOVEFRAME|MFS_4THICKFRAME);
+ dwStyle &= ~(MFS_MOVEFRAME | MFS_4THICKFRAME);
#endif
- if (!CMiniFrameWnd::CreateEx(dwExStyle,
- NULL, &afxChNil, dwStyle, rectDefault, pParent))
+ if(!CMiniFrameWnd::CreateEx(dwExStyle,
+ NULL, &afxChNil, dwStyle, rectDefault, pParent))
{
m_bInRecalcLayout = FALSE;
return FALSE;
}
- dwStyle = dwBarStyle & (CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT) ?
- CBRS_ALIGN_LEFT : CBRS_ALIGN_TOP;
+ dwStyle = dwBarStyle & (CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT) ?
+ CBRS_ALIGN_LEFT : CBRS_ALIGN_TOP;
dwStyle |= dwBarStyle & CBRS_FLOAT_MULTI;
CMenu* pSysMenu = GetSystemMenu(FALSE);
//pSysMenu->DeleteMenu(SC_SIZE, MF_BYCOMMAND);
CString strHide;
- if (strHide.LoadString(AFX_IDS_HIDE))
+ if(strHide.LoadString(AFX_IDS_HIDE))
{
pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);
- pSysMenu->AppendMenu(MF_STRING|MF_ENABLED, SC_CLOSE, strHide);
+ pSysMenu->AppendMenu(MF_STRING | MF_ENABLED, SC_CLOSE, strHide);
}
// must initially create with parent frame as parent
- if (!m_wndDockBar.Create(pParent, WS_CHILD | WS_VISIBLE | dwStyle,
- AFX_IDW_DOCKBAR_FLOAT))
+ if(!m_wndDockBar.Create(pParent, WS_CHILD | WS_VISIBLE | dwStyle,
+ AFX_IDW_DOCKBAR_FLOAT))
{
m_bInRecalcLayout = FALSE;
return FALSE;
@@ -1323,13 +1331,13 @@ BOOL CSCBMiniDockFrameWnd::Create(CWnd* pParent, DWORD dwBarStyle)
void CSCBMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
- if (nHitTest == HTCAPTION || nHitTest == HTCLOSE)
+ if(nHitTest == HTCAPTION || nHitTest == HTCLOSE)
{
baseCSCBMiniDockFrameWnd::OnNcLButtonDown(nHitTest, point);
return;
}
- if (GetSizingControlBar() != NULL)
+ if(GetSizingControlBar() != NULL)
CMiniFrameWnd::OnNcLButtonDown(nHitTest, point);
else
baseCSCBMiniDockFrameWnd::OnNcLButtonDown(nHitTest, point);
@@ -1338,24 +1346,24 @@ void CSCBMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
CSizingControlBar* CSCBMiniDockFrameWnd::GetSizingControlBar()
{
CWnd* pWnd = GetWindow(GW_CHILD); // get the dockbar
- if (pWnd == NULL)
+ if(pWnd == NULL)
return NULL;
-
+
pWnd = pWnd->GetWindow(GW_CHILD); // get the controlbar
- if (pWnd == NULL)
+ if(pWnd == NULL)
return NULL;
- if (!pWnd->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ if(!pWnd->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
return NULL;
- return static_cast<CSizingControlBar*> (pWnd);
+ return static_cast<CSizingControlBar*>(pWnd);
}
-void CSCBMiniDockFrameWnd::OnSize(UINT nType, int cx, int cy)
+void CSCBMiniDockFrameWnd::OnSize(UINT nType, int cx, int cy)
{
CSizingControlBar* pBar = GetSizingControlBar();
- if ((pBar != NULL) && (GetStyle() & MFS_4THICKFRAME) == 0
- && pBar->IsVisible())
+ if((pBar != NULL) && (GetStyle() & MFS_4THICKFRAME) == 0
+ && pBar->IsVisible())
pBar->m_szFloat = CSize(cx + 4, cy + 4);
baseCSCBMiniDockFrameWnd::OnSize(nType, cx, cy);
@@ -1366,33 +1374,33 @@ void CSCBMiniDockFrameWnd::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
baseCSCBMiniDockFrameWnd::OnGetMinMaxInfo(lpMMI);
CSizingControlBar* pBar = GetSizingControlBar();
- if (pBar != NULL)
+ if(pBar != NULL)
{
CRect r(CPoint(0, 0), pBar->m_szMinFloat - CSize(4, 4));
#ifndef _SCB_MINIFRAME_CAPTION
CMiniFrameWnd::CalcBorders(&r, WS_THICKFRAME);
#else
- CMiniFrameWnd::CalcBorders(&r, WS_THICKFRAME|WS_CAPTION);
+ CMiniFrameWnd::CalcBorders(&r, WS_THICKFRAME | WS_CAPTION);
#endif //_SCB_MINIFRAME_CAPTION
lpMMI->ptMinTrackSize.x = r.Width();
lpMMI->ptMinTrackSize.y = r.Height();
- if(pBar->m_bFixedFloat)
- {
- lpMMI->ptMinTrackSize.x = pBar->m_szFixedFloat.cx;
- lpMMI->ptMinTrackSize.y = pBar->m_szFixedFloat.cy;
- lpMMI->ptMaxTrackSize.x = pBar->m_szFixedFloat.cx;
- lpMMI->ptMaxTrackSize.y = pBar->m_szFixedFloat.cy;
- }
+ if(pBar->m_bFixedFloat)
+ {
+ lpMMI->ptMinTrackSize.x = pBar->m_szFixedFloat.cx;
+ lpMMI->ptMinTrackSize.y = pBar->m_szFixedFloat.cy;
+ lpMMI->ptMaxTrackSize.x = pBar->m_szFixedFloat.cx;
+ lpMMI->ptMaxTrackSize.y = pBar->m_szFixedFloat.cy;
+ }
}
}
-void CSCBMiniDockFrameWnd::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
+void CSCBMiniDockFrameWnd::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
{
- if ((GetStyle() & MFS_4THICKFRAME) != 0)
+ if((GetStyle() & MFS_4THICKFRAME) != 0)
{
CSizingControlBar* pBar = GetSizingControlBar();
- if (pBar != NULL)
+ if(pBar != NULL)
{
lpwndpos->flags |= SWP_NOSIZE; // don't size this time
// prevents flicker
@@ -1401,7 +1409,7 @@ void CSCBMiniDockFrameWnd::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
ModifyStyle(MFS_4THICKFRAME, 0);
#ifndef _SCB_MINIFRAME_CAPTION
// remove caption
- ModifyStyle(WS_SYSMENU|WS_CAPTION, 0);
+ ModifyStyle(WS_SYSMENU | WS_CAPTION, 0);
#endif
DelayRecalcLayout();
pBar->PostMessage(WM_NCPAINT);
diff --git a/src/ui/sizecbar/sizecbar.h b/src/ui/sizecbar/sizecbar.h
index 0d0cf16f9..8c912c78f 100644
--- a/src/ui/sizecbar/sizecbar.h
+++ b/src/ui/sizecbar/sizecbar.h
@@ -10,7 +10,7 @@
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
//
-// This code is free for personal and commercial use, providing this
+// This code is free for personal and commercial use, providing this
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
@@ -38,7 +38,7 @@
#if defined(_SCB_MINIFRAME_CAPTION) && !defined(_SCB_REPLACE_MINIFRAME)
- #error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME"
+#error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME"
#endif
/////////////////////////////////////////////////////////////////////////
@@ -79,10 +79,10 @@ public:
CSizingControlBar();
virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
- CSize sizeDefault, BOOL bHasGripper,
- UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
+ CSize sizeDefault, BOOL bHasGripper,
+ UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
- UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
+ UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
// Attributes
public:
@@ -90,7 +90,10 @@ public:
const BOOL IsHorzDocked() const;
const BOOL IsVertDocked() const;
const BOOL IsSideTracking() const;
- const BOOL GetSCBStyle() const {return m_dwSCBStyle;}
+ const BOOL GetSCBStyle() const
+ {
+ return m_dwSCBStyle;
+ }
// Operations
public:
@@ -102,13 +105,15 @@ public:
static void GlobalLoadState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
static void GlobalSaveState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
void SetSCBStyle(DWORD dwSCBStyle)
- {m_dwSCBStyle = (dwSCBStyle & ~SCBS_EDGEALL);}
+ {
+ m_dwSCBStyle = (dwSCBStyle & ~SCBS_EDGEALL);
+ }
- void SetHeight(const int nHeight)
- {
- m_szFloat.cy = m_szHorz.cy = m_szVert.cy = nHeight;
- m_pDockSite->DelayRecalcLayout();
- }
+ void SetHeight(const int nHeight)
+ {
+ m_szFloat.cy = m_szHorz.cy = m_szVert.cy = nHeight;
+ m_pDockSite->DelayRecalcLayout();
+ }
// Overridables
@@ -118,7 +123,7 @@ public:
public:
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSizingControlBar)
- public:
+public:
virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
//}}AFX_VIRTUAL
@@ -126,7 +131,7 @@ public:
// Implementation
public:
virtual ~CSizingControlBar();
-
+
protected:
// implementation helpers
UINT GetEdgeHTCode(int nEdge);
@@ -165,8 +170,8 @@ protected:
UINT m_nDockBarID;
int m_cxEdge;
- BOOL m_bFixedFloat;
- CSize m_szFixedFloat;
+ BOOL m_bFixedFloat;
+ CSize m_szFixedFloat;
// Generated message map functions
protected:
@@ -227,7 +232,7 @@ class CSCBMiniDockFrameWnd : public baseCSCBMiniDockFrameWnd
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSCBMiniDockFrameWnd)
- public:
+public:
virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
//}}AFX_VIRTUAL