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
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2012-12-26 12:38:53 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2012-12-27 20:35:22 +0400
commit2079a19be85fc3c33a3240877becfa58faef62e6 (patch)
treeeccb86af5a9c68bbc0c49fab2e95d00087510df3 /src/thirdparty/TreePropSheet
parent379cb1f7304df064975c130b3826476134a54455 (diff)
ResizableLib and TreePropSheet: convert tabs to spaces
Diffstat (limited to 'src/thirdparty/TreePropSheet')
-rw-r--r--src/thirdparty/TreePropSheet/PropPageFrame.cpp104
-rw-r--r--src/thirdparty/TreePropSheet/PropPageFrame.h464
-rw-r--r--src/thirdparty/TreePropSheet/PropPageFrameDefault.cpp460
-rw-r--r--src/thirdparty/TreePropSheet/PropPageFrameDefault.h86
-rw-r--r--src/thirdparty/TreePropSheet/TreePropSheet.cpp1430
-rw-r--r--src/thirdparty/TreePropSheet/TreePropSheet.h708
6 files changed, 1626 insertions, 1626 deletions
diff --git a/src/thirdparty/TreePropSheet/PropPageFrame.cpp b/src/thirdparty/TreePropSheet/PropPageFrame.cpp
index 962008aca..37de78ccf 100644
--- a/src/thirdparty/TreePropSheet/PropPageFrame.cpp
+++ b/src/thirdparty/TreePropSheet/PropPageFrame.cpp
@@ -13,7 +13,7 @@
* $Author:$
*
* Revision History:
-* $History:$
+* $History:$
*
*********************************************************************/
@@ -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()
+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 /*lpszCap
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/thirdparty/TreePropSheet/PropPageFrame.h b/src/thirdparty/TreePropSheet/PropPageFrame.h
index e16684961..998d30bf4 100644
--- a/src/thirdparty/TreePropSheet/PropPageFrame.h
+++ b/src/thirdparty/TreePropSheet/PropPageFrame.h
@@ -13,7 +13,7 @@
* $Author:$
*
* Revision History:
-* $History:$
+* $History:$
*
*********************************************************************/
@@ -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/thirdparty/TreePropSheet/PropPageFrameDefault.cpp b/src/thirdparty/TreePropSheet/PropPageFrameDefault.cpp
index d12564206..001a8be0f 100644
--- a/src/thirdparty/TreePropSheet/PropPageFrameDefault.cpp
+++ b/src/thirdparty/TreePropSheet/PropPageFrameDefault.cpp
@@ -13,7 +13,7 @@
* $Author:$
*
* Revision History:
-* $History:$
+* $History:$
*
*********************************************************************/
@@ -42,24 +42,24 @@ namespace TreePropSheet
// class CThemeLib
//-------------------------------------------------------------------
-#define THEMEAPITYPE(f) typedef HRESULT (__stdcall *_##f)
-#define THEMEAPITYPE_(t, f) typedef t (__stdcall *_##f)
-#define THEMEAPIPTR(f) _##f m_p##f
+#define THEMEAPITYPE(f) typedef HRESULT (__stdcall *_##f)
+#define THEMEAPITYPE_(t, f) typedef t (__stdcall *_##f)
+#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.
@@ -70,56 +70,56 @@ 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)();}
+ BOOL IsThemeActive() const
+ {THEMECALL(IsThemeActive)();}
- HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList) const
- {THEMECALL(OpenThemeData)(hwnd, pszClassList);}
+ HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList) const
+ {THEMECALL(OpenThemeData)(hwnd, pszClassList);}
- HRESULT CloseThemeData(HTHEME hTheme) const
- {THEMECALL(CloseThemeData)(hTheme);}
+ 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 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);}
+ 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;
};
/**
@@ -129,32 +129,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;
}
@@ -163,10 +163,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()
@@ -177,8 +177,8 @@ CPropPageFrameDefault::CPropPageFrameDefault()
CPropPageFrameDefault::~CPropPageFrameDefault()
{
- if (m_Images.GetSafeHandle())
- m_Images.DeleteImageList();
+ if (m_Images.GetSafeHandle())
+ m_Images.DeleteImageList();
}
@@ -187,153 +187,153 @@ 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)
{
- // <MPC-HC Custom Code>
- COLORREF clrLeft = GetSysColor(COLOR_ACTIVECAPTION);
- // </MPC-HC Custom Code>
- 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);
-
- // <MPC-HC Custom Code>
- LOGFONT lf;
- GetMessageFont(&lf);
- lf.lfHeight = rect.Height();
- lf.lfWeight = FW_BOLD;
-
- if (!SysVersion::IsVistaOrLater()) {
- _tcscpy_s(lf.lfFaceName, _T("Arial"));
- }
- // <MPC-HC Custom Code>
- 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);
+ // <MPC-HC Custom Code>
+ COLORREF clrLeft = GetSysColor(COLOR_ACTIVECAPTION);
+ // </MPC-HC Custom Code>
+ 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);
+
+ // <MPC-HC Custom Code>
+ LOGFONT lf;
+ GetMessageFont(&lf);
+ lf.lfHeight = rect.Height();
+ lf.lfWeight = FW_BOLD;
+
+ if (!SysVersion::IsVistaOrLater()) {
+ _tcscpy_s(lf.lfFaceName, _T("Arial"));
+ }
+ // <MPC-HC Custom Code>
+ 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);
}
@@ -342,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);
+ }
}
diff --git a/src/thirdparty/TreePropSheet/PropPageFrameDefault.h b/src/thirdparty/TreePropSheet/PropPageFrameDefault.h
index 57fc20af2..f41b93cb8 100644
--- a/src/thirdparty/TreePropSheet/PropPageFrameDefault.h
+++ b/src/thirdparty/TreePropSheet/PropPageFrameDefault.h
@@ -13,7 +13,7 @@
* $Author:$
*
* Revision History:
-* $History:$
+* $History:$
*
*********************************************************************/
@@ -44,66 +44,66 @@ class /*AFX_EXT_CLASS*/ CPropPageFrameDefault : public CWnd,
{
// 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/thirdparty/TreePropSheet/TreePropSheet.cpp b/src/thirdparty/TreePropSheet/TreePropSheet.cpp
index 30ffd3d52..0649d92a1 100644
--- a/src/thirdparty/TreePropSheet/TreePropSheet.cpp
+++ b/src/thirdparty/TreePropSheet/TreePropSheet.cpp
@@ -13,7 +13,7 @@
* $Author:$
*
* Revision History:
-* $History:$
+* $History:$
*
*********************************************************************/
@@ -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;
}
@@ -100,93 +100,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 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;
}
@@ -195,42 +195,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;
}
@@ -239,21 +239,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 new CTreeCtrl;
+ return new CTreeCtrl;
}
CPropPageFrame* CTreePropSheet::CreatePageFrame()
{
- return new CPropPageFrameDefault;
+ return new CPropPageFrameDefault;
}
@@ -262,722 +262,722 @@ CPropPageFrame* CTreePropSheet::CreatePageFrame()
void CTreePropSheet::MoveChildWindows(int nDx, int nDy)
{
- CWnd *pWnd = GetWindow(GW_CHILD);
- while (pWnd)
- {
- CRect rect;
- pWnd->GetWindowRect(rect);
- ScreenToClient(rect);
- rect.OffsetRect(nDx, nDy);
- pWnd->MoveWindow(rect);
+ CWnd *pWnd = GetWindow(GW_CHILD);
+ while (pWnd)
+ {
+ CRect rect;
+ pWnd->GetWindowRect(rect);
+ ScreenToClient(rect);
+ rect.OffsetRect(nDx, nDy);
+ 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;
- SecureZeroMemory(&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;
+ SecureZeroMemory(&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, (DWORD_PTR)-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, (DWORD_PTR)-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;
- for (;;)
- {
- 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;
+ for (;;)
+ {
+ 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;
- SecureZeroMemory(&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;
+ SecureZeroMemory(&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 = m_pwndPageTree->GetPrevSiblingItem(hItem);
- if (hPrevItem)
- {
- 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();
-
- for (;;)
- {
- 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 = m_pwndPageTree->GetPrevSiblingItem(hItem);
+ if (hPrevItem)
+ {
+ 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();
+
+ for (;;)
+ {
+ 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 = m_pwndPageTree->GetChildItem(hItem);
- if (!hNextItem)
- {
- hNextItem = m_pwndPageTree->GetNextSiblingItem(hItem);
- if (!hNextItem && 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 = m_pwndPageTree->GetChildItem(hItem);
+ if (!hNextItem)
+ {
+ hNextItem = m_pwndPageTree->GetNextSiblingItem(hItem);
+ if (!hNextItem && 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;
-// 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();
+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();
}
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 = (int)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 = (int)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/thirdparty/TreePropSheet/TreePropSheet.h b/src/thirdparty/TreePropSheet/TreePropSheet.h
index 8599d218b..9090c3337 100644
--- a/src/thirdparty/TreePropSheet/TreePropSheet.h
+++ b/src/thirdparty/TreePropSheet/TreePropSheet.h
@@ -13,7 +13,7 @@
* $Author:$
*
* Revision History:
-* $History:$
+* $History:$
*
*********************************************************************/
@@ -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;
};