1
0
forked from mirrors/0ad

Fix some headers in gui

Make include-what-you-use happy with a part of the files in source/gui
and fix what needs to be fixed after including missing compile flags.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2025-06-20 00:06:41 +02:00
parent 707abee34d
commit 61326cfca6
40 changed files with 152 additions and 58 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,6 +18,8 @@
#ifndef INCLUDED_SCOLOR
#define INCLUDED_SCOLOR
#include "lib/types.h"
// SColor3ub: structure for packed RGB colors
struct SColor3ub
{
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,6 +20,8 @@
#ifndef INCLUDED_SHADERTECHNIQUEPTR
#define INCLUDED_SHADERTECHNIQUEPTR
#include <memory>
/*
* Forward declaration, to reduce the number of header files that have to pull
* in the whole of ShaderTechnique.h
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,6 +18,8 @@
#ifndef INCLUDED_TEXTURE
#define INCLUDED_TEXTURE
#include <memory>
// Forward-declare for CTextureManager handles
class CTexture;
typedef std::shared_ptr<CTexture> CTexturePtr;
+24 -8
View File
@@ -24,36 +24,52 @@
#define INCLUDED_CGUI
#include "gui/GUITooltip.h"
#include "gui/SettingTypes/CGUIColor.h"
#include "gui/SGUIIcon.h"
#include "gui/SGUIMessage.h"
#include "gui/SGUIStyle.h"
#include "gui/SettingTypes/CGUIColor.h"
#include "lib/code_annotation.h"
#include "lib/file/vfs/vfs_path.h"
#include "lib/input.h"
#include "lib/types.h"
#include "maths/Rect.h"
#include "maths/Size2D.h"
#include "maths/Vector2D.h"
#include "ps/XML/Xeromyces.h"
#include "ps/CStr.h"
#include "scriptinterface/ModuleLoader.h"
#include "scriptinterface/StructuredClone.h"
#include "scriptinterface/ScriptForward.h"
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
extern const double SELECT_DBLCLICK_RATE;
class CCanvas2D;
class CGUISpriteInstance;
class CGUISprite;
class CGUISpriteInstance;
class CSize2D;
class GUIProxyProps;
class IGUIObject;
class JSObject;
class ScriptContext;
class ScriptInterface;
class ScriptRequest;
class XMBData;
class XMBElement;
namespace JS { class HandleValueArray; }
namespace JS { class Value; }
namespace js { class BaseProxyHandler; }
struct SDL_Event_;
struct SGUIImageEffects;
struct SGUIScrollBarStyle;
class GUIProxyProps;
extern const double SELECT_DBLCLICK_RATE;
using map_pObjects = std::map<CStr, IGUIObject*>;
+6 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,6 +20,11 @@
#include "CGUIScrollBarHorizontal.h"
#include "gui/CGUI.h"
#include "gui/CGUISprite.h"
#include "gui/IGUIScrollBar.h"
#include "gui/SGUIMessage.h"
#include "maths/Rect.h"
#include "maths/Vector2D.h"
#include "ps/CLogger.h"
CGUIScrollBarHorizontal::CGUIScrollBarHorizontal(CGUI& pGUI)
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -26,6 +26,8 @@
#include "IGUIScrollBar.h"
class CGUI;
/**
* Horizontal implementation of IGUIScrollBar
*
+6 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,6 +20,11 @@
#include "CGUIScrollBarVertical.h"
#include "gui/CGUI.h"
#include "gui/CGUISprite.h"
#include "gui/IGUIScrollBar.h"
#include "gui/SGUIMessage.h"
#include "maths/Rect.h"
#include "maths/Vector2D.h"
#include "ps/CLogger.h"
CGUIScrollBarVertical::CGUIScrollBarVertical(CGUI& pGUI)
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -26,6 +26,8 @@
#include "IGUIScrollBar.h"
class CGUI;
/**
* Vertical implementation of IGUIScrollBar
*
+3 -1
View File
@@ -18,12 +18,14 @@
#ifndef INCLUDED_CGUISETTINGS
#define INCLUDED_CGUISETTINGS
#include "lib/code_annotation.h"
#include "ps/CStr.h"
#include "scriptinterface/ScriptForward.h"
#include <js/TypeDecls.h>
#include <utility>
class IGUIObject;
class ScriptRequest;
/**
* This setting interface allows GUI objects to call setting function functions without having to know the setting type.
+2
View File
@@ -19,6 +19,8 @@
#include "CGUISprite.h"
#include <utility>
CGUISprite::~CGUISprite() = default;
void CGUISprite::AddImage(std::unique_ptr<SGUIImage> image)
+4 -1
View File
@@ -24,9 +24,11 @@
#define INCLUDED_CGUISPRITE
#include "gui/GUIRenderer.h"
#include "gui/SettingTypes/CGUISize.h"
#include "gui/SettingTypes/CGUIColor.h"
#include "gui/SettingTypes/CGUISize.h"
#include "lib/code_annotation.h"
#include "lib/file/vfs/vfs_path.h"
#include "maths/Rect.h"
#include "ps/CStr.h"
#include "renderer/backend/Sampler.h"
@@ -35,6 +37,7 @@
#include <vector>
class CCanvas2D;
class CGUI;
struct SGUIImageEffects
{
+6 -3
View File
@@ -23,12 +23,15 @@
#include "graphics/FontMetrics.h"
#include "graphics/TextRenderer.h"
#include "gui/CGUI.h"
#include "gui/ObjectBases/IGUIObject.h"
#include "gui/SGUIIcon.h"
#include "gui/SettingTypes/CGUIString.h"
#include "ps/CStrInternStatic.h"
#include "gui/SettingTypes/EAlign.h"
#include "lib/debug.h"
#include <cmath>
#include <algorithm>
#include <iterator>
#include <optional>
#include <utility>
extern int g_xres, g_yres;
+4 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,10 +20,11 @@
#include "gui/CGUISprite.h"
#include "gui/SettingTypes/CGUIColor.h"
#include "gui/SettingTypes/EAlign.h"
#include "lib/code_annotation.h"
#include "maths/Rect.h"
#include "maths/Size2D.h"
#include "maths/Vector2D.h"
#include "ps/CStr.h"
#include "ps/CStrIntern.h"
#include <array>
@@ -34,6 +35,7 @@ class CCanvas2D;
class CGUI;
class CGUIString;
class IGUIObject;
enum class EAlign;
struct SGenerateTextImage;
using SGenerateTextImages = std::array<std::vector<SGenerateTextImage>, 2>;
+1
View File
@@ -28,6 +28,7 @@
#include "ps/Profile.h"
#include "ps/VideoMode.h"
#include "ps/XML/Xeromyces.h"
#include "ps/containers/StaticVector.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/Promises.h"
+13 -1
View File
@@ -18,20 +18,32 @@
#ifndef INCLUDED_GUIMANAGER
#define INCLUDED_GUIMANAGER
#include "lib/code_annotation.h"
#include "lib/file/vfs/vfs_path.h"
#include "lib/input.h"
#include "ps/containers/StaticVector.h"
#include "lib/path.h"
#include "lib/status.h"
#include "ps/CStr.h"
#include "ps/TemplateLoader.h"
#include "scriptinterface/StructuredClone.h"
#include <cstddef>
#include <deque>
#include <js/TypeDecls.h>
#include <memory>
#include <optional>
#include <string>
#include <unordered_set>
class CCanvas2D;
class CGUI;
class CParamNode;
class ScriptContext;
class ScriptInterface;
namespace JS { class HandleValueArray; }
namespace JS { class Value; }
namespace PS { template <typename T, size_t N> class StaticVector; }
struct SDL_Event_;
/**
* External interface to the GUI system.
+6 -1
View File
@@ -21,9 +21,14 @@
#define GUIOBJECTEVENTBROADCASTER
#include "gui/ObjectBases/IGUIObject.h"
#include "gui/ObjectBases/IGUIPanel.h"
#include "lib/alignment.h"
#include "lib/allocators/DynamicArena.h"
#include "lib/allocators/STLAllocators.h"
#include "lib/types.h"
#include <algorithm>
#include <utility>
#include <vector>
namespace
{
+2 -3
View File
@@ -19,18 +19,17 @@
#define INCLUDED_GUIRENDERER
#include "graphics/Color.h"
#include "graphics/ShaderTechniquePtr.h"
#include "graphics/Texture.h"
#include "maths/Rect.h"
#include "ps/CStrForward.h"
#include "ps/CStrIntern.h"
#include <map>
#include <memory>
#include <vector>
class CCanvas2D;
class CGUI;
class CGUISprite;
class CStr8;
struct CGUIColor;
struct SGUIImage;
+2 -1
View File
@@ -18,8 +18,9 @@
#include "precompiled.h"
#include "gui/CGUI.h"
#include "gui/SettingTypes/EScrollOrientation.h"
#include "gui/SettingTypes/CGUIString.h"
#include "gui/SettingTypes/EAlign.h"
#include "gui/SettingTypes/EScrollOrientation.h"
#include "ps/CLogger.h"
class CGUIList;
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -21,6 +21,7 @@
class IGUIObject;
class CGUI;
#include "lib/code_annotation.h"
#include "maths/Vector2D.h"
#include "ps/CStr.h"
+3 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,9 +20,10 @@
#include "IGUIScrollBar.h"
#include "gui/CGUI.h"
#include "gui/SGUIMessage.h"
#include "gui/ObjectBases/IGUIScrollBarOwner.h"
#include "gui/SGUIMessage.h"
#include "maths/MathUtil.h"
#include "maths/Rect.h"
IGUIScrollBar::IGUIScrollBar(CGUI& pGUI)
: m_pGUI(pGUI),
+4
View File
@@ -25,11 +25,15 @@
#define INCLUDED_IGUISCROLLBAR
#include "gui/CGUISprite.h"
#include "lib/code_annotation.h"
#include "maths/Vector2D.h"
#include "ps/CStr.h"
#include <algorithm>
class CCanvas2D;
class CGUI;
class CRect;
class IGUIScrollBarOwner;
struct SGUIMessage;
+3 -2
View File
@@ -33,11 +33,9 @@
#include "lib/input.h"
#include "maths/Rect.h"
#include "ps/CStr.h"
#include "ps/XMB/XMBData.h"
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <js/ValueArray.h>
#include <map>
#include <memory>
#include <vector>
@@ -47,6 +45,9 @@ class CGUI;
class IGUIProxyObject;
class JSObject;
class JSTracer;
class XMBData;
class XMBElement;
namespace JS { class HandleValueArray; }
struct SDL_Event_;
#define GUI_OBJECT(obj) \
@@ -22,6 +22,7 @@
#include "gui/CGUI.h"
#include "gui/IGUIScrollBar.h"
#include "gui/ObjectBases/IGUIObject.h"
#include "ps/CStr.h"
#include <utility>
+1 -1
View File
@@ -19,12 +19,12 @@
#define INCLUDED_IGUISCROLLBAROWNER
#include "lib/code_annotation.h"
#include "ps/CStr.h"
#include <memory>
#include <vector>
class CCanvas2D;
class CStr8;
class IGUIObject;
class IGUIScrollBar;
struct SGUIMessage;
+1
View File
@@ -26,6 +26,7 @@
#include "lib/debug.h"
#include "maths/Size2D.h"
#include "maths/Vector2D.h"
#include "ps/CStr.h"
#include <string>
+1 -1
View File
@@ -33,7 +33,6 @@ GUI Object Base - Text Owner
#include "gui/CGUISetting.h"
#include "lib/code_annotation.h"
#include "maths/Rect.h"
#include "ps/CStr.h"
#include <cstddef>
#include <vector>
@@ -41,6 +40,7 @@ GUI Object Base - Text Owner
class CCanvas2D;
class CGUIString;
class CGUIText;
class CStrW;
class CVector2D;
class IGUIObject;
enum class EAlign;
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,6 +18,7 @@
#ifndef INCLUDED_SGUIICON
#define INCLUDED_SGUIICON
#include "lib/code_annotation.h"
#include "maths/Size2D.h"
#include "ps/CStr.h"
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,6 +18,7 @@
#ifndef INCLUDED_SGUIMESSAGE
#define INCLUDED_SGUIMESSAGE
#include "lib/code_annotation.h"
#include "ps/CStr.h"
/**
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,6 +18,7 @@
#ifndef INCLUDED_SGUISTYLE
#define INCLUDED_SGUISTYLE
#include "lib/code_annotation.h"
#include "ps/CStr.h"
#include <map>
@@ -18,16 +18,17 @@
#include "precompiled.h"
#include "gui/ObjectBases/IGUIObject.h"
#include "gui/SettingTypes/EScrollOrientation.h"
#include "gui/Scripting/JSInterface_GUIProxy.h"
#include "gui/SettingTypes/CGUIColor.h"
#include "gui/SettingTypes/CGUIList.h"
#include "gui/SettingTypes/CGUISeries.h"
#include "gui/Scripting/JSInterface_GUIProxy.h"
#include "gui/SettingTypes/EAlign.h"
#include "gui/SettingTypes/EScrollOrientation.h"
#include "lib/external_libraries/libsdl.h"
#include "maths/Size2D.h"
#include "maths/Vector2D.h"
#include "ps/Hotkey.h"
#include "ps/CLogger.h"
#include "ps/Hotkey.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptConversions.h"
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,6 +19,7 @@
#define INCLUDED_GUICOLOR
#include "graphics/Color.h"
#include "lib/code_annotation.h"
#include "ps/CStrForward.h"
class CGUI;
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,6 +19,7 @@
#ifndef INCLUDED_CGUISERIES
#define INCLUDED_CGUISERIES
#include "lib/code_annotation.h"
#include "maths/Vector2D.h"
#include <vector>
+2
View File
@@ -22,12 +22,14 @@
#include "gui/CGUI.h"
#include "gui/CGUIText.h"
#include "gui/SettingTypes/CGUIString.h"
#include "gui/SettingTypes/EAlign.h"
#include "i18n/L10n.h"
#include "ps/CLogger.h"
#include "ps/ConfigDB.h"
#include "ps/Filesystem.h"
#include "ps/ProfileViewer.h"
#include "ps/VideoMode.h"
#include "ps/XML/Xeromyces.h"
#include "renderer/Renderer.h"
#include "scriptinterface/ScriptInterface.h"
+3 -2
View File
@@ -21,10 +21,10 @@
#include "graphics/FontMetrics.h"
#include "gui/CGUI.h"
#include "gui/CGUISetting.h"
#include "gui/Scripting/JSInterface_CGUISize.h"
#include "gui/Scripting/JSInterface_GUIProxy.h"
#include "gui/CGUIText.h"
#include "gui/ObjectBases/IGUIObject.h"
#include "gui/Scripting/JSInterface_CGUISize.h"
#include "gui/Scripting/JSInterface_GUIProxy.h"
#include "gui/SettingTypes/CGUISize.h"
#include "gui/SettingTypes/CGUIString.h"
#include "i18n/L10n.h"
@@ -33,6 +33,7 @@
#include "ps/Filesystem.h"
#include "ps/ProfileViewer.h"
#include "ps/VideoMode.h"
#include "ps/XML/Xeromyces.h"
#include "renderer/Renderer.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptContext.h"
+2
View File
@@ -23,9 +23,11 @@
#ifndef INCLUDED_ALIGNMENT
#define INCLUDED_ALIGNMENT
#include "lib/code_annotation.h"
#include "lib/sysdep/compiler.h" // MSC_VERSION
#include "lib/sysdep/arch.h" // ARCH_AMD64
#include <cstddef>
#include <cstdint>
template<typename T>
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -60,6 +60,8 @@ scope
#ifndef INCLUDED_LIB
#define INCLUDED_LIB
#include "lib/types.h"
#include <cmath> // fabsf
#include <limits> // numeric_limits
#include <stdexcept> // out_of_range
+2
View File
@@ -37,6 +37,8 @@
#ifndef INCLUDED_PATH
#define INCLUDED_PATH
#include "lib/debug.h"
#include "lib/status.h"
#include "lib/sysdep/os.h"
#include "lib/utf8.h"
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -23,6 +23,8 @@
#ifndef INCLUDED_UTF8
#define INCLUDED_UTF8
#include "lib/status.h"
#include <string>
// note: error codes are returned via optional output parameter.
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -50,6 +50,7 @@ enum PS_TRIM_MODE
#define CSTR_H_A
#endif
#include "lib/types.h"
#include "ps/CStrForward.h"
#include <string>
+11 -10
View File
@@ -33,23 +33,23 @@
#include "lib/input.h"
#include "lib/timer.h"
#include "lobby/IXmppClient.h"
#include "network/NetServer.h"
#include "network/NetClient.h"
#include "network/NetMessage.h"
#include "network/NetMessages.h"
#include "network/NetServer.h"
#include "network/scripting/JSInterface_Network.h"
#include "ps/CConsole.h"
#include "ps/CLogger.h"
#include "ps/ConfigDB.h"
#include "ps/Filesystem.h"
#include "ps/GUID.h"
#include "ps/Game.h"
#include "ps/GameSetup/Atlas.h"
#include "ps/GameSetup/Paths.h"
#include "ps/GameSetup/Config.h"
#include "ps/GameSetup/CmdLineArgs.h"
#include "ps/GameSetup/Config.h"
#include "ps/GameSetup/HWDetect.h"
#include "ps/GameSetup/Paths.h"
#include "ps/Globals.h"
#include "ps/GUID.h"
#include "ps/Hotkey.h"
#include "ps/Joystick.h"
#include "ps/Loader.h"
@@ -59,25 +59,26 @@
#include "ps/ProfileViewer.h"
#include "ps/Profiler2.h"
#include "ps/Pyrogenesis.h" // psSetLogDir
#include "ps/scripting/JSInterface_Console.h"
#include "ps/scripting/JSInterface_Game.h"
#include "ps/scripting/JSInterface_Main.h"
#include "ps/scripting/JSInterface_VFS.h"
#include "ps/TouchInput.h"
#include "ps/UserReport.h"
#include "ps/Util.h"
#include "ps/VideoMode.h"
#include "ps/VisualReplay.h"
#include "ps/World.h"
#include "ps/XML/Xeromyces.h"
#include "ps/scripting/JSInterface_Console.h"
#include "ps/scripting/JSInterface_Game.h"
#include "ps/scripting/JSInterface_Main.h"
#include "ps/scripting/JSInterface_VFS.h"
#include "renderer/Renderer.h"
#include "renderer/SceneRenderer.h"
#include "renderer/VertexBufferManager.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptStats.h"
#include "scriptinterface/ScriptContext.h"
#include "scriptinterface/ScriptConversions.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptStats.h"
#include "simulation2/Simulation2.h"
#include "simulation2/scripting/JSInterface_Simulation.h"
#include "soundmanager/scripting/JSInterface_Sound.h"