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

Function TabWindowProc

source/script_gui.cpp:9153–9196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9151
9152
9153LRESULT CALLBACK TabWindowProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
9154{
9155 // Variables are kept separate up here for future expansion of this function (to handle
9156 // more iMsgs/cases, etc.):
9157 GuiType *pgui;
9158 GuiControlType *pcontrol;
9159 HWND parent_window;
9160 HBRUSH bk_brush;
9161 COLORREF bk_color;
9162
9163 switch (iMsg)
9164 {
9165 case WM_ERASEBKGND:
9166 case WM_WINDOWPOSCHANGED:
9167 parent_window = GetParent(hWnd);
9168 // Relies on short-circuit boolean order:
9169 if ( !(pgui = GuiType::FindGui(parent_window)) || !(pcontrol = pgui->FindControl(hWnd)) )
9170 break;
9171 switch (iMsg)
9172 {
9173 case WM_ERASEBKGND:
9174 pgui->ControlGetBkColor(*pcontrol, true, bk_brush, bk_color);
9175 if (!bk_brush)
9176 break; // Let default proc handle it.
9177 // Can't use SetBkColor(), need a real brush to fill it.
9178 RECT clipbox;
9179 GetClipBox((HDC)wParam, &clipbox);
9180 FillRect((HDC)wParam, &clipbox, bk_brush);
9181 return 1; // "An application should return nonzero if it erases the background."
9182 case WM_WINDOWPOSCHANGED:
9183 if ((LPWINDOWPOS(lParam)->flags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE)) // i.e. moved, resized or both.
9184 {
9185 // This appears to allow the tab control to update its row count:
9186 LRESULT r = CallWindowProc(g_TabClassProc, hWnd, iMsg, wParam, lParam);
9187 // Update this tab control's dialog, if it has one, to match the new size/position.
9188 pgui->UpdateTabDialog(hWnd);
9189 return r;
9190 }
9191 }
9192 }
9193
9194 // This will handle anything not already fully handled and returned from above:
9195 return CallWindowProc(g_TabClassProc, hWnd, iMsg, wParam, lParam);
9196}
9197
9198
9199

Callers

nothing calls this directly

Calls 3

ControlGetBkColorMethod · 0.80
UpdateTabDialogMethod · 0.80
FindControlMethod · 0.45

Tested by

no test coverage detected