2003-11-06 01:21:45 +01:00
|
|
|
/*
|
|
|
|
GUI Core, stuff that the whole GUI uses
|
|
|
|
by Gustav Larsson
|
|
|
|
gee@pyro.nu
|
|
|
|
|
|
|
|
--Overview--
|
|
|
|
|
|
|
|
Contains defines, includes, types etc that the whole
|
|
|
|
GUI should have included.
|
|
|
|
|
|
|
|
--More info--
|
|
|
|
|
|
|
|
http://gee.pyro.nu/wfg/GUI/
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GUIbase_H
|
|
|
|
#define GUIbase_H
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------
|
|
|
|
// Includes / Compiler directives
|
|
|
|
//--------------------------------------------------------
|
|
|
|
|
|
|
|
//--------------------------------------------------------
|
|
|
|
// Forward declarations
|
|
|
|
//--------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
class IGUIObject;
|
2003-11-06 01:21:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------
|
|
|
|
// Macros
|
|
|
|
//--------------------------------------------------------
|
2003-11-06 12:54:46 +01:00
|
|
|
|
|
|
|
// Global CGUI
|
|
|
|
#define g_GUI CGUI::GetSingleton()
|
|
|
|
|
2003-11-06 01:21:45 +01:00
|
|
|
// Temp
|
|
|
|
#define CInput nemInput
|
2003-11-07 02:55:29 +01:00
|
|
|
//#define CStr std::string
|
2003-11-06 01:21:45 +01:00
|
|
|
|
|
|
|
// Example
|
|
|
|
// GUI_ADD_OFFSET(CButton, SButtonSettings, m_Settings, "frozen", m_Frozen);
|
|
|
|
//
|
|
|
|
#define GUI_ADD_OFFSET(_class, _struct, name, type, str, var) \
|
|
|
|
m_SettingsInfo[str].m_Offset = offsetof(_class, name) + offsetof(_struct, var); \
|
|
|
|
m_SettingsInfo[str].m_Type = type;
|
|
|
|
|
2003-11-24 03:18:41 +01:00
|
|
|
// Declares the static variable in IGUISettingsObject<>
|
2003-11-06 01:21:45 +01:00
|
|
|
#define DECLARE_SETTINGS_INFO(_struct) \
|
2003-11-24 03:18:41 +01:00
|
|
|
map_Settings IGUISettingsObject<_struct>::m_SettingsInfo;
|
2003-11-06 01:21:45 +01:00
|
|
|
|
|
|
|
// Setup an object's ConstructObject function
|
|
|
|
#define GUI_OBJECT(obj) \
|
|
|
|
public: \
|
2003-11-24 03:18:41 +01:00
|
|
|
static IGUIObject *ConstructObject() { return new obj(); }
|
2003-11-06 01:21:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------
|
|
|
|
// Types
|
|
|
|
//--------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
/**
|
|
|
|
* @enum EGUIMessage
|
|
|
|
* Message send to IGUIObject::HandleMessage() in order
|
2003-11-18 11:00:57 +01:00
|
|
|
* to give life to Objects manually with
|
2003-11-24 03:18:41 +01:00
|
|
|
* a derived HandleMessage().
|
2003-11-18 11:00:57 +01:00
|
|
|
*/
|
2003-11-06 01:21:45 +01:00
|
|
|
enum EGUIMessage
|
|
|
|
{
|
|
|
|
GUIM_PREPROCESS,
|
|
|
|
GUIM_POSTPROCESS,
|
|
|
|
GUIM_MOUSE_OVER,
|
|
|
|
GUIM_MOUSE_ENTER,
|
|
|
|
GUIM_MOUSE_LEAVE,
|
|
|
|
GUIM_MOUSE_PRESS_LEFT,
|
|
|
|
GUIM_MOUSE_PRESS_RIGHT,
|
|
|
|
GUIM_MOUSE_DOWN_LEFT,
|
|
|
|
GUIM_MOUSE_DOWN_RIGHT,
|
|
|
|
GUIM_MOUSE_RELEASE_LEFT,
|
|
|
|
GUIM_MOUSE_RELEASE_RIGHT,
|
|
|
|
GUIM_SETTINGS_UPDATED,
|
|
|
|
GUIM_PRESSED
|
|
|
|
};
|
|
|
|
|
2003-11-18 11:00:57 +01:00
|
|
|
/**
|
|
|
|
* Recurse restrictions, when we recurse, if an object
|
|
|
|
* is hidden for instance, you might want it to skip
|
|
|
|
* the children also
|
|
|
|
* Notice these are flags! and we don't really need one
|
|
|
|
* for no restrictions, because then you'll just enter 0
|
|
|
|
*/
|
2003-11-06 01:21:45 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GUIRR_HIDDEN=1,
|
|
|
|
GUIRR_DISABLED=2
|
|
|
|
};
|
|
|
|
|
|
|
|
// Typedefs
|
2003-11-24 03:18:41 +01:00
|
|
|
typedef std::map<CStr, IGUIObject*> map_pObjects;
|
2003-11-06 01:21:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------
|
|
|
|
// Error declarations
|
|
|
|
//--------------------------------------------------------
|
|
|
|
DECLARE_ERROR(PS_NAME_TAKEN)
|
|
|
|
DECLARE_ERROR(PS_OBJECT_FAIL)
|
|
|
|
DECLARE_ERROR(PS_SETTING_FAIL)
|
|
|
|
DECLARE_ERROR(PS_VALUE_INVALID)
|
|
|
|
DECLARE_ERROR(PS_NEEDS_PGUI)
|
|
|
|
DECLARE_ERROR(PS_NAME_AMBIGUITY)
|
|
|
|
DECLARE_ERROR(PS_NEEDS_NAME)
|
|
|
|
|
|
|
|
DECLARE_ERROR(PS_LEXICAL_FAIL)
|
|
|
|
DECLARE_ERROR(PS_SYNTACTICAL_FAIL)
|
|
|
|
|
|
|
|
#endif
|