Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CGUI.h
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2019 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 10 Lines | |||||
* and settings are stored within this class. | * and settings are stored within this class. | ||||
*/ | */ | ||||
#ifndef INCLUDED_CGUI | #ifndef INCLUDED_CGUI | ||||
#define INCLUDED_CGUI | #define INCLUDED_CGUI | ||||
#include "GUITooltip.h" | #include "GUITooltip.h" | ||||
#include "GUIbase.h" | #include "GUIbase.h" | ||||
wraitii: Why is this suddenly necessary? | |||||
Not Done Inline ActionsIt was added so we could add a friend to the CGUI class in an earlier version of this revision. This friend was subsequently removed, and this wasn't removed at the same time. s0600204: It was added so we could add a `friend` to the `CGUI` class in an earlier version of this… | |||||
#include "lib/input.h" | #include "lib/input.h" | ||||
#include "ps/Shapes.h" | #include "ps/Shapes.h" | ||||
#include "ps/XML/Xeromyces.h" | #include "ps/XML/Xeromyces.h" | ||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptInterface.h" | ||||
#include <boost/unordered_set.hpp> | #include <boost/unordered_set.hpp> | ||||
ERROR_TYPE(GUI, JSOpenFailed); | ERROR_TYPE(GUI, JSOpenFailed); | ||||
Show All 26 Lines | |||||
* | * | ||||
* No interfacial functions throws. | * No interfacial functions throws. | ||||
*/ | */ | ||||
class CGUI | class CGUI | ||||
{ | { | ||||
NONCOPYABLE(CGUI); | NONCOPYABLE(CGUI); | ||||
friend class IGUIObject; | friend class IGUIObject; | ||||
friend class IGUIScrollBarOwner; | |||||
friend class CInternalCGUIAccessorBase; | friend class CInternalCGUIAccessorBase; | ||||
Done Inline ActionsWe have to avoid these hacks. I think it's better to add a method which returns const map<...>&. Since this hack used for the IGUIScrollBarOwner too. vladislavbelov: We have to avoid these hacks. I think it's better to add a method which returns `const map<... | |||||
private: | private: | ||||
// Private typedefs | // Private typedefs | ||||
typedef IGUIObject *(*ConstructObjectFunction)(); | typedef IGUIObject *(*ConstructObjectFunction)(); | ||||
public: | public: | ||||
CGUI(const shared_ptr<ScriptRuntime>& runtime); | CGUI(const shared_ptr<ScriptRuntime>& runtime); | ||||
~CGUI(); | ~CGUI(); | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
IGUIObject* FindObjectByName(const CStr& Name) const; | IGUIObject* FindObjectByName(const CStr& Name) const; | ||||
/** | /** | ||||
* Returns the GUI object under the mouse, or NULL if none. | * Returns the GUI object under the mouse, or NULL if none. | ||||
*/ | */ | ||||
IGUIObject* FindObjectUnderMouse() const; | IGUIObject* FindObjectUnderMouse() const; | ||||
const SGUIScrollBarStyle* GetScrollBarStyle(const CStr& style) const; | |||||
/** | /** | ||||
* The GUI needs to have all object types inputted and | * The GUI needs to have all object types inputted and | ||||
* their constructors. Also it needs to associate a type | * their constructors. Also it needs to associate a type | ||||
* by a string name of the type. | * by a string name of the type. | ||||
* | * | ||||
* To add a type: | * To add a type: | ||||
* @code | * @code | ||||
* AddObjectType("button", &CButton::ConstructObject); | * AddObjectType("button", &CButton::ConstructObject); | ||||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Why is this suddenly necessary?