Changeset View
Changeset View
Standalone View
Standalone View
source/gui/ObjectBases/IGUIObject.cpp
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 18 Lines | |||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#include "scriptinterface/Object.h" | #include "scriptinterface/Object.h" | ||||
#include "scriptinterface/ScriptContext.h" | #include "scriptinterface/ScriptContext.h" | ||||
#include "scriptinterface/ScriptExtraHeaders.h" | #include "scriptinterface/ScriptExtraHeaders.h" | ||||
#include "scriptinterface/ScriptConversions.h" | #include "scriptinterface/ScriptConversions.h" | ||||
#include "soundmanager/ISoundManager.h" | #include "soundmanager/ISoundManager.h" | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <string_view> | |||||
#include <unordered_map> | #include <unordered_map> | ||||
const CStr IGUIObject::EventNameMouseEnter = "MouseEnter"; | const CStr IGUIObject::EventNameMouseEnter = "MouseEnter"; | ||||
const CStr IGUIObject::EventNameMouseMove = "MouseMove"; | const CStr IGUIObject::EventNameMouseMove = "MouseMove"; | ||||
const CStr IGUIObject::EventNameMouseLeave = "MouseLeave"; | const CStr IGUIObject::EventNameMouseLeave = "MouseLeave"; | ||||
IGUIObject::IGUIObject(CGUI& pGUI) | IGUIObject::IGUIObject(CGUI& pGUI) | ||||
: m_pGUI(pGUI), | : m_pGUI(pGUI), | ||||
▲ Show 20 Lines • Show All 412 Lines • ▼ Show 20 Lines | |||||
CStr IGUIObject::GetPresentableName() const | CStr IGUIObject::GetPresentableName() const | ||||
{ | { | ||||
// __internal(), must be at least 13 letters to be able to be | // __internal(), must be at least 13 letters to be able to be | ||||
// an internal name | // an internal name | ||||
if (m_Name.length() <= 12) | if (m_Name.length() <= 12) | ||||
return m_Name; | return m_Name; | ||||
if (m_Name.substr(0, 10) == "__internal") | if (std::string_view{m_Name}.substr(0, 10) == "__internal") | ||||
return CStr("[unnamed object]"); | return CStr("[unnamed object]"); | ||||
else | else | ||||
return m_Name; | return m_Name; | ||||
} | } | ||||
void IGUIObject::SetFocus() | void IGUIObject::SetFocus() | ||||
{ | { | ||||
m_pGUI.SetFocusedObject(this); | m_pGUI.SetFocusedObject(this); | ||||
Show All 29 Lines |
Wildfire Games · Phabricator