Click here to Skip to main content
11,705,123 members (53,528 online)
Click here to Skip to main content
Add your own
alternative version

The Ultimate Toolbox - Updates and User Contributions

, 12 Feb 2013 CPOL 167.3K 18.5K 164
Updates and User Contributions for the Ultimate Toolbox Libraries
OutlookDemoUpdate.zip
Ultimate Grid
Demos
OutlookStyle
OutlookStyle.aps
OutlookStyle.dsp
OutlookStyle.dsw
OutlookStyle.suo
res
bitmap1.bmp
bmattach.bmp
bmp00001.bmp
bmp00002.bmp
bmp00003.bmp
Flags.bmp
OutlookStyle.ico
OutlookStyleDoc.ico
Toolbar.bmp
toolbar1.bmp
toolbar2.bmp
toolbarf.bmp
UltimateGrid72_Src_Update01.zip
CellTypes
Include
Source
UltimateGrid72_Src_Update02.zip
DataSources
ODBC
OleDB
EditControls
UltimateGrid72_Src_Update03.zip
UltimateGrid72_Src_Update04.zip
UltimateGrid73_src.zip
BuildDLL
Build DLL.dsp
Build DLL.dsw
res
BuildLib
ugmfclib.dsp
ugmfclib.dsw
Lib
Skel
UltimateTCP-IP42_Src_Update01.zip
Ultimate TCP-IP
Include
Security
Include
Source
source
UltimateTCP-IP42_Src_Update02.zip
Examples
Client
Mail
icon1.ico
icon2.ico
MailClientS.suo
test.dsp
test.dsw
UltimateTCP-IP42_Src_Update03.zip
ultimatetoolbox93_src_update01.zip
Ultimate Toolbox
include
source
UltimateToolbox93_Src_Update02.zip
lib
Build DLLs
Build Libs
UltimateToolbox93_Src_Update03.zip
UltimateToolbox93_Src_Update04.zip
UltimateToolbox93_Src_Update05.zip
// UGXPThemes.h: interface for the UGXPThemes class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_UGXPThemes_H__5F3CE743_0206_482D_9C42_E408B983A3C6__INCLUDED_)
#define AFX_UGXPThemes_H__5F3CE743_0206_482D_9C42_E408B983A3C6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "ugcell.h"

#pragma warning (push,3)
#pragma warning (disable : 4018 4146)
#include<string>
#pragma warning (pop)

typedef struct _XPMARGINS
{
    int cxLeftWidth;      // width of left border that retains its size
    int cxRightWidth;     // width of right border that retains its size
    int cyTopHeight;      // height of top border that retains its size
    int cyBottomHeight;   // height of bottom border that retains its size
} XPMARGINS, *PXPMARGINS;


enum UGXPThemeStyles { Style1, Style2 };

class UG_CLASS_DECL UGXPThemes  
{
private:
	static UGXPThemeStyles m_style;
	static HMODULE m_huxtheme;
	static bool useThemes;
	static bool drawEdgeBorder;
public:
	virtual ~UGXPThemes();
	static bool IsThemed();

	static void SetGridStyle(UGXPThemeStyles style);
	static UGXPThemeStyles GetGridStyle() { return m_style; }
private:

	static BOOL IsThemeBackgroundPartiallyTransparent(HANDLE hTheme, int iPartId, int iStateId);
	static HRESULT DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT * prc);

	static HRESULT DrawThemeBackground(HANDLE hTheme, HDC hdc, 
		int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect);
	static HANDLE OpenThemeData(HWND hwnd, LPCWSTR pszClassList, bool useCache = true);
	static HRESULT CloseThemeData(HANDLE hTheme);
	static HRESULT DrawThemeText(HANDLE hTheme, HDC hdc, int iPartId, 
		int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, 
		DWORD dwTextFlags2, const RECT *pRect);	
	static HRESULT DrawThemeEdge(HANDLE hTheme, HDC hdc, 
		int iPartId, int iStateId, const RECT *pRect, UINT uEdge, UINT uFlags, RECT *pContentRect);
	static HRESULT GetThemeMargins(HANDLE hTheme,  HDC hdc, int iPartId, 
		 int iStateId, int iPropId,  RECT *prc, XPMARGINS *pMargins);
		static HRESULT GetThemeTextExtent(HANDLE hTheme, HDC hdc, 
		int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, 
		DWORD dwTextFlags,  const RECT *pBoundingRect, 
		RECT *pExtentRect);
	static HRESULT GetThemeString(HANDLE theme, int iPartId, 
		int iStateId, int iPropId,  LPWSTR pszBuff, int cchMaxBuffChars);

	static HRESULT GetThemeRect(HANDLE hTheme, int iPartId, int iStateId, int iPropId,  RECT *pRect);
	static HRESULT GetThemePartSize(HANDLE hTheme, HDC dc, int iPartId, int iStateId, RECT * pRect, int eSize,  SIZE *psz);

public:

	static bool GetThemeString(LPCWSTR theme, int iPartId, 
		int iStateId, int iPropId,  LPWSTR pszBuff, int cchMaxBuffChars);

	static bool GetTextExtent(HWND hwnd, HDC hdc, LPCWSTR themeName, int iPartId, int iStateId,
		LPCSTR pszText, int iCharCount, DWORD dwTextFlags,  const RECT *pBoundingRect, 
		RECT *pExtentRect);

	static bool WriteText(HWND hwnd, HDC hdc, LPCTSTR theme, int partID, 
		int stateID, LPCTSTR text, int textLength, DWORD textFlags, const RECT *pRect, bool useCache = true);

	static bool DrawBackground(HWND hwnd, HDC hdc, LPCWSTR theme, int partID, 
		int stateID,  const RECT *pRect, const RECT *pClipRect, bool useCache = true);
	static bool DrawBackground(HWND hwnd, HDC hdc, UGXPCellType type, UGXPThemeState state,
		const RECT *pRect, const RECT *pClipRect);
	static bool WriteText(HWND hwnd, HDC hdc, UGXPCellType type, UGXPThemeState state,
		LPCTSTR text, int textLength, DWORD textFlags, const RECT *pRect);
	static bool DrawEdge(HWND hwnd, HDC hdc, UGXPCellType type, UGXPThemeState state, 
		const RECT *pRect, UINT uEdge, UINT uFlags, RECT *pContentRect);

	static bool GetThemeRect(LPCWSTR hTheme, int iPartId, int iStateId, RECT *pRect);

	static bool GetThemePartSize(LPCWSTR hTheme, HDC dc, int iPartId, int iStateId, RECT * pRect, int eSize,  SIZE *psz);

	static bool GetMargins(HWND hwnd, HDC hdc, UGXPCellType type, UGXPThemeState state, int propID,
		RECT *prc, XPMARGINS *pMargins);


	static bool GetTextExtent(HWND hwnd, HDC hdc, UGXPCellType type, UGXPThemeState state,
		LPCTSTR pszText, int iCharCount, DWORD dwTextFlags,  const RECT *pBoundingRect, 
		RECT *pExtentRect);

	static bool UseThemes() { return useThemes; }
	static void UseThemes(bool use) { useThemes = use; }

	static void DrawBorderEdges(bool draw) { drawEdgeBorder = draw; }
	static bool DrawBorderEdges() { return drawEdgeBorder; }

	static UGXPThemeState GetState(bool selected, bool current);

	static void CleanUp();

	static void SetXPTheme(UGXPCellType type, UGXPThemeState state, LPCWSTR typeName, int iPartId, int iStateId);

	static bool DrawEdge(HWND hwnd, HDC hdc, LPCWSTR theme, int partID, int stateID, 
		const RECT *pRect, UINT uEdge, UINT uFlags, RECT *pContentRect);

private:
	// This class has only static methods
	UGXPThemes();

	// Calling LoadLibrary here means that our static HMODULE can be initialised to NULL 
	// ( i.e. it is only loaded if we need it )
	// The function returns true if the load succeeds.
	static bool LoadLibrary(); 

	// These are the function signatures used when calling GetProcAddress.
	typedef HANDLE(__stdcall *OPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
	typedef HRESULT(__stdcall *DRAWTHEMEBACKGROUND)(HANDLE hTheme, HDC hdc, 
		int iPartId, int iStateId, const RECT *pRect,  const RECT *pClipRect);
	typedef HRESULT(__stdcall *CLOSETHEMEDATA)(HANDLE hTheme);
	typedef HRESULT (__stdcall *DRAWTHEMETEXT)(HANDLE hTheme, HDC hdc, int iPartId, 
		int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, 
		DWORD dwTextFlags2, const RECT *pRect);
	typedef HRESULT (__stdcall *DRAWTHEMEEDGE)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, 
		const RECT *pDestRect, UINT uEdge, UINT uFlags,   RECT *pContentRect);
	typedef HRESULT (__stdcall *GETTHEMEMARGINS)(HANDLE hTheme,  HDC hdc, int iPartId, 
		int iStateId, int iPropId,  RECT *prc,  XPMARGINS *pMargins);
	typedef HRESULT (__stdcall *GETTHEMETEXTEXTENT)(HANDLE hTheme, HDC hdc, 
		int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, 
		DWORD dwTextFlags,  const RECT *pBoundingRect, 
		RECT *pExtentRect);
	typedef HRESULT (__stdcall *GETTHEMESTRING)(HANDLE hTheme, int iPartId, 
		int iStateId, int iPropId,  LPWSTR pszBuff, int cchMaxBuffChars);
	typedef BOOL (__stdcall *ISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(HANDLE hTheme, int iPartId, int iStateId);
	typedef HRESULT (__stdcall *DRAWTHEMEPARENTBACKGROUND)(HWND hwnd, HDC hdc, RECT * prc);
	typedef HRESULT (__stdcall *GETTHEMERECT)(HANDLE hTheme, int iPartId, 
		int iStateId, int iPropId,  RECT *pRect);
	typedef HRESULT(__stdcall *GETTHEMEPARTSIZE)(HANDLE hTheme, HDC hdc, 
		int iPartId, int iStateId, RECT * pRect, int eSize,  SIZE *psz);
	/* eSize is really this:
	typedef enum THEMESIZE
	{
		TS_MIN,             // minimum size
		TS_TRUE,            // size without stretching
		TS_DRAW,            // size that theme mgr will use to draw part
	};*/
};

#endif // !defined(AFX_UGXPThemes_H__5F3CE743_0206_482D_9C42_E408B983A3C6__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

The Ultimate Toolbox
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
Group type: Organisation

412 members


You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150819.1 | Last Updated 13 Feb 2013
Article Copyright 2008 by The Ultimate Toolbox
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid