本文整理汇总了C++中GetWindowTheme函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowTheme函数的具体用法?C++ GetWindowTheme怎么用?C++ GetWindowTheme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetWindowTheme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: THEMING_EditSubclassProc
/**********************************************************************
* The edit control subclass window proc.
*/
LRESULT CALLBACK THEMING_EditSubclassProc (HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam,
ULONG_PTR dwRefData)
{
const WCHAR* themeClass = WC_EDITW;
HTHEME theme;
LRESULT result;
switch (msg)
{
case WM_CREATE:
result = THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
OpenThemeData( hwnd, themeClass );
return result;
case WM_DESTROY:
theme = GetWindowTheme( hwnd );
CloseThemeData ( theme );
return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
case WM_THEMECHANGED:
theme = GetWindowTheme( hwnd );
CloseThemeData ( theme );
OpenThemeData( hwnd, themeClass );
break;
case WM_SYSCOLORCHANGE:
theme = GetWindowTheme( hwnd );
if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
/* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
* which will do the repaint. */
break;
case WM_NCPAINT:
theme = GetWindowTheme( hwnd );
if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
nc_paint (theme, hwnd, (HRGN)wParam);
break;
case WM_ENABLE:
case WM_KILLFOCUS:
case WM_SETFOCUS:
theme = GetWindowTheme( hwnd );
if (theme) RedrawWindow (hwnd, NULL, NULL,
RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
default:
/* Call old proc */
return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
}
return 0;
}
示例2: UPDOWN_Draw
/***********************************************************************
* UPDOWN_Draw
*
* Draw the arrows. The background need not be erased.
*/
static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc)
{
BOOL uPressed, uHot, dPressed, dHot;
RECT rect;
HTHEME theme = GetWindowTheme (infoPtr->Self);
int uPart = 0, uState = 0, dPart = 0, dState = 0;
BOOL needBuddyBg = FALSE;
uPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR);
uHot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN);
dPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR);
dHot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN);
if (theme) {
uPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_UPHORZ : SPNP_UP;
uState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED
: (uPressed ? DNS_PRESSED : (uHot ? DNS_HOT : DNS_NORMAL));
dPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_DOWNHORZ : SPNP_DOWN;
dState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED
: (dPressed ? DNS_PRESSED : (dHot ? DNS_HOT : DNS_NORMAL));
needBuddyBg = IsWindow (infoPtr->Buddy)
&& (IsThemeBackgroundPartiallyTransparent (theme, uPart, uState)
|| IsThemeBackgroundPartiallyTransparent (theme, dPart, dState));
}
/* Draw the common border between ourselves and our buddy */
if (UPDOWN_HasBuddyBorder(infoPtr) || needBuddyBg) {
if (!theme || !UPDOWN_DrawBuddyBackground (infoPtr, hdc)) {
GetClientRect(infoPtr->Self, &rect);
DrawEdge(hdc, &rect, EDGE_SUNKEN,
BF_BOTTOM | BF_TOP |
(infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT));
}
}
/* Draw the incr button */
UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR);
if (theme) {
DrawThemeBackground(theme, hdc, uPart, uState, &rect, NULL);
} else {
DrawFrameControl(hdc, &rect, DFC_SCROLL,
(infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) |
((infoPtr->dwStyle & UDS_HOTTRACK) && uHot ? DFCS_HOT : 0) |
(uPressed ? DFCS_PUSHED : 0) |
(infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
}
/* Draw the decr button */
UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR);
if (theme) {
DrawThemeBackground(theme, hdc, dPart, dState, &rect, NULL);
} else {
DrawFrameControl(hdc, &rect, DFC_SCROLL,
(infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) |
((infoPtr->dwStyle & UDS_HOTTRACK) && dHot ? DFCS_HOT : 0) |
(dPressed ? DFCS_PUSHED : 0) |
(infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
}
return 0;
}
示例3: theme_changed
/* update theme after a WM_THEMECHANGED message */
static LRESULT theme_changed (const STATUS_INFO* infoPtr)
{
HTHEME theme = GetWindowTheme (infoPtr->Self);
CloseThemeData (theme);
OpenThemeData (infoPtr->Self, themeClass);
return 0;
}
示例4: STATUSBAR_RefreshPart
static void
STATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
{
HBRUSH hbrBk;
HTHEME theme;
TRACE("item %d\n", itemID);
if (part->bound.right < part->bound.left) return;
if (!RectVisible(hdc, &part->bound))
return;
if ((theme = GetWindowTheme (infoPtr->Self)))
{
RECT cr;
GetClientRect (infoPtr->Self, &cr);
DrawThemeBackground(theme, hdc, 0, 0, &cr, &part->bound);
}
else
{
if (infoPtr->clrBk != CLR_DEFAULT)
hbrBk = CreateSolidBrush (infoPtr->clrBk);
else
hbrBk = GetSysColorBrush (COLOR_3DFACE);
FillRect(hdc, &part->bound, hbrBk);
if (infoPtr->clrBk != CLR_DEFAULT)
DeleteObject (hbrBk);
}
STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
}
示例5: STATUSBAR_WMDestroy
static LRESULT
STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
{
unsigned int i;
TRACE("\n");
for (i = 0; i < infoPtr->numParts; i++) {
if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))
Free (infoPtr->parts[i].text);
}
if (!(infoPtr->part0.style & SBT_OWNERDRAW))
Free (infoPtr->part0.text);
Free (infoPtr->parts);
/* delete default font */
if (infoPtr->hDefaultFont)
DeleteObject (infoPtr->hDefaultFont);
/* delete tool tip control */
if (infoPtr->hwndToolTip)
DestroyWindow (infoPtr->hwndToolTip);
CloseThemeData (GetWindowTheme (infoPtr->Self));
SetWindowLongPtrW(infoPtr->Self, 0, 0);
Free (infoPtr);
return 0;
}
示例6: STATUSBAR_ComputeHeight
static UINT
STATUSBAR_ComputeHeight(STATUS_INFO *infoPtr)
{
HTHEME theme;
UINT height;
TEXTMETRICW tm;
int margin;
COMCTL32_GetFontMetrics(infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont, &tm);
margin = (tm.tmInternalLeading ? tm.tmInternalLeading : 2);
height = max(tm.tmHeight + margin + 2*GetSystemMetrics(SM_CYBORDER), infoPtr->minHeight) + infoPtr->verticalBorder;
if ((theme = GetWindowTheme(infoPtr->Self)))
{
/* Determine bar height from theme such that the content area is
* textHeight pixels large */
HDC hdc = GetDC(infoPtr->Self);
RECT r;
SetRect(&r, 0, 0, 0, max(infoPtr->minHeight, tm.tmHeight));
if (SUCCEEDED(GetThemeBackgroundExtent(theme, hdc, SP_PANE, 0, &r, &r)))
{
height = r.bottom - r.top;
}
ReleaseDC(infoPtr->Self, hdc);
}
TRACE(" textHeight=%d+%d, final height=%d\n", tm.tmHeight, tm.tmInternalLeading, height);
return height;
}
示例7: UPDOWN_DrawBuddyBackground
/***********************************************************************
* UPDOWN_DrawBuddyBackground
*
* Draw buddy background for visual integration.
*/
static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc)
{
RECT br;
HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);
if (!buddyTheme) return FALSE;
GetClientRect (infoPtr->Buddy, &br);
MapWindowPoints (infoPtr->Buddy, infoPtr->Self, (POINT*)&br, 2);
/* FIXME: take disabled etc. into account */
DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL);
return TRUE;
}
示例8: get_led_gap
/* Helper to obtain gap between progress bar chunks */
static inline int get_led_gap ( PROGRESS_INFO *infoPtr )
{
HTHEME theme = GetWindowTheme (infoPtr->Self);
if (theme)
{
int spaceSize;
if (SUCCEEDED( GetThemeInt( theme, 0, 0, TMT_PROGRESSSPACESIZE, &spaceSize )))
return spaceSize;
}
return LED_GAP;
}
示例9: STATUSBAR_DrawPart
static void
STATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
{
RECT r = part->bound;
UINT border = BDR_SUNKENOUTER;
HTHEME theme = GetWindowTheme (infoPtr->Self);
int themePart = SP_PANE;
int x = 0;
TRACE("part bound %s\n", wine_dbgstr_rect(&r));
if (part->style & SBT_POPOUT)
border = BDR_RAISEDOUTER;
else if (part->style & SBT_NOBORDERS)
border = 0;
if (theme)
{
if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
&& (infoPtr->simple || (itemID == (infoPtr->numParts-1))))
themePart = SP_GRIPPERPANE;
DrawThemeBackground(theme, hdc, themePart, 0, &r, NULL);
}
else
DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
if (part->hIcon) {
INT cy = r.bottom - r.top;
DrawIconEx (hdc, r.left + 2, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
x = 2 + cy;
}
if (part->style & SBT_OWNERDRAW) {
DRAWITEMSTRUCT dis;
dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
dis.itemID = itemID;
dis.hwndItem = infoPtr->Self;
dis.hDC = hdc;
dis.rcItem = r;
dis.itemData = (ULONG_PTR)part->text;
SendMessageW (infoPtr->Notify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
} else {
r.left += x;
#ifdef __REACTOS__
if (!theme)
DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
else
DrawThemeText(theme, hdc, SP_PANE, 0, part->text, -1, DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX, 0, &r);
#else
DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
#endif
}
}
示例10: get_client_rect
/* Get client rect. Takes into account that theming needs no adjustment. */
static inline void get_client_rect (HWND hwnd, RECT* rect)
{
HTHEME theme = GetWindowTheme (hwnd);
GetClientRect (hwnd, rect);
if (!theme)
InflateRect(rect, -1, -1);
else
{
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
int part = (dwStyle & PBS_VERTICAL) ? PP_BARVERT : PP_BAR;
GetThemeBackgroundContentRect (theme, 0, part, 0, rect, rect);
}
}
示例11: STATUSBAR_Refresh
static LRESULT
STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
{
RECT rect;
HBRUSH hbrBk;
HFONT hOldFont;
HTHEME theme;
TRACE("\n");
if (!IsWindowVisible(infoPtr->Self))
return 0;
STATUSBAR_SetPartBounds(infoPtr);
GetClientRect (infoPtr->Self, &rect);
if ((theme = GetWindowTheme (infoPtr->Self)))
{
DrawThemeBackground(theme, hdc, 0, 0, &rect, NULL);
}
else
{
if (infoPtr->clrBk != CLR_DEFAULT)
hbrBk = CreateSolidBrush (infoPtr->clrBk);
else
hbrBk = GetSysColorBrush (COLOR_3DFACE);
FillRect(hdc, &rect, hbrBk);
if (infoPtr->clrBk != CLR_DEFAULT)
DeleteObject (hbrBk);
}
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
if (infoPtr->simple) {
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
} else {
unsigned int i;
for (i = 0; i < infoPtr->numParts; i++) {
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
}
}
SelectObject (hdc, hOldFont);
if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
&& !(GetWindowLongW (infoPtr->Notify, GWL_STYLE) & WS_MAXIMIZE))
STATUSBAR_DrawSizeGrip (theme, hdc, &rect);
return 0;
}
示例12: ShowWindow
HRESULT CMenuToolbarBase::ShowDW(BOOL fShow)
{
ShowWindow(fShow ? SW_SHOW : SW_HIDE);
// Ensure that the right image list is assigned to the toolbar
UpdateImageLists();
// For custom-drawing
if (IsAppThemed())
GetThemeSysBool(GetWindowTheme(m_hWnd), TMT_FLATMENUS);
else
SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
return S_OK;
}
示例13: get_led_size
/* Helper to obtain size of a progress bar chunk ("led"). */
static inline int get_led_size ( PROGRESS_INFO *infoPtr, LONG style,
const RECT* rect )
{
HTHEME theme = GetWindowTheme (infoPtr->Self);
if (theme)
{
int chunkSize;
if (SUCCEEDED( GetThemeInt( theme, 0, 0, TMT_PROGRESSCHUNKSIZE, &chunkSize )))
return chunkSize;
}
if (style & PBS_VERTICAL)
return MulDiv (rect->right - rect->left, 2, 3);
else
return MulDiv (rect->bottom - rect->top, 2, 3);
}
示例14: UPDOWN_GetArrowRect
/***********************************************************************
* UPDOWN_GetArrowRect
* wndPtr - pointer to the up-down wnd
* rect - will hold the rectangle
* arrow - FLAG_INCR to get the "increment" rect (up or right)
* FLAG_DECR to get the "decrement" rect (down or left)
* If both flags are present, the envelope is returned.
*/
static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
{
HTHEME theme = GetWindowTheme (infoPtr->Self);
const int border = theme ? DEFAULT_BUDDYBORDER_THEMED : DEFAULT_BUDDYBORDER;
const int spacer = theme ? DEFAULT_BUDDYSPACER_THEMED : DEFAULT_BUDDYSPACER;
GetClientRect (infoPtr->Self, rect);
/*
* Make sure we calculate the rectangle to fit even if we draw the
* border.
*/
if (UPDOWN_HasBuddyBorder(infoPtr)) {
if (infoPtr->dwStyle & UDS_ALIGNLEFT)
rect->left += border;
else
rect->right -= border;
InflateRect(rect, 0, -border);
}
/* now figure out if we need a space away from the buddy */
if (IsWindow(infoPtr->Buddy) ) {
if (infoPtr->dwStyle & UDS_ALIGNLEFT) rect->right -= spacer;
else rect->left += spacer;
}
/*
* We're calculating the midpoint to figure-out where the
* separation between the buttons will lay. We make sure that we
* round the uneven numbers by adding 1.
*/
if (infoPtr->dwStyle & UDS_HORZ) {
int len = rect->right - rect->left + 1; /* compute the width */
if (arrow & FLAG_INCR)
rect->left = rect->left + len/2;
if (arrow & FLAG_DECR)
rect->right = rect->left + len/2 - (theme ? 0 : 1);
} else {
int len = rect->bottom - rect->top + 1; /* compute the height */
if (arrow & FLAG_INCR)
rect->bottom = rect->top + len/2 - (theme ? 0 : 1);
if (arrow & FLAG_DECR)
rect->top = rect->top + len/2;
}
}
示例15: UPDOWN_DrawBuddyBackground
/***********************************************************************
* UPDOWN_DrawBuddyBackground
*
* Draw buddy background for visual integration.
*/
static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc)
{
RECT br, r;
HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);
if (!buddyTheme) return FALSE;
GetWindowRect (infoPtr->Buddy, &br);
MapWindowPoints (NULL, infoPtr->Self, (POINT*)&br, 2);
GetClientRect (infoPtr->Self, &r);
if (infoPtr->dwStyle & UDS_ALIGNLEFT)
br.left = r.left;
else if (infoPtr->dwStyle & UDS_ALIGNRIGHT)
br.right = r.right;
/* FIXME: take disabled etc. into account */
DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL);
return TRUE;
}