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

Method Paint

src/windows/MessageList.cpp:3038–3204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3036}
3037
3038void MessageList::Paint(HDC hdc, RECT& paintRect)
3039{
3040 RECT rect = {};
3041 GetClientRect(m_hwnd, &rect);
3042 PaintBackground(hdc, paintRect, rect);
3043 int windowHeight = rect.bottom - rect.top;
3044 int ScrollHeight = 0;
3045 SCROLLINFO si;
3046 si.cbSize = sizeof(si);
3047 si.fMask = SIF_POS | SIF_RANGE;
3048 ri::GetScrollInfo(m_hwnd, SB_VERT, &si);
3049 ScrollHeight = si.nPos;
3050
3051 RECT msgRect = rect;
3052 msgRect.top -= ScrollHeight;
3053
3054 if (m_total_height < windowHeight && !m_bIsTopDown) {
3055 msgRect.top += windowHeight - m_total_height;
3056 }
3057
3058 msgRect.bottom = msgRect.top;
3059
3060 eMessageStyle mStyle = GetLocalSettings()->GetMessageStyle();
3061
3062 int oldBkMode = 0; bool oldBkModeSet = false;
3063 COLORREF oldBkColor = CLR_NONE;
3064 COLORREF chosenBkColor = CLR_NONE;
3065
3066 switch (mStyle) {
3067 case MS_GRADIENT: {
3068 oldBkMode = SetBkMode(hdc, TRANSPARENT);
3069 oldBkModeSet = true;
3070 chosenBkColor = GetSysColor(COLOR_3DFACE);
3071 break;
3072 }
3073 case MS_FLATBR: {
3074 chosenBkColor = GetSysColor(COLOR_WINDOW);
3075 oldBkColor = SetBkColor(hdc, chosenBkColor);
3076 break;
3077 }
3078 case MS_IMAGE: {
3079 oldBkMode = SetBkMode(hdc, TRANSPARENT);
3080 oldBkModeSet = true;
3081 chosenBkColor = m_backgroundColor;
3082 break;
3083 }
3084 default: {
3085 chosenBkColor = GetSysColor(COLOR_3DFACE);
3086 oldBkColor = SetBkColor(hdc, chosenBkColor);
3087 break;
3088 }
3089 }
3090
3091 DrawingContext mddc(hdc);
3092 mddc.SetBackgroundColor(chosenBkColor);
3093 mddc.SetInvertTextColor(InvertIfNeeded(GetSysColor(COLOR_WINDOWTEXT)));
3094
3095 Snowflake lastDrawnMessage = 0;

Callers 1

WndProcMethod · 0.45

Calls 14

GetLocalSettingsFunction · 0.85
GetDiscordInstanceFunction · 0.85
GetMessageStyleMethod · 0.80
SetBackgroundColorMethod · 0.80
SetInvertTextColorMethod · 0.80
IsLoadGapMethod · 0.80
SetEmptyMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
EmptyMethod · 0.45

Tested by

no test coverage detected