1
0
forked from 0ad/0ad

no message

This was SVN commit r76.
This commit is contained in:
Gee 2003-11-24 02:27:04 +00:00
parent 170be50b84
commit eb2ddf4c50
12 changed files with 0 additions and 1166 deletions

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<!DOCTYPE objects SYSTEM "objects.dtd">
<objects>
<object name="Button2" type="button" size1024="120 120 220 220" style="hello" z="20" />
<object name="Button3" type="button" size1024="120 120 220 220" style="hello" z="20">
<object name="Child" type="button" size1024="140 140 300 200" z="22">
<object name="ChildsChilds" type="button" size1024="200 150 400 190" z="24"> </object>
</object>
</object>
</objects>

View File

@ -1,49 +0,0 @@
<!--
GUI XML Files DTD
Root Element: <objects>
Version:
-->
<!ELEMENT objects (object*)>
<!ELEMENT object (#PCDATA|object|action)*>
<!--
Base Settings
-->
<!ATTLIST object name CDATA #IMPLIED>
<!ATTLIST object type CDATA #IMPLIED>
<!ATTLIST object absolute (true|false) #IMPLIED>
<!ATTLIST object disabled (true|false) #IMPLIED>
<!ATTLIST object ghost (true|false) #IMPLIED>
<!ATTLIST object hidden (true|false) #IMPLIED>
<!ATTLIST object size1024 CDATA #IMPLIED>
<!ATTLIST object style CDATA #IMPLIED>
<!ATTLIST object z CDATA #IMPLIED>
<!--
Setting Pool
-->
<!ATTLIST object font CDATA #IMPLIED>
<!ATTLIST object input-initvalue-destroyed-at-focus (true|false) #IMPLIED>
<!ATTLIST object rectcolor-selected CDATA #IMPLIED>
<!ATTLIST object scrollbar (true|false) #IMPLIED>
<!ATTLIST object scrollbar-style CDATA #IMPLIED>
<!ATTLIST object sprite CDATA #IMPLIED>
<!ATTLIST object sprite2 CDATA #IMPLIED>
<!ATTLIST object sprite-disabled CDATA #IMPLIED>
<!ATTLIST object sprite2-disabled CDATA #IMPLIED>
<!ATTLIST object sprite-over CDATA #IMPLIED>
<!ATTLIST object sprite2-over CDATA #IMPLIED>
<!ATTLIST object sprite-pressed CDATA #IMPLIED>
<!ATTLIST object square-side CDATA #IMPLIED>
<!ATTLIST object textalign (left|center|right) #IMPLIED>
<!ATTLIST object textcolor CDATA #IMPLIED>
<!ATTLIST object textcolor-disabled CDATA #IMPLIED>
<!ATTLIST object textcolor-over CDATA #IMPLIED>
<!ATTLIST object textcolor-pressed CDATA #IMPLIED>
<!ATTLIST object textcolor-selected CDATA #IMPLIED>
<!ATTLIST object textvalign (top|center|bottom) #IMPLIED>
<!ATTLIST object tooltip CDATA #IMPLIED>
<!ATTLIST object tooltip-style CDATA #IMPLIED>

View File

@ -1,60 +0,0 @@
/*
CGUIButtonBehavior
by Gustav Larsson
gee@pyro.nu
*/
//#include "stdafx."
#include "GUI.h"
using namespace std;
//-------------------------------------------------------------------
// Constructor / Destructor
//-------------------------------------------------------------------
CGUIButtonBehavior::CGUIButtonBehavior() : m_Pressed(false)
{
}
CGUIButtonBehavior::~CGUIButtonBehavior()
{
}
void CGUIButtonBehavior::HandleMessage(const EGUIMessage &Message)
{
switch (Message)
{
case GUIM_POSTPROCESS:
// Check if button has been pressed
if (m_Pressed)
{
// Now check if mouse is released, that means
// it's released outside, since GUIM_MOUSE_RELEASE_LEFT
// would've handled m_Pressed and reset it already
// Get input structure
/// if (GetGUI()->GetInput()->mRelease(NEMM_BUTTON1))
{
// Reset
m_Pressed = false;
}
}
break;
case GUIM_MOUSE_PRESS_LEFT:
m_Pressed = true;
break;
case GUIM_MOUSE_RELEASE_LEFT:
if (m_Pressed)
{
m_Pressed = false;
// BUTTON WAS CLICKED
HandleMessage(GUIM_PRESSED);
}
break;
default:
break;
}
}

View File

@ -1,71 +0,0 @@
/*
GUI Object - Button
by Gustav Larsson
gee@pyro.nu
--Overview--
Interface class that enhance the CGUIObject with
buttony behavior (click and release to click a button),
and the GUI message GUIM_PRESSED.
When creating a class with extended settings and
buttony behavior, just do a multiple inheritance.
--More info--
Check GUI.h
*/
#ifndef CGUIButtonBehavior_H
#define CGUIButtonBehavior_H
//--------------------------------------------------------
// Includes / Compiler directives
//--------------------------------------------------------
#include "GUI.h"
//--------------------------------------------------------
// Macros
//--------------------------------------------------------
//--------------------------------------------------------
// Types
//--------------------------------------------------------
//--------------------------------------------------------
// Declarations
//--------------------------------------------------------
/**
* @author Gustav Larsson
*
* Appends button behaviours to the <code>CGUIObject</code>.
* Can be used with multiple inheritance alongside
* <code>CGUISettingsObject</code> and such.
*
* @see CGUIObject
*/
class CGUIButtonBehavior : virtual public CGUIObject
{
public:
CGUIButtonBehavior();
virtual ~CGUIButtonBehavior();
/**
* @see CGUIObject#HandleMessage()
*/
virtual void HandleMessage(const EGUIMessage &Message);
protected:
/**
* Everybody knows how a button works, you don't simply press it,
* you have to first press the button, and then release it...
* in between those two steps you can actually leave the button
* area, as long as you release it within the button area... Anyway
* this lets us know we are done with step one (clicking).
*/
bool m_Pressed;
};
#endif

View File

@ -1,335 +0,0 @@
/*
CGUIObject
by Gustav Larsson
gee@pyro.nu
*/
//#include "stdafx."
#include "GUI.h"
///// janwas: again, including etiquette?
#include "../ps/Parser.h"
#include <assert.h>
/////
using namespace std;
// Offsets
map_Settings CGUIObject::m_SettingsInfo;
//-------------------------------------------------------------------
// Implementation Macros
//-------------------------------------------------------------------
#define _GUI_ADD_OFFSET(type, str, var) \
SettingsInfo[str].m_Offset = offsetof(CGUIObject, m_BaseSettings) + offsetof(SGUIBaseSettings,var); \
SettingsInfo[str].m_Type = type;
//-------------------------------------------------------------------
// Constructor / Destructor
//-------------------------------------------------------------------
CGUIObject::CGUIObject() :
m_pGUI(NULL),
m_pParent(NULL),
m_MouseHovering(false)
{
// Default values of base settings !
m_BaseSettings.m_Enabled = true;
m_BaseSettings.m_Hidden = false;
m_BaseSettings.m_Style = "null";
m_BaseSettings.m_Z = 0.f;
// Static! Only done once
if (m_SettingsInfo.empty())
{
SetupBaseSettingsInfo(m_SettingsInfo);
}
}
CGUIObject::~CGUIObject()
{
}
//-------------------------------------------------------------------
// Functions
//-------------------------------------------------------------------
void CGUIObject::SetBaseSettings(const SGUIBaseSettings &Set)
{
m_BaseSettings = Set;
CheckSettingsValidity();
}
void CGUIObject::AddChild(CGUIObject *pChild)
{
//
// assert(pChild);
pChild->SetParent(this);
m_Children.push_back(pChild);
// If this (not the child) object is already attached
// to a CGUI, it pGUI pointer will be non-null.
// This will mean we'll have to check if we're using
// names already used.
if (pChild->GetGUI())
{
try
{
// Atomic function, if it fails it won't
// have changed anything
//UpdateObjects();
pChild->GetGUI()->UpdateObjects();
}
catch (PS_RESULT e)
{
// If anything went wrong, reverse what we did and throw
// an exception telling it never added a child
m_Children.erase( m_Children.end()-1 );
// We'll throw the same exception for easier
// error handling
throw e;
}
}
// else do nothing
}
void CGUIObject::AddToPointersMap(map_pObjects &ObjectMap)
{
// Just don't do anything about the top node
if (m_pParent == NULL)
return;
// Now actually add this one
// notice we won't add it if it's doesn't have any parent
// (i.e. being the base object)
if (m_Name == string())
{
throw PS_NEEDS_NAME;
}
if (ObjectMap.count(m_Name) > 0)
{
throw PS_NAME_AMBIGUITY;
}
else
{
ObjectMap[m_Name] = this;
}
}
void CGUIObject::Destroy()
{
// Is there anything besides the children to destroy?
}
void CGUIObject::SetupBaseSettingsInfo(map_Settings &SettingsInfo)
{
SettingsInfo["hejsan"].m_Offset = 0;
_GUI_ADD_OFFSET("bool", "enabled", m_Enabled)
_GUI_ADD_OFFSET("bool", "hidden", m_Hidden)
_GUI_ADD_OFFSET("rect", "size1024", m_Size)
_GUI_ADD_OFFSET("string", "style", m_Style)
_GUI_ADD_OFFSET("float", "z", m_Z)
_GUI_ADD_OFFSET("string", "caption", m_Caption)
}
bool CGUIObject::MouseOver()
{
if(!GetGUI())
throw PS_NEEDS_PGUI;
u16 mouse_x = GetMouseX(),
mouse_y = GetMouseY();
return (mouse_x >= m_BaseSettings.m_Size.left &&
mouse_x <= m_BaseSettings.m_Size.right &&
mouse_y >= m_BaseSettings.m_Size.bottom &&
mouse_y <= m_BaseSettings.m_Size.top);
}
u16 CGUIObject::GetMouseX() const
{
return ((GetGUI())?(GetGUI()->m_MouseX):0);
}
u16 CGUIObject::GetMouseY() const
{
return ((GetGUI())?(GetGUI()->m_MouseY):0);
}
void CGUIObject::UpdateMouseOver(CGUIObject * const &pMouseOver)
{
// Check if this is the object being hovered.
if (pMouseOver == this)
{
if (!m_MouseHovering)
{
// It wasn't hovering, so that must mean it just entered
HandleMessage(GUIM_MOUSE_ENTER);
}
// Either way, set to true
m_MouseHovering = true;
// call mouse over
HandleMessage(GUIM_MOUSE_OVER);
}
else // Some other object (or none) is hovered
{
if (m_MouseHovering)
{
m_MouseHovering = false;
HandleMessage(GUIM_MOUSE_LEAVE);
}
}
}
bool CGUIObject::SettingExists(const CStr &Setting) const
{
// Because GetOffsets will direct dynamically defined
// classes with polymorifsm to respective m_SettingsInfo
// we need to make no further updates on this function
// in derived classes.
return (GetSettingsInfo().count(Setting) == 1)?true:false;
}
void CGUIObject::SetSetting(const CStr &Setting, const CStr &Value)
{
if (!SettingExists(Setting))
{
throw PS_FAIL;
}
// Get setting
SGUISetting set = GetSettingsInfo()[Setting];
if (set.m_Type == CStr(_T("string")))
{
GUI<CStr>::SetSetting(this, Setting, Value);
}
else
if (set.m_Type == CStr(_T("float")))
{
// Use the parser to parse the values
/* CParser parser;
parser.InputTaskType("", "_$value_");
CParserLine line;
line.ParseString(parser, Value);
if (!line.m_ParseOK)
{
// ERROR!
throw PS_FAIL;
}
float value;
if (!line.GetArgFloat(0, value))
{
// ERROR!
throw PS_FAIL;
}
// Finally the rectangle values
GUI<float>::SetSetting(this, Setting, value);
*/
GUI<float>::SetSetting(this, Setting, Value.ToFloat() );
}
else
if (set.m_Type == CStr(_T("rect")))
{
// TEMP
GUI<CRect>::SetSetting(this, Setting, CRect(100,100,200,200));
// Use the parser to parse the values
/* CParser parser;
parser.InputTaskType("", "_$value_$value_$value_$value_");
// TODO Gee string really?
string str = Value;
CParserLine line;
line.ParseString(parser, Value);
if (!line.m_ParseOK)
{
// ERROR!
throw PS_FAIL;
}
int values[4];
for (int i=0; i<4; ++i)
{
if (!line.GetArgInt(i, values[i]))
{
// ERROR!
throw PS_FAIL;
}
}
// Finally the rectangle values
CRect rect(values[0], values[1], values[2], values[3]);
GUI<CRect>::SetSetting(this, Setting, rect);
*/}
else
{
throw PS_FAIL;
}
}
void CGUIObject::ChooseMouseOverAndClosest(CGUIObject* &pObject)
{
if (MouseOver())
{
// Check if we've got competition at all
if (pObject == NULL)
{
pObject = this;
return;
}
// Or if it's closer
if (GetBaseSettings().m_Z >= pObject->GetBaseSettings().m_Z)
{
pObject = this;
return;
}
}
}
CGUIObject *CGUIObject::GetParent()
{
// Important, we're not using GetParent() for these
// checks, that could screw it up
if (m_pParent)
{
if (m_pParent->m_pParent == NULL)
return NULL;
}
return m_pParent;
}
// GeeTODO keep this function and all???
void CGUIObject::CheckSettingsValidity()
{
// If we hide an object, reset many of its parts
if (GetBaseSettings().m_Hidden)
{
// Simulate that no object is hovered for this object and all its children
// why? because it's
try
{
GUI<CGUIObject*>::RecurseObject(0, this, &CGUIObject::UpdateMouseOver, NULL);
}
catch (...) {}
}
try
{
// Send message to myself
HandleMessage(GUIM_SETTINGS_UPDATED);
}
catch (...)
{
}
}

View File

@ -1,405 +0,0 @@
/*
The base class of an object
by Gustav Larsson
gee@pyro.nu
--Overview--
All objects are derived from this class, it's an ADT
so it can't be used per se
Also contains a Dummy object which is used for
completely blank objects.
--Usage--
Write about how to use it here
--Examples--
Provide examples of how to use this code, if necessary
--More info--
Check GUI.h
*/
#ifndef CGUIObject_H
#define CGUIObject_H
//--------------------------------------------------------
// Includes / Compiler directives
//--------------------------------------------------------
#include "GUI.h"
#include <string>
#include <vector>
struct SGUISetting;
class CGUI;
//--------------------------------------------------------
// Macros
//--------------------------------------------------------
//--------------------------------------------------------
// Types
//--------------------------------------------------------
// Map with pointers
typedef std::map<CStr, SGUISetting> map_Settings;
typedef std::vector<CGUIObject*> vector_pObjects;
//--------------------------------------------------------
// Error declarations
//--------------------------------------------------------
//--------------------------------------------------------
// Declarations
//--------------------------------------------------------
// TEMP
struct CRect
{
CRect() {}
CRect(int _l, int _b, int _r, int _t) :
top(_t),
bottom(_b),
right(_r),
left(_l) {}
int bottom, top, left, right;
bool operator ==(const CRect &rect) const
{
return (bottom==rect.bottom) &&
(top==rect.top) &&
(left==rect.left) &&
(right==rect.right);
}
bool operator !=(const CRect &rect) const
{
return !(*this==rect);
}
};
// TEMP
struct CColor
{
float r, g, b, a;
};
// Text alignments
enum EAlign { EAlign_Left, EAlign_Right, EAlign_Center };
enum EValign { EValign_Top, EValign_Bottom, EValign_Center };
/**
* @author Gustav Larsson
*
* Stores the information where to find a variable
* in a GUI-Object object, also what type it is.
*/
struct SGUISetting
{
size_t m_Offset; // The offset from CGUIObject to the variable (not from SGUIBaseSettings or similar)
CStr m_Type; // "string" or maybe "int"
};
/**
* @author Gustav Larsson
*
* Base settings, all objects possess these settings
* in their <code>m_BaseSettings</code>
* Instructions can be found in the documentations.
*/
struct SGUIBaseSettings
{
bool m_Hidden;
bool m_Enabled;
bool m_Absolute;
CRect m_Size;
CStr m_Style;
float m_Z;
CStr m_Caption; // Is usually set within an XML element and not in the attributes
};
//////////////////////////////////////////////////////////
/**
* @author Gustav Larsson
*
* GUI object such as a button or an input-box.
* Abstract data type !
*/
class CGUIObject
{
friend class CGUI;
friend class GUI;
public:
CGUIObject();
virtual ~CGUIObject();
/**
* Get offsets
*
* @return Retrieves settings info
*/
virtual map_Settings GetSettingsInfo() const { return m_SettingsInfo; }
/**
* Checks if mouse is hovering this object.
* The mouse position is cached in CGUI.
*
* This function checks if the mouse is hovering the
* rectangle that the base setting "size" makes.
* Although it is virtual, so one could derive
* an object from CButton, which changes only this
* to checking the circle that "size" makes.
*
* @return true if mouse is hovering
*/
virtual bool MouseOver();
//--------------------------------------------------------
/** @name Leaf Functions */
//--------------------------------------------------------
//@{
/// Get object name, name is unique
CStr GetName() const { return m_Name; }
/// Get object name
void SetName(const CStr &Name) { m_Name = Name; }
/**
* Adds object and its children to the map, it's name being the
* first part, and the second being itself.
*
* @param ObjectMap Adds <code>this</code> to the <code>map_pObjects</code>.
*
* @throws PS_NEEDS_NAME Name is missing
* @throws PS_NAME_AMBIGUITY Name is already taken
*/
void AddToPointersMap(map_pObjects &ObjectMap);
/**
* Notice nothing will be returned or thrown if the child hasn't
* been inputted into the GUI yet. This is because that's were
* all is checked. Now we're just linking two objects, but
* it's when we're inputting them into the GUI we'll check
* validity! Notice also when adding it to the GUI this function
* will inevitably have been called by CGUI::AddObject which
* will catch the throw and return the error code.
* i.e. The user will never put in the situation wherein a throw
* must be caught, the GUI's internal error handling will be
* completely transparent to the interfacially sequential model.
*
* @param pChild Child to add
*
* @throws PS_RESULT from CGUI::UpdateObjects().
*/
void AddChild(CGUIObject *pChild);
//@}
//--------------------------------------------------------
/** @name Iterate */
//--------------------------------------------------------
//@{
vector_pObjects::iterator ChildrenItBegin() { return m_Children.begin(); }
vector_pObjects::iterator ChildrenItEnd() { return m_Children.end(); }
//@}
//--------------------------------------------------------
/** @name Settings Management */
//--------------------------------------------------------
//@{
SGUIBaseSettings GetBaseSettings() const { return m_BaseSettings; }
void SetBaseSettings(const SGUIBaseSettings &Set);
/**
* Checks if settings exists, only available for derived
* classes that has this set up, that's why the base
* class just returns false
*
* @param Setting setting name
* @return True if settings exist.
*/
bool SettingExists(const CStr &Setting) const;
/**
* Should be called every time the settings has been updated
* will also send a message GUIM_SETTINGS_UPDATED, so that
* if a derived object wants to add things to be updated,
* they add it in that message part, this is a better solution
* than making this virtual, since the updates that the base
* class does, are the most essential.
* This is not private since there should be no harm in
* checking validity.
*
* @throws GeeTODO not quite settled yet.
*/
void CheckSettingsValidity();
/**
* Sets up a map_size_t to include the variables in m_BaseSettings
*
* @param SettingsInfo Pointers that should be filled with base variables
*/
void SetupBaseSettingsInfo(map_Settings &SettingsInfo);
/**
* Set a setting by string, regardless of what type it is.
*
* example a CRect(10,10,20,20) would be "10 10 20 20"
*
* @param Setting Setting by name
* @param Value Value to set to
*/
void SetSetting(const CStr &Setting, const CStr &Value);
//@}
protected:
//--------------------------------------------------------
/** @name Called by CGUI and friends
*
* Methods that the CGUI will call using
* its friendship, these should not
* be called by user.
* These functions' security are a lot
* what constitutes the GUI's
*/
//--------------------------------------------------------
//@{
/**
* Calls Destroy on all children, and deallocates all memory.
* BIG TODO Should it destroy it's children?
*/
virtual void Destroy();
/**
* This function is called with different messages
* for instance when the mouse enters the object.
*
* @param Message EGUIMessage
*/
virtual void HandleMessage(const EGUIMessage &Message)=0;
/**
* Draws the object.
*
* @throws PS_RESULT if any. But this will mostlikely be
* very rare since if an object is drawn unsuccessfully
* it'll probably only output in the Error log, and not
* disrupt the whole GUI drawing.
*/
virtual void Draw()=0;
// This is done internally
CGUI *GetGUI() { return m_pGUI; }
const CGUI *GetGUI() const { return m_pGUI; }
void SetGUI(CGUI * const &pGUI) { m_pGUI = pGUI; }
// Set parent
void SetParent(CGUIObject *pParent) { m_pParent = pParent; }
/**
* <b>NOTE!</b> This will not just return m_pParent, when that is
* need use it! There is one exception to it, when the parent is
* the top-node (the object that isn't a real object), this
* will return NULL, so that the top-node's children are
* seemingly parentless.
*
* @return Pointer to parent
*/
CGUIObject *GetParent();
// Get cached mouse x/y from CGUI
u16 GetMouseX() const;
u16 GetMouseY() const;
//@}
private:
//--------------------------------------------------------
/** @name Internal functions */
//--------------------------------------------------------
//@{
/**
* Inputs a reference pointer, checks if the new inputted object
* if hovered, if so, then check if <code>this</code>'s Z value is greater
* than the inputted object... If so then the object is closer
* and we'll replace the pointer with <code>this</code>.
* Also Notice input can be NULL, which means the Z value demand
* is out. NOTICE you can't input NULL as const so you'll have
* to set an object to NULL.
*
* @param pObject Object pointer, can be either the old one, or
* the new one.
*/
void ChooseMouseOverAndClosest(CGUIObject* &pObject);
/**
* Inputes the object that is currently hovered, this function
* updates this object accordingly (i.e. if it's the object
* being inputted one thing happens, and not, another).
*
* @param pMouseOver Object that is currently hovered,
* can OF COURSE be NULL too!
*/
void UpdateMouseOver(CGUIObject * const &pMouseOver);
//@}
// Variables
protected:
/// Name of object
CStr m_Name;
/// Constructed on the heap, will be destroyed along with the the object TODO Really?
vector_pObjects m_Children;
/// Pointer to parent
CGUIObject *m_pParent;
/// Base settings
SGUIBaseSettings m_BaseSettings;
// More variables
/// Is mouse hovering the object? used with the function <code>MouseOver()</code>
bool m_MouseHovering;
/**
* Tells us where a variable by a string name is
* located hardcoded, in order to acquire a pointer
* for that variable... Say "frozen" gives
* the offset from CGUIObject to m_Frozen.
* <b>note!</b> <u>NOT</u> from SGUIBaseSettings to
* m_Frozen!
*/
static map_Settings m_SettingsInfo;
private:
/// An object can't function stand alone
CGUI *m_pGUI;
};
/**
* @author Gustav Larsson
*
* Dummy object used primarily for the root object
* which isn't a *real* object in the GUI.
*/
class CGUIDummyObject : public CGUIObject
{
virtual void HandleMessage(const EGUIMessage &Message) {}
virtual void Draw() {}
};
#endif

View File

@ -1,10 +0,0 @@
/*
CGUISettingsObject
by Gustav Larsson
gee@pyro.nu
*/
//#include "stdafx.h"
#include "GUI.h"
using namespace std;

View File

@ -1,124 +0,0 @@
/*
Object with settings
by Gustav Larsson
gee@pyro.nu
--Overview--
Generic object that stores a struct with settings
--Usage--
If an object wants settings with a standard,
it will use this as a middle step instead of being
directly derived from CGUIObject
--Examples--
instead of:
class CButton : public CGUIObject
you go:
class CButton : public CGUISettingsObject<SButtonSettings>
and SButtonSettings will be included as m_Settings with
all gets and sets set up
--More info--
Check GUI.h
*/
#ifndef CGUISettingsObject_H
#define CGUISettingsObject_H
//--------------------------------------------------------
// Includes / Compiler directives
//--------------------------------------------------------
#include "GUI.h"
//--------------------------------------------------------
// Macros
//--------------------------------------------------------
//--------------------------------------------------------
// Types
//--------------------------------------------------------
//--------------------------------------------------------
// Error declarations
//--------------------------------------------------------
//--------------------------------------------------------
// Declarations
//--------------------------------------------------------
/**
* @author Gustav Larsson
*
* Appends more settings to the <code>CGUIObject</code>.
* Can be used with multiple inheritance.
*
* @see CGUIObject
*/
template <typename SETTINGS>
class CGUISettingsObject : virtual public CGUIObject
{
public:
CGUISettingsObject() {}
virtual ~CGUISettingsObject() {}
/**
* Get Offsets, <b>important</b> to include so it returns this
* <code>m_Offsets</code> and not <code>CGUIObject::m_SettingsInfo</code>
*
* @return Settings infos
*/
virtual map_Settings GetSettingsInfo() const { return m_SettingsInfo; }
/**
* @return Returns a copy of <code>m_Settings</code>
*/
SETTINGS GetSettings() const { return m_Settings; }
/// Sets settings
void SetSettings(const SETTINGS &Set)
{
m_Settings = Set;
//CheckSettingsValidity();
// Since that function out-commented above really
// does just update the base settings, we'll call
// the message immediately instead
try
{
HandleMessage(GUIM_SETTINGS_UPDATED);
}
catch (...) { }
}
protected:
/// Settings struct
SETTINGS m_Settings;
/**
* <b>Offset database</b><br>
* tells us where a variable by a string name is
* located hardcoded, in order to acquire a pointer
* for that variable... Say "frozen" gives
* the offset from <code>CGUIObject</code> to <code>m_Frozen</code>.
*
* <b>note!</b> _NOT_ from <code>SGUIBaseSettings</code> to <code>m_Frozen</code>!
*
* Note that it's imperative that this <code>m_SettingsInfo</code> includes
* all offsets of <code>m_BaseSettings</code> too, because when
* using this class, this m_SettingsInfo will be the only
* one used.
*/
static map_Settings m_SettingsInfo;
};
#endif

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<!DOCTYPE objects SYSTEM "objects.dtd">
<objects>
<object name="Button2" type="button" size1024="120 120 220 220" style="hello" z="20" />
<object name="Button3" type="button" size1024="120 120 220 220" style="hello" z="20">
<object name="Child" type="button" size1024="140 140 300 200" z="22">
<object name="ChildsChilds" type="button" size1024="200 150 400 190" z="24"> </object>
</object>
</object>
</objects>

View File

@ -1,49 +0,0 @@
<!--
GUI XML Files DTD
Root Element: <objects>
Version:
-->
<!ELEMENT objects (object*)>
<!ELEMENT object (#PCDATA|object|action)*>
<!--
Base Settings
-->
<!ATTLIST object name CDATA #IMPLIED>
<!ATTLIST object type CDATA #IMPLIED>
<!ATTLIST object absolute (true|false) #IMPLIED>
<!ATTLIST object disabled (true|false) #IMPLIED>
<!ATTLIST object ghost (true|false) #IMPLIED>
<!ATTLIST object hidden (true|false) #IMPLIED>
<!ATTLIST object size1024 CDATA #IMPLIED>
<!ATTLIST object style CDATA #IMPLIED>
<!ATTLIST object z CDATA #IMPLIED>
<!--
Setting Pool
-->
<!ATTLIST object font CDATA #IMPLIED>
<!ATTLIST object input-initvalue-destroyed-at-focus (true|false) #IMPLIED>
<!ATTLIST object rectcolor-selected CDATA #IMPLIED>
<!ATTLIST object scrollbar (true|false) #IMPLIED>
<!ATTLIST object scrollbar-style CDATA #IMPLIED>
<!ATTLIST object sprite CDATA #IMPLIED>
<!ATTLIST object sprite2 CDATA #IMPLIED>
<!ATTLIST object sprite-disabled CDATA #IMPLIED>
<!ATTLIST object sprite2-disabled CDATA #IMPLIED>
<!ATTLIST object sprite-over CDATA #IMPLIED>
<!ATTLIST object sprite2-over CDATA #IMPLIED>
<!ATTLIST object sprite-pressed CDATA #IMPLIED>
<!ATTLIST object square-side CDATA #IMPLIED>
<!ATTLIST object textalign (left|center|right) #IMPLIED>
<!ATTLIST object textcolor CDATA #IMPLIED>
<!ATTLIST object textcolor-disabled CDATA #IMPLIED>
<!ATTLIST object textcolor-over CDATA #IMPLIED>
<!ATTLIST object textcolor-pressed CDATA #IMPLIED>
<!ATTLIST object textcolor-selected CDATA #IMPLIED>
<!ATTLIST object textvalign (top|center|bottom) #IMPLIED>
<!ATTLIST object tooltip CDATA #IMPLIED>
<!ATTLIST object tooltip-style CDATA #IMPLIED>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE sprites SYSTEM "sprites.dtd">
<sprites>
<sprite name="sprite1">
<image texture="t1" />
</sprite>
</sprites>

View File

@ -1,28 +0,0 @@
<!--
GUI XML Files DTD
Root Element: <sprites>
Version:
-->
<!ELEMENT sprites (sprite*)>
<!ELEMENT sprite (image+)>
<!ELEMENT image (#PCDATA)>
<!--
<sprite>
-->
<!ATTLIST sprite name CDATA #REQUIRED>
<!--
<image>
-->
<!ATTLIST image texture CDATA #IMPLIED>
<!ATTLIST image pixel CDATA #IMPLIED>
<!ATTLIST image percent CDATA #IMPLIED>
<!ATTLIST image t_pixel CDATA #IMPLIED>
<!ATTLIST image t_percent CDATA #IMPLIED>
<!ATTLIST image backcolor CDATA #IMPLIED>
<!ATTLIST image bordercolor CDATA #IMPLIED>
<!ATTLIST image bordersize CDATA #IMPLIED>