uxtheme.h
来自「这是VCF框架的代码」· C头文件 代码 · 共 936 行 · 第 1/4 页
H
936 行
//---------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.//// File : uxtheme.h// Version: 1.0//---------------------------------------------------------------------------#ifndef _UXTHEME_H_#define _UXTHEME_H_#ifdef __BORLANDC__#pragma option push -b -a8 -pc -A- /*P_O_Push*/#endif//---------------------------------------------------------------------------#include <commctrl.h>//---------------------------------------------------------------------------//#if (_WIN32_WINNT >= 0x0500) // only available on XP//---------------------------------------------------------------------------// Define API decoration for direct importing of DLL references.#ifndef THEMEAPI#if !defined(_UXTHEME_)#define THEMEAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE#define THEMEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE#else#define THEMEAPI STDAPI#define THEMEAPI_(type) STDAPI_(type)#endif#endif // THEMEAPI//---------------------------------------------------------------------------typedef HANDLE HTHEME; // handle to a section of theme data for class//---------------------------------------------------------------------------// NOTE: PartId's and StateId's used in the theme API are defined in the // hdr file <tmschema.h> using the TM_PART and TM_STATE macros. For// example, "TM_PART(BP, PUSHBUTTON)" defines the PartId "BP_PUSHBUTTON".//---------------------------------------------------------------------------// OpenThemeData() - Open the theme data for the specified HWND and // semi-colon separated list of class names. // // OpenThemeData() will try each class name, one at // a time, and use the first matching theme info// found. If a match is found, a theme handle// to the data is returned. If no match is found,// a "NULL" handle is returned. //// When the window is destroyed or a WM_THEMECHANGED// msg is received, "CloseThemeData()" should be // called to close the theme handle.//// hwnd - window handle of the control/window to be themed//// pszClassList - class name (or list of names) to match to theme data// section. if the list contains more than one name, // the names are tested one at a time for a match. // If a match is found, OpenThemeData() returns a // theme handle associated with the matching class. // This param is a list (instead of just a single // class name) to provide the class an opportunity // to get the "best" match between the class and // the current theme. For example, a button might// pass L"OkButton, Button" if its ID=ID_OK. If // the current theme has an entry for OkButton, // that will be used. Otherwise, we fall back on // the normal Button entry.//---------------------------------------------------------------------------THEMEAPI_(HTHEME) OpenThemeData(HWND hwnd, LPCWSTR pszClassList);//---------------------------------------------------------------------------// CloseTHemeData() - closes the theme data handle. This should be done // when the window being themed is destroyed or// whenever a WM_THEMECHANGED msg is received // (followed by an attempt to create a new Theme data // handle).//// hTheme - open theme data handle (returned from prior call// to OpenThemeData() API).//---------------------------------------------------------------------------THEMEAPI CloseThemeData(HTHEME hTheme);//---------------------------------------------------------------------------// functions for basic drawing support //---------------------------------------------------------------------------// The following methods are the theme-aware drawing services.// Controls/Windows are defined in drawable "parts" by their author: a // parent part and 0 or more child parts. Each of the parts can be // described in "states" (ex: disabled, hot, pressed). //---------------------------------------------------------------------------// For the list of all themed classes and the definition of all// parts and states, see the file "tmschmea.h".//---------------------------------------------------------------------------// Each of the below methods takes a "iPartId" param to specify the // part and a "iStateId" to specify the state of the part. // "iStateId=0" refers to the root part. "iPartId" = "0" refers to // the root class. //-----------------------------------------------------------------------// Note: draw operations are always scaled to fit (and not to exceed) // the specified "Rect".//-----------------------------------------------------------------------//------------------------------------------------------------------------// DrawThemeBackground() // - draws the theme-specified border and fill for // the "iPartId" and "iStateId". This could be // based on a bitmap file, a border and fill, or // other image description. //// hTheme - theme data handle// hdc - HDC to draw into// iPartId - part number to draw// iStateId - state number (of the part) to draw// pRect - defines the size/location of the part// pClipRect - optional clipping rect (don't draw outside it)//------------------------------------------------------------------------THEMEAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);//---------------------------------------------------------------------------//----- DrawThemeText() flags ----#define DTT_GRAYED 0x1 // draw a grayed-out string //-------------------------------------------------------------------------// DrawThemeText() - draws the text using the theme-specified // color and font for the "iPartId" and // "iStateId". //// hTheme - theme data handle// hdc - HDC to draw into// iPartId - part number to draw// iStateId - state number (of the part) to draw// pszText - actual text to draw// dwCharCount - number of chars to draw (-1 for all)// dwTextFlags - same as DrawText() "uFormat" param// dwTextFlags2 - additional drawing options // pRect - defines the size/location of the part//-------------------------------------------------------------------------THEMEAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect);//-------------------------------------------------------------------------// GetThemeBackgroundContentRect()// - gets the size of the content for the theme-defined // background. This is usually the area inside// the borders or Margins. //// hTheme - theme data handle// hdc - (optional) device content to be used for drawing// iPartId - part number to draw// iStateId - state number (of the part) to draw// pBoundingRect - the outer RECT of the part being drawn// pContentRect - RECT to receive the content area//-------------------------------------------------------------------------THEMEAPI GetThemeBackgroundContentRect(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, OUT RECT *pContentRect);//-------------------------------------------------------------------------// GetThemeBackgroundExtent() - calculates the size/location of the theme-// specified background based on the // "pContentRect".//// hTheme - theme data handle// hdc - (optional) device content to be used for drawing// iPartId - part number to draw// iStateId - state number (of the part) to draw// pContentRect - RECT that defines the content area// pBoundingRect - RECT to receive the overall size/location of part//-------------------------------------------------------------------------THEMEAPI GetThemeBackgroundExtent(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pContentRect, OUT RECT *pExtentRect);//-------------------------------------------------------------------------typedef enum tag_THEMESIZE{ TS_MIN, // minimum size TS_TRUE, // size without stretching TS_DRAW, // size that theme mgr will use to draw part} THEMESIZE;//-------------------------------------------------------------------------// GetThemePartSize() - returns the specified size of the theme part//// hTheme - theme data handle// hdc - HDC to select font into & measure against// iPartId - part number to retrieve size for// iStateId - state number (of the part) // prc - (optional) rect for part drawing destination// eSize - the type of size to be retreived// psz - receives the specified size of the part //-------------------------------------------------------------------------THEMEAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum tag_THEMESIZE eSize, OUT SIZE *psz);//-------------------------------------------------------------------------// GetThemeTextExtent() - calculates the size/location of the specified // text when rendered in the Theme Font. //// hTheme - theme data handle// hdc - HDC to select font & measure into// iPartId - part number to draw// iStateId - state number (of the part) // pszText - the text to be measured// dwCharCount - number of chars to draw (-1 for all)// dwTextFlags - same as DrawText() "uFormat" param// pszBoundingRect - optional: to control layout of text// pszExtentRect - receives the RECT for text size/location//-------------------------------------------------------------------------THEMEAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, OPTIONAL const RECT *pBoundingRect, OUT RECT *pExtentRect);//-------------------------------------------------------------------------// GetThemeTextMetrics()// - returns info about the theme-specified font// for the part/state passed in.//// hTheme - theme data handle// hdc - optional: HDC for screen context// iPartId - part number to draw// iStateId - state number (of the part) // ptm - receives the font info//-------------------------------------------------------------------------THEMEAPI GetThemeTextMetrics(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, OUT TEXTMETRIC* ptm);//-------------------------------------------------------------------------// GetThemeBackgroundRegion()// - computes the region for a regular or partially // transparent theme-specified background that is // bound by the specified "pRect".// If the rectangle is empty, sets the HRGN to NULL
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?