MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / DrawLoading

Method DrawLoading

src/windows/LoadingMessage.cpp:62–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void LoadingMessage::DrawLoading(HDC hdc)
63{
64 RECT rect;
65 GetClientRect(m_hwnd, &rect);
66 rect.top += MulDiv(rect.bottom - rect.top, 3, 4);
67 int iconSizeSm = GetSystemMetrics(SM_CXSMICON);
68
69 // Draw loading bar
70 int dotWidth = iconSizeSm / 2;
71 int yLoad = rect.top - ScaleByDPI(12) - iconSizeSm / 2;
72 int xLoad = (rect.right - rect.left - dotWidth * C_NUM_LOADING_DOTS) / 2;
73
74 for (int i = 0; i < C_NUM_LOADING_DOTS; i++) {
75 // XXX: crappy solution, done to allow smooth looparound
76 int st1 = m_icon_stage;
77 int st2 = (m_icon_stage + 1) % C_NUM_LOADING_DOTS;
78 int st3 = (m_icon_stage + 2) % C_NUM_LOADING_DOTS;
79 HICON ic = m_dot_0;
80 if (i == st1 || i == st2 || i == st3)
81 ic = m_dot_1;
82
83 ri::DrawIconEx(hdc, xLoad + i * dotWidth - (iconSizeSm - dotWidth) / 2, yLoad, ic, iconSizeSm, iconSizeSm, 0, NULL, DI_COMPAT | DI_NORMAL);
84 }
85
86 m_load_rect = { xLoad, yLoad, xLoad + dotWidth * C_NUM_LOADING_DOTS, yLoad + iconSizeSm };
87}
88
89LRESULT CALLBACK LoadingMessage::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
90{

Callers 1

WndProcMethod · 0.80

Calls 1

ScaleByDPIFunction · 0.85

Tested by

no test coverage detected