no message

This was SVN commit r71.
This commit is contained in:
Gee 2003-11-22 15:07:22 +00:00
parent e1c6c4c954
commit b095ca8176
11 changed files with 227 additions and 312 deletions

View File

@ -70,11 +70,6 @@ CButton::~CButton()
{
}
//-------------------------------------------------------------------
// Handles messages send from the CGUI
// Input:
// Message Message ID, GUIM_*
//-------------------------------------------------------------------
void CButton::HandleMessage(const EGUIMessage &Message)
{
// TODO REMOVE
@ -118,11 +113,6 @@ void CButton::HandleMessage(const EGUIMessage &Message)
}
}
//-------------------------------------------------------------------
// Draws the object
// Input:
// pInput Handler of keyboard and mouse
//-------------------------------------------------------------------
void CButton::Draw()
{
if (m_MouseHovering)

View File

@ -31,9 +31,11 @@ using namespace std;
#include "input.h"
// called from main loop when (input) events are received.
// event is passed to other handlers if false is returned.
// trampoline: we don't want to make the implementation (in CGUI) static
//-------------------------------------------------------------------
// called from main loop when (input) events are received.
// event is passed to other handlers if false is returned.
// trampoline: we don't want to make the implementation (in CGUI) static
//-------------------------------------------------------------------
bool gui_handler(const SDL_Event& ev)
{
return g_GUI.HandleEvent(ev);
@ -41,7 +43,6 @@ bool gui_handler(const SDL_Event& ev)
// return false;
}
bool CGUI::HandleEvent(const SDL_Event& ev)
{
if(ev.type == SDL_MOUSEMOTION)
@ -97,7 +98,9 @@ CGUI::~CGUI()
delete m_BaseObject;
}
// Construct an object
//-------------------------------------------------------------------
// Functions
//-------------------------------------------------------------------
CGUIObject *CGUI::ConstructObject(const CStr &str)
{
if (m_ObjectTypes.count(str) > 0)
@ -106,11 +109,6 @@ CGUIObject *CGUI::ConstructObject(const CStr &str)
return NULL;
}
//-------------------------------------------------------------------
// Initializes the GUI
// Inputs:
//
//-------------------------------------------------------------------
void CGUI::Initialize(/*/*CInput *pInput*/)
{
/// m_pInput = pInput;
@ -119,10 +117,6 @@ void CGUI::Initialize(/*/*CInput *pInput*/)
AddObjectType("button", &CButton::ConstructObject);
}
//-------------------------------------------------------------------
// Process the GUI, this should be run every loop after CInput
// has been processed
//-------------------------------------------------------------------
void CGUI::Process()
{
/*/*
@ -190,9 +184,6 @@ void CGUI::Process()
*/
}
//-------------------------------------------------------------------
// Make all drawing calls of the GUI
//-------------------------------------------------------------------
void CGUI::Draw()
{
try
@ -206,13 +197,10 @@ void CGUI::Draw()
}
}
//-------------------------------------------------------------------
// Shutdown all memory
//-------------------------------------------------------------------
void CGUI::Destroy()
{
// We can use the map to delete all
// now we don't want to cancel all if one Destory fails
// now we don't want to cancel all if one Destroy fails
map_pObjects::iterator it;
for (it = m_pAllObjects.begin(); it != m_pAllObjects.end(); ++it)
{
@ -234,15 +222,6 @@ void CGUI::Destroy()
m_Sprites.clear();
}
//-------------------------------------------------------------------
// Adds an object to the GUI's object database
// Input:
// Name Name of object
// pObject Object's pointer
//
// Return:
// Throws PS_RESULT
//-------------------------------------------------------------------
void CGUI::AddObject(CGUIObject* pObject)
{
try
@ -259,13 +238,6 @@ void CGUI::AddObject(CGUIObject* pObject)
}
}
//-------------------------------------------------------------------
// Should be called when an object has been
// This function is atomic, meaning if it throws anything, it will
// have seen it through that nothing was ultimately changed.
// Throws:
// Whatever AddToPointersMap throws
//-------------------------------------------------------------------
void CGUI::UpdateObjects()
{
// We'll fill a temporary map until we know everything
@ -287,11 +259,6 @@ void CGUI::UpdateObjects()
m_pAllObjects = AllObjects;
}
//-------------------------------------------------------------------
// Check if an object exists by name
// Input:
// Name Object reference name
//-------------------------------------------------------------------
bool CGUI::ObjectExists(const CStr &Name) const
{
if (m_pAllObjects.count(Name))
@ -300,12 +267,6 @@ bool CGUI::ObjectExists(const CStr &Name) const
return false;
}
//-------------------------------------------------------------------
// Report XML Reading Error, should be called from within the
// Xerces_* functions.
// Input:
// str String explaining error
//-------------------------------------------------------------------
void CGUI::ReportParseError(const CStr &str, ...)
{
// Print header
@ -328,11 +289,6 @@ void CGUI::ReportParseError(const CStr &str, ...)
/// g_nemLog(" %s", buffer);
}
//-------------------------------------------------------------------
// Adds an object to the GUI's object database
// Input:
// Filename XML filename
//-------------------------------------------------------------------
void CGUI::LoadXMLFile(const string &Filename)
{
// Reset parse error
@ -431,12 +387,6 @@ void CGUI::LoadXMLFile(const string &Filename)
// XML Reading Xerces Specific Sub-Routines
//===================================================================
//-------------------------------------------------------------------
// Reads in the root element <objects></objects> (the DOMElement).
// Input:
// pElement The Xerces C++ Parser object that represents
// the <objects>.
//-------------------------------------------------------------------
void CGUI::Xerces_ReadRootObjects(XERCES_CPP_NAMESPACE::DOMElement *pElement)
{
// Iterate main children
@ -456,12 +406,6 @@ void CGUI::Xerces_ReadRootObjects(XERCES_CPP_NAMESPACE::DOMElement *pElement)
}
}
//-------------------------------------------------------------------
// Reads in the root element <sprites></sprites> (the DOMElement).
// Input:
// pElement The Xerces C++ Parser object that represents
// the <sprites>.
//-------------------------------------------------------------------
void CGUI::Xerces_ReadRootSprites(XERCES_CPP_NAMESPACE::DOMElement *pElement)
{
// Iterate main children
@ -481,21 +425,6 @@ void CGUI::Xerces_ReadRootSprites(XERCES_CPP_NAMESPACE::DOMElement *pElement)
}
}
//-------------------------------------------------------------------
// Notice! Recursive function!
//
// Reads in an <object></object> (the DOMElement) and stores it
// as a child in the pParent.
// It will also check the object's children and call this function
// on them too. Also it will call all other functions that reads
// in other stuff that can be found within an object. Such as
// <action> will call Xerces_ReadAction (TODO, real funcion?)
// Input:
// pParent Parent to add this object as child in
// pElement The Xerces C++ Parser object that represents
// the <object>.
//-------------------------------------------------------------------
void CGUI::Xerces_ReadObject(DOMElement *pElement, CGUIObject *pParent)
{
assert(pParent && pElement);
@ -631,13 +560,6 @@ void CGUI::Xerces_ReadObject(DOMElement *pElement, CGUIObject *pParent)
}
}
//-------------------------------------------------------------------
// Reads in a <sprite></sprite> (the DOMElement).
// Input:
// pElement The Xerces C++ Parser object that represents
// the <sprite>.
//-------------------------------------------------------------------
void CGUI::Xerces_ReadSprite(XERCES_CPP_NAMESPACE::DOMElement *pElement)
{
assert(pElement);
@ -689,14 +611,6 @@ void CGUI::Xerces_ReadSprite(XERCES_CPP_NAMESPACE::DOMElement *pElement)
m_Sprites[name] = sprite;
}
//-------------------------------------------------------------------
// Reads in a <image></image> (the DOMElement) to parent
// Input:
// parent Sprite to add this image too
// pElement The Xerces C++ Parser object that represents
// the <image>.
//-------------------------------------------------------------------
void CGUI::Xerces_ReadImage(XERCES_CPP_NAMESPACE::DOMElement *pElement, CGUISprite &parent)
{
assert(pElement);

View File

@ -81,12 +81,16 @@ public:
/**
* Displays the whole GUI
*
* @throws PS_RESULT from CGUIObject::Draw().
*/
void Draw();
/**
* Clean up, call this to clean up all memory allocated
* within the GUI.
*
* @throws PS_RESULT from CGUIObject::Destroy().
*/
void Destroy();
@ -131,6 +135,11 @@ private:
/**
* Updates the object pointers, needs to be called each
* time an object has been added or removed.
*
* This function is atomic, meaning if it throws anything, it will
* have seen it through that nothing was ultimately changed.
*
* @throws PS_RESULT that is thrown from CGUIObject::AddToPointersMap().
*/
void UpdateObjects();
@ -139,11 +148,15 @@ private:
* Private, since you can only add objects through
* XML files. Why? Becasue it enables the GUI to
* be much more encapsulated and safe.
*
* @throws Rethrows PS_RESULT from CGUIObject::SetGUI() and
* CGUIObject::AddChild().
*/
void AddObject(CGUIObject* pObject);
/**
* Report an XML parsing error
* Report XML Reading Error, should be called from within the
* Xerces_* functions.
*
* @param str Error message
*/
@ -160,10 +173,7 @@ private:
CGUIObject *ConstructObject(const CStr &str);
//--------------------------------------------------------
// XML Reading Xerces C++ specific subroutines
//--------------------------------------------------------
/**
* @name Xerces_* Read Function
/** @name XML Reading Xerces C++ specific subroutines
*
* These does not throw!
* Because when reading in XML files, it won't be fatal
@ -171,54 +181,101 @@ private:
* fails, but it'll still continue reading in the next.
* All Error are reported with ReportParseError
*/
//@{
//--------------------------------------------------------
/*
/**
Xerces_* functions tree
==========================
<objects> (ReadRootObjects)
<code>
\<objects\> (ReadRootObjects)
|
+-<object> (ReadObject)
+-\<object\> (ReadObject)
|
+-<action>
+-\<action\>
|
+-Optional Type Extensions (CGUIObject::ReadExtendedElement) TODO
|
+-«object» *recursive*
<styles> (ReadRootStyles)
\<styles\> (ReadRootStyles)
|
+-<style> (ReadStyle)
+-\<style\> (ReadStyle)
<sprites> (ReadRootSprites)
\<sprites\> (ReadRootSprites)
|
+-<sprite> (ReadSprite)
+-\<sprite\> (ReadSprite)
|
+-<image> (ReadImage)
+-\<image\> (ReadImage)
<setup> (ReadRootSetup)
\<setup>\ (ReadRootSetup)
|
+-<tooltip> (ReadToolTip)
+-\<tooltip>\ (ReadToolTip)
|
+-<scrollbar> (ReadScrollBar)
+-\<scrollbar>\ (ReadScrollBar)
|
+-<icon> (ReadIcon)
+-\<icon>\ (ReadIcon)
==========================
</code>
*/
//@{
// Read roots
// Read Roots
/**
* Reads in the root element "objects" (the DOMElement).
*
* @param pElement The Xerces C++ Parser object that represents
* the objects-tag.
*/
void Xerces_ReadRootObjects(XERCES_CPP_NAMESPACE::DOMElement *pElement);
/**
* Reads in the root element "sprites" (the DOMElement).
*
* @param pElement The Xerces C++ Parser object that represents
* the sprites-tag.
*/
void Xerces_ReadRootSprites(XERCES_CPP_NAMESPACE::DOMElement *pElement);
// Read subs
// Read Subs
/**
* Notice! Recursive function!
*
* Read in an "object"-tag (the DOMElement) and stores it
* as a child in the pParent.
*
* It will also check the object's children and call this function
* on them too. Also it will call all other functions that reads
* in other stuff that can be found within an object. Such as
* "action"-tag will call Xerces_ReadAction (TODO, real funcion?).
*
* Reads in the root element "sprites" (the DOMElement).
*
* @param pElement The Xerces C++ Parser object that represents
* the object-tag.
* @param pParent Parent to add this object as child in.
*/
void Xerces_ReadObject(XERCES_CPP_NAMESPACE::DOMElement *, CGUIObject *pParent);
/**
* Reads in the element "sprite" (the DOMElement) and store the
* result in a new CGUISprite.
*
* @param pElement The Xerces C++ Parser object that represents
* the sprite-tag.
*/
void Xerces_ReadSprite(XERCES_CPP_NAMESPACE::DOMElement *);
/**
* Reads in the element "image" (the DOMElement) and store the
* result within the CGUISprite.
*
* @param pElement The Xerces C++ Parser object that represents
* the image-tag.
*/
void Xerces_ReadImage(XERCES_CPP_NAMESPACE::DOMElement *, CGUISprite &parent);
//@}
@ -227,10 +284,9 @@ private:
// Variables
//--------------------------------------------------------
// Misc
//--------------------------------------------------------
/** @name Miscellaneous */
//--------------------------------------------------------
//@{
/**
@ -245,9 +301,8 @@ private:
//@}
//--------------------------------------------------------
// Objects
//--------------------------------------------------------
/** @name Objects */
//--------------------------------------------------------
//@{
/**
@ -274,9 +329,8 @@ private:
//@}
//--------------------------------------------------------
// Sprites
//--------------------------------------------------------
/** @name Sprites */
//--------------------------------------------------------
//@{
std::map<CStr, CGUISprite> m_Sprites;

View File

@ -20,11 +20,6 @@ CGUIButtonBehavior::~CGUIButtonBehavior()
{
}
//-------------------------------------------------------------------
// Handles messages send from the CGUI
// Input:
// Message Message ID, GUIM_*
//-------------------------------------------------------------------
void CGUIButtonBehavior::HandleMessage(const EGUIMessage &Message)
{
switch (Message)

View File

@ -52,7 +52,9 @@ public:
CGUIButtonBehavior();
virtual ~CGUIButtonBehavior();
/// Handle Messages
/**
* @see CGUIObject#HandleMessage()
*/
virtual void HandleMessage(const EGUIMessage &Message);
protected:

View File

@ -7,10 +7,6 @@ gee@pyro.nu
//#include "stdafx."
#include "GUI.h"
///// janwas: you addded this? not needed
//#include "cgui.h"
/////
///// janwas: again, including etiquette?
#include "../ps/Parser.h"
#include <assert.h>
@ -21,12 +17,6 @@ using namespace std;
// Offsets
map_Settings CGUIObject::m_SettingsInfo;
// This must be placed after the line above defining
// m_SettingsInfo, GeeTODO, I'm not sure if this is
// the appropriate file, but it crashes if it's not
// in this file.
//CGUI g_GUI;
//-------------------------------------------------------------------
// Implementation Macros
//-------------------------------------------------------------------
@ -60,9 +50,7 @@ CGUIObject::~CGUIObject()
}
//-------------------------------------------------------------------
// Change the base settings
// Input:
// Set Setting struct
// Functions
//-------------------------------------------------------------------
void CGUIObject::SetBaseSettings(const SGUIBaseSettings &Set)
{
@ -70,21 +58,6 @@ void CGUIObject::SetBaseSettings(const SGUIBaseSettings &Set)
CheckSettingsValidity();
}
//-------------------------------------------------------------------
// Adds a child
// 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.
// Input:
// pChild Child to add
//-------------------------------------------------------------------
void CGUIObject::AddChild(CGUIObject *pChild)
{
//
@ -121,16 +94,6 @@ void CGUIObject::AddChild(CGUIObject *pChild)
// else do nothing
}
//-------------------------------------------------------------------
// Adds object and its children to the map, it's name being the
// first part, and the second being itself.
// Input:
// ObjectMap Checks to see if the name's already taken
// Output:
// ObjectMap Fills it with more
// Throws:
// PS_NAME_AMBIGUITY
//-------------------------------------------------------------------
void CGUIObject::AddToPointersMap(map_pObjects &ObjectMap)
{
// Just don't do anything about the top node
@ -154,20 +117,11 @@ void CGUIObject::AddToPointersMap(map_pObjects &ObjectMap)
}
}
//-------------------------------------------------------------------
// Destroys all children and the current object too
//-------------------------------------------------------------------
void CGUIObject::Destroy()
{
// Is there anything besides the children to destroy?
}
//-------------------------------------------------------------------
// Sets up a map_size_t to include the variables in m_BaseSettings
// Input:
// p Pointers that should be filled with base
// variables
//-------------------------------------------------------------------
void CGUIObject::SetupBaseSettingsInfo(map_Settings &SettingsInfo)
{
SettingsInfo["hejsan"].m_Offset = 0;
@ -181,10 +135,6 @@ void CGUIObject::SetupBaseSettingsInfo(map_Settings &SettingsInfo)
_GUI_ADD_OFFSET("string", "caption", m_Caption)
}
//-------------------------------------------------------------------
// Checks if mouse is over and returns result
// mouse_x, mouse_y defined in CGUI
//-------------------------------------------------------------------
bool CGUIObject::MouseOver()
{
if(!GetGUI())
@ -199,9 +149,6 @@ bool CGUIObject::MouseOver()
mouse_y <= m_BaseSettings.m_Size.top);
}
//-------------------------------------------------------------------
// Get Mouse X/Y from CGUI
//-------------------------------------------------------------------
u16 CGUIObject::GetMouseX() const
{
return ((GetGUI())?(GetGUI()->m_MouseX):0);
@ -212,14 +159,6 @@ u16 CGUIObject::GetMouseY() const
return ((GetGUI())?(GetGUI()->m_MouseY):0);
}
//-------------------------------------------------------------------
// 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).
// Input:
// pMouseOver Object that is currently hovered
// can OF COURSE be NULL too!
//-------------------------------------------------------------------
void CGUIObject::UpdateMouseOver(CGUIObject * const &pMouseOver)
{
// Check if this is the object being hovered.
@ -247,11 +186,6 @@ void CGUIObject::UpdateMouseOver(CGUIObject * const &pMouseOver)
}
}
//-------------------------------------------------------------------
// Check if setting exists by name
// Input:
// Setting Setting by name
//-------------------------------------------------------------------
bool CGUIObject::SettingExists(const CStr &Setting) const
{
// Because GetOffsets will direct dynamically defined
@ -261,13 +195,6 @@ bool CGUIObject::SettingExists(const CStr &Setting) const
return (GetSettingsInfo().count(Setting) == 1)?true:false;
}
//-------------------------------------------------------------------
// Set a setting by string, regardless of what type it is...
// example a CRect(10,10,20,20) would be "10 10 20 20"
// Input:
// Setting Setting by name
// Value Value
//-------------------------------------------------------------------
void CGUIObject::SetSetting(const CStr &Setting, const CStr &Value)
{
if (!SettingExists(Setting))
@ -349,20 +276,6 @@ void CGUIObject::SetSetting(const CStr &Setting, const CStr &Value)
}
}
//-------------------------------------------------------------------
// Inputs a reference pointer, checks if the new inputted object
// if hovered, if so, then check if (this)'s Z value is greater
// than the inputted object... If so then the object is closer
// and we'll replace the pointer with (this)
// 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.
// Input:
// pObject Object pointer
// Input:
// pObject Object pointer, either old or (this)
//-------------------------------------------------------------------
void CGUIObject::ChooseMouseOverAndClosest(CGUIObject* &pObject)
{
if (MouseOver())
@ -383,13 +296,6 @@ void CGUIObject::ChooseMouseOverAndClosest(CGUIObject* &pObject)
}
}
//-------------------------------------------------------------------
// Get Object's parent, notice that if the parent is the top-node
// then, we'll return NULL, because we don't want the top-node
// taken into account.
// Return:
// The Parent
//-------------------------------------------------------------------
CGUIObject *CGUIObject::GetParent()
{
// Important, we're not using GetParent() for these
@ -404,13 +310,6 @@ CGUIObject *CGUIObject::GetParent()
}
// GeeTODO keep this function and all???
//-------------------------------------------------------------------
// Called every time settings are change, this is where you check
// validity (not syntactical, that's already check) of your values.
// perhaps you can't have Z being below 0. Anyway this is where
// all is checked, and if you wanbt to add more in a derived object
// do that in GUIM_SETTINGS_UPDATED
//-------------------------------------------------------------------
void CGUIObject::CheckSettingsValidity()
{
// If we hide an object, reset many of its parts

View File

@ -94,6 +94,8 @@ 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.
*/
@ -104,6 +106,8 @@ struct SGUISetting
};
/**
* @author Gustav Larsson
*
* Base settings, all objects possess these settings
* in their <code>m_BaseSettings</code>
* Instructions can be found in the documentations.
@ -144,22 +148,22 @@ public:
virtual map_Settings GetSettingsInfo() const { return m_SettingsInfo; }
/**
* Is mouse over
* because it's virtual you can change the
* mouse over demands, such as making a round
* button, or just modifying it when changed,
* like for a combo box.
* Checks if mouse is hovering this object.
* The mouse position is cached in CGUI.
*
* The default one uses <code>m_Size</code>.
* 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 over
* @return true if mouse is hovering
*/
virtual bool MouseOver();
//--------------------------------------------------------
// Leaf Functions
//--------------------------------------------------------
/** @name Leaf Functions */
//--------------------------------------------------------
//@{
/// Get object name, name is unique
@ -169,24 +173,38 @@ public:
void SetName(const CStr &Name) { m_Name = Name; }
/**
* Fill a map_pObjects with this object (does not include recursion)
* 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);
/**
* Add child
* 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 Add child by pointer
* @param pChild Child to add
*
* @throws PS_RESULT from CGUI::UpdateObjects().
*/
void AddChild(CGUIObject *pChild);
//@}
//--------------------------------------------------------
// Iterate
//--------------------------------------------------------
/** @name Iterate */
//--------------------------------------------------------
//@{
vector_pObjects::iterator ChildrenItBegin() { return m_Children.begin(); }
@ -194,57 +212,71 @@ public:
//@}
//--------------------------------------------------------
// Settings Management
//--------------------------------------------------------
/** @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
* @return True if settings exist.
*/
bool SettingExists(const CStr &Setting) const;
/// Setup base pointers
void SetupBaseSettingsInfo(map_Settings &SettingsInfo);
/// Set Setting by string
void SetSetting(const CStr &Setting, const CStr &Value);
/**
* Should be called every time the settings has been updated
* will also send a message <code>GUIM_SETTINGS_UPDATED</code>, so that
* 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:
//--------------------------------------------------------
// 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
/** @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
*/
//--------------------------------------------------------
/** @name Internal methods that uses friendship */
//@{
/**
* Calls Destroy on all children, and deallocates all memory
* Calls Destroy on all children, and deallocates all memory.
* BIG TODO Should it destroy it's children?
*/
virtual void Destroy();
@ -252,12 +284,17 @@ protected:
* This function is called with different messages
* for instance when the mouse enters the object.
*
* @param Message <code>EGUIMessage</code>.
* @param Message EGUIMessage
*/
virtual void HandleMessage(const EGUIMessage &Message)=0;
/**
* Draws the object
* 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;
@ -270,46 +307,52 @@ protected:
void SetParent(CGUIObject *pParent) { m_pParent = pParent; }
/**
* <b>NOTE!</b> This will not just return <code>m_pParent</code>, when that is need
* use it! There is one exception to it, when the parent is
* <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 <code>NULL</code>, so that the top-node's children are
* will return NULL, so that the top-node's children are
* seemingly parentless.
*
* @return Pointer to parent
*/
CGUIObject *GetParent();
/**
* Clear children, removes all children
* Update objects, will basically use the this base class
* to access a private member in <code>CGUI</code>, this base
* class will be only one with permission
*/
// void UpdateObjects();
// Get cached mouse x/y from CGUI
u16 GetMouseX() const;
u16 GetMouseY() const;
//@}
private:
// Functions used fully private and by friends (mainly the CGUI)
//--------------------------------------------------------
/** @name Internal functions */
//--------------------------------------------------------
//@{
/**
* You input pointer, and if the Z value of this object
* is greater than the one inputted, the pointer is changed to this.
* 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
* @param pObject Object pointer, can be either the old one, or
* the new one.
*/
void ChooseMouseOverAndClosest(CGUIObject* &pObject);
/**
* Update Mouse Over (for this object only)
* 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
* @param pMouseOver Object that is currently hovered,
* can OF COURSE be NULL too!
*/
void UpdateMouseOver(CGUIObject * const &pMouseOver);
//@}
// Variables
@ -317,7 +360,7 @@ protected:
/// Name of object
CStr m_Name;
/// Constructed on the heap, will be destroyed along with the the object
/// Constructed on the heap, will be destroyed along with the the object TODO Really?
vector_pObjects m_Children;
/// Pointer to parent
@ -332,8 +375,7 @@ protected:
bool m_MouseHovering;
/**
* Offset database
* tells us where a variable by a string name is
* 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.

View File

@ -9,14 +9,6 @@ gee@pyro.nu
using namespace std;
//-------------------------------------------------------------------
// Draw this sprite
// Input:
// rect Rectangle where the sprite should be drawn
// z Same as above only with Z-value
// clipping The clipping rectangle, things should only
// be drawn within these perimeters.
//-------------------------------------------------------------------
void CGUISprite::Draw(const float &z, const CRect &rect, const CRect &clipping=CRect(0,0,0,0))
{
bool DoClipping = (clipping != CRect(0,0,0,0));

View File

@ -82,8 +82,10 @@ public:
/**
* Execute a drawing request for this sprite
*
* @param z Draw in what depth.
* @param rect Outer rectangle to draw the collage.
* @param z Draw in what depth.
* @param rect Outer rectangle to draw the collage.
* @param clipping The clipping rectangle, things should only
* be drawn within these perimeters.
*/
void Draw(const float &z, const CRect &rect, const CRect &clipping);

View File

@ -9,10 +9,35 @@ gee@pyro.nu
--More info--
http://gee.pyro.nu/wfg/GUI/
http://gee.pyro.nu/GUI/
*/
// Main page for GUI documentation
/**
* \mainpage
* Welcome to the Wildfire Games Graphical User Interface Documentation.
*
* Additional Downloads can be made from the link below.\n
* <a href="http://gee.pyro.nu/GUIfiles/">Technical Design Document</a>
*
*
* \dot
* digraph
* {
* node [shape=record, fontname=Helvetica, fontsize=10];
* q [ label="Questions?"];
* c [ label="Comments?"];
* s [ label="Suggestions?"];
* email [label="E-mail Me" URL="mailto:slimgee@bredband.net"];
* q -> email;
* c -> email;
* s -> email;
* }
* \enddot
*/
#ifndef GUI_H
#define GUI_H

View File

@ -59,7 +59,7 @@ public: \
//--------------------------------------------------------
// Types
//--------------------------------------------------------
/**
/** \enum EGUIMessage
* Message send to <code>CGUIObject::HandleMessage()</code> in order
* to give life to Objects manually with
* a derived <code>HandleMessage()</code>.