• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Return-To-The-Roots / s25client / 44076625557

17 Nov 2026 11:43AM UTC coverage: 51.803% (-0.002%) from 51.805%
44076625557

push

github

web-flow
Merge pull request #2018 from Return-To-The-Roots/refactor/lowerCamelCase-methods

Rename Msg_* handlers to lowerCamelCase

8121 of 16693 new or added lines in 565 files covered. (48.65%)

323 existing lines in 133 files now uncovered.

24236 of 46785 relevant lines covered (51.8%)

49647.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.52
/libs/s25main/controls/ctrlCheck.cpp
1
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
2
//
3
// SPDX-License-Identifier: GPL-2.0-or-later
4

5
#include "ctrlCheck.h"
6

7
#include "CollisionDetection.h"
8
#include "Loader.h"
9
#include "driver/MouseCoords.h"
10
#include "ogl/FontStyle.h"
11
#include "ogl/glArchivItem_Bitmap.h"
12
#include "ogl/glFont.h"
13
#include <utility>
14

15
ctrlCheck::ctrlCheck(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
51 ✔
16
                     std::string text, const glFont* font, bool readonly)
51 ✔
17
    : Window(parent, id, pos, size), tc(tc), text(std::move(text)), font(font), check(false), readonly(readonly)
51 ✔
18
{}
51 ✔
19

NEW
20
bool ctrlCheck::msgLeftDown(const MouseCoords& mc)
×
21
{
NEW
22
    if(!readonly && IsPointInRect(mc.pos, getDrawRect()))
×
23
    {
24
        check = !check;
×
NEW
25
        getParent()->msgCheckboxChange(getID(), check);
×
26
        return true;
×
27
    }
28

29
    return false;
×
30
}
31

NEW
32
bool ctrlCheck::msgMouseMove(const MouseCoords& mc)
×
33
{
NEW
34
    if(isMouseOver(mc.pos))
×
35
    {
NEW
36
        showTooltip();
×
37
        return true;
×
38
    } else
39
    {
NEW
40
        hideTooltip();
×
41
        return false;
×
42
    }
43
}
44

45
void ctrlCheck::drawImpl()
3 ✔
46
{
47
    const unsigned short boxSize = 20;
3 ✔
48
    short spacing = (getSize().y - boxSize) / 2;
3 ✔
49
    if(spacing < 0)
3 ✔
50
        spacing = 0;
×
51
    Rect drawRect = getDrawRect();
3 ✔
52
    const bool drawText = font && !text.empty();
3 ✔
53
    if(!drawText)
3 ✔
54
    {
55
        // If we draw only the check mark, draw surrounding box smaller and center checkbox
56
        drawRect.setSize(Extent(boxSize + 2 * spacing, drawRect.getSize().y));
×
NEW
57
        drawRect.move(DrawPoint((getSize().x - drawRect.getSize().x) / 2, 0));
×
58
    }
59
    short boxStartOffsetX = drawRect.getSize().x - spacing - boxSize;
3 ✔
60
    if(boxStartOffsetX < 0)
3 ✔
61
        boxStartOffsetX = 0;
×
62

63
    draw3D(drawRect, tc, false);
3 ✔
64

65
    if(drawText)
3 ✔
66
    {
67
        int availableWidth = boxStartOffsetX - 4;
3 ✔
68
        if(availableWidth < 0)
3 ✔
69
            availableWidth = 0;
×
70
        font->draw(drawRect.getOrigin() + DrawPoint(4, getSize().y / 2), text, FontStyle::VCENTER,
6 ✔
71
                   (check ? COLOR_YELLOW : 0xFFBBBBBB), availableWidth);
3 ✔
72
    }
73

74
    DrawPoint boxPos = drawRect.getOrigin() + DrawPoint(boxStartOffsetX, spacing);
3 ✔
75

76
    if(!readonly)
3 ✔
77
        draw3D(Rect(boxPos, Extent::all(boxSize)), tc, false);
3 ✔
78

79
    if(check)
3 ✔
80
        LOADER.getImageN("io", 32)->drawFull(boxPos + DrawPoint(boxSize, boxSize) / 2);
2 ✔
81
}
3 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc