MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / TabDialogProc

Function TabDialogProc

source/script_gui.cpp:10443–10536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10441
10442
10443INT_PTR CALLBACK TabDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
10444{
10445 switch (uMsg)
10446 {
10447 // Messages to be forwarded to the main GUI window:
10448 case WM_COMMAND:
10449 case WM_NOTIFY:
10450 case WM_VSCROLL: // These two should only be received for sliders and up-downs.
10451 case WM_HSCROLL: //
10452 case WM_CONTEXTMENU:
10453 //case WM_DROPFILES: // Not sent to the tab dialog since it doesn't accept drop.
10454 case WM_CTLCOLOREDIT:
10455 case WM_CTLCOLORLISTBOX:
10456 case WM_CTLCOLORSTATIC:
10457 case WM_CTLCOLORBTN: // Not used directly, but might be used by script.
10458 case WM_CTLCOLORSCROLLBAR: // As above.
10459 if (GuiType *pgui = GuiType::FindGui(GetParent(hDlg)))
10460 {
10461 // For Slider and Link controls to look right in a themed tab control, this custom
10462 // handling is needed. This also handles other controls for simplicity, although
10463 // there are easier methods available for them:
10464 // - Text/Picture: BackgroundTrans works (and overrides this section)
10465 // - Check/Radio/Group: EnableThemeDialogTexture() is enough
10466 // Unlike IsThemeActive, IsAppThemed will return false if the "Disable visual styles"
10467 // compatibility setting is turned on for this script's EXE.
10468 GuiControlType *pcontrol;
10469 if ( uMsg == WM_CTLCOLORSTATIC
10470 && (TABDIALOG_ATTRIB_THEMED & GetWindowLongPtr(hDlg, GWLP_USERDATA))
10471 && (pcontrol = pgui->FindControl((HWND)lParam))
10472 && (pcontrol->background_color != CLR_TRANSPARENT)
10473 && IsAppThemed() )
10474 {
10475 HDC hdc = (HDC)wParam;
10476 HBRUSH brush = (HBRUSH)GetProp(hDlg, _T("br"));
10477 if (!brush)
10478 {
10479 // Create a pattern brush based on a bitmap of this tab dialog's background.
10480 if (brush = CreateTabDialogBrush(hDlg, hdc))
10481 SetProp(hDlg, _T("br"), brush);
10482 }
10483 if (brush)
10484 {
10485 if (pcontrol->type != GUI_CONTROL_PIC && pcontrol->union_color != CLR_DEFAULT)
10486 SetTextColor((HDC)wParam, pcontrol->union_color);
10487 else
10488 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
10489
10490 // Tell the control to draw its background using our pattern brush.
10491 POINT pt = { 0,0 };
10492 MapWindowPoints(hDlg, (HWND)lParam, &pt, 1);
10493 SetBrushOrgEx(hdc, pt.x, pt.y, NULL);
10494 SetBkMode(hdc, TRANSPARENT); // Affects text rendering.
10495 return (INT_PTR)brush;
10496 }
10497 }
10498 // Forward this message to the GUI:
10499 LRESULT result = SendMessage(pgui->mHwnd, uMsg, wParam, lParam);
10500 if (uMsg >= WM_CTLCOLOREDIT && uMsg <= WM_CTLCOLORSTATIC)

Callers

nothing calls this directly

Calls 4

CreateTabDialogBrushFunction · 0.85
FindTabControlMethod · 0.80
ControlGetBkColorMethod · 0.80
FindControlMethod · 0.45

Tested by

no test coverage detected