forked from Mirrors/openclonk
renamed C4GuiWindow to C4ScriptGuiWindow to increase expressivness and reduce similarity with C4Gui*
parent
a8690f0b31
commit
2a78b77bda
|
@ -247,13 +247,13 @@ set(OC_CLONK_SOURCES
|
|||
src/gui/C4Gui.cpp
|
||||
src/gui/C4GuiDialogs.cpp
|
||||
src/gui/C4GuiEdit.cpp
|
||||
src/gui/C4GuiWindow.cpp
|
||||
src/gui/C4ScriptGuiWindow.cpp
|
||||
src/gui/C4Gui.h
|
||||
src/gui/C4GuiLabels.cpp
|
||||
src/gui/C4GuiListBox.cpp
|
||||
src/gui/C4GuiMenu.cpp
|
||||
src/gui/C4GuiTabular.cpp
|
||||
src/gui/C4GuiWindow.cpp
|
||||
src/gui/C4ScriptGuiWindow.cpp
|
||||
src/gui/C4KeyboardInput.cpp
|
||||
src/gui/C4KeyboardInput.h
|
||||
src/gui/C4LoaderScreen.cpp
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <C4PlayerList.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4GameControl.h>
|
||||
#include <C4GuiWindow.h>
|
||||
#include <C4ScriptGuiWindow.h>
|
||||
#include "gui/C4MessageInput.h"
|
||||
#include "object/C4DefList.h"
|
||||
|
||||
|
@ -555,13 +555,13 @@ C4ControlMenuCommand::C4ControlMenuCommand(int32_t actionID, int32_t player, int
|
|||
void C4ControlMenuCommand::Execute() const
|
||||
{
|
||||
// invalid action? The action needs to be in bounds!
|
||||
if (actionType < 0 || actionType >= C4GuiWindowPropertyName::_lastProp)
|
||||
if (actionType < 0 || actionType >= C4ScriptGuiWindowPropertyName::_lastProp)
|
||||
{
|
||||
// this could only come from a malicious attempt to crash the engine!
|
||||
Log("Warning: invalid action type for C4ControlMenuCommand!");
|
||||
return;
|
||||
}
|
||||
C4GuiWindow *menu = ::Game.GuiWindowRoot->GetChildByID(menuID);
|
||||
C4ScriptGuiWindow *menu = ::Game.ScriptGuiRoot->GetChildByID(menuID);
|
||||
// menu was closed?
|
||||
if (!menu) return;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include <C4RankSystem.h>
|
||||
#include <C4RoundResults.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4GuiWindow.h>
|
||||
#include <C4ScriptGuiWindow.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Network2Reference.h>
|
||||
#include <C4Weather.h>
|
||||
|
@ -102,7 +102,7 @@ C4Game::C4Game():
|
|||
pSec1Timer(new C4GameSec1Timer()),
|
||||
fPreinited(false), StartupLogPos(0), QuitLogPos(0),
|
||||
fQuitWithError(false),
|
||||
GuiWindowRoot(0)
|
||||
ScriptGuiRoot(0)
|
||||
{
|
||||
Default();
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ void C4Game::ClearPointers(C4Object * pObj)
|
|||
::MessageInput.ClearPointers(pObj);
|
||||
::Console.ClearPointers(pObj);
|
||||
::MouseControl.ClearPointers(pObj);
|
||||
GuiWindowRoot->ClearPointers(pObj);
|
||||
ScriptGuiRoot->ClearPointers(pObj);
|
||||
TransferZones.ClearPointers(pObj);
|
||||
if (pGlobalEffects)
|
||||
pGlobalEffects->ClearPointers(pObj);
|
||||
|
@ -1485,7 +1485,7 @@ void C4Game::Default()
|
|||
DebugPassword.Clear();
|
||||
DebugHost.Clear();
|
||||
DebugWait = false;
|
||||
GuiWindowRoot = nullptr; // will be initialized when the game starts
|
||||
ScriptGuiRoot = nullptr; // will be initialized when the game starts
|
||||
}
|
||||
|
||||
void C4Game::Evaluate()
|
||||
|
@ -1628,12 +1628,12 @@ void C4Game::CompileFunc(StdCompiler *pComp, CompileSettings comp, C4ValueNumber
|
|||
{
|
||||
C4Value val;
|
||||
pComp->Value(mkNamingAdapt(mkParAdapt(val, numbers), "CustomGUIs", C4VNull));
|
||||
assert (GuiWindowRoot->GetID() == 0);
|
||||
GuiWindowRoot->CreateFromPropList(val.getPropList(), false, false, true);
|
||||
assert (ScriptGuiRoot->GetID() == 0);
|
||||
ScriptGuiRoot->CreateFromPropList(val.getPropList(), false, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
C4Value val = GuiWindowRoot->ToC4Value();
|
||||
C4Value val = ScriptGuiRoot->ToC4Value();
|
||||
pComp->Value(mkNamingAdapt(mkParAdapt(val, numbers), "CustomGUIs", C4VNull));
|
||||
}
|
||||
}
|
||||
|
@ -2248,11 +2248,11 @@ bool C4Game::InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky, C4Value
|
|||
}
|
||||
|
||||
// prepare script menus
|
||||
assert(!GuiWindowRoot);
|
||||
assert(!ScriptGuiRoot);
|
||||
const float standardVerticalBorder = 100.0f;
|
||||
const float standardHorizontalBorder = 100.0f;
|
||||
GuiWindowRoot = new C4GuiWindow(standardVerticalBorder, standardHorizontalBorder);
|
||||
pGUI->AddElement(GuiWindowRoot);
|
||||
ScriptGuiRoot = new C4ScriptGuiWindow(standardVerticalBorder, standardHorizontalBorder);
|
||||
pGUI->AddElement(ScriptGuiRoot);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "C4Scoreboard.h"
|
||||
#include <C4PlayerControl.h>
|
||||
|
||||
class C4GuiWindow;
|
||||
class C4ScriptGuiWindow;
|
||||
|
||||
class C4Game
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
bool InitPlayerControlSettings();
|
||||
bool InitPlayerControlUserSettings(); // merge player control default settings and config overloads into user setting
|
||||
|
||||
C4GuiWindow *GuiWindowRoot;
|
||||
C4ScriptGuiWindow *ScriptGuiRoot;
|
||||
protected:
|
||||
void Default();
|
||||
void InitInEarth();
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <C4MouseControl.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4GuiWindow.h>
|
||||
#include <C4ScriptGuiWindow.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Landscape.h>
|
||||
|
@ -297,7 +297,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
|
|||
// ingame menus
|
||||
C4ST_STARTNEW(GuiWindowStat, "C4Viewport::DrawOverlay: Menus")
|
||||
pDraw->SetZoom(0, 0, 1.0);
|
||||
::Game.GuiWindowRoot->DrawAll(gui_cgo, Player);
|
||||
::Game.ScriptGuiRoot->DrawAll(gui_cgo, Player);
|
||||
C4ST_STOP(GuiWindowStat)
|
||||
|
||||
DrawOverlay(gui_cgo, GameZoom);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4MessageInput.h>
|
||||
#include <C4GuiWindow.h>
|
||||
#include <C4ScriptGuiWindow.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4ObjectInfoList.h>
|
||||
#include <C4Player.h>
|
||||
|
@ -2330,26 +2330,26 @@ static bool FnCustomMessage(C4PropList * _this, C4String *pMsg, C4Object *pObj,
|
|||
|
||||
static int FnGuiOpen(C4PropList * _this, C4PropList *menu)
|
||||
{
|
||||
C4GuiWindow *window = new C4GuiWindow;
|
||||
C4ScriptGuiWindow *window = new C4ScriptGuiWindow;
|
||||
|
||||
::Game.GuiWindowRoot->AddChild(window);
|
||||
::Game.ScriptGuiRoot->AddChild(window);
|
||||
|
||||
if (!window->CreateFromPropList(menu, true))
|
||||
{
|
||||
::Game.GuiWindowRoot->RemoveChild(window, false);
|
||||
::Game.ScriptGuiRoot->RemoveChild(window, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return window->GetID();
|
||||
}
|
||||
|
||||
static bool FnGuiUpdateTag(C4PropList * _this, C4String *tag, int32_t menuID, int32_t childID, C4Object *target)
|
||||
static bool FnGuiUpdateTag(C4PropList * _this, C4String *tag, int32_t guiID, int32_t childID, C4Object *target)
|
||||
{
|
||||
C4GuiWindow *window = ::Game.GuiWindowRoot->GetChildByID(menuID);
|
||||
C4ScriptGuiWindow *window = ::Game.ScriptGuiRoot->GetChildByID(guiID);
|
||||
if (!window) return false;
|
||||
if (childID) // note: valid child IDs are always non-zero
|
||||
{
|
||||
C4GuiWindow *subwindow = window->GetSubWindow(childID, target);
|
||||
C4ScriptGuiWindow *subwindow = window->GetSubWindow(childID, target);
|
||||
if (!subwindow) return false;
|
||||
subwindow->SetTag(tag);
|
||||
return true;
|
||||
|
@ -2358,13 +2358,13 @@ static bool FnGuiUpdateTag(C4PropList * _this, C4String *tag, int32_t menuID, in
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool FnGuiClose(C4PropList *_this, int32_t menuID, int32_t childID, C4Object *target)
|
||||
static bool FnGuiClose(C4PropList *_this, int32_t guiID, int32_t childID, C4Object *target)
|
||||
{
|
||||
C4GuiWindow *window = ::Game.GuiWindowRoot->GetChildByID(menuID);
|
||||
C4ScriptGuiWindow *window = ::Game.ScriptGuiRoot->GetChildByID(guiID);
|
||||
if (!window) return false;
|
||||
if (childID) // note: valid child IDs are always non-zero
|
||||
{
|
||||
C4GuiWindow *subwindow = window->GetSubWindow(childID, target);
|
||||
C4ScriptGuiWindow *subwindow = window->GetSubWindow(childID, target);
|
||||
if (!subwindow) return false;
|
||||
subwindow->Close();
|
||||
return true;
|
||||
|
@ -2373,14 +2373,14 @@ static bool FnGuiClose(C4PropList *_this, int32_t menuID, int32_t childID, C4Obj
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool FxGuiUpdate(C4PropList *_this, C4PropList *update, int32_t menuID, int32_t childID, C4Object *target)
|
||||
static bool FxGuiUpdate(C4PropList *_this, C4PropList *update, int32_t guiID, int32_t childID, C4Object *target)
|
||||
{
|
||||
if (!update) return false;
|
||||
C4GuiWindow *window = ::Game.GuiWindowRoot->GetChildByID(menuID);
|
||||
C4ScriptGuiWindow *window = ::Game.ScriptGuiRoot->GetChildByID(guiID);
|
||||
if (!window) return false;
|
||||
if (childID) // note: valid child IDs are always non-zero
|
||||
{
|
||||
C4GuiWindow *subwindow = window->GetSubWindow(childID, target);
|
||||
C4ScriptGuiWindow *subwindow = window->GetSubWindow(childID, target);
|
||||
if (!subwindow) return false;
|
||||
subwindow->CreateFromPropList(update, false, true);
|
||||
return true;
|
||||
|
@ -2891,20 +2891,20 @@ C4ScriptConstDef C4ScriptGameConstMap[]=
|
|||
{ "ATTACH_Back" ,C4V_Int, C4ATTACH_Back },
|
||||
{ "ATTACH_MoveRelative" ,C4V_Int, C4ATTACH_MoveRelative },
|
||||
|
||||
{ "GUI_SetTag" ,C4V_Int, C4GuiWindowActionID::SetTag },
|
||||
{ "GUI_Call" ,C4V_Int, C4GuiWindowActionID::Call },
|
||||
{ "GUI_GridLayout" ,C4V_Int, C4GuiWindowStyleFlag::GridLayout },
|
||||
{ "GUI_VerticalLayout" ,C4V_Int, C4GuiWindowStyleFlag::VerticalLayout },
|
||||
{ "GUI_TextVCenter" ,C4V_Int, C4GuiWindowStyleFlag::TextVCenter },
|
||||
{ "GUI_TextHCenter" ,C4V_Int, C4GuiWindowStyleFlag::TextHCenter },
|
||||
{ "GUI_TextRight" ,C4V_Int, C4GuiWindowStyleFlag::TextRight },
|
||||
{ "GUI_TextBottom" ,C4V_Int, C4GuiWindowStyleFlag::TextBottom },
|
||||
{ "GUI_TextTop" ,C4V_Int, C4GuiWindowStyleFlag::None }, // note that top and left are considered default
|
||||
{ "GUI_TextLeft" ,C4V_Int, C4GuiWindowStyleFlag::None }, // they are only included for completeness
|
||||
{ "GUI_FitChildren" ,C4V_Int, C4GuiWindowStyleFlag::FitChildren },
|
||||
{ "GUI_Multiple" ,C4V_Int, C4GuiWindowStyleFlag::Multiple },
|
||||
{ "GUI_IgnoreMouse" ,C4V_Int, C4GuiWindowStyleFlag::IgnoreMouse },
|
||||
{ "GUI_NoCrop" ,C4V_Int, C4GuiWindowStyleFlag::NoCrop },
|
||||
{ "GUI_SetTag" ,C4V_Int, C4ScriptGuiWindowActionID::SetTag },
|
||||
{ "GUI_Call" ,C4V_Int, C4ScriptGuiWindowActionID::Call },
|
||||
{ "GUI_GridLayout" ,C4V_Int, C4ScriptGuiWindowStyleFlag::GridLayout },
|
||||
{ "GUI_VerticalLayout" ,C4V_Int, C4ScriptGuiWindowStyleFlag::VerticalLayout },
|
||||
{ "GUI_TextVCenter" ,C4V_Int, C4ScriptGuiWindowStyleFlag::TextVCenter },
|
||||
{ "GUI_TextHCenter" ,C4V_Int, C4ScriptGuiWindowStyleFlag::TextHCenter },
|
||||
{ "GUI_TextRight" ,C4V_Int, C4ScriptGuiWindowStyleFlag::TextRight },
|
||||
{ "GUI_TextBottom" ,C4V_Int, C4ScriptGuiWindowStyleFlag::TextBottom },
|
||||
{ "GUI_TextTop" ,C4V_Int, C4ScriptGuiWindowStyleFlag::None }, // note that top and left are considered default
|
||||
{ "GUI_TextLeft" ,C4V_Int, C4ScriptGuiWindowStyleFlag::None }, // they are only included for completeness
|
||||
{ "GUI_FitChildren" ,C4V_Int, C4ScriptGuiWindowStyleFlag::FitChildren },
|
||||
{ "GUI_Multiple" ,C4V_Int, C4ScriptGuiWindowStyleFlag::Multiple },
|
||||
{ "GUI_IgnoreMouse" ,C4V_Int, C4ScriptGuiWindowStyleFlag::IgnoreMouse },
|
||||
{ "GUI_NoCrop" ,C4V_Int, C4ScriptGuiWindowStyleFlag::NoCrop },
|
||||
{ NULL, C4V_Nil, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -910,7 +910,7 @@ namespace C4GUI
|
|||
void SetScrollPos(int32_t iToPos) { iScrollPos = iToPos * GetMaxScroll() / (iCBMaxRange-1); }
|
||||
|
||||
friend class ScrollWindow;
|
||||
friend class C4GuiWindow;
|
||||
friend class C4ScriptGuiWindow;
|
||||
};
|
||||
|
||||
// a window that can be scrolled
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <C4PlayerList.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4GameControl.h>
|
||||
#include <C4GuiWindow.h>
|
||||
#include <C4ScriptGuiWindow.h>
|
||||
|
||||
const int32_t C4MC_Drag_None = 0,
|
||||
C4MC_Drag_Script = 6,
|
||||
|
@ -320,7 +320,7 @@ void C4MouseControl::Move(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyFl
|
|||
bool menuProcessed = false;
|
||||
if (pPlayer)
|
||||
// adjust by viewport X/Y because the GUI windows calculate their positions (and thus check input) based on that
|
||||
menuProcessed = ::Game.GuiWindowRoot->MouseInput(iButton, iX, iY, dwKeyFlags);
|
||||
menuProcessed = ::Game.ScriptGuiRoot->MouseInput(iButton, iX, iY, dwKeyFlags);
|
||||
|
||||
if (menuProcessed)
|
||||
Cursor = C4MC_Cursor_Select;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,8 +17,8 @@
|
|||
|
||||
/* a flexisble ingame menu system that can be composed out of multiple windows */
|
||||
|
||||
#ifndef INC_C4GuiWindow
|
||||
#define INC_C4GuiWindow
|
||||
#ifndef INC_C4ScriptGuiWindow
|
||||
#define INC_C4ScriptGuiWindow
|
||||
|
||||
#include <C4Surface.h>
|
||||
#include <C4Gui.h>
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
enum C4GuiWindowPropertyName
|
||||
enum C4ScriptGuiWindowPropertyName
|
||||
{
|
||||
left = 0,
|
||||
top,
|
||||
|
@ -65,13 +65,13 @@ enum C4GuiWindowPropertyName
|
|||
_lastProp
|
||||
};
|
||||
|
||||
enum C4GuiWindowActionID
|
||||
enum C4ScriptGuiWindowActionID
|
||||
{
|
||||
SetTag = 1,
|
||||
Call,
|
||||
};
|
||||
|
||||
enum C4GuiWindowStyleFlag
|
||||
enum C4ScriptGuiWindowStyleFlag
|
||||
{
|
||||
None = 0,
|
||||
GridLayout = 1,
|
||||
|
@ -86,18 +86,18 @@ enum C4GuiWindowStyleFlag
|
|||
NoCrop = 512
|
||||
};
|
||||
|
||||
class C4GuiWindow;
|
||||
class C4ScriptGuiWindow;
|
||||
|
||||
class C4GuiWindowAction
|
||||
class C4ScriptGuiWindowAction
|
||||
{
|
||||
friend class C4GuiWindow;
|
||||
friend class C4ScriptGuiWindow;
|
||||
|
||||
private:
|
||||
// the ID is unique among all actions. It is used later to synchronize callbacks
|
||||
int32_t id;
|
||||
|
||||
int32_t action;
|
||||
C4GuiWindowAction *nextAction; // a linked list of actions
|
||||
C4ScriptGuiWindowAction *nextAction; // a linked list of actions
|
||||
// note: depending on the action not all of the following attributes always have values
|
||||
C4PropList *target; // contains a valid C4Object in case of SetTag, a generic proplist in case of Call
|
||||
C4String *text; // can be either a function name to call or a tag to set
|
||||
|
@ -105,22 +105,22 @@ class C4GuiWindowAction
|
|||
int32_t subwindowID;
|
||||
|
||||
public:
|
||||
C4GuiWindowAction() : id(0), action(0), nextAction(0), target(0), text(0), value(0), subwindowID(0) { }
|
||||
~C4GuiWindowAction();
|
||||
C4ScriptGuiWindowAction() : id(0), action(0), nextAction(0), target(0), text(0), value(0), subwindowID(0) { }
|
||||
~C4ScriptGuiWindowAction();
|
||||
void ClearPointers(C4Object *pObj);
|
||||
bool Init(C4ValueArray *array, int32_t index = 0); // index is the current action in an array of actions
|
||||
// executes non-synced actions and syncs the others
|
||||
// the action type parameters is only used to be able to sync commands
|
||||
void Execute(C4GuiWindow *parent, int32_t player, int32_t actionType);
|
||||
// used to execute synced commands, explanation see C4GuiWindow::ExecuteCommand
|
||||
bool ExecuteCommand(int32_t actionID, C4GuiWindow *parent, int32_t player);
|
||||
void Execute(C4ScriptGuiWindow *parent, int32_t player, int32_t actionType);
|
||||
// used to execute synced commands, explanation see C4ScriptGuiWindow::ExecuteCommand
|
||||
bool ExecuteCommand(int32_t actionID, C4ScriptGuiWindow *parent, int32_t player);
|
||||
// used for serialization. The "first" parameter is used so that chained actions are stored correctly into an array
|
||||
const C4Value ToC4Value(bool first = true);
|
||||
};
|
||||
|
||||
class C4GuiWindowProperty
|
||||
class C4ScriptGuiWindowProperty
|
||||
{
|
||||
friend class C4GuiWindow;
|
||||
friend class C4ScriptGuiWindow;
|
||||
|
||||
private:
|
||||
typedef union
|
||||
|
@ -132,7 +132,7 @@ class C4GuiWindowProperty
|
|||
C4Def *def;
|
||||
C4GUI::FrameDecoration *deco;
|
||||
StdCopyStrBuf *strBuf;
|
||||
C4GuiWindowAction *action;
|
||||
C4ScriptGuiWindowAction *action;
|
||||
} Prop;
|
||||
|
||||
Prop *current;
|
||||
|
@ -152,8 +152,8 @@ class C4GuiWindowProperty
|
|||
void SetNull(C4String *tag = 0);
|
||||
|
||||
public:
|
||||
~C4GuiWindowProperty();
|
||||
C4GuiWindowProperty() : current(0), currentTag(0), type(-1) {}
|
||||
~C4ScriptGuiWindowProperty();
|
||||
C4ScriptGuiWindowProperty() : current(0), currentTag(0), type(-1) {}
|
||||
void Set(const C4Value &value, C4String *tag);
|
||||
|
||||
int32_t GetInt() { return current->d; }
|
||||
|
@ -162,8 +162,8 @@ class C4GuiWindowProperty
|
|||
C4Def *GetDef() { return current->def; }
|
||||
C4GUI::FrameDecoration *GetFrameDecoration() { return current->deco; }
|
||||
StdCopyStrBuf *GetStrBuf() { return current->strBuf; }
|
||||
C4GuiWindowAction *GetAction() { return current->action; }
|
||||
std::list<C4GuiWindowAction*> GetAllActions(); // used to synchronize actions
|
||||
C4ScriptGuiWindowAction *GetAction() { return current->action; }
|
||||
std::list<C4ScriptGuiWindowAction*> GetAllActions(); // used to synchronize actions
|
||||
|
||||
bool SwitchTag(C4String *tag);
|
||||
C4String *GetCurrentTag() { return currentTag; }
|
||||
|
@ -173,10 +173,10 @@ class C4GuiWindowProperty
|
|||
void ClearPointers(C4Object *pObj);
|
||||
};
|
||||
|
||||
class C4GuiWindow : public C4GUI::ScrollWindow
|
||||
class C4ScriptGuiWindow : public C4GUI::ScrollWindow
|
||||
{
|
||||
friend class C4GuiWindowAction;
|
||||
friend class C4GuiWindowScrollBar;
|
||||
friend class C4ScriptGuiWindowAction;
|
||||
friend class C4ScriptGuiWindowScrollBar;
|
||||
|
||||
private:
|
||||
// the "main" menu ID is always unique, however the sub-menu IDs do NOT have to be unique
|
||||
|
@ -202,20 +202,20 @@ class C4GuiWindow : public C4GUI::ScrollWindow
|
|||
const C4Object *GetTarget() { return target; }
|
||||
|
||||
// properties are stored extra to make "tags" possible
|
||||
C4GuiWindowProperty props[C4GuiWindowPropertyName::_lastProp];
|
||||
C4ScriptGuiWindowProperty props[C4ScriptGuiWindowPropertyName::_lastProp];
|
||||
void Init();
|
||||
// ID is set by parent, parent gives unique IDs to children
|
||||
void SetID(int32_t to) { id = to; }
|
||||
// to be used to generate the quick-access children map for main menus
|
||||
void ChildGotID(C4GuiWindow *child);
|
||||
void ChildWithIDRemoved(C4GuiWindow *child);
|
||||
std::multimap<int32_t, C4GuiWindow *> childrenIDMap;
|
||||
void ChildGotID(C4ScriptGuiWindow *child);
|
||||
void ChildWithIDRemoved(C4ScriptGuiWindow *child);
|
||||
std::multimap<int32_t, C4ScriptGuiWindow *> childrenIDMap;
|
||||
// should be called when the Priority property of a child changes
|
||||
// will sort the child correctly into the children list
|
||||
void ChildChangedPriority(C4GuiWindow *child);
|
||||
void ChildChangedPriority(C4ScriptGuiWindow *child);
|
||||
// helper function to extract relative and absolute position values from a string
|
||||
void SetPositionStringProperties(const C4Value &property, C4GuiWindowPropertyName relative, C4GuiWindowPropertyName absolute, C4String *tag);
|
||||
C4Value PositionToC4Value(C4GuiWindowPropertyName relative, C4GuiWindowPropertyName absolute);
|
||||
void SetPositionStringProperties(const C4Value &property, C4ScriptGuiWindowPropertyName relative, C4ScriptGuiWindowPropertyName absolute, C4String *tag);
|
||||
C4Value PositionToC4Value(C4ScriptGuiWindowPropertyName relative, C4ScriptGuiWindowPropertyName absolute);
|
||||
// sets all margins either from a string or from an array
|
||||
void SetMarginProperties(const C4Value &property, C4String *tag);
|
||||
C4Value MarginsToC4Value();
|
||||
|
@ -244,19 +244,19 @@ class C4GuiWindow : public C4GUI::ScrollWindow
|
|||
|
||||
void SetTag(C4String *tag);
|
||||
|
||||
C4GuiWindow();
|
||||
C4GuiWindow(float stdBorderX, float stdBorderY);
|
||||
virtual ~C4GuiWindow();
|
||||
C4ScriptGuiWindow();
|
||||
C4ScriptGuiWindow(float stdBorderX, float stdBorderY);
|
||||
virtual ~C4ScriptGuiWindow();
|
||||
|
||||
int32_t GetID() { return id; }
|
||||
// finds a child with a certain ID, usually called on ::MainWindowRoot to get submenus
|
||||
C4GuiWindow *GetChildByID(int32_t child);
|
||||
C4ScriptGuiWindow *GetChildByID(int32_t child);
|
||||
// finds a child by name, usually called when updating a window with a new proplist
|
||||
C4GuiWindow *GetChildByName(C4String *childName);
|
||||
C4ScriptGuiWindow *GetChildByName(C4String *childName);
|
||||
// finds any fitting sub menu - not necessarily direct child
|
||||
// has to be called on children of ::MainWindowRoot, uses the childrenIDMap
|
||||
// note: always checks the target to avoid ambiguities, even if 0
|
||||
C4GuiWindow *GetSubWindow(int32_t childID, C4Object *childTarget);
|
||||
C4ScriptGuiWindow *GetSubWindow(int32_t childID, C4Object *childTarget);
|
||||
|
||||
|
||||
|
||||
|
@ -268,12 +268,12 @@ class C4GuiWindow : public C4GUI::ScrollWindow
|
|||
// constructs a C4Value (proplist) that contains everything that is needed for saving this window
|
||||
const C4Value ToC4Value();
|
||||
|
||||
// C4GuiWindow will delete its children on close. Make sure you don't delete anything twice
|
||||
C4GuiWindow *AddChild(C4GuiWindow *child);
|
||||
C4GuiWindow *AddChild() { return AddChild(new C4GuiWindow()); }
|
||||
// C4ScriptGuiWindow will delete its children on close. Make sure you don't delete anything twice
|
||||
C4ScriptGuiWindow *AddChild(C4ScriptGuiWindow *child);
|
||||
C4ScriptGuiWindow *AddChild() { return AddChild(new C4ScriptGuiWindow()); }
|
||||
|
||||
void ClearChildren(bool close = true); // close: whether to properly "Close" them, alias for RemoveChild
|
||||
void RemoveChild(C4GuiWindow *child, bool close = true, bool all = false); // child = 0 & all = true to clear all
|
||||
void RemoveChild(C4ScriptGuiWindow *child, bool close = true, bool all = false); // child = 0 & all = true to clear all
|
||||
void Close();
|
||||
void ClearPointers(C4Object *pObj);
|
||||
|
Loading…
Reference in New Issue