CHANGED: #1471 The classes moved in the previous commit are now under the NLGUI namespace.
This commit is contained in:
parent
529dd877fe
commit
3db1f3cc48
44 changed files with 8337 additions and 8074 deletions
|
@ -24,113 +24,119 @@
|
||||||
#include "nel/misc/xml_auto_ptr.h"
|
#include "nel/misc/xml_auto_ptr.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
/**
|
namespace NLGUI
|
||||||
* interface for action handlers
|
|
||||||
* \author Nicolas Brigand
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
|
|
||||||
class CCtrlBase;
|
|
||||||
|
|
||||||
class IActionHandler
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
// Execute the answer to the action
|
|
||||||
// Params has the following form : paramName=theParam|paramName2=theParam2|...
|
|
||||||
virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { }
|
|
||||||
|
|
||||||
virtual ~IActionHandler() {}
|
class CCtrlBase;
|
||||||
|
|
||||||
static std::string getParam (const std::string &Params, const std::string &ParamName);
|
|
||||||
|
|
||||||
static void getAllParams (const std::string &Params, std::vector< std::pair<std::string,std::string> > &AllParams);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
interface for action handlers factory
|
* interface for action handlers
|
||||||
no release in this factory : a handler must be destroyed by the control that created it
|
* \author Nicolas Brigand
|
||||||
*/
|
* \author Nevrax France
|
||||||
class CAHManager
|
* \date 2002
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::map< std::string, IActionHandler* > TFactoryMap;
|
|
||||||
typedef std::map< IActionHandler*, std::string > TNameMap;
|
|
||||||
|
|
||||||
static CAHManager* getInstance()
|
|
||||||
{
|
|
||||||
if (_GlobalInstance == NULL)
|
|
||||||
_GlobalInstance = new CAHManager;
|
|
||||||
return _GlobalInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// return pointer to action handler or null if it doesn't exist
|
|
||||||
IActionHandler *getActionHandler(const std::string &name) const
|
|
||||||
{
|
|
||||||
TFactoryMap::const_iterator it = FactoryMap.find(name);
|
|
||||||
return it != FactoryMap.end() ? it->second : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return the name of the action handler given its pointer
|
|
||||||
const std::string &getActionHandlerName(IActionHandler *pAH) const
|
|
||||||
{
|
|
||||||
TNameMap::const_iterator it = NameMap.find(pAH);
|
|
||||||
return it != NameMap.end() ? it->second : EmptyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// map of action handler factories
|
|
||||||
TFactoryMap FactoryMap;
|
|
||||||
TNameMap NameMap;
|
|
||||||
std::string EmptyName;
|
|
||||||
|
|
||||||
/// return the Action Handler 'name'. if name is of form 'ah:params', then params are filled (NB: else not changed)
|
|
||||||
IActionHandler *getAH(const std::string &name, std::string ¶ms);
|
|
||||||
IActionHandler *getAH(const std::string &name, class CStringShared ¶ms);
|
|
||||||
|
|
||||||
/** common method to parse Action Handler from a xml node
|
|
||||||
* \param ahId eg: "onclick_l"
|
|
||||||
* \param paramId eg: "params_l".
|
|
||||||
* \param params returned parameters.
|
|
||||||
* NB: if paramId is NULL, empty or does not exist in the xmlNode, then the optional param in ahId (eg: "show:phrase_book")
|
|
||||||
* is taken
|
|
||||||
* NB: if none of the optional param in ahId, or the specified param are filled/found, then params is not changed
|
|
||||||
*/
|
*/
|
||||||
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, std::string ¶ms);
|
class IActionHandler
|
||||||
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, class CStringShared ¶ms);
|
{
|
||||||
|
public:
|
||||||
/// Get the AH name from ptr
|
// Execute the answer to the action
|
||||||
const std::string &getAHName(IActionHandler *pAH){ return getActionHandlerName(pAH); }
|
// Params has the following form : paramName=theParam|paramName2=theParam2|...
|
||||||
|
virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { }
|
||||||
|
|
||||||
void runActionHandler(const std::string &AHName, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
virtual ~IActionHandler() {}
|
||||||
void runActionHandler(IActionHandler *ah, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
|
||||||
|
|
||||||
private:
|
static std::string getParam (const std::string &Params, const std::string &ParamName);
|
||||||
CAHManager(){}
|
|
||||||
static CAHManager *_GlobalInstance;
|
|
||||||
|
|
||||||
};
|
static void getAllParams (const std::string &Params, std::vector< std::pair<std::string,std::string> > &AllParams);
|
||||||
|
};
|
||||||
|
|
||||||
/// Ah name must all be lower case
|
|
||||||
#define REGISTER_ACTION_HANDLER(handler ,name) \
|
/**
|
||||||
class handler##Factory : public handler \
|
interface for action handlers factory
|
||||||
{ \
|
no release in this factory : a handler must be destroyed by the control that created it
|
||||||
public: \
|
*/
|
||||||
handler##Factory () \
|
class CAHManager
|
||||||
{ \
|
{
|
||||||
nlassert(name!=NULL); \
|
public:
|
||||||
const char *c= name; \
|
typedef std::map< std::string, IActionHandler* > TFactoryMap;
|
||||||
while(*c!='\0') \
|
typedef std::map< IActionHandler*, std::string > TNameMap;
|
||||||
{ \
|
|
||||||
nlassert(islower(*c) || !isalpha(*c)); \
|
static CAHManager* getInstance()
|
||||||
c++; \
|
{
|
||||||
} \
|
if (_GlobalInstance == NULL)
|
||||||
CAHManager *pAHFM = CAHManager::getInstance(); \
|
_GlobalInstance = new CAHManager;
|
||||||
pAHFM->FactoryMap.insert(CAHManager::TFactoryMap::value_type(name,this)); \
|
return _GlobalInstance;
|
||||||
pAHFM->NameMap.insert(CAHManager::TNameMap::value_type(this,name)); \
|
}
|
||||||
}; \
|
|
||||||
}; \
|
/// return pointer to action handler or null if it doesn't exist
|
||||||
handler##Factory handler##FactoryInstance ; \
|
IActionHandler *getActionHandler(const std::string &name) const
|
||||||
\
|
{
|
||||||
|
TFactoryMap::const_iterator it = FactoryMap.find(name);
|
||||||
|
return it != FactoryMap.end() ? it->second : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the name of the action handler given its pointer
|
||||||
|
const std::string &getActionHandlerName(IActionHandler *pAH) const
|
||||||
|
{
|
||||||
|
TNameMap::const_iterator it = NameMap.find(pAH);
|
||||||
|
return it != NameMap.end() ? it->second : EmptyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// map of action handler factories
|
||||||
|
TFactoryMap FactoryMap;
|
||||||
|
TNameMap NameMap;
|
||||||
|
std::string EmptyName;
|
||||||
|
|
||||||
|
/// return the Action Handler 'name'. if name is of form 'ah:params', then params are filled (NB: else not changed)
|
||||||
|
IActionHandler *getAH(const std::string &name, std::string ¶ms);
|
||||||
|
IActionHandler *getAH(const std::string &name, class CStringShared ¶ms);
|
||||||
|
|
||||||
|
/** common method to parse Action Handler from a xml node
|
||||||
|
* \param ahId eg: "onclick_l"
|
||||||
|
* \param paramId eg: "params_l".
|
||||||
|
* \param params returned parameters.
|
||||||
|
* NB: if paramId is NULL, empty or does not exist in the xmlNode, then the optional param in ahId (eg: "show:phrase_book")
|
||||||
|
* is taken
|
||||||
|
* NB: if none of the optional param in ahId, or the specified param are filled/found, then params is not changed
|
||||||
|
*/
|
||||||
|
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, std::string ¶ms);
|
||||||
|
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, class CStringShared ¶ms);
|
||||||
|
|
||||||
|
/// Get the AH name from ptr
|
||||||
|
const std::string &getAHName(IActionHandler *pAH){ return getActionHandlerName(pAH); }
|
||||||
|
|
||||||
|
void runActionHandler(const std::string &AHName, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
||||||
|
void runActionHandler(IActionHandler *ah, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
||||||
|
|
||||||
|
private:
|
||||||
|
CAHManager(){}
|
||||||
|
static CAHManager *_GlobalInstance;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Ah name must all be lower case
|
||||||
|
#define REGISTER_ACTION_HANDLER(handler ,name) \
|
||||||
|
class handler##Factory : public handler \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
handler##Factory () \
|
||||||
|
{ \
|
||||||
|
nlassert(name!=NULL); \
|
||||||
|
const char *c= name; \
|
||||||
|
while(*c!='\0') \
|
||||||
|
{ \
|
||||||
|
nlassert(islower(*c) || !isalpha(*c)); \
|
||||||
|
c++; \
|
||||||
|
} \
|
||||||
|
CAHManager *pAHFM = CAHManager::getInstance(); \
|
||||||
|
pAHFM->FactoryMap.insert(CAHManager::TFactoryMap::value_type(name,this)); \
|
||||||
|
pAHFM->NameMap.insert(CAHManager::TNameMap::value_type(this,name)); \
|
||||||
|
}; \
|
||||||
|
}; \
|
||||||
|
handler##Factory handler##FactoryInstance ; \
|
||||||
|
\
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif //NL_ACTION_HANDLER_H
|
#endif //NL_ACTION_HANDLER_H
|
||||||
|
|
|
@ -23,141 +23,144 @@
|
||||||
#include "nel/gui/view_base.h"
|
#include "nel/gui/view_base.h"
|
||||||
#include "nel/gui/event_descriptor.h"
|
#include "nel/gui/event_descriptor.h"
|
||||||
|
|
||||||
class CCtrlBase : public CViewBase
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
public:
|
class CCtrlBase : public CViewBase
|
||||||
|
|
||||||
// Tooltip mode
|
|
||||||
enum TToolTipParentType
|
|
||||||
{
|
{
|
||||||
TTMouse= 0, // The tooltip is displayed relatively to the mouse when it appears
|
public:
|
||||||
TTCtrl= 1, // The tooltip is displayed relatively to the ctrl it comes from when it apeears
|
|
||||||
TTWindow= 2, // The tooltip is displayed relatively to the window where the control lies.
|
|
||||||
TTSpecialWindow= 3, // The tooltip is displayed relatively to a special user window
|
|
||||||
|
|
||||||
NumToolTipParentRef
|
// Tooltip mode
|
||||||
|
enum TToolTipParentType
|
||||||
|
{
|
||||||
|
TTMouse= 0, // The tooltip is displayed relatively to the mouse when it appears
|
||||||
|
TTCtrl= 1, // The tooltip is displayed relatively to the ctrl it comes from when it apeears
|
||||||
|
TTWindow= 2, // The tooltip is displayed relatively to the window where the control lies.
|
||||||
|
TTSpecialWindow= 3, // The tooltip is displayed relatively to a special user window
|
||||||
|
|
||||||
|
NumToolTipParentRef
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// Constructor
|
||||||
|
CCtrlBase(const TCtorParam ¶m) : CViewBase(param)
|
||||||
|
{
|
||||||
|
_ToolTipInstant= true;
|
||||||
|
_ToolTipParent= TTCtrl;
|
||||||
|
// see interface.txt for meaning of auto
|
||||||
|
_ToolTipParentPosRef= Hotspot_TTAuto;
|
||||||
|
_ToolTipPosRef= Hotspot_TTAuto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
virtual ~CCtrlBase();
|
||||||
|
|
||||||
|
// special parse
|
||||||
|
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||||
|
|
||||||
|
|
||||||
|
/// Handle all events (implemented by derived classes) (return true to signal event handled)
|
||||||
|
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||||
|
|
||||||
|
virtual CCtrlBase *getSubCtrl (sint32 /* x */, sint32 /* y */) { return this; }
|
||||||
|
|
||||||
|
/// Debug
|
||||||
|
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||||
|
|
||||||
|
|
||||||
|
/// Get the ContextHelp for this control. Default is to return _ContextHelp
|
||||||
|
virtual void getContextHelp(ucstring &help) const {help= _ContextHelp;}
|
||||||
|
/// Get the ContextHelp for this control, with tooltip specific code. Default behaviour is identical to getContextHelp.
|
||||||
|
virtual void getContextHelpToolTip(ucstring &help) const { getContextHelp(help); }
|
||||||
|
// Get the name of the context help window. Default to "context_help"
|
||||||
|
virtual std::string getContextHelpWindowName() const;
|
||||||
|
/// Get the ContextHelp ActionHandler. If "", noop
|
||||||
|
const std::string &getContextHelpActionHandler() const {return _OnContextHelp;}
|
||||||
|
/// Get the ContextHelp ActionHandler Params
|
||||||
|
const std::string &getContextHelpAHParams() const {return _OnContextHelpParams;}
|
||||||
|
/// true if both are empty
|
||||||
|
bool emptyContextHelp() const;
|
||||||
|
// Should return true if the context help should be displayed instantly
|
||||||
|
bool wantInstantContextHelp() const { return _ToolTipInstant; }
|
||||||
|
/// Set true if ToolTip should be displayed instantly
|
||||||
|
void setInstantContextHelp(bool instant) { _ToolTipInstant = instant;}
|
||||||
|
|
||||||
|
/** If ctrl has a non rectangle shape, perform further test to know
|
||||||
|
* if control should be taken in account for context help
|
||||||
|
*/
|
||||||
|
virtual bool preciseHitTest(sint32 /* x */, sint32 /* y */) const { return true; }
|
||||||
|
|
||||||
|
|
||||||
|
/// return the type of anchor for the tooltip of this control
|
||||||
|
TToolTipParentType getToolTipParent() const { return _ToolTipParent;}
|
||||||
|
const std::string &getToolTipSpecialParent() const {return _ToolTipSpecialParent.toString();}
|
||||||
|
/// Set the type of anchor for the tooltip of this control
|
||||||
|
void setToolTipParent(TToolTipParentType type) { _ToolTipParent = type; }
|
||||||
|
void setToolTipSpecialParent(const std::string &parent) { _ToolTipSpecialParent = parent; }
|
||||||
|
/// Get the ToolTip pos references (parent relevant only if getToolTipParent()!=TTMouse)
|
||||||
|
THotSpot getToolTipParentPosRef() const { return _ToolTipParentPosRef;}
|
||||||
|
THotSpot getToolTipPosRef() const { return _ToolTipPosRef;}
|
||||||
|
THotSpot getToolTipParentPosRefAlt() const { return _ToolTipParentPosRefAlt;}
|
||||||
|
THotSpot getToolTipPosRefAlt() const { return _ToolTipPosRefAlt;}
|
||||||
|
/// Set the ToolTip pos references (parent relevant only if getToolTipParent()!=TTMouse)
|
||||||
|
void setToolTipParentPosRef(THotSpot pos) { _ToolTipParentPosRef = pos;}
|
||||||
|
void setToolTipPosRef(THotSpot pos) { _ToolTipPosRef = pos;}
|
||||||
|
|
||||||
|
/// replace the default contextHelp
|
||||||
|
ucstring getDefaultContextHelp() const {return _ContextHelp;}
|
||||||
|
void setDefaultContextHelp(const ucstring &help) {_ContextHelp= help;}
|
||||||
|
void setOnContextHelp(const std::string &help) {_OnContextHelp= help;}
|
||||||
|
void setOnContextHelpAHParams(const std::string &p) {_OnContextHelpParams= p;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// called when this element or a son has been captured
|
||||||
|
virtual void elementCaptured(CCtrlBase * /* capturedElement */) {}
|
||||||
|
|
||||||
|
virtual bool isCtrl() const { return true; }
|
||||||
|
|
||||||
|
// Made for CtrlResizer to take the precedence over son controls.
|
||||||
|
virtual uint getDeltaDepth() const { return 0; }
|
||||||
|
|
||||||
|
// true if this ctrl is capturable (true by default, false for tooltip)
|
||||||
|
virtual bool isCapturable() const {return true;}
|
||||||
|
|
||||||
|
// from CInterfaceElement
|
||||||
|
virtual void visit(CInterfaceElementVisitor *visitor);
|
||||||
|
|
||||||
|
/** test if virtual desktop change is possible while this element is captured by the mouse
|
||||||
|
* Useful for resizers
|
||||||
|
*/
|
||||||
|
virtual bool canChangeVirtualDesktop() const { return true; }
|
||||||
|
|
||||||
|
// called when keyboard capture has been lost
|
||||||
|
virtual void onKeyboardCaptureLost() {}
|
||||||
|
|
||||||
|
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
|
||||||
|
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
|
||||||
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
|
// special for mouse over : return true and fill the name of the cursor to display
|
||||||
|
virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */) { return false; }
|
||||||
|
|
||||||
|
virtual void serial(NLMISC::IStream &f);
|
||||||
|
protected:
|
||||||
|
// This is the ContextHelp filled by default in parse()
|
||||||
|
ucstring _ContextHelp;
|
||||||
|
CStringShared _OnContextHelp;
|
||||||
|
CStringShared _OnContextHelpParams;
|
||||||
|
CStringShared _ToolTipSpecialParent;
|
||||||
|
TToolTipParentType _ToolTipParent;
|
||||||
|
bool _ToolTipInstant : 1;
|
||||||
|
THotSpot _ToolTipParentPosRef : 6;
|
||||||
|
THotSpot _ToolTipPosRef : 6;
|
||||||
|
THotSpot _ToolTipParentPosRefAlt : 6;
|
||||||
|
THotSpot _ToolTipPosRefAlt : 6;
|
||||||
|
protected:
|
||||||
|
void convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS);
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
}
|
||||||
|
|
||||||
/// Constructor
|
|
||||||
CCtrlBase(const TCtorParam ¶m) : CViewBase(param)
|
|
||||||
{
|
|
||||||
_ToolTipInstant= true;
|
|
||||||
_ToolTipParent= TTCtrl;
|
|
||||||
// see interface.txt for meaning of auto
|
|
||||||
_ToolTipParentPosRef= Hotspot_TTAuto;
|
|
||||||
_ToolTipPosRef= Hotspot_TTAuto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destructor
|
|
||||||
virtual ~CCtrlBase();
|
|
||||||
|
|
||||||
// special parse
|
|
||||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
|
||||||
|
|
||||||
|
|
||||||
/// Handle all events (implemented by derived classes) (return true to signal event handled)
|
|
||||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
|
||||||
|
|
||||||
virtual CCtrlBase *getSubCtrl (sint32 /* x */, sint32 /* y */) { return this; }
|
|
||||||
|
|
||||||
/// Debug
|
|
||||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
|
||||||
|
|
||||||
|
|
||||||
/// Get the ContextHelp for this control. Default is to return _ContextHelp
|
|
||||||
virtual void getContextHelp(ucstring &help) const {help= _ContextHelp;}
|
|
||||||
/// Get the ContextHelp for this control, with tooltip specific code. Default behaviour is identical to getContextHelp.
|
|
||||||
virtual void getContextHelpToolTip(ucstring &help) const { getContextHelp(help); }
|
|
||||||
// Get the name of the context help window. Default to "context_help"
|
|
||||||
virtual std::string getContextHelpWindowName() const;
|
|
||||||
/// Get the ContextHelp ActionHandler. If "", noop
|
|
||||||
const std::string &getContextHelpActionHandler() const {return _OnContextHelp;}
|
|
||||||
/// Get the ContextHelp ActionHandler Params
|
|
||||||
const std::string &getContextHelpAHParams() const {return _OnContextHelpParams;}
|
|
||||||
/// true if both are empty
|
|
||||||
bool emptyContextHelp() const;
|
|
||||||
// Should return true if the context help should be displayed instantly
|
|
||||||
bool wantInstantContextHelp() const { return _ToolTipInstant; }
|
|
||||||
/// Set true if ToolTip should be displayed instantly
|
|
||||||
void setInstantContextHelp(bool instant) { _ToolTipInstant = instant;}
|
|
||||||
|
|
||||||
/** If ctrl has a non rectangle shape, perform further test to know
|
|
||||||
* if control should be taken in account for context help
|
|
||||||
*/
|
|
||||||
virtual bool preciseHitTest(sint32 /* x */, sint32 /* y */) const { return true; }
|
|
||||||
|
|
||||||
|
|
||||||
/// return the type of anchor for the tooltip of this control
|
|
||||||
TToolTipParentType getToolTipParent() const { return _ToolTipParent;}
|
|
||||||
const std::string &getToolTipSpecialParent() const {return _ToolTipSpecialParent.toString();}
|
|
||||||
/// Set the type of anchor for the tooltip of this control
|
|
||||||
void setToolTipParent(TToolTipParentType type) { _ToolTipParent = type; }
|
|
||||||
void setToolTipSpecialParent(const std::string &parent) { _ToolTipSpecialParent = parent; }
|
|
||||||
/// Get the ToolTip pos references (parent relevant only if getToolTipParent()!=TTMouse)
|
|
||||||
THotSpot getToolTipParentPosRef() const { return _ToolTipParentPosRef;}
|
|
||||||
THotSpot getToolTipPosRef() const { return _ToolTipPosRef;}
|
|
||||||
THotSpot getToolTipParentPosRefAlt() const { return _ToolTipParentPosRefAlt;}
|
|
||||||
THotSpot getToolTipPosRefAlt() const { return _ToolTipPosRefAlt;}
|
|
||||||
/// Set the ToolTip pos references (parent relevant only if getToolTipParent()!=TTMouse)
|
|
||||||
void setToolTipParentPosRef(THotSpot pos) { _ToolTipParentPosRef = pos;}
|
|
||||||
void setToolTipPosRef(THotSpot pos) { _ToolTipPosRef = pos;}
|
|
||||||
|
|
||||||
/// replace the default contextHelp
|
|
||||||
ucstring getDefaultContextHelp() const {return _ContextHelp;}
|
|
||||||
void setDefaultContextHelp(const ucstring &help) {_ContextHelp= help;}
|
|
||||||
void setOnContextHelp(const std::string &help) {_OnContextHelp= help;}
|
|
||||||
void setOnContextHelpAHParams(const std::string &p) {_OnContextHelpParams= p;}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// called when this element or a son has been captured
|
|
||||||
virtual void elementCaptured(CCtrlBase * /* capturedElement */) {}
|
|
||||||
|
|
||||||
virtual bool isCtrl() const { return true; }
|
|
||||||
|
|
||||||
// Made for CtrlResizer to take the precedence over son controls.
|
|
||||||
virtual uint getDeltaDepth() const { return 0; }
|
|
||||||
|
|
||||||
// true if this ctrl is capturable (true by default, false for tooltip)
|
|
||||||
virtual bool isCapturable() const {return true;}
|
|
||||||
|
|
||||||
// from CInterfaceElement
|
|
||||||
virtual void visit(CInterfaceElementVisitor *visitor);
|
|
||||||
|
|
||||||
/** test if virtual desktop change is possible while this element is captured by the mouse
|
|
||||||
* Useful for resizers
|
|
||||||
*/
|
|
||||||
virtual bool canChangeVirtualDesktop() const { return true; }
|
|
||||||
|
|
||||||
// called when keyboard capture has been lost
|
|
||||||
virtual void onKeyboardCaptureLost() {}
|
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
|
|
||||||
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
|
|
||||||
REFLECT_EXPORT_END
|
|
||||||
|
|
||||||
// special for mouse over : return true and fill the name of the cursor to display
|
|
||||||
virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */) { return false; }
|
|
||||||
|
|
||||||
virtual void serial(NLMISC::IStream &f);
|
|
||||||
protected:
|
|
||||||
// This is the ContextHelp filled by default in parse()
|
|
||||||
ucstring _ContextHelp;
|
|
||||||
CStringShared _OnContextHelp;
|
|
||||||
CStringShared _OnContextHelpParams;
|
|
||||||
CStringShared _ToolTipSpecialParent;
|
|
||||||
TToolTipParentType _ToolTipParent;
|
|
||||||
bool _ToolTipInstant : 1;
|
|
||||||
THotSpot _ToolTipParentPosRef : 6;
|
|
||||||
THotSpot _ToolTipPosRef : 6;
|
|
||||||
THotSpot _ToolTipParentPosRefAlt : 6;
|
|
||||||
THotSpot _ToolTipPosRefAlt : 6;
|
|
||||||
protected:
|
|
||||||
void convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // RZ_VIEW_BASE_H
|
#endif // RZ_VIEW_BASE_H
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,64 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#ifndef CTRL_DRAGGABLE_H
|
#ifndef CTRL_DRAGGABLE_H
|
||||||
#define CTRL_DRAGGABLE_H
|
#define CTRL_DRAGGABLE_H
|
||||||
|
|
||||||
#include "nel/gui/ctrl_base.h"
|
#include "nel/gui/ctrl_base.h"
|
||||||
|
|
||||||
class CCtrlDraggable : public CCtrlBase
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DECLARE_UI_CLASS( CCtrlDraggable )
|
|
||||||
|
|
||||||
CCtrlDraggable( const TCtorParam ¶m );
|
class CCtrlDraggable : public CCtrlBase
|
||||||
virtual ~CCtrlDraggable(){};
|
|
||||||
|
|
||||||
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
|
|
||||||
bool isDragged() const{ return dragged; }
|
|
||||||
void setDragged( bool dragged ){ this->dragged = dragged; }
|
|
||||||
bool isDraggable() const{ return draggable; }
|
|
||||||
void setDraggable( bool draggable ){ this->draggable = draggable; }
|
|
||||||
|
|
||||||
void abortDragging()
|
|
||||||
{
|
{
|
||||||
dragged = false;
|
public:
|
||||||
_LastDraggedSheet = NULL;
|
DECLARE_UI_CLASS( CCtrlDraggable )
|
||||||
}
|
|
||||||
|
|
||||||
// Necessary because of reflection, no other purpose
|
CCtrlDraggable( const TCtorParam ¶m );
|
||||||
void draw(){}
|
virtual ~CCtrlDraggable(){};
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CCtrlDraggable, CCtrlBase)
|
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
|
||||||
REFLECT_BOOL("dragable", isDraggable, setDraggable);
|
bool isDragged() const{ return dragged; }
|
||||||
REFLECT_EXPORT_END
|
void setDragged( bool dragged ){ this->dragged = dragged; }
|
||||||
|
bool isDraggable() const{ return draggable; }
|
||||||
|
void setDraggable( bool draggable ){ this->draggable = draggable; }
|
||||||
|
|
||||||
|
void abortDragging()
|
||||||
|
{
|
||||||
|
dragged = false;
|
||||||
|
_LastDraggedSheet = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
// Necessary because of reflection, no other purpose
|
||||||
static void setDraggedSheet( CCtrlDraggable *draggable ){ _LastDraggedSheet = draggable; }
|
void draw(){}
|
||||||
|
|
||||||
private:
|
REFLECT_EXPORT_START(CCtrlDraggable, CCtrlBase)
|
||||||
static CCtrlDraggable *_LastDraggedSheet;
|
REFLECT_BOOL("dragable", isDraggable, setDraggable);
|
||||||
bool dragged;
|
REFLECT_EXPORT_END
|
||||||
bool draggable;
|
|
||||||
};
|
protected:
|
||||||
|
static void setDraggedSheet( CCtrlDraggable *draggable ){ _LastDraggedSheet = draggable; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
static CCtrlDraggable *_LastDraggedSheet;
|
||||||
|
bool dragged;
|
||||||
|
bool draggable;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,37 +19,42 @@
|
||||||
|
|
||||||
#include "nel/gui/ctrl_base.h"
|
#include "nel/gui/ctrl_base.h"
|
||||||
|
|
||||||
class CInterfaceGroup;
|
namespace NLGUI
|
||||||
|
|
||||||
class CCtrlScrollBase : public CCtrlBase
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DECLARE_UI_CLASS( CCtrlScrollBase )
|
|
||||||
|
|
||||||
CCtrlScrollBase( const TCtorParam ¶m );
|
class CInterfaceGroup;
|
||||||
virtual ~CCtrlScrollBase();
|
|
||||||
|
|
||||||
virtual void setTarget( CInterfaceGroup *pIG );
|
|
||||||
CInterfaceGroup* getTarget(){ return _Target; }
|
|
||||||
virtual sint32 moveTrackX( sint32 dx );
|
|
||||||
virtual sint32 moveTrackY( sint32 dy );
|
|
||||||
|
|
||||||
/** Move the Target Ofs with a Delta, and recompute TrackPos from this Ofs.
|
class CCtrlScrollBase : public CCtrlBase
|
||||||
* Useful for finer controled group scrolling when the list is very big (with mouseWheel or scroll buttons)
|
{
|
||||||
*/
|
public:
|
||||||
virtual void moveTargetX( sint32 dx );
|
DECLARE_UI_CLASS( CCtrlScrollBase )
|
||||||
virtual void moveTargetY( sint32 dy );
|
|
||||||
|
CCtrlScrollBase( const TCtorParam ¶m );
|
||||||
|
virtual ~CCtrlScrollBase();
|
||||||
|
|
||||||
|
virtual void setTarget( CInterfaceGroup *pIG );
|
||||||
|
CInterfaceGroup* getTarget(){ return _Target; }
|
||||||
|
virtual sint32 moveTrackX( sint32 dx );
|
||||||
|
virtual sint32 moveTrackY( sint32 dy );
|
||||||
|
|
||||||
|
/** Move the Target Ofs with a Delta, and recompute TrackPos from this Ofs.
|
||||||
|
* Useful for finer controled group scrolling when the list is very big (with mouseWheel or scroll buttons)
|
||||||
|
*/
|
||||||
|
virtual void moveTargetX( sint32 dx );
|
||||||
|
virtual void moveTargetY( sint32 dy );
|
||||||
|
|
||||||
|
|
||||||
// Necessary because of reflection, no other purpose
|
// Necessary because of reflection, no other purpose
|
||||||
void draw(){}
|
void draw(){}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CInterfaceGroup *_Target; // If NULL the scroller is a value scroller
|
CInterfaceGroup *_Target; // If NULL the scroller is a value scroller
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -20,75 +20,82 @@
|
||||||
|
|
||||||
#include "nel/gui/interface_group.h"
|
#include "nel/gui/interface_group.h"
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
class CGroupContainerBase : public CInterfaceGroup
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DECLARE_UI_CLASS( CGroupContainerBase )
|
|
||||||
|
|
||||||
CGroupContainerBase( const TCtorParam ¶m );
|
class CGroupContainerBase : public CInterfaceGroup
|
||||||
virtual ~CGroupContainerBase();
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS( CGroupContainerBase )
|
||||||
|
|
||||||
virtual void removeAllContainers();
|
CGroupContainerBase( const TCtorParam ¶m );
|
||||||
virtual void setLocked( bool locked );
|
virtual ~CGroupContainerBase();
|
||||||
bool isLocked() const { return _Locked; }
|
|
||||||
|
|
||||||
uint8 getContainerAlpha() const { return _ContainerAlpha; }
|
virtual void removeAllContainers();
|
||||||
uint8 getContentAlpha() const { return _ContentAlpha; }
|
virtual void setLocked( bool locked );
|
||||||
uint8 getRolloverAlphaContent() const { return _RolloverAlphaContent; }
|
bool isLocked() const { return _Locked; }
|
||||||
uint8 getRolloverAlphaContainer() const { return _RolloverAlphaContainer; }
|
|
||||||
|
|
||||||
void setContainerAlpha( uint8 alpha );
|
uint8 getContainerAlpha() const { return _ContainerAlpha; }
|
||||||
void setContentAlpha( uint8 alpha );
|
uint8 getContentAlpha() const { return _ContentAlpha; }
|
||||||
void setRolloverAlphaContent( uint8 alpha );
|
uint8 getRolloverAlphaContent() const { return _RolloverAlphaContent; }
|
||||||
void setRolloverAlphaContainer( uint8 alpha );
|
uint8 getRolloverAlphaContainer() const { return _RolloverAlphaContainer; }
|
||||||
|
|
||||||
// for export
|
void setContainerAlpha( uint8 alpha );
|
||||||
sint32 getContainerAlphaAsSInt32() const{ return (sint32)_ContainerAlpha; }
|
void setContentAlpha( uint8 alpha );
|
||||||
sint32 getContentAlphaAsSInt32() const{ return (sint32)_ContentAlpha; }
|
void setRolloverAlphaContent( uint8 alpha );
|
||||||
sint32 getRolloverAlphaContentAsSInt32() const{ return (sint32)_RolloverAlphaContent; }
|
void setRolloverAlphaContainer( uint8 alpha );
|
||||||
sint32 getRolloverAlphaContainerAsSInt32() const{ return (sint32)_RolloverAlphaContainer; }
|
|
||||||
|
|
||||||
// sin32 versions for export
|
// for export
|
||||||
void setContainerAlpha( sint32 alpha ){ setContainerAlpha((uint8) alpha); }
|
sint32 getContainerAlphaAsSInt32() const{ return (sint32)_ContainerAlpha; }
|
||||||
void setContentAlpha( sint32 alpha ){ setContentAlpha((uint8) alpha); }
|
sint32 getContentAlphaAsSInt32() const{ return (sint32)_ContentAlpha; }
|
||||||
void setRolloverAlphaContent( sint32 alpha ){ setRolloverAlphaContent((uint8) alpha); }
|
sint32 getRolloverAlphaContentAsSInt32() const{ return (sint32)_RolloverAlphaContent; }
|
||||||
void setRolloverAlphaContainer( sint32 alpha ){ setRolloverAlphaContainer((uint8) alpha); }
|
sint32 getRolloverAlphaContainerAsSInt32() const{ return (sint32)_RolloverAlphaContainer; }
|
||||||
|
|
||||||
void setUseGlobalAlpha( bool use );
|
// sin32 versions for export
|
||||||
bool isUsingGlobalAlpha() const{ return _UseGlobalAlpha; }
|
void setContainerAlpha( sint32 alpha ){ setContainerAlpha((uint8) alpha); }
|
||||||
|
void setContentAlpha( sint32 alpha ){ setContentAlpha((uint8) alpha); }
|
||||||
|
void setRolloverAlphaContent( sint32 alpha ){ setRolloverAlphaContent((uint8) alpha); }
|
||||||
|
void setRolloverAlphaContainer( sint32 alpha ){ setRolloverAlphaContainer((uint8) alpha); }
|
||||||
|
|
||||||
std::string getAHOnAlphaSettingsChanged() const{ return CAHManager::getInstance()->getAHName( _AHOnAlphaSettingsChanged ); }
|
void setUseGlobalAlpha( bool use );
|
||||||
std::string getAHOnAlphaSettingsChangedParams() const{ return _AHOnAlphaSettingsChangedParams; }
|
bool isUsingGlobalAlpha() const{ return _UseGlobalAlpha; }
|
||||||
|
|
||||||
void setAHOnAlphaSettingsChanged( const std::string &h ){ _AHOnAlphaSettingsChanged = CAHManager::getInstance()->getAH( h, _AHOnAlphaSettingsChangedParams ); }
|
std::string getAHOnAlphaSettingsChanged() const{ return CAHManager::getInstance()->getAHName( _AHOnAlphaSettingsChanged ); }
|
||||||
void setAHOnAlphaSettingsChangedParams( const std::string &p ){ _AHOnAlphaSettingsChangedParams = p; }
|
std::string getAHOnAlphaSettingsChangedParams() const{ return _AHOnAlphaSettingsChangedParams; }
|
||||||
|
|
||||||
REFLECT_EXPORT_START( CGroupContainerBase, CInterfaceGroup )
|
void setAHOnAlphaSettingsChanged( const std::string &h ){ _AHOnAlphaSettingsChanged = CAHManager::getInstance()->getAH( h, _AHOnAlphaSettingsChangedParams ); }
|
||||||
REFLECT_SINT32("container_alpha", getContainerAlphaAsSInt32, setContainerAlpha);
|
void setAHOnAlphaSettingsChangedParams( const std::string &p ){ _AHOnAlphaSettingsChangedParams = p; }
|
||||||
REFLECT_SINT32("content_alpha", getContentAlphaAsSInt32, setContentAlpha);
|
|
||||||
REFLECT_SINT32("rollover_content_alpha", getRolloverAlphaContentAsSInt32, setRolloverAlphaContent);
|
|
||||||
REFLECT_SINT32("rollover_container_alpha", getRolloverAlphaContainerAsSInt32, setRolloverAlphaContainer);
|
|
||||||
REFLECT_BOOL("use_global_alpha_settings", isUsingGlobalAlpha, setUseGlobalAlpha);
|
|
||||||
REFLECT_STRING("on_alpha_settings_changed", getAHOnAlphaSettingsChanged, setAHOnAlphaSettingsChanged);
|
|
||||||
REFLECT_STRING("on_alpha_settings_changed_aparams", getAHOnAlphaSettingsChangedParams, setAHOnAlphaSettingsChangedParams);
|
|
||||||
REFLECT_EXPORT_END
|
|
||||||
|
|
||||||
protected:
|
REFLECT_EXPORT_START( CGroupContainerBase, CInterfaceGroup )
|
||||||
void triggerAlphaSettingsChangedAH();
|
REFLECT_SINT32("container_alpha", getContainerAlphaAsSInt32, setContainerAlpha);
|
||||||
|
REFLECT_SINT32("content_alpha", getContentAlphaAsSInt32, setContentAlpha);
|
||||||
|
REFLECT_SINT32("rollover_content_alpha", getRolloverAlphaContentAsSInt32, setRolloverAlphaContent);
|
||||||
|
REFLECT_SINT32("rollover_container_alpha", getRolloverAlphaContainerAsSInt32, setRolloverAlphaContainer);
|
||||||
|
REFLECT_BOOL("use_global_alpha_settings", isUsingGlobalAlpha, setUseGlobalAlpha);
|
||||||
|
REFLECT_STRING("on_alpha_settings_changed", getAHOnAlphaSettingsChanged, setAHOnAlphaSettingsChanged);
|
||||||
|
REFLECT_STRING("on_alpha_settings_changed_aparams", getAHOnAlphaSettingsChangedParams, setAHOnAlphaSettingsChangedParams);
|
||||||
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
uint8 _ContainerAlpha;
|
protected:
|
||||||
uint8 _ContentAlpha;
|
void triggerAlphaSettingsChangedAH();
|
||||||
uint8 _RolloverAlphaContainer; // Alpha for the window when mouse not over it
|
|
||||||
uint8 _RolloverAlphaContent; // Alpha for the content when mouse not over it
|
|
||||||
bool _Locked : 1; // Is the container locked (ie override movable, openable ...)
|
|
||||||
bool _UseGlobalAlpha : 1;
|
|
||||||
|
|
||||||
IActionHandler *_AHOnAlphaSettingsChanged;
|
uint8 _ContainerAlpha;
|
||||||
CStringShared _AHOnAlphaSettingsChangedParams;
|
uint8 _ContentAlpha;
|
||||||
|
uint8 _RolloverAlphaContainer; // Alpha for the window when mouse not over it
|
||||||
|
uint8 _RolloverAlphaContent; // Alpha for the content when mouse not over it
|
||||||
|
bool _Locked : 1; // Is the container locked (ie override movable, openable ...)
|
||||||
|
bool _UseGlobalAlpha : 1;
|
||||||
|
|
||||||
private:
|
IActionHandler *_AHOnAlphaSettingsChanged;
|
||||||
|
CStringShared _AHOnAlphaSettingsChangedParams;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,45 +20,50 @@
|
||||||
|
|
||||||
#include "nel/gui/interface_group.h"
|
#include "nel/gui/interface_group.h"
|
||||||
|
|
||||||
class CGroupEditBoxBase : public CInterfaceGroup
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DECLARE_UI_CLASS( CGroupEditBoxBase )
|
|
||||||
|
|
||||||
CGroupEditBoxBase( const TCtorParam ¶m );
|
class CGroupEditBoxBase : public CInterfaceGroup
|
||||||
~CGroupEditBoxBase();
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS( CGroupEditBoxBase )
|
||||||
|
|
||||||
// True if the editBox can recover the focus on enter. if not, it does not erase OldCapturedKeyboard when loose focus
|
CGroupEditBoxBase( const TCtorParam ¶m );
|
||||||
bool getRecoverFocusOnEnter() const{ return _RecoverFocusOnEnter; }
|
~CGroupEditBoxBase();
|
||||||
void setRecoverFocusOnEnter( bool state ){ _RecoverFocusOnEnter = state; }
|
|
||||||
|
|
||||||
std::string getAHOnFocus(){ return _AHOnFocus; }
|
// True if the editBox can recover the focus on enter. if not, it does not erase OldCapturedKeyboard when loose focus
|
||||||
std::string getAHOnFocusParams(){ return _AHOnFocusParams; }
|
bool getRecoverFocusOnEnter() const{ return _RecoverFocusOnEnter; }
|
||||||
|
void setRecoverFocusOnEnter( bool state ){ _RecoverFocusOnEnter = state; }
|
||||||
|
|
||||||
// disable any current selection
|
std::string getAHOnFocus(){ return _AHOnFocus; }
|
||||||
static void disableSelection(){ _CurrSelection = NULL; }
|
std::string getAHOnFocusParams(){ return _AHOnFocusParams; }
|
||||||
|
|
||||||
// Get / set current selection
|
// disable any current selection
|
||||||
static CGroupEditBoxBase *getCurrSelection(){ return _CurrSelection; }
|
static void disableSelection(){ _CurrSelection = NULL; }
|
||||||
static void setCurrSelection( CGroupEditBoxBase *selection ){ _CurrSelection = selection; }
|
|
||||||
|
|
||||||
void draw(){}
|
// Get / set current selection
|
||||||
|
static CGroupEditBoxBase *getCurrSelection(){ return _CurrSelection; }
|
||||||
|
static void setCurrSelection( CGroupEditBoxBase *selection ){ _CurrSelection = selection; }
|
||||||
|
|
||||||
REFLECT_EXPORT_START( CGroupEditBoxBase, CInterfaceGroup )
|
void draw(){}
|
||||||
REFLECT_BOOL( "enter_recover_focus", getRecoverFocusOnEnter, setRecoverFocusOnEnter );
|
|
||||||
REFLECT_EXPORT_END
|
|
||||||
|
|
||||||
protected:
|
REFLECT_EXPORT_START( CGroupEditBoxBase, CInterfaceGroup )
|
||||||
bool _RecoverFocusOnEnter : 1;
|
REFLECT_BOOL( "enter_recover_focus", getRecoverFocusOnEnter, setRecoverFocusOnEnter );
|
||||||
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
std::string _AHOnFocus;
|
protected:
|
||||||
std::string _AHOnFocusParams;
|
bool _RecoverFocusOnEnter : 1;
|
||||||
|
|
||||||
static CGroupEditBoxBase *_CurrSelection; // the edit box for which the selection is currently active, or NULL if there's none
|
std::string _AHOnFocus;
|
||||||
|
std::string _AHOnFocusParams;
|
||||||
|
|
||||||
private:
|
static CGroupEditBoxBase *_CurrSelection; // the edit box for which the selection is currently active, or NULL if there's none
|
||||||
|
|
||||||
};
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,83 +23,88 @@
|
||||||
#include "nel/gui/interface_group.h"
|
#include "nel/gui/interface_group.h"
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
namespace NLGUI
|
||||||
/** A Group with a background and a frame displayed
|
|
||||||
* \author Lionel Berenguier
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CGroupFrame : public CInterfaceGroup
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
/// Constructor
|
// ***************************************************************************
|
||||||
CGroupFrame(const TCtorParam ¶m);
|
/** A Group with a background and a frame displayed
|
||||||
|
* \author Lionel Berenguier
|
||||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
* \author Nevrax France
|
||||||
virtual void draw ();
|
* \date 2002
|
||||||
|
*/
|
||||||
void copyOptionFrom(const CGroupFrame &other);
|
class CGroupFrame : public CInterfaceGroup
|
||||||
|
|
||||||
|
|
||||||
void setColorAsString(const std::string & col);
|
|
||||||
std::string getColorAsString() const;
|
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CGroupFrame, CInterfaceGroup)
|
|
||||||
REFLECT_STRING ("color", getColorAsString, setColorAsString);
|
|
||||||
REFLECT_EXPORT_END
|
|
||||||
|
|
||||||
|
|
||||||
static void resetDisplayTypes() { _DispTypes.clear(); }
|
|
||||||
|
|
||||||
// ******************
|
|
||||||
protected:
|
|
||||||
|
|
||||||
bool _DisplayFrame;
|
|
||||||
|
|
||||||
NLMISC::CRGBA _Color;
|
|
||||||
|
|
||||||
uint8 _DispType;
|
|
||||||
|
|
||||||
// Fields Defined in the XML => must not herit them from extends=""
|
|
||||||
bool _DisplayFrameDefined : 1;
|
|
||||||
bool _ColorDefined : 1;
|
|
||||||
bool _DispTypeDefined : 1;
|
|
||||||
|
|
||||||
// Static stuff
|
|
||||||
enum
|
|
||||||
{
|
{
|
||||||
TextTL= 0,
|
public:
|
||||||
TextTM,
|
|
||||||
TextTR,
|
|
||||||
TextML,
|
|
||||||
TextMM,
|
|
||||||
TextMR,
|
|
||||||
TextBL,
|
|
||||||
TextBM,
|
|
||||||
TextBR
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SDisplayType
|
/// Constructor
|
||||||
{
|
CGroupFrame(const TCtorParam ¶m);
|
||||||
std::string Name;
|
|
||||||
sint32 BorderIds[9];
|
|
||||||
uint8 TileBorder[9]; // Dont works for TextTL, TextTR, TextBL, TextBR
|
|
||||||
sint32 LeftBorder; // enum
|
|
||||||
sint32 RightBorder;
|
|
||||||
sint32 TopBorder;
|
|
||||||
sint32 BottomBorder;
|
|
||||||
|
|
||||||
// -----------------------
|
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||||
SDisplayType()
|
virtual void draw ();
|
||||||
|
|
||||||
|
void copyOptionFrom(const CGroupFrame &other);
|
||||||
|
|
||||||
|
|
||||||
|
void setColorAsString(const std::string & col);
|
||||||
|
std::string getColorAsString() const;
|
||||||
|
|
||||||
|
REFLECT_EXPORT_START(CGroupFrame, CInterfaceGroup)
|
||||||
|
REFLECT_STRING ("color", getColorAsString, setColorAsString);
|
||||||
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
|
|
||||||
|
static void resetDisplayTypes() { _DispTypes.clear(); }
|
||||||
|
|
||||||
|
// ******************
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool _DisplayFrame;
|
||||||
|
|
||||||
|
NLMISC::CRGBA _Color;
|
||||||
|
|
||||||
|
uint8 _DispType;
|
||||||
|
|
||||||
|
// Fields Defined in the XML => must not herit them from extends=""
|
||||||
|
bool _DisplayFrameDefined : 1;
|
||||||
|
bool _ColorDefined : 1;
|
||||||
|
bool _DispTypeDefined : 1;
|
||||||
|
|
||||||
|
// Static stuff
|
||||||
|
enum
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < 9; ++i)
|
TextTL= 0,
|
||||||
TileBorder[i] = 0;
|
TextTM,
|
||||||
}
|
TextTR,
|
||||||
};
|
TextML,
|
||||||
static std::vector<SDisplayType> _DispTypes;
|
TextMM,
|
||||||
};
|
TextMR,
|
||||||
|
TextBL,
|
||||||
|
TextBM,
|
||||||
|
TextBR
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SDisplayType
|
||||||
|
{
|
||||||
|
std::string Name;
|
||||||
|
sint32 BorderIds[9];
|
||||||
|
uint8 TileBorder[9]; // Dont works for TextTL, TextTR, TextBL, TextBR
|
||||||
|
sint32 LeftBorder; // enum
|
||||||
|
sint32 RightBorder;
|
||||||
|
sint32 TopBorder;
|
||||||
|
sint32 BottomBorder;
|
||||||
|
|
||||||
|
// -----------------------
|
||||||
|
SDisplayType()
|
||||||
|
{
|
||||||
|
for (uint i = 0; i < 9; ++i)
|
||||||
|
TileBorder[i] = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static std::vector<SDisplayType> _DispTypes;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NL_GROUP_FRAME_H
|
#endif // NL_GROUP_FRAME_H
|
||||||
|
|
||||||
|
|
|
@ -22,48 +22,51 @@
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
#include "nel/gui/group_frame.h"
|
#include "nel/gui/group_frame.h"
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
// ***************************************************************************
|
|
||||||
/**
|
|
||||||
* A group with special modal options
|
|
||||||
* \author Lionel Berenguier
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CGroupModal : public CGroupFrame
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
bool SpawnOnMousePos : 1;
|
|
||||||
bool ExitClickOut : 1;
|
|
||||||
bool ExitClickL : 1;
|
|
||||||
bool ExitClickR : 1;
|
|
||||||
bool ForceInsideScreen : 1;
|
|
||||||
bool ExitKeyPushed : 1;
|
|
||||||
sint32 SpawnMouseX, SpawnMouseY;
|
|
||||||
std::string Category;
|
|
||||||
|
|
||||||
std::string OnClickOut; // Launched when clicking out of the window, and BEFORE a new control has been cpatured
|
// ***************************************************************************
|
||||||
std::string OnClickOutParams;
|
/**
|
||||||
std::string OnPostClickOut; // Launched when clicking out of the window, and AFTER a new control has been captured
|
* A group with special modal options
|
||||||
std::string OnPostClickOutParams;
|
* \author Lionel Berenguier
|
||||||
public:
|
* \author Nevrax France
|
||||||
|
* \date 2002
|
||||||
|
*/
|
||||||
|
class CGroupModal : public CGroupFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool SpawnOnMousePos : 1;
|
||||||
|
bool ExitClickOut : 1;
|
||||||
|
bool ExitClickL : 1;
|
||||||
|
bool ExitClickR : 1;
|
||||||
|
bool ForceInsideScreen : 1;
|
||||||
|
bool ExitKeyPushed : 1;
|
||||||
|
sint32 SpawnMouseX, SpawnMouseY;
|
||||||
|
std::string Category;
|
||||||
|
|
||||||
/// Constructor
|
std::string OnClickOut; // Launched when clicking out of the window, and BEFORE a new control has been cpatured
|
||||||
CGroupModal(const TCtorParam ¶m);
|
std::string OnClickOutParams;
|
||||||
|
std::string OnPostClickOut; // Launched when clicking out of the window, and AFTER a new control has been captured
|
||||||
|
std::string OnPostClickOutParams;
|
||||||
|
public:
|
||||||
|
|
||||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
/// Constructor
|
||||||
virtual void updateCoords ();
|
CGroupModal(const TCtorParam ¶m);
|
||||||
void setBaseX(sint32 x) { _MouseDeltaX = x;}
|
|
||||||
void setBaseY(sint32 y) { _MouseDeltaY = y;}
|
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CGroupModal, CGroupFrame)
|
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||||
REFLECT_EXPORT_END
|
virtual void updateCoords ();
|
||||||
|
void setBaseX(sint32 x) { _MouseDeltaX = x;}
|
||||||
|
void setBaseY(sint32 y) { _MouseDeltaY = y;}
|
||||||
|
|
||||||
// ******************
|
REFLECT_EXPORT_START(CGroupModal, CGroupFrame)
|
||||||
protected:
|
REFLECT_EXPORT_END
|
||||||
sint32 _MouseDeltaX, _MouseDeltaY;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// ******************
|
||||||
|
protected:
|
||||||
|
sint32 _MouseDeltaX, _MouseDeltaY;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NL_GROUP_MODAL_H
|
#endif // NL_GROUP_MODAL_H
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -22,382 +22,386 @@
|
||||||
#include "nel/gui/ctrl_base.h"
|
#include "nel/gui/ctrl_base.h"
|
||||||
#include "nel/gui/action_handler.h"
|
#include "nel/gui/action_handler.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
namespace NLGUI
|
||||||
class CInterfaceGroup : public CCtrlBase
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DECLARE_UI_CLASS(CInterfaceGroup)
|
|
||||||
|
|
||||||
/// Constructor
|
class CInterfaceGroup : public CCtrlBase
|
||||||
CInterfaceGroup(const TCtorParam ¶m);
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS(CInterfaceGroup)
|
||||||
|
|
||||||
/// Destructor
|
/// Constructor
|
||||||
virtual ~CInterfaceGroup();
|
CInterfaceGroup(const TCtorParam ¶m);
|
||||||
|
|
||||||
virtual void setIdRecurse(const std::string &id);
|
/// Destructor
|
||||||
|
virtual ~CInterfaceGroup();
|
||||||
|
|
||||||
/// Coming from CInterfaceElement
|
virtual void setIdRecurse(const std::string &id);
|
||||||
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
|
||||||
|
|
||||||
virtual uint32 getMemory ();
|
/// Coming from CInterfaceElement
|
||||||
|
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
||||||
virtual CInterfaceElement* getElement (const std::string &id);
|
|
||||||
CInterfaceElement* findFromShortId(const std::string &id);
|
|
||||||
|
|
||||||
/// Dynamic creation
|
virtual uint32 getMemory ();
|
||||||
virtual void addView (CViewBase *child , sint eltOrder = -1);
|
|
||||||
virtual void addCtrl (CCtrlBase *child, sint eltOrder = -1);
|
|
||||||
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
|
|
||||||
|
|
||||||
CViewBase* getView (const std::string &id);
|
|
||||||
CCtrlBase* getCtrl (const std::string &id);
|
|
||||||
CInterfaceGroup* getGroup(const std::string &id) const;
|
|
||||||
|
|
||||||
// Delete know type by ptr (return true if found and removed)
|
|
||||||
virtual bool delView (CViewBase *child, bool dontDelete = false);
|
|
||||||
virtual bool delCtrl (CCtrlBase *child, bool dontDelete = false);
|
|
||||||
virtual bool delGroup (CInterfaceGroup * child, bool dontDelete = false);
|
|
||||||
|
|
||||||
// Delete know type by name (return true if found and removed)
|
|
||||||
virtual bool delView (const std::string &id, bool dontDelete = false);
|
|
||||||
virtual bool delCtrl (const std::string &id, bool dontDelete = false);
|
|
||||||
virtual bool delGroup (const std::string &id, bool dontDelete = false);
|
|
||||||
|
|
||||||
// Delete unknow type by name or ptr. NB: additionaly, if it's a group, unmakeWindow() is called as necessary
|
|
||||||
bool delElement (const std::string &id, bool noWarning=false);
|
|
||||||
bool delElement (CInterfaceElement *pIE, bool noWarning=false);
|
|
||||||
|
|
||||||
uint getNumGroup() const { return (uint)_ChildrenGroups.size(); }
|
virtual CInterfaceElement* getElement (const std::string &id);
|
||||||
CInterfaceGroup *getGroup(uint index) const;
|
CInterfaceElement* findFromShortId(const std::string &id);
|
||||||
|
|
||||||
sint32 getMaxUsedW() const;
|
|
||||||
sint32 getMinUsedW() const;
|
|
||||||
|
|
||||||
/// Coming from CCtrlBase
|
|
||||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
|
||||||
|
|
||||||
void executeControl (const std::string &sControlName);
|
|
||||||
|
|
||||||
const std::vector<CInterfaceGroup*> & getGroups () { return _ChildrenGroups; }
|
|
||||||
const std::vector<CCtrlBase*> & getControls() { return _Controls; }
|
|
||||||
const std::vector<CViewBase*> & getViews() { return _Views; }
|
|
||||||
|
|
||||||
// test is a group is a direct child of this interface group
|
|
||||||
bool isChildGroup(const CInterfaceGroup *group) const;
|
|
||||||
|
|
||||||
virtual bool isWindowUnder (sint32 x, sint32 y); // Virtual for menu that is not square
|
|
||||||
CInterfaceGroup *getGroupUnder (sint32 x, sint32 y);
|
|
||||||
virtual bool getViewsUnder (sint32 x, sint32 y, sint32 clipX, sint32 clipY, sint32 clipW, sint32 clipH, std::vector<CViewBase*> &vVB); // Return true if x,y under the group
|
|
||||||
virtual bool getCtrlsUnder (sint32 x, sint32 y, sint32 clipX, sint32 clipY, sint32 clipW, sint32 clipH, std::vector<CCtrlBase*> &vICL);
|
|
||||||
virtual bool getGroupsUnder (sint32 x, sint32 y, sint32 clipX, sint32 clipY, sint32 clipW, sint32 clipH, std::vector<CInterfaceGroup *> &vIGL);
|
|
||||||
|
|
||||||
void absoluteToRelative (sint32 &x, sint32 &y);
|
|
||||||
|
|
||||||
/// Coming from CViewBase
|
|
||||||
virtual void draw ();
|
|
||||||
// Draw with no clip (if clip is done by parent)
|
|
||||||
virtual void drawNoClip();
|
|
||||||
|
|
||||||
/// Tool function to draw a single Element that should exist in the group (clipped by the group)
|
|
||||||
void drawElement (CViewBase *el);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* update the elements coords
|
|
||||||
*/
|
|
||||||
virtual void checkCoords();
|
|
||||||
virtual void updateCoords();
|
|
||||||
|
|
||||||
/// remove all views
|
|
||||||
virtual void clearViews();
|
|
||||||
|
|
||||||
/// remove all controls
|
|
||||||
virtual void clearControls();
|
|
||||||
|
|
||||||
/// remove all groups
|
|
||||||
virtual void clearGroups();
|
|
||||||
|
|
||||||
void setParentSizeMax(CInterfaceElement *pIE) { _ParentSizeMax = pIE; }
|
|
||||||
void setMaxW (sint32 maxw) { _MaxW = maxw; }
|
|
||||||
void setMaxH (sint32 maxh) { _MaxH = maxh; }
|
|
||||||
void setOfsX (sint32 x) { _OffsetX = x; }
|
|
||||||
void setOfsY (sint32 y) { _OffsetY = y; }
|
|
||||||
bool moveSBTrackY (CInterfaceGroup *target, sint32 dy);
|
|
||||||
bool moveSBTargetY (CInterfaceGroup *target, sint32 dy);
|
|
||||||
void setResizeFromChildW(bool resize) { _ResizeFromChildW = resize; }
|
|
||||||
void setResizeFromChildH(bool resize) { _ResizeFromChildH = resize; }
|
|
||||||
|
|
||||||
// Valid only for windows InterfaceGroup.
|
|
||||||
// escapable
|
|
||||||
void setEscapable(bool b) { _Escapable= b; }
|
|
||||||
bool getEscapable() const { return _Escapable; }
|
|
||||||
void setAHOnEscape(const std::string &ah) { _AHOnEscape = CAHManager::getInstance()->getAH(ah, _AHOnEscapeParams); }
|
|
||||||
const std::string &getAHOnEscape() const { return CAHManager::getInstance()->getAHName(_AHOnEscape); }
|
|
||||||
void setAHOnEscapeParams(const std::string &ah) { _AHOnEscapeParams = ah; }
|
|
||||||
const std::string &getAHOnEscapeParams() const { return _AHOnEscapeParams; }
|
|
||||||
// enterable
|
|
||||||
void setAHOnEnter(const std::string &ah) { _AHOnEnter = CAHManager::getInstance()->getAH(ah, _AHOnEnterParams); }
|
|
||||||
const std::string &getAHOnEnter() const { return CAHManager::getInstance()->getAHName(_AHOnEnter); }
|
|
||||||
void setAHOnEnterParams(const std::string &ah) { _AHOnEnterParams = ah; }
|
|
||||||
const std::string &getAHOnEnterParams() const { return _AHOnEnterParams; }
|
|
||||||
uint8 getPriority() const { return _Priority; }
|
|
||||||
void setPriority(uint8 nprio);
|
|
||||||
|
|
||||||
|
|
||||||
sint32 getMaxW () const { return _MaxW; }
|
|
||||||
sint32 getMaxH () const { return _MaxH; }
|
|
||||||
sint32 getMaxWReal () const { return _Active ? _MaxWReal : 0; }
|
|
||||||
sint32 getMaxHReal () const { return _Active ? _MaxHReal : 0; }
|
|
||||||
sint32 getOfsX () const { return _OffsetX; }
|
|
||||||
sint32 getOfsY () const { return _OffsetY; }
|
|
||||||
bool getResizeFromChildW() const { return _ResizeFromChildW; }
|
|
||||||
bool getResizeFromChildH() const { return _ResizeFromChildH; }
|
|
||||||
sint32 getResizeFromChildWMargin() const { return _ResizeFromChildWMargin; }
|
|
||||||
sint32 getResizeFromChildHMargin() const { return _ResizeFromChildHMargin; }
|
|
||||||
void setResizeFromChildWMargin(sint32 margin) { _ResizeFromChildWMargin = margin; }
|
|
||||||
void setResizeFromChildHMargin(sint32 margin) { _ResizeFromChildHMargin = margin; }
|
|
||||||
bool getOverlappable() const { return _Overlappable; }
|
|
||||||
|
|
||||||
virtual void setActive (bool state);
|
|
||||||
|
|
||||||
// eval dimension of children bbox
|
|
||||||
void evalChildrenBBox(bool resizeFromChildW, bool resizeFromChildH, sint &width, sint &height) const;
|
|
||||||
|
|
||||||
virtual void launch ();
|
|
||||||
|
|
||||||
|
|
||||||
// right & left clicks handler
|
|
||||||
void setLeftClickHandler(const std::string &handler);
|
|
||||||
void setRightClickHandler(const std::string &handler);
|
|
||||||
void setLeftClickHandlerParams(const std::string ¶ms) { _AHOnLeftClickParams = params; }
|
|
||||||
void setRightClickHandlerParams(const std::string ¶ms) { _AHOnRightClickParams = params; }
|
|
||||||
void setOnActiveHandler(const std::string &h) { _AHOnActive = CAHManager::getInstance()->getAH(h,_AHOnActiveParams); }
|
|
||||||
void setOnActiveParams(const std::string &p) { _AHOnActiveParams = p; }
|
|
||||||
void setOnDeactiveHandler(const std::string &h) { _AHOnDeactive = CAHManager::getInstance()->getAH(h,_AHOnDeactiveParams); }
|
|
||||||
void setOnDeactiveParams(const std::string &p) { _AHOnDeactiveParams = p; }
|
|
||||||
|
|
||||||
const std::string &getLeftClickHandler() const { return CAHManager::getInstance()->getAHName(_AHOnLeftClick); }
|
|
||||||
const std::string &getLeftClickHandlerParams() const { return _AHOnLeftClickParams; }
|
|
||||||
const std::string &getRightClickHandler() const { return CAHManager::getInstance()->getAHName(_AHOnRightClick); }
|
|
||||||
const std::string &getRightClickHandlerParams() const { return _AHOnRightClickParams; }
|
|
||||||
const std::string &getOnActiveHandler() const { return CAHManager::getInstance()->getAHName(_AHOnActive); }
|
|
||||||
const std::string &getOnActiveParams() const { return _AHOnActiveParams; }
|
|
||||||
const std::string &getOnDeactiveHandler() const { return CAHManager::getInstance()->getAHName(_AHOnDeactive); }
|
|
||||||
const std::string &getOnDeactiveParams() const { return _AHOnDeactiveParams; }
|
|
||||||
|
|
||||||
// find a sub view/ctrl/group in this group from its id
|
|
||||||
int luaFind(CLuaState &ls);
|
|
||||||
int luaGetEnclosingContainer(CLuaState &ls);
|
|
||||||
int luaDeleteLUAEnvTable(CLuaState &ls);
|
|
||||||
int luaAddGroup(CLuaState &ls);
|
|
||||||
int luaDelGroup(CLuaState &ls);
|
|
||||||
int luaGetNumGroups(CLuaState &ls);
|
|
||||||
int luaGetGroup(CLuaState &ls);
|
|
||||||
|
|
||||||
void setMaxSizeRef(const std::string &maxSizeRef);
|
|
||||||
std::string getMaxSizeRefAsString() const;
|
|
||||||
|
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CInterfaceGroup, CCtrlBase)
|
|
||||||
REFLECT_LUA_METHOD("find", luaFind);
|
|
||||||
REFLECT_LUA_METHOD("deleteLUAEnvTable", luaDeleteLUAEnvTable);
|
|
||||||
REFLECT_LUA_METHOD("getEnclosingContainer", luaGetEnclosingContainer);
|
|
||||||
REFLECT_LUA_METHOD("addGroup", luaAddGroup);
|
|
||||||
REFLECT_LUA_METHOD("delGroup", luaDelGroup);
|
|
||||||
REFLECT_LUA_METHOD("getNumGroups", luaGetNumGroups);
|
|
||||||
REFLECT_LUA_METHOD("getGroup", luaGetGroup);
|
|
||||||
REFLECT_STRING ("left_click", getLeftClickHandler, setLeftClickHandler);
|
|
||||||
REFLECT_STRING ("right_click", getRightClickHandler, setRightClickHandler);
|
|
||||||
REFLECT_STRING ("left_click_params", getLeftClickHandlerParams, setLeftClickHandlerParams);
|
|
||||||
REFLECT_STRING ("right_click_params", getRightClickHandlerParams, setRightClickHandlerParams);
|
|
||||||
REFLECT_STRING ("on_active", getOnActiveHandler, setOnActiveHandler);
|
|
||||||
REFLECT_STRING ("on_active_params", getOnActiveParams, setOnActiveParams);
|
|
||||||
REFLECT_STRING ("on_deactive", getOnDeactiveHandler, setOnDeactiveHandler);
|
|
||||||
REFLECT_STRING ("on_deactive_params", getOnDeactiveParams, setOnDeactiveParams);
|
|
||||||
REFLECT_STRING ("on_enter", getAHOnEnter, setAHOnEnter);
|
|
||||||
REFLECT_STRING ("on_enter_params", getAHOnEnterParams, setAHOnEnterParams);
|
|
||||||
REFLECT_STRING ("on_escape", getAHOnEscape, setAHOnEscape);
|
|
||||||
REFLECT_STRING ("on_escape_params", getAHOnEscapeParams, setAHOnEscapeParams);
|
|
||||||
REFLECT_SINT32 ("ofsx", getOfsX, setOfsX);
|
|
||||||
REFLECT_SINT32 ("ofsy", getOfsY, setOfsY);
|
|
||||||
REFLECT_BOOL("child_resize_w", getResizeFromChildW, setResizeFromChildW);
|
|
||||||
REFLECT_SINT32("child_resize_wmargin", getResizeFromChildWMargin, setResizeFromChildWMargin);
|
|
||||||
REFLECT_BOOL("child_resize_h", getResizeFromChildH, setResizeFromChildH);
|
|
||||||
REFLECT_SINT32("child_resize_hmargin", getResizeFromChildHMargin, setResizeFromChildHMargin);
|
|
||||||
REFLECT_SINT32 ("ofsy", getOfsY, setOfsY);
|
|
||||||
REFLECT_STRING("max_sizeref", getMaxSizeRefAsString, setMaxSizeRef);
|
|
||||||
REFLECT_SINT32 ("max_w", getMaxW, setMaxW);
|
|
||||||
REFLECT_SINT32 ("max_h", getMaxH, setMaxH);
|
|
||||||
REFLECT_SINT32 ("max_w_real", getMaxWReal, dummySet);
|
|
||||||
REFLECT_SINT32 ("max_h_real", getMaxHReal, dummySet);
|
|
||||||
REFLECT_EXPORT_END
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// From CCtrlBase
|
|
||||||
virtual void updateAllLinks();
|
|
||||||
|
|
||||||
/// return true for some containers. false by default
|
|
||||||
virtual bool isMovable() const {return false;}
|
|
||||||
|
|
||||||
virtual sint32 getAlpha() const;
|
|
||||||
virtual void setAlpha (sint32 a);
|
|
||||||
|
|
||||||
/// Eval current clip coords. This is not incremental as with makeNewClip, and thus more slow. This also doesn't change the current clip window.
|
|
||||||
void getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const;
|
|
||||||
|
|
||||||
// quick way to know if the group is a CGroupContainer
|
|
||||||
bool isGroupContainer() const { return _IsGroupContainer; }
|
|
||||||
bool isGroupScrollText() const{ return _IsGroupScrollText; }
|
|
||||||
bool isGroupInScene() const{ return _IsGroupInScene; }
|
|
||||||
|
|
||||||
CInterfaceGroup* getEnclosingContainer();
|
|
||||||
|
|
||||||
sint getInsertionOrder(CViewBase *vb) const;
|
|
||||||
|
|
||||||
// for debug only
|
|
||||||
void dumpGroups();
|
|
||||||
void dumpEltsOrder();
|
|
||||||
|
|
||||||
virtual void renderWiredQuads(CInterfaceElement::TRenderWired type, const std::string &uiFilter);
|
|
||||||
|
|
||||||
virtual bool isGroup() const { return true; }
|
|
||||||
|
|
||||||
// clear all edit box in the ui
|
|
||||||
virtual void clearAllEditBox();
|
|
||||||
// restore all backuped positions for containers
|
|
||||||
virtual void restoreAllContainersBackupPosition();
|
|
||||||
|
|
||||||
virtual void dumpSize(uint depth = 0) const;
|
|
||||||
|
|
||||||
// From CInterfaceElement
|
|
||||||
virtual void visit(CInterfaceElementVisitor *visitor);
|
|
||||||
|
|
||||||
/// Visits only this group's sub-groups and then the group itself
|
|
||||||
virtual void visitGroupAndChildren( CInterfaceElementVisitor *visitor );
|
|
||||||
|
|
||||||
// Check cursor
|
|
||||||
void setUseCursor(bool use);
|
|
||||||
bool getUseCursor() const { return _UseCursor; }
|
|
||||||
|
|
||||||
|
|
||||||
// From CInterfaceElement
|
|
||||||
virtual void onFrameUpdateWindowPos(sint dx, sint dy);
|
|
||||||
// true for CGroupInScene for instance
|
|
||||||
bool isNeedFrameUpdatePos() const {return _NeedFrameUpdatePos;}
|
|
||||||
|
|
||||||
|
|
||||||
/// \name LUA specific
|
|
||||||
// @{
|
|
||||||
// Create a LUA Environement if don't exist, then push it on the LUA stack
|
|
||||||
void pushLUAEnvTable();
|
|
||||||
// Free the LUA Env Table
|
|
||||||
void deleteLUAEnvTable(bool recurse = false);
|
|
||||||
// Set the LUA script to execute at checkCoords time (empty to reset)
|
|
||||||
void setLuaScriptOnDraw(const std::string &script);
|
|
||||||
//
|
|
||||||
void executeLuaScriptOnDraw();
|
|
||||||
// Set the LUA script to execute when a list of DB change (of forms: "@DB1,@DB2" ....). The dbList is the key
|
|
||||||
void addLuaScriptOnDBChange(const std::string &dbList, const std::string &script);
|
|
||||||
// Remove the LUA script to execute when a list of DB change
|
|
||||||
void removeLuaScriptOnDBChange(const std::string &dbList);
|
|
||||||
// @}
|
|
||||||
|
|
||||||
virtual CInterfaceElement *clone();
|
|
||||||
virtual void serial(NLMISC::IStream &f);
|
|
||||||
|
|
||||||
// Return the current Depth, with no ZBias applied.
|
|
||||||
float getDepthForZSort() const { return _DepthForZSort; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void makeNewClip (sint32 &oldClipX, sint32 &oldClipY, sint32 &oldClipW, sint32 &oldClipH);
|
|
||||||
void restoreClip (sint32 oldSciX, sint32 oldSciY, sint32 oldSciW, sint32 oldSciH);
|
|
||||||
|
|
||||||
// Compute clip contribution for current window, and a previous clipping rectangle. This doesn't change the clip window in the driver.
|
|
||||||
void computeCurrentClipContribution(sint32 prevX, sint32 prevY, sint32 prevW, sint32 prevH,
|
|
||||||
sint32 &newX, sint32 &newY, sint32 &newW, sint32 &newH) const;
|
|
||||||
|
|
||||||
void delEltOrder (CViewBase *pElt);
|
|
||||||
|
|
||||||
// update coords one time
|
|
||||||
void doUpdateCoords();
|
|
||||||
|
|
||||||
// notify children controls & groups that 'active' has been called on one of their parent
|
|
||||||
void notifyActiveCalled(const NLGUI::CEventDescriptorActiveCalledOnParent &desc);
|
|
||||||
|
|
||||||
protected:
|
/// Dynamic creation
|
||||||
|
virtual void addView (CViewBase *child , sint eltOrder = -1);
|
||||||
|
virtual void addCtrl (CCtrlBase *child, sint eltOrder = -1);
|
||||||
|
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
|
||||||
|
|
||||||
/// children interface elements
|
CViewBase* getView (const std::string &id);
|
||||||
std::vector<CInterfaceGroup*> _ChildrenGroups;
|
CCtrlBase* getCtrl (const std::string &id);
|
||||||
std::vector<CCtrlBase*> _Controls;
|
CInterfaceGroup* getGroup(const std::string &id) const;
|
||||||
std::vector<CViewBase*> _Views;
|
|
||||||
|
// Delete know type by ptr (return true if found and removed)
|
||||||
|
virtual bool delView (CViewBase *child, bool dontDelete = false);
|
||||||
|
virtual bool delCtrl (CCtrlBase *child, bool dontDelete = false);
|
||||||
|
virtual bool delGroup (CInterfaceGroup * child, bool dontDelete = false);
|
||||||
|
|
||||||
|
// Delete know type by name (return true if found and removed)
|
||||||
|
virtual bool delView (const std::string &id, bool dontDelete = false);
|
||||||
|
virtual bool delCtrl (const std::string &id, bool dontDelete = false);
|
||||||
|
virtual bool delGroup (const std::string &id, bool dontDelete = false);
|
||||||
|
|
||||||
|
// Delete unknow type by name or ptr. NB: additionaly, if it's a group, unmakeWindow() is called as necessary
|
||||||
|
bool delElement (const std::string &id, bool noWarning=false);
|
||||||
|
bool delElement (CInterfaceElement *pIE, bool noWarning=false);
|
||||||
|
|
||||||
std::vector<CViewBase*> _EltOrder;
|
uint getNumGroup() const { return (uint)_ChildrenGroups.size(); }
|
||||||
|
CInterfaceGroup *getGroup(uint index) const;
|
||||||
/// Scroll properties
|
|
||||||
NLMISC::CRefPtr<CInterfaceElement> _ParentSizeMax; // RefPtr in case of group destroyed in a parent group with posref on it
|
sint32 getMaxUsedW() const;
|
||||||
sint32 _MaxW, _MaxH;
|
sint32 getMinUsedW() const;
|
||||||
sint32 _MaxWReal, _MaxHReal;
|
|
||||||
sint32 _OffsetX, _OffsetY;
|
/// Coming from CCtrlBase
|
||||||
|
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||||
uint8 _Priority;
|
|
||||||
|
void executeControl (const std::string &sControlName);
|
||||||
// Misc prop
|
|
||||||
bool _Overlappable : 1;
|
const std::vector<CInterfaceGroup*> & getGroups () { return _ChildrenGroups; }
|
||||||
bool _ResizeFromChildW : 1;
|
const std::vector<CCtrlBase*> & getControls() { return _Controls; }
|
||||||
bool _ResizeFromChildH : 1;
|
const std::vector<CViewBase*> & getViews() { return _Views; }
|
||||||
bool _Escapable : 1;
|
|
||||||
bool _UseCursor : 1;
|
// test is a group is a direct child of this interface group
|
||||||
bool _IsGroupContainer : 1; // faster than a virual call
|
bool isChildGroup(const CInterfaceGroup *group) const;
|
||||||
bool _IsGroupScrollText : 1;
|
|
||||||
bool _IsGroupInScene : 1;
|
virtual bool isWindowUnder (sint32 x, sint32 y); // Virtual for menu that is not square
|
||||||
bool _NeedFrameUpdatePos : 1; // typically For CGroupInScene
|
CInterfaceGroup *getGroupUnder (sint32 x, sint32 y);
|
||||||
sint32 _ResizeFromChildWMargin;
|
virtual bool getViewsUnder (sint32 x, sint32 y, sint32 clipX, sint32 clipY, sint32 clipW, sint32 clipH, std::vector<CViewBase*> &vVB); // Return true if x,y under the group
|
||||||
sint32 _ResizeFromChildHMargin;
|
virtual bool getCtrlsUnder (sint32 x, sint32 y, sint32 clipX, sint32 clipY, sint32 clipW, sint32 clipH, std::vector<CCtrlBase*> &vICL);
|
||||||
sint32 _GroupSizeRef;
|
virtual bool getGroupsUnder (sint32 x, sint32 y, sint32 clipX, sint32 clipY, sint32 clipW, sint32 clipH, std::vector<CInterfaceGroup *> &vIGL);
|
||||||
|
|
||||||
// Projected Depth with no ZBias applied
|
void absoluteToRelative (sint32 &x, sint32 &y);
|
||||||
float _DepthForZSort;
|
|
||||||
|
/// Coming from CViewBase
|
||||||
// handler for activation
|
virtual void draw ();
|
||||||
IActionHandler *_AHOnActive;
|
// Draw with no clip (if clip is done by parent)
|
||||||
CStringShared _AHOnActiveParams;
|
virtual void drawNoClip();
|
||||||
IActionHandler *_AHOnDeactive;
|
|
||||||
CStringShared _AHOnDeactiveParams;
|
/// Tool function to draw a single Element that should exist in the group (clipped by the group)
|
||||||
|
void drawElement (CViewBase *el);
|
||||||
// right & left clicks
|
|
||||||
IActionHandler *_AHOnLeftClick;
|
|
||||||
CStringShared _AHOnLeftClickParams;
|
/**
|
||||||
IActionHandler *_AHOnRightClick;
|
* update the elements coords
|
||||||
CStringShared _AHOnRightClickParams;
|
*/
|
||||||
|
virtual void checkCoords();
|
||||||
// enter params.
|
virtual void updateCoords();
|
||||||
IActionHandler *_AHOnEnter;
|
|
||||||
CStringShared _AHOnEnterParams;
|
/// remove all views
|
||||||
|
virtual void clearViews();
|
||||||
// escape AH
|
|
||||||
IActionHandler *_AHOnEscape;
|
/// remove all controls
|
||||||
CStringShared _AHOnEscapeParams;
|
virtual void clearControls();
|
||||||
|
|
||||||
private:
|
/// remove all groups
|
||||||
|
virtual void clearGroups();
|
||||||
void addToEltOrder(CViewBase *view, sint order);
|
|
||||||
|
void setParentSizeMax(CInterfaceElement *pIE) { _ParentSizeMax = pIE; }
|
||||||
/// \name LUA specific
|
void setMaxW (sint32 maxw) { _MaxW = maxw; }
|
||||||
// @{
|
void setMaxH (sint32 maxh) { _MaxH = maxh; }
|
||||||
// Lua Env Table created. Table is in the LUA_REGISTRYINDEX, with key as this CInterfaceGroup* userdata
|
void setOfsX (sint32 x) { _OffsetX = x; }
|
||||||
bool _LUAEnvTableCreated;
|
void setOfsY (sint32 y) { _OffsetY = y; }
|
||||||
// The LUA script to be executed on Draw (checkCoords)
|
bool moveSBTrackY (CInterfaceGroup *target, sint32 dy);
|
||||||
CStringShared _LUAOnDraw;
|
bool moveSBTargetY (CInterfaceGroup *target, sint32 dy);
|
||||||
// The InterfaceLink created specialy for Lua Script to be executed at some DB change
|
void setResizeFromChildW(bool resize) { _ResizeFromChildW = resize; }
|
||||||
typedef std::map<std::string, NLMISC::CSmartPtr<CInterfaceLink> > TLUAOnDbChange;
|
void setResizeFromChildH(bool resize) { _ResizeFromChildH = resize; }
|
||||||
TLUAOnDbChange _LUAOnDbChange;
|
|
||||||
void removeAllLUAOnDbChange();
|
// Valid only for windows InterfaceGroup.
|
||||||
protected:
|
// escapable
|
||||||
void parseMaxSizeRef(const char *ptr);
|
void setEscapable(bool b) { _Escapable= b; }
|
||||||
// @}
|
bool getEscapable() const { return _Escapable; }
|
||||||
};
|
void setAHOnEscape(const std::string &ah) { _AHOnEscape = CAHManager::getInstance()->getAH(ah, _AHOnEscapeParams); }
|
||||||
|
const std::string &getAHOnEscape() const { return CAHManager::getInstance()->getAHName(_AHOnEscape); }
|
||||||
|
void setAHOnEscapeParams(const std::string &ah) { _AHOnEscapeParams = ah; }
|
||||||
|
const std::string &getAHOnEscapeParams() const { return _AHOnEscapeParams; }
|
||||||
|
// enterable
|
||||||
|
void setAHOnEnter(const std::string &ah) { _AHOnEnter = CAHManager::getInstance()->getAH(ah, _AHOnEnterParams); }
|
||||||
|
const std::string &getAHOnEnter() const { return CAHManager::getInstance()->getAHName(_AHOnEnter); }
|
||||||
|
void setAHOnEnterParams(const std::string &ah) { _AHOnEnterParams = ah; }
|
||||||
|
const std::string &getAHOnEnterParams() const { return _AHOnEnterParams; }
|
||||||
|
uint8 getPriority() const { return _Priority; }
|
||||||
|
void setPriority(uint8 nprio);
|
||||||
|
|
||||||
|
|
||||||
|
sint32 getMaxW () const { return _MaxW; }
|
||||||
|
sint32 getMaxH () const { return _MaxH; }
|
||||||
|
sint32 getMaxWReal () const { return _Active ? _MaxWReal : 0; }
|
||||||
|
sint32 getMaxHReal () const { return _Active ? _MaxHReal : 0; }
|
||||||
|
sint32 getOfsX () const { return _OffsetX; }
|
||||||
|
sint32 getOfsY () const { return _OffsetY; }
|
||||||
|
bool getResizeFromChildW() const { return _ResizeFromChildW; }
|
||||||
|
bool getResizeFromChildH() const { return _ResizeFromChildH; }
|
||||||
|
sint32 getResizeFromChildWMargin() const { return _ResizeFromChildWMargin; }
|
||||||
|
sint32 getResizeFromChildHMargin() const { return _ResizeFromChildHMargin; }
|
||||||
|
void setResizeFromChildWMargin(sint32 margin) { _ResizeFromChildWMargin = margin; }
|
||||||
|
void setResizeFromChildHMargin(sint32 margin) { _ResizeFromChildHMargin = margin; }
|
||||||
|
bool getOverlappable() const { return _Overlappable; }
|
||||||
|
|
||||||
|
virtual void setActive (bool state);
|
||||||
|
|
||||||
|
// eval dimension of children bbox
|
||||||
|
void evalChildrenBBox(bool resizeFromChildW, bool resizeFromChildH, sint &width, sint &height) const;
|
||||||
|
|
||||||
|
virtual void launch ();
|
||||||
|
|
||||||
|
|
||||||
|
// right & left clicks handler
|
||||||
|
void setLeftClickHandler(const std::string &handler);
|
||||||
|
void setRightClickHandler(const std::string &handler);
|
||||||
|
void setLeftClickHandlerParams(const std::string ¶ms) { _AHOnLeftClickParams = params; }
|
||||||
|
void setRightClickHandlerParams(const std::string ¶ms) { _AHOnRightClickParams = params; }
|
||||||
|
void setOnActiveHandler(const std::string &h) { _AHOnActive = CAHManager::getInstance()->getAH(h,_AHOnActiveParams); }
|
||||||
|
void setOnActiveParams(const std::string &p) { _AHOnActiveParams = p; }
|
||||||
|
void setOnDeactiveHandler(const std::string &h) { _AHOnDeactive = CAHManager::getInstance()->getAH(h,_AHOnDeactiveParams); }
|
||||||
|
void setOnDeactiveParams(const std::string &p) { _AHOnDeactiveParams = p; }
|
||||||
|
|
||||||
|
const std::string &getLeftClickHandler() const { return CAHManager::getInstance()->getAHName(_AHOnLeftClick); }
|
||||||
|
const std::string &getLeftClickHandlerParams() const { return _AHOnLeftClickParams; }
|
||||||
|
const std::string &getRightClickHandler() const { return CAHManager::getInstance()->getAHName(_AHOnRightClick); }
|
||||||
|
const std::string &getRightClickHandlerParams() const { return _AHOnRightClickParams; }
|
||||||
|
const std::string &getOnActiveHandler() const { return CAHManager::getInstance()->getAHName(_AHOnActive); }
|
||||||
|
const std::string &getOnActiveParams() const { return _AHOnActiveParams; }
|
||||||
|
const std::string &getOnDeactiveHandler() const { return CAHManager::getInstance()->getAHName(_AHOnDeactive); }
|
||||||
|
const std::string &getOnDeactiveParams() const { return _AHOnDeactiveParams; }
|
||||||
|
|
||||||
|
// find a sub view/ctrl/group in this group from its id
|
||||||
|
int luaFind(CLuaState &ls);
|
||||||
|
int luaGetEnclosingContainer(CLuaState &ls);
|
||||||
|
int luaDeleteLUAEnvTable(CLuaState &ls);
|
||||||
|
int luaAddGroup(CLuaState &ls);
|
||||||
|
int luaDelGroup(CLuaState &ls);
|
||||||
|
int luaGetNumGroups(CLuaState &ls);
|
||||||
|
int luaGetGroup(CLuaState &ls);
|
||||||
|
|
||||||
|
void setMaxSizeRef(const std::string &maxSizeRef);
|
||||||
|
std::string getMaxSizeRefAsString() const;
|
||||||
|
|
||||||
|
|
||||||
|
REFLECT_EXPORT_START(CInterfaceGroup, CCtrlBase)
|
||||||
|
REFLECT_LUA_METHOD("find", luaFind);
|
||||||
|
REFLECT_LUA_METHOD("deleteLUAEnvTable", luaDeleteLUAEnvTable);
|
||||||
|
REFLECT_LUA_METHOD("getEnclosingContainer", luaGetEnclosingContainer);
|
||||||
|
REFLECT_LUA_METHOD("addGroup", luaAddGroup);
|
||||||
|
REFLECT_LUA_METHOD("delGroup", luaDelGroup);
|
||||||
|
REFLECT_LUA_METHOD("getNumGroups", luaGetNumGroups);
|
||||||
|
REFLECT_LUA_METHOD("getGroup", luaGetGroup);
|
||||||
|
REFLECT_STRING ("left_click", getLeftClickHandler, setLeftClickHandler);
|
||||||
|
REFLECT_STRING ("right_click", getRightClickHandler, setRightClickHandler);
|
||||||
|
REFLECT_STRING ("left_click_params", getLeftClickHandlerParams, setLeftClickHandlerParams);
|
||||||
|
REFLECT_STRING ("right_click_params", getRightClickHandlerParams, setRightClickHandlerParams);
|
||||||
|
REFLECT_STRING ("on_active", getOnActiveHandler, setOnActiveHandler);
|
||||||
|
REFLECT_STRING ("on_active_params", getOnActiveParams, setOnActiveParams);
|
||||||
|
REFLECT_STRING ("on_deactive", getOnDeactiveHandler, setOnDeactiveHandler);
|
||||||
|
REFLECT_STRING ("on_deactive_params", getOnDeactiveParams, setOnDeactiveParams);
|
||||||
|
REFLECT_STRING ("on_enter", getAHOnEnter, setAHOnEnter);
|
||||||
|
REFLECT_STRING ("on_enter_params", getAHOnEnterParams, setAHOnEnterParams);
|
||||||
|
REFLECT_STRING ("on_escape", getAHOnEscape, setAHOnEscape);
|
||||||
|
REFLECT_STRING ("on_escape_params", getAHOnEscapeParams, setAHOnEscapeParams);
|
||||||
|
REFLECT_SINT32 ("ofsx", getOfsX, setOfsX);
|
||||||
|
REFLECT_SINT32 ("ofsy", getOfsY, setOfsY);
|
||||||
|
REFLECT_BOOL("child_resize_w", getResizeFromChildW, setResizeFromChildW);
|
||||||
|
REFLECT_SINT32("child_resize_wmargin", getResizeFromChildWMargin, setResizeFromChildWMargin);
|
||||||
|
REFLECT_BOOL("child_resize_h", getResizeFromChildH, setResizeFromChildH);
|
||||||
|
REFLECT_SINT32("child_resize_hmargin", getResizeFromChildHMargin, setResizeFromChildHMargin);
|
||||||
|
REFLECT_SINT32 ("ofsy", getOfsY, setOfsY);
|
||||||
|
REFLECT_STRING("max_sizeref", getMaxSizeRefAsString, setMaxSizeRef);
|
||||||
|
REFLECT_SINT32 ("max_w", getMaxW, setMaxW);
|
||||||
|
REFLECT_SINT32 ("max_h", getMaxH, setMaxH);
|
||||||
|
REFLECT_SINT32 ("max_w_real", getMaxWReal, dummySet);
|
||||||
|
REFLECT_SINT32 ("max_h_real", getMaxHReal, dummySet);
|
||||||
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// From CCtrlBase
|
||||||
|
virtual void updateAllLinks();
|
||||||
|
|
||||||
|
/// return true for some containers. false by default
|
||||||
|
virtual bool isMovable() const {return false;}
|
||||||
|
|
||||||
|
virtual sint32 getAlpha() const;
|
||||||
|
virtual void setAlpha (sint32 a);
|
||||||
|
|
||||||
|
/// Eval current clip coords. This is not incremental as with makeNewClip, and thus more slow. This also doesn't change the current clip window.
|
||||||
|
void getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const;
|
||||||
|
|
||||||
|
// quick way to know if the group is a CGroupContainer
|
||||||
|
bool isGroupContainer() const { return _IsGroupContainer; }
|
||||||
|
bool isGroupScrollText() const{ return _IsGroupScrollText; }
|
||||||
|
bool isGroupInScene() const{ return _IsGroupInScene; }
|
||||||
|
|
||||||
|
CInterfaceGroup* getEnclosingContainer();
|
||||||
|
|
||||||
|
sint getInsertionOrder(CViewBase *vb) const;
|
||||||
|
|
||||||
|
// for debug only
|
||||||
|
void dumpGroups();
|
||||||
|
void dumpEltsOrder();
|
||||||
|
|
||||||
|
virtual void renderWiredQuads(CInterfaceElement::TRenderWired type, const std::string &uiFilter);
|
||||||
|
|
||||||
|
virtual bool isGroup() const { return true; }
|
||||||
|
|
||||||
|
// clear all edit box in the ui
|
||||||
|
virtual void clearAllEditBox();
|
||||||
|
// restore all backuped positions for containers
|
||||||
|
virtual void restoreAllContainersBackupPosition();
|
||||||
|
|
||||||
|
virtual void dumpSize(uint depth = 0) const;
|
||||||
|
|
||||||
|
// From CInterfaceElement
|
||||||
|
virtual void visit(CInterfaceElementVisitor *visitor);
|
||||||
|
|
||||||
|
/// Visits only this group's sub-groups and then the group itself
|
||||||
|
virtual void visitGroupAndChildren( CInterfaceElementVisitor *visitor );
|
||||||
|
|
||||||
|
// Check cursor
|
||||||
|
void setUseCursor(bool use);
|
||||||
|
bool getUseCursor() const { return _UseCursor; }
|
||||||
|
|
||||||
|
|
||||||
|
// From CInterfaceElement
|
||||||
|
virtual void onFrameUpdateWindowPos(sint dx, sint dy);
|
||||||
|
// true for CGroupInScene for instance
|
||||||
|
bool isNeedFrameUpdatePos() const {return _NeedFrameUpdatePos;}
|
||||||
|
|
||||||
|
|
||||||
|
/// \name LUA specific
|
||||||
|
// @{
|
||||||
|
// Create a LUA Environement if don't exist, then push it on the LUA stack
|
||||||
|
void pushLUAEnvTable();
|
||||||
|
// Free the LUA Env Table
|
||||||
|
void deleteLUAEnvTable(bool recurse = false);
|
||||||
|
// Set the LUA script to execute at checkCoords time (empty to reset)
|
||||||
|
void setLuaScriptOnDraw(const std::string &script);
|
||||||
|
//
|
||||||
|
void executeLuaScriptOnDraw();
|
||||||
|
// Set the LUA script to execute when a list of DB change (of forms: "@DB1,@DB2" ....). The dbList is the key
|
||||||
|
void addLuaScriptOnDBChange(const std::string &dbList, const std::string &script);
|
||||||
|
// Remove the LUA script to execute when a list of DB change
|
||||||
|
void removeLuaScriptOnDBChange(const std::string &dbList);
|
||||||
|
// @}
|
||||||
|
|
||||||
|
virtual CInterfaceElement *clone();
|
||||||
|
virtual void serial(NLMISC::IStream &f);
|
||||||
|
|
||||||
|
// Return the current Depth, with no ZBias applied.
|
||||||
|
float getDepthForZSort() const { return _DepthForZSort; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void makeNewClip (sint32 &oldClipX, sint32 &oldClipY, sint32 &oldClipW, sint32 &oldClipH);
|
||||||
|
void restoreClip (sint32 oldSciX, sint32 oldSciY, sint32 oldSciW, sint32 oldSciH);
|
||||||
|
|
||||||
|
// Compute clip contribution for current window, and a previous clipping rectangle. This doesn't change the clip window in the driver.
|
||||||
|
void computeCurrentClipContribution(sint32 prevX, sint32 prevY, sint32 prevW, sint32 prevH,
|
||||||
|
sint32 &newX, sint32 &newY, sint32 &newW, sint32 &newH) const;
|
||||||
|
|
||||||
|
void delEltOrder (CViewBase *pElt);
|
||||||
|
|
||||||
|
// update coords one time
|
||||||
|
void doUpdateCoords();
|
||||||
|
|
||||||
|
// notify children controls & groups that 'active' has been called on one of their parent
|
||||||
|
void notifyActiveCalled(const NLGUI::CEventDescriptorActiveCalledOnParent &desc);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/// children interface elements
|
||||||
|
std::vector<CInterfaceGroup*> _ChildrenGroups;
|
||||||
|
std::vector<CCtrlBase*> _Controls;
|
||||||
|
std::vector<CViewBase*> _Views;
|
||||||
|
|
||||||
|
std::vector<CViewBase*> _EltOrder;
|
||||||
|
|
||||||
|
/// Scroll properties
|
||||||
|
NLMISC::CRefPtr<CInterfaceElement> _ParentSizeMax; // RefPtr in case of group destroyed in a parent group with posref on it
|
||||||
|
sint32 _MaxW, _MaxH;
|
||||||
|
sint32 _MaxWReal, _MaxHReal;
|
||||||
|
sint32 _OffsetX, _OffsetY;
|
||||||
|
|
||||||
|
uint8 _Priority;
|
||||||
|
|
||||||
|
// Misc prop
|
||||||
|
bool _Overlappable : 1;
|
||||||
|
bool _ResizeFromChildW : 1;
|
||||||
|
bool _ResizeFromChildH : 1;
|
||||||
|
bool _Escapable : 1;
|
||||||
|
bool _UseCursor : 1;
|
||||||
|
bool _IsGroupContainer : 1; // faster than a virual call
|
||||||
|
bool _IsGroupScrollText : 1;
|
||||||
|
bool _IsGroupInScene : 1;
|
||||||
|
bool _NeedFrameUpdatePos : 1; // typically For CGroupInScene
|
||||||
|
sint32 _ResizeFromChildWMargin;
|
||||||
|
sint32 _ResizeFromChildHMargin;
|
||||||
|
sint32 _GroupSizeRef;
|
||||||
|
|
||||||
|
// Projected Depth with no ZBias applied
|
||||||
|
float _DepthForZSort;
|
||||||
|
|
||||||
|
// handler for activation
|
||||||
|
IActionHandler *_AHOnActive;
|
||||||
|
CStringShared _AHOnActiveParams;
|
||||||
|
IActionHandler *_AHOnDeactive;
|
||||||
|
CStringShared _AHOnDeactiveParams;
|
||||||
|
|
||||||
|
// right & left clicks
|
||||||
|
IActionHandler *_AHOnLeftClick;
|
||||||
|
CStringShared _AHOnLeftClickParams;
|
||||||
|
IActionHandler *_AHOnRightClick;
|
||||||
|
CStringShared _AHOnRightClickParams;
|
||||||
|
|
||||||
|
// enter params.
|
||||||
|
IActionHandler *_AHOnEnter;
|
||||||
|
CStringShared _AHOnEnterParams;
|
||||||
|
|
||||||
|
// escape AH
|
||||||
|
IActionHandler *_AHOnEscape;
|
||||||
|
CStringShared _AHOnEscapeParams;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void addToEltOrder(CViewBase *view, sint order);
|
||||||
|
|
||||||
|
/// \name LUA specific
|
||||||
|
// @{
|
||||||
|
// Lua Env Table created. Table is in the LUA_REGISTRYINDEX, with key as this CInterfaceGroup* userdata
|
||||||
|
bool _LUAEnvTableCreated;
|
||||||
|
// The LUA script to be executed on Draw (checkCoords)
|
||||||
|
CStringShared _LUAOnDraw;
|
||||||
|
// The InterfaceLink created specialy for Lua Script to be executed at some DB change
|
||||||
|
typedef std::map<std::string, NLMISC::CSmartPtr<CInterfaceLink> > TLUAOnDbChange;
|
||||||
|
TLUAOnDbChange _LUAOnDbChange;
|
||||||
|
void removeAllLUAOnDbChange();
|
||||||
|
protected:
|
||||||
|
void parseMaxSizeRef(const char *ptr);
|
||||||
|
// @}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NL_INTERFACE_GROUP_H
|
#endif // NL_INTERFACE_GROUP_H
|
||||||
|
|
||||||
|
|
|
@ -27,165 +27,160 @@ namespace NLGUI
|
||||||
class CReflectedProperty;
|
class CReflectedProperty;
|
||||||
class CInterfaceExprValue;
|
class CInterfaceExprValue;
|
||||||
class CInterfaceExprNode;
|
class CInterfaceExprNode;
|
||||||
}
|
class CInterfaceElement;
|
||||||
|
class CInterfaceGroup;
|
||||||
|
|
||||||
|
/** A link in an interface.
|
||||||
class CInterfaceElement;
|
* A link is an object that can read one or several values from the database, that can evaluate an expression
|
||||||
class CInterfaceGroup;
|
* on these database entries (simple computation, using the CInterfaceExpr class), and that can affect the result to
|
||||||
|
* an interface property that has been exported by an interface element (the export system uses reflect.h).
|
||||||
|
* The first time it is created, it places observers on the database entries that are needed by the expression, so each
|
||||||
using namespace NLGUI;
|
* time a database value changes, the link is marked as 'triggered'
|
||||||
|
* When updateTrigeredLinks() is called, all links are effectively updated.
|
||||||
|
*
|
||||||
/** A link in an interface.
|
* Example of use : connecting a change in the db tree to the 'active' state of a window
|
||||||
* A link is an object that can read one or several values from the database, that can evaluate an expression
|
*
|
||||||
* on these database entries (simple computation, using the CInterfaceExpr class), and that can affect the result to
|
* NB : an additionnal action handler can be provided
|
||||||
* an interface property that has been exported by an interface element (the export system uses reflect.h).
|
* NB : The links are owned by the interface element (using a smart pointer)
|
||||||
* The first time it is created, it places observers on the database entries that are needed by the expression, so each
|
* NB : Several targets may be used.
|
||||||
* time a database value changes, the link is marked as 'triggered'
|
*
|
||||||
* When updateTrigeredLinks() is called, all links are effectively updated.
|
* \author Nicolas Vizerie
|
||||||
*
|
* \author Nevrax France
|
||||||
* Example of use : connecting a change in the db tree to the 'active' state of a window
|
* \date 2002
|
||||||
*
|
*/
|
||||||
* NB : an additionnal action handler can be provided
|
class CInterfaceLink : public NLMISC::ICDBNode::IPropertyObserver
|
||||||
* NB : The links are owned by the interface element (using a smart pointer)
|
|
||||||
* NB : Several targets may be used.
|
|
||||||
*
|
|
||||||
* \author Nicolas Vizerie
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CInterfaceLink : public NLMISC::ICDBNode::IPropertyObserver
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
#ifdef NL_DEBUG
|
|
||||||
// for debugging purposes : if this link is 'named' e.g is owner by CInterfaceManager
|
|
||||||
// and was created by calling CInterfaceManager::addLink, contains the name of this link
|
|
||||||
std::string LinkName;
|
|
||||||
#endif
|
|
||||||
public:
|
|
||||||
struct CTargetInfo
|
|
||||||
{
|
|
||||||
CInterfaceElement *Elem;
|
|
||||||
std::string PropertyName;
|
|
||||||
/** Affect a value to this target.
|
|
||||||
* \return true if the affectation could be made
|
|
||||||
*/
|
|
||||||
bool affect(const CInterfaceExprValue &value);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// Updates triggered interface links when triggered by the observed branch
|
|
||||||
class CInterfaceLinkUpdater : public NLMISC::CCDBBranchObservingHandler::IBranchObserverCallFlushObserver
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CInterfaceLinkUpdater();
|
#ifdef NL_DEBUG
|
||||||
~CInterfaceLinkUpdater();
|
// for debugging purposes : if this link is 'named' e.g is owner by CInterfaceManager
|
||||||
void onObserverCallFlush();
|
// and was created by calling CInterfaceManager::addLink, contains the name of this link
|
||||||
|
std::string LinkName;
|
||||||
|
#endif
|
||||||
|
public:
|
||||||
|
struct CTargetInfo
|
||||||
|
{
|
||||||
|
CInterfaceElement *Elem;
|
||||||
|
std::string PropertyName;
|
||||||
|
/** Affect a value to this target.
|
||||||
|
* \return true if the affectation could be made
|
||||||
|
*/
|
||||||
|
bool affect(const CInterfaceExprValue &value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// Updates triggered interface links when triggered by the observed branch
|
||||||
|
class CInterfaceLinkUpdater : public NLMISC::CCDBBranchObservingHandler::IBranchObserverCallFlushObserver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CInterfaceLinkUpdater();
|
||||||
|
~CInterfaceLinkUpdater();
|
||||||
|
void onObserverCallFlush();
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
CInterfaceLink();
|
||||||
|
~CInterfaceLink(); // this object should only be destroyed by a CInterfaceElement
|
||||||
|
/** Make a link between the given interface element properties and a value that depends on database entries.
|
||||||
|
* The link is automatically added in the link list of the targets element (it calls CInterfaceElement::addLink), so when all target elements are removed, the link is.
|
||||||
|
* If there are no target element, the link is permanent (removed at exit)
|
||||||
|
* NB : The target is not updated during this call.
|
||||||
|
*/
|
||||||
|
bool init(const std::vector<CTargetInfo> &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent);
|
||||||
|
// force all the links that have been created to update their targets. This can be called when the interface has been loaded, and when the databse entries have been retrieved.
|
||||||
|
static void updateAllLinks();
|
||||||
|
// force all trigered links to be updated
|
||||||
|
static void updateTrigeredLinks();
|
||||||
|
// remove from the _LinksWithNoTarget list if the link has no target
|
||||||
|
void uninit();
|
||||||
|
|
||||||
|
// Force an update of the target of this link
|
||||||
|
void update();
|
||||||
|
/** Remove a target element. It won't be updated anymore by that link
|
||||||
|
* NB : this don't call removeLink() on the target
|
||||||
|
*/
|
||||||
|
void removeTarget(CInterfaceElement *elem);
|
||||||
|
// Get the number of targets of this link
|
||||||
|
uint getNumTargets() const { return (uint)_Targets.size(); }
|
||||||
|
// Get the i-th target
|
||||||
|
CInterfaceElement *getTarget(uint index) const { return _Targets[index]._InterfaceElement; }
|
||||||
|
|
||||||
|
static void removeAllLinks();
|
||||||
|
|
||||||
|
static void setTargetProperty (const std::string & Target, const CInterfaceExprValue &val);
|
||||||
|
|
||||||
|
static bool isUpdatingAllLinks() { return _UpdateAllLinks; }
|
||||||
|
|
||||||
|
/** From a target name of a link, retrieve the target element and its target target property
|
||||||
|
* \return true if the target is valid
|
||||||
|
*/
|
||||||
|
static bool splitLinkTarget(const std::string &target, CInterfaceGroup *parentGroup, std::string &propertyName, CInterfaceElement *&targetElm);
|
||||||
|
|
||||||
|
/** From several target names of a link (seprated by ','), retrieve the target elements and their target properties
|
||||||
|
* \return true if all targets are valid
|
||||||
|
*/
|
||||||
|
static bool splitLinkTargets(const std::string &targets, CInterfaceGroup *parentGroup, std::vector<CInterfaceLink::CTargetInfo> &targetsVect);
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
private:
|
||||||
|
friend struct CRemoveTargetPred;
|
||||||
|
// a target property
|
||||||
|
struct CTarget
|
||||||
|
{
|
||||||
|
CInterfaceElement *_InterfaceElement;
|
||||||
|
const CReflectedProperty *_Property;
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
typedef std::list<CInterfaceLink *> TLinkList;
|
||||||
|
typedef NLMISC::CSmartPtr<CInterfaceLink> TLinkSmartPtr;
|
||||||
|
typedef std::vector<TLinkSmartPtr> TLinkVect;
|
||||||
|
typedef std::vector<NLMISC::ICDBNode *> TNodeVect;
|
||||||
|
private:
|
||||||
|
std::vector<CTarget> _Targets;
|
||||||
|
TNodeVect _ObservedNodes;
|
||||||
|
std::string _Expr;
|
||||||
|
CInterfaceExprNode *_ParseTree;
|
||||||
|
std::string _ActionHandler;
|
||||||
|
std::string _AHParams;
|
||||||
|
std::string _AHCond;
|
||||||
|
CInterfaceGroup *_AHParent;
|
||||||
|
static TLinkList _LinkList;
|
||||||
|
TLinkList::iterator _ListEntry;
|
||||||
|
bool _On;
|
||||||
|
static TLinkVect _LinksWithNoTarget; // there should be an owner for links with no targets
|
||||||
|
static bool _UpdateAllLinks;
|
||||||
|
///\ name triggered link mgt
|
||||||
|
//@{
|
||||||
|
// next/previous link that was trigered. NULL means end or start of list
|
||||||
|
// each ptr is duplicated because with manage 2 lists : one list in which links are added, and one list in which we update links.
|
||||||
|
// This way one link can trigger another with no prb
|
||||||
|
CInterfaceLink *_PrevTriggeredLink[2];
|
||||||
|
CInterfaceLink *_NextTriggeredLink[2];
|
||||||
|
bool _Triggered[2];
|
||||||
|
// global lists
|
||||||
|
static CInterfaceLink *_FirstTriggeredLink[2];
|
||||||
|
static CInterfaceLink *_LastTriggeredLink[2];
|
||||||
|
// iterators in current list being updated : they're global so that deleting a CInterfaceLink instance prevent them from becoming dangling pointers
|
||||||
|
static CInterfaceLink *_CurrUpdatedLink;
|
||||||
|
static CInterfaceLink *_NextUpdatedLink;
|
||||||
|
// Index of the list in which triggered link must be inserted
|
||||||
|
static uint _CurrentTriggeredLinkList;
|
||||||
|
|
||||||
|
//
|
||||||
|
void linkInTriggerList(uint list);
|
||||||
|
void unlinkFromTriggerList(uint list);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** Inherited from ICDBNode::IPropertyObserver
|
||||||
|
* This doesn't update the node directly, but mark it as 'triggered'
|
||||||
|
* The node is really updated during the call to 'updateTrigeredLinks()'
|
||||||
|
*/
|
||||||
|
virtual void update(NLMISC::ICDBNode *node);
|
||||||
|
void createObservers(const TNodeVect &nodes);
|
||||||
|
void removeObservers(const TNodeVect &nodes);
|
||||||
|
// debug : check that there are as many targets as reference to a link
|
||||||
|
void checkNbRefs();
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
}
|
||||||
CInterfaceLink();
|
|
||||||
~CInterfaceLink(); // this object should only be destroyed by a CInterfaceElement
|
|
||||||
/** Make a link between the given interface element properties and a value that depends on database entries.
|
|
||||||
* The link is automatically added in the link list of the targets element (it calls CInterfaceElement::addLink), so when all target elements are removed, the link is.
|
|
||||||
* If there are no target element, the link is permanent (removed at exit)
|
|
||||||
* NB : The target is not updated during this call.
|
|
||||||
*/
|
|
||||||
bool init(const std::vector<CTargetInfo> &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent);
|
|
||||||
// force all the links that have been created to update their targets. This can be called when the interface has been loaded, and when the databse entries have been retrieved.
|
|
||||||
static void updateAllLinks();
|
|
||||||
// force all trigered links to be updated
|
|
||||||
static void updateTrigeredLinks();
|
|
||||||
// remove from the _LinksWithNoTarget list if the link has no target
|
|
||||||
void uninit();
|
|
||||||
|
|
||||||
// Force an update of the target of this link
|
|
||||||
void update();
|
|
||||||
/** Remove a target element. It won't be updated anymore by that link
|
|
||||||
* NB : this don't call removeLink() on the target
|
|
||||||
*/
|
|
||||||
void removeTarget(CInterfaceElement *elem);
|
|
||||||
// Get the number of targets of this link
|
|
||||||
uint getNumTargets() const { return (uint)_Targets.size(); }
|
|
||||||
// Get the i-th target
|
|
||||||
CInterfaceElement *getTarget(uint index) const { return _Targets[index]._InterfaceElement; }
|
|
||||||
|
|
||||||
static void removeAllLinks();
|
|
||||||
|
|
||||||
static void setTargetProperty (const std::string & Target, const CInterfaceExprValue &val);
|
|
||||||
|
|
||||||
static bool isUpdatingAllLinks() { return _UpdateAllLinks; }
|
|
||||||
|
|
||||||
/** From a target name of a link, retrieve the target element and its target target property
|
|
||||||
* \return true if the target is valid
|
|
||||||
*/
|
|
||||||
static bool splitLinkTarget(const std::string &target, CInterfaceGroup *parentGroup, std::string &propertyName, CInterfaceElement *&targetElm);
|
|
||||||
|
|
||||||
/** From several target names of a link (seprated by ','), retrieve the target elements and their target properties
|
|
||||||
* \return true if all targets are valid
|
|
||||||
*/
|
|
||||||
static bool splitLinkTargets(const std::string &targets, CInterfaceGroup *parentGroup, std::vector<CInterfaceLink::CTargetInfo> &targetsVect);
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
private:
|
|
||||||
friend struct CRemoveTargetPred;
|
|
||||||
// a target property
|
|
||||||
struct CTarget
|
|
||||||
{
|
|
||||||
CInterfaceElement *_InterfaceElement;
|
|
||||||
const CReflectedProperty *_Property;
|
|
||||||
};
|
|
||||||
private:
|
|
||||||
typedef std::list<CInterfaceLink *> TLinkList;
|
|
||||||
typedef NLMISC::CSmartPtr<CInterfaceLink> TLinkSmartPtr;
|
|
||||||
typedef std::vector<TLinkSmartPtr> TLinkVect;
|
|
||||||
typedef std::vector<NLMISC::ICDBNode *> TNodeVect;
|
|
||||||
private:
|
|
||||||
std::vector<CTarget> _Targets;
|
|
||||||
TNodeVect _ObservedNodes;
|
|
||||||
std::string _Expr;
|
|
||||||
CInterfaceExprNode *_ParseTree;
|
|
||||||
std::string _ActionHandler;
|
|
||||||
std::string _AHParams;
|
|
||||||
std::string _AHCond;
|
|
||||||
CInterfaceGroup *_AHParent;
|
|
||||||
static TLinkList _LinkList;
|
|
||||||
TLinkList::iterator _ListEntry;
|
|
||||||
bool _On;
|
|
||||||
static TLinkVect _LinksWithNoTarget; // there should be an owner for links with no targets
|
|
||||||
static bool _UpdateAllLinks;
|
|
||||||
///\ name triggered link mgt
|
|
||||||
//@{
|
|
||||||
// next/previous link that was trigered. NULL means end or start of list
|
|
||||||
// each ptr is duplicated because with manage 2 lists : one list in which links are added, and one list in which we update links.
|
|
||||||
// This way one link can trigger another with no prb
|
|
||||||
CInterfaceLink *_PrevTriggeredLink[2];
|
|
||||||
CInterfaceLink *_NextTriggeredLink[2];
|
|
||||||
bool _Triggered[2];
|
|
||||||
// global lists
|
|
||||||
static CInterfaceLink *_FirstTriggeredLink[2];
|
|
||||||
static CInterfaceLink *_LastTriggeredLink[2];
|
|
||||||
// iterators in current list being updated : they're global so that deleting a CInterfaceLink instance prevent them from becoming dangling pointers
|
|
||||||
static CInterfaceLink *_CurrUpdatedLink;
|
|
||||||
static CInterfaceLink *_NextUpdatedLink;
|
|
||||||
// Index of the list in which triggered link must be inserted
|
|
||||||
static uint _CurrentTriggeredLinkList;
|
|
||||||
|
|
||||||
//
|
|
||||||
void linkInTriggerList(uint list);
|
|
||||||
void unlinkFromTriggerList(uint list);
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
/** Inherited from ICDBNode::IPropertyObserver
|
|
||||||
* This doesn't update the node directly, but mark it as 'triggered'
|
|
||||||
* The node is really updated during the call to 'updateTrigeredLinks()'
|
|
||||||
*/
|
|
||||||
virtual void update(NLMISC::ICDBNode *node);
|
|
||||||
void createObservers(const TNodeVect &nodes);
|
|
||||||
void removeObservers(const TNodeVect &nodes);
|
|
||||||
// debug : check that there are as many targets as reference to a link
|
|
||||||
void checkNbRefs();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,70 +28,73 @@ namespace NL3D
|
||||||
class UAnimationSet;
|
class UAnimationSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
// ***************************************************************************
|
|
||||||
class CInterfaceOptionValue
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
CInterfaceOptionValue()
|
// ***************************************************************************
|
||||||
|
class CInterfaceOptionValue
|
||||||
{
|
{
|
||||||
_Color= NLMISC::CRGBA::White;
|
public:
|
||||||
_Int= 0;
|
CInterfaceOptionValue()
|
||||||
_Float= 0;
|
{
|
||||||
_Boolean= false;
|
_Color= NLMISC::CRGBA::White;
|
||||||
}
|
_Int= 0;
|
||||||
|
_Float= 0;
|
||||||
|
_Boolean= false;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string &getValStr () const {return _Str;}
|
const std::string &getValStr () const {return _Str;}
|
||||||
sint32 getValSInt32() const {return _Int;}
|
sint32 getValSInt32() const {return _Int;}
|
||||||
float getValFloat () const {return _Float;}
|
float getValFloat () const {return _Float;}
|
||||||
NLMISC::CRGBA getValColor () const {return _Color;}
|
NLMISC::CRGBA getValColor () const {return _Color;}
|
||||||
bool getValBool () const {return _Boolean;}
|
bool getValBool () const {return _Boolean;}
|
||||||
|
|
||||||
void init(const std::string &str);
|
void init(const std::string &str);
|
||||||
|
|
||||||
// returned when InterfaceOptions param not found
|
// returned when InterfaceOptions param not found
|
||||||
static const CInterfaceOptionValue NullValue;
|
static const CInterfaceOptionValue NullValue;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string _Str;
|
std::string _Str;
|
||||||
NLMISC::CRGBA _Color;
|
NLMISC::CRGBA _Color;
|
||||||
sint32 _Int;
|
sint32 _Int;
|
||||||
float _Float;
|
float _Float;
|
||||||
bool _Boolean;
|
bool _Boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
class CInterfaceOptions : public NLMISC::CRefCount
|
class CInterfaceOptions : public NLMISC::CRefCount
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CInterfaceOptions();
|
CInterfaceOptions();
|
||||||
virtual ~CInterfaceOptions();
|
virtual ~CInterfaceOptions();
|
||||||
|
|
||||||
virtual bool parse (xmlNodePtr cur);
|
virtual bool parse (xmlNodePtr cur);
|
||||||
|
|
||||||
// return NullValue if param not found
|
// return NullValue if param not found
|
||||||
const CInterfaceOptionValue &getValue(const std::string &sParamName) const;
|
const CInterfaceOptionValue &getValue(const std::string &sParamName) const;
|
||||||
|
|
||||||
// shortcuts to getValue(paramName).getValXXX()
|
// shortcuts to getValue(paramName).getValXXX()
|
||||||
const std::string &getValStr (const std::string &sParamName) const;
|
const std::string &getValStr (const std::string &sParamName) const;
|
||||||
sint32 getValSInt32 (const std::string &sParamName) const;
|
sint32 getValSInt32 (const std::string &sParamName) const;
|
||||||
float getValFloat (const std::string &sParamName) const;
|
float getValFloat (const std::string &sParamName) const;
|
||||||
NLMISC::CRGBA getValColor (const std::string &sParamName) const;
|
NLMISC::CRGBA getValColor (const std::string &sParamName) const;
|
||||||
bool getValBool (const std::string &sParamName) const;
|
bool getValBool (const std::string &sParamName) const;
|
||||||
|
|
||||||
// copy basic map only from other CInterfaceOptions (non virtual method)
|
// copy basic map only from other CInterfaceOptions (non virtual method)
|
||||||
void copyBasicMap(const CInterfaceOptions &other);
|
void copyBasicMap(const CInterfaceOptions &other);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
std::map<std::string, CInterfaceOptionValue> _ParamValue;
|
std::map<std::string, CInterfaceOptionValue> _ParamValue;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NL_INTERFACE_LAYER_H
|
#endif // NL_INTERFACE_LAYER_H
|
||||||
|
|
||||||
|
|
|
@ -23,59 +23,63 @@
|
||||||
#include "nel/misc/factory.h"
|
#include "nel/misc/factory.h"
|
||||||
#include "nel/gui/interface_element.h"
|
#include "nel/gui/interface_element.h"
|
||||||
|
|
||||||
class CViewBase : public CInterfaceElement
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
// for factory construction
|
class CViewBase : public CInterfaceElement
|
||||||
struct TCtorParam
|
|
||||||
{};
|
|
||||||
|
|
||||||
/// Constructor
|
|
||||||
CViewBase(const TCtorParam &/* param */) : CInterfaceElement()
|
|
||||||
{
|
{
|
||||||
}
|
public:
|
||||||
|
|
||||||
/// Destructor
|
// for factory construction
|
||||||
virtual ~CViewBase();
|
struct TCtorParam
|
||||||
|
{};
|
||||||
|
|
||||||
// Returns 'true' if that element can be downcasted to a view
|
/// Constructor
|
||||||
virtual bool isView() const { return true; }
|
CViewBase(const TCtorParam &/* param */) : CInterfaceElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// Draw the view from XReal, YReal, WReal, HReal (implemented by derived classes)
|
/// Destructor
|
||||||
/// this coordinates are relative to the screen bottom left and begins the bottom left of the view
|
virtual ~CViewBase();
|
||||||
virtual void draw () = 0;
|
|
||||||
|
|
||||||
virtual void updateCoords() { CInterfaceElement::updateCoords(); }
|
// Returns 'true' if that element can be downcasted to a view
|
||||||
|
virtual bool isView() const { return true; }
|
||||||
|
|
||||||
/// Debug
|
/// Draw the view from XReal, YReal, WReal, HReal (implemented by derived classes)
|
||||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
/// this coordinates are relative to the screen bottom left and begins the bottom left of the view
|
||||||
|
virtual void draw () = 0;
|
||||||
|
|
||||||
/// Reflection
|
virtual void updateCoords() { CInterfaceElement::updateCoords(); }
|
||||||
virtual sint32 getAlpha() const { return -1; } // Not obliged to implement this
|
|
||||||
virtual void setAlpha (sint32 /* a */) {} // Not obliged to implement this
|
/// Debug
|
||||||
|
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||||
|
|
||||||
|
/// Reflection
|
||||||
|
virtual sint32 getAlpha() const { return -1; } // Not obliged to implement this
|
||||||
|
virtual void setAlpha (sint32 /* a */) {} // Not obliged to implement this
|
||||||
|
|
||||||
|
|
||||||
void copyOptionFrom(const CViewBase &other)
|
void copyOptionFrom(const CViewBase &other)
|
||||||
{
|
{
|
||||||
CInterfaceElement::copyOptionFrom(other);
|
CInterfaceElement::copyOptionFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CViewBase, CInterfaceElement)
|
REFLECT_EXPORT_START(CViewBase, CInterfaceElement)
|
||||||
REFLECT_SINT32 ("alpha", getAlpha, setAlpha);
|
REFLECT_SINT32 ("alpha", getAlpha, setAlpha);
|
||||||
REFLECT_EXPORT_END
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
virtual void dumpSize(uint depth = 0) const;
|
virtual void dumpSize(uint depth = 0) const;
|
||||||
|
|
||||||
// from CInterfaceElement
|
// from CInterfaceElement
|
||||||
virtual void visit(CInterfaceElementVisitor *visitor);
|
virtual void visit(CInterfaceElementVisitor *visitor);
|
||||||
|
|
||||||
// special for mouse over : return true and fill the name of the cursor to display
|
// special for mouse over : return true and fill the name of the cursor to display
|
||||||
virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */) { return false; }
|
virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */) { return false; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // RZ_VIEW_BASE_H
|
#endif // RZ_VIEW_BASE_H
|
||||||
|
|
||||||
|
|
|
@ -1,55 +1,77 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#ifndef VIEW_POINTER_BASE_H
|
#ifndef VIEW_POINTER_BASE_H
|
||||||
#define VIEW_POINTER_BASE_H
|
#define VIEW_POINTER_BASE_H
|
||||||
|
|
||||||
#include "nel/gui/view_base.h"
|
#include "nel/gui/view_base.h"
|
||||||
|
|
||||||
class CViewPointerBase : public CViewBase
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DECLARE_UI_CLASS( CViewPointerBase )
|
|
||||||
|
|
||||||
CViewPointerBase( const TCtorParam ¶m );
|
class CViewPointerBase : public CViewBase
|
||||||
virtual ~CViewPointerBase();
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS( CViewPointerBase )
|
||||||
|
|
||||||
// Set the pointer position.
|
CViewPointerBase( const TCtorParam ¶m );
|
||||||
void setPointerPos (sint32 x, sint32 y);
|
virtual ~CViewPointerBase();
|
||||||
void setPointerDispPos (sint32 x, sint32 y);
|
|
||||||
|
|
||||||
void resetPointerPos ();
|
// Set the pointer position.
|
||||||
void setPointerDown (bool pd);
|
void setPointerPos (sint32 x, sint32 y);
|
||||||
void setPointerDownString (const std::string &s);
|
void setPointerDispPos (sint32 x, sint32 y);
|
||||||
|
|
||||||
void getPointerPos (sint32 &x, sint32 &y);
|
void resetPointerPos ();
|
||||||
void getPointerDispPos (sint32 &x, sint32 &y);
|
void setPointerDown (bool pd);
|
||||||
|
void setPointerDownString (const std::string &s);
|
||||||
|
|
||||||
void getPointerOldPos (sint32 &x, sint32 &y);
|
void getPointerPos (sint32 &x, sint32 &y);
|
||||||
void getPointerDownPos (sint32 &x, sint32 &y);
|
void getPointerDispPos (sint32 &x, sint32 &y);
|
||||||
bool getPointerDown ();
|
|
||||||
std::string getPointerDownString ();
|
|
||||||
bool getPointerDrag ();
|
|
||||||
|
|
||||||
/// Is the pointer visible ?
|
void getPointerOldPos (sint32 &x, sint32 &y);
|
||||||
bool show() const {return _PointerVisible;}
|
void getPointerDownPos (sint32 &x, sint32 &y);
|
||||||
|
bool getPointerDown ();
|
||||||
|
std::string getPointerDownString ();
|
||||||
|
bool getPointerDrag ();
|
||||||
|
|
||||||
void draw(){}
|
/// Is the pointer visible ?
|
||||||
|
bool show() const {return _PointerVisible;}
|
||||||
|
|
||||||
protected:
|
void draw(){}
|
||||||
// (x,y) is from the TopLeft corner of the window
|
|
||||||
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
|
||||||
sint32 _PointerY;
|
|
||||||
sint32 _PointerOldX; // Previous frame pointer position
|
|
||||||
sint32 _PointerOldY;
|
|
||||||
bool _PointerDown; // Is the pointer down ?
|
|
||||||
sint32 _PointerDownX; // Pointer down position
|
|
||||||
sint32 _PointerDownY;
|
|
||||||
std::string _PointerDownString; // What is under the pointer at the down position
|
|
||||||
bool _PointerDrag; // Is the pointer down and we have moved ?
|
|
||||||
bool _PointerVisible; // Is the pointer visible or hidden ?
|
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
// (x,y) is from the TopLeft corner of the window
|
||||||
|
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
||||||
|
sint32 _PointerY;
|
||||||
|
sint32 _PointerOldX; // Previous frame pointer position
|
||||||
|
sint32 _PointerOldY;
|
||||||
|
bool _PointerDown; // Is the pointer down ?
|
||||||
|
sint32 _PointerDownX; // Pointer down position
|
||||||
|
sint32 _PointerDownY;
|
||||||
|
std::string _PointerDownString; // What is under the pointer at the down position
|
||||||
|
bool _PointerDrag; // Is the pointer down and we have moved ?
|
||||||
|
bool _PointerVisible; // Is the pointer visible or hidden ?
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,314 +23,319 @@
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
#include "nel/gui/interface_common.h"
|
#include "nel/gui/interface_common.h"
|
||||||
|
|
||||||
class CInterfaceElement;
|
|
||||||
class CCtrlBase;
|
|
||||||
class CViewBase;
|
|
||||||
class CInterfaceGroup;
|
|
||||||
class CViewPointerBase;
|
|
||||||
class CInterfaceOptions;
|
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
class CCDBNodeLeaf;
|
class CCDBNodeLeaf;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IParser
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
virtual void addParentPositionAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
|
|
||||||
virtual void addParentSizeAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
|
|
||||||
virtual void addParentSizeMaxAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
|
|
||||||
virtual void addLuaClassAssociation( CInterfaceGroup *group, const std::string &luaScript ) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Manages the GUI widgets
|
class CInterfaceElement;
|
||||||
class CWidgetManager{
|
class CCtrlBase;
|
||||||
public:
|
class CViewBase;
|
||||||
|
class CInterfaceGroup;
|
||||||
|
class CViewPointerBase;
|
||||||
|
class CInterfaceOptions;
|
||||||
|
|
||||||
// Master groups encapsulate all windows
|
class IParser
|
||||||
struct SMasterGroup
|
|
||||||
{
|
{
|
||||||
SMasterGroup()
|
public:
|
||||||
{
|
virtual void addParentPositionAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
|
||||||
Group = NULL;
|
virtual void addParentSizeAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
|
||||||
LastTopWindowPriority = WIN_PRIORITY_NORMAL;
|
virtual void addParentSizeMaxAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
|
||||||
}
|
virtual void addLuaClassAssociation( CInterfaceGroup *group, const std::string &luaScript ) = 0;
|
||||||
|
|
||||||
CInterfaceGroup *Group;
|
|
||||||
std::list< CInterfaceGroup* > PrioritizedWindows[ WIN_PRIORITY_MAX ];
|
|
||||||
|
|
||||||
void addWindow( CInterfaceGroup *pIG, uint8 nPrio = WIN_PRIORITY_NORMAL );
|
|
||||||
void delWindow( CInterfaceGroup *pIG );
|
|
||||||
CInterfaceGroup *getWindowFromId( const std::string &winID );
|
|
||||||
bool isWindowPresent( CInterfaceGroup *pIG );
|
|
||||||
// Set a window top in its priority queue
|
|
||||||
void setTopWindow( CInterfaceGroup *pIG );
|
|
||||||
void setBackWindow( CInterfaceGroup *pIG );
|
|
||||||
void deactiveAllContainers();
|
|
||||||
void centerAllContainers();
|
|
||||||
void unlockAllContainers();
|
|
||||||
|
|
||||||
// Sort the world space group
|
|
||||||
void sortWorldSpaceGroup ();
|
|
||||||
|
|
||||||
uint8 LastTopWindowPriority;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Manages the GUI widgets
|
||||||
|
class CWidgetManager{
|
||||||
|
public:
|
||||||
|
|
||||||
// Infos about a modal window.
|
// Master groups encapsulate all windows
|
||||||
struct SModalWndInfo
|
struct SMasterGroup
|
||||||
{
|
|
||||||
// Yoyo: store as CRefPtr in case they are deleted (can happen for instance if menu right click on a guild memeber, and guild members are udpated after)
|
|
||||||
NLMISC::CRefPtr< CInterfaceGroup > ModalWindow; // the current modal window
|
|
||||||
NLMISC::CRefPtr< CCtrlBase > CtrlLaunchingModal;
|
|
||||||
bool ModalClip;
|
|
||||||
bool ModalExitClickOut;
|
|
||||||
bool ModalExitClickL;
|
|
||||||
bool ModalExitClickR;
|
|
||||||
bool ModalExitKeyPushed;
|
|
||||||
std::string ModalHandlerClickOut;
|
|
||||||
std::string ModalClickOutParams;
|
|
||||||
|
|
||||||
SModalWndInfo()
|
|
||||||
{
|
{
|
||||||
ModalWindow = NULL;
|
SMasterGroup()
|
||||||
CtrlLaunchingModal = NULL;
|
{
|
||||||
ModalExitClickOut = false;
|
Group = NULL;
|
||||||
ModalExitClickL = false;
|
LastTopWindowPriority = WIN_PRIORITY_NORMAL;
|
||||||
ModalExitClickR = false;
|
}
|
||||||
ModalExitKeyPushed = false;
|
|
||||||
|
CInterfaceGroup *Group;
|
||||||
|
std::list< CInterfaceGroup* > PrioritizedWindows[ WIN_PRIORITY_MAX ];
|
||||||
|
|
||||||
|
void addWindow( CInterfaceGroup *pIG, uint8 nPrio = WIN_PRIORITY_NORMAL );
|
||||||
|
void delWindow( CInterfaceGroup *pIG );
|
||||||
|
CInterfaceGroup *getWindowFromId( const std::string &winID );
|
||||||
|
bool isWindowPresent( CInterfaceGroup *pIG );
|
||||||
|
// Set a window top in its priority queue
|
||||||
|
void setTopWindow( CInterfaceGroup *pIG );
|
||||||
|
void setBackWindow( CInterfaceGroup *pIG );
|
||||||
|
void deactiveAllContainers();
|
||||||
|
void centerAllContainers();
|
||||||
|
void unlockAllContainers();
|
||||||
|
|
||||||
|
// Sort the world space group
|
||||||
|
void sortWorldSpaceGroup ();
|
||||||
|
|
||||||
|
uint8 LastTopWindowPriority;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Infos about a modal window.
|
||||||
|
struct SModalWndInfo
|
||||||
|
{
|
||||||
|
// Yoyo: store as CRefPtr in case they are deleted (can happen for instance if menu right click on a guild memeber, and guild members are udpated after)
|
||||||
|
NLMISC::CRefPtr< CInterfaceGroup > ModalWindow; // the current modal window
|
||||||
|
NLMISC::CRefPtr< CCtrlBase > CtrlLaunchingModal;
|
||||||
|
bool ModalClip;
|
||||||
|
bool ModalExitClickOut;
|
||||||
|
bool ModalExitClickL;
|
||||||
|
bool ModalExitClickR;
|
||||||
|
bool ModalExitKeyPushed;
|
||||||
|
std::string ModalHandlerClickOut;
|
||||||
|
std::string ModalClickOutParams;
|
||||||
|
|
||||||
|
SModalWndInfo()
|
||||||
|
{
|
||||||
|
ModalWindow = NULL;
|
||||||
|
CtrlLaunchingModal = NULL;
|
||||||
|
ModalExitClickOut = false;
|
||||||
|
ModalExitClickL = false;
|
||||||
|
ModalExitClickR = false;
|
||||||
|
ModalExitKeyPushed = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static CWidgetManager* getInstance();
|
||||||
|
static void release();
|
||||||
|
|
||||||
|
CInterfaceGroup* getMasterGroupFromId( const std::string &MasterGroupName );
|
||||||
|
std::vector< SMasterGroup > &getAllMasterGroup(){ return _MasterGroups; }
|
||||||
|
SMasterGroup& getMasterGroup( uint8 i ) { return _MasterGroups[ i ]; }
|
||||||
|
CInterfaceGroup* getWindowFromId( const std::string &groupId );
|
||||||
|
void addWindowToMasterGroup( const std::string &sMasterGroupName, CInterfaceGroup *pIG );
|
||||||
|
void removeWindowFromMasterGroup( const std::string &sMasterGroupName, CInterfaceGroup *pIG );
|
||||||
|
void removeAllMasterGroups();
|
||||||
|
|
||||||
|
void activateMasterGroup (const std::string &sMasterGroupName, bool bActive);
|
||||||
|
|
||||||
|
CInterfaceElement* getElementFromId( const std::string &sEltId );
|
||||||
|
CInterfaceElement* getElementFromId( const std::string &sStart, const std::string &sEltId );
|
||||||
|
|
||||||
|
/// Get the window from an element (ui:interface:###)
|
||||||
|
CInterfaceGroup* getWindow(CInterfaceElement*);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the top window
|
||||||
|
* \param win : pointer to the window to be set on top
|
||||||
|
*/
|
||||||
|
void setTopWindow (CInterfaceGroup *pWin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the back window
|
||||||
|
* \param win : pointer to the window to be set on top
|
||||||
|
*/
|
||||||
|
void setBackWindow (CInterfaceGroup *pWin);
|
||||||
|
|
||||||
|
/** get the top window in the first activated masterGroup
|
||||||
|
*/
|
||||||
|
CInterfaceGroup* getTopWindow (uint8 nPriority = WIN_PRIORITY_NORMAL) const;
|
||||||
|
|
||||||
|
/** get the back window in the first activated masterGroup
|
||||||
|
*/
|
||||||
|
CInterfaceGroup* getBackWindow (uint8 nPriority = WIN_PRIORITY_NORMAL) const;
|
||||||
|
|
||||||
|
/** get the last escapable top window in the first activated masterGroup
|
||||||
|
*/
|
||||||
|
CInterfaceGroup* getLastEscapableTopWindow() const;
|
||||||
|
|
||||||
|
void setWindowPriority (CInterfaceGroup *pWin, uint8 nPriority);
|
||||||
|
|
||||||
|
/** return the priority of the Last Window setTopWindow()-ed.
|
||||||
|
*/
|
||||||
|
uint8 getLastTopWindowPriority() const;
|
||||||
|
|
||||||
|
bool hasModal() const;
|
||||||
|
|
||||||
|
SModalWndInfo& getModal();
|
||||||
|
|
||||||
|
bool isPreviousModal( CInterfaceGroup *wnd ) const;
|
||||||
|
|
||||||
|
void enableModalWindow (CCtrlBase *ctrlLaunchingModal, CInterfaceGroup *pIG);
|
||||||
|
void enableModalWindow (CCtrlBase *ctrlLaunchingModal, const std::string &groupName);
|
||||||
|
// Disable all modals windows
|
||||||
|
void disableModalWindow ();
|
||||||
|
|
||||||
|
/** Push a modal window that becomes the current modal window
|
||||||
|
*/
|
||||||
|
void pushModalWindow(CCtrlBase *ctrlLaunchingModal, CInterfaceGroup *pIG);
|
||||||
|
void pushModalWindow (CCtrlBase *ctrlLaunchingModal, const std::string &groupName);
|
||||||
|
void popModalWindow();
|
||||||
|
// pop all top modal windows with the given category (a string stored in the modal)
|
||||||
|
void popModalWindowCategory(const std::string &category);
|
||||||
|
|
||||||
|
CCtrlBase *getCtrlLaunchingModal ()
|
||||||
|
{
|
||||||
|
if (_ModalStack.empty()) return NULL;
|
||||||
|
return _ModalStack.back().CtrlLaunchingModal;
|
||||||
}
|
}
|
||||||
|
/// get the currently active modal window, or NULL if none
|
||||||
|
CInterfaceGroup *getModalWindow() const
|
||||||
|
{
|
||||||
|
if (_ModalStack.empty()) return NULL;
|
||||||
|
return _ModalStack.back().ModalWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCurContextHelp( CCtrlBase *curContextHelp ){ this->curContextHelp = curContextHelp; }
|
||||||
|
CCtrlBase* getCurContextHelp(){ return curContextHelp; }
|
||||||
|
|
||||||
|
float _DeltaTimeStopingContextHelp;
|
||||||
|
|
||||||
|
CViewPointerBase* getPointer(){ return _Pointer; }
|
||||||
|
void setPointer( CViewPointerBase *pointer ){ _Pointer = pointer; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the window under a spot
|
||||||
|
* \param : X coord of the spot
|
||||||
|
* \param : Y coord of the spot
|
||||||
|
* \return : pointer to the window
|
||||||
|
*/
|
||||||
|
CInterfaceGroup* getWindowUnder (sint32 x, sint32 y);
|
||||||
|
CInterfaceGroup* getCurrentWindowUnder() { return _WindowUnder; }
|
||||||
|
void setCurrentWindowUnder( CInterfaceGroup *group ){ _WindowUnder = group; }
|
||||||
|
CInterfaceGroup* getGroupUnder (sint32 x, sint32 y);
|
||||||
|
|
||||||
|
void getViewsUnder( sint32 x, sint32 y, std::vector< CViewBase* > &vVB );
|
||||||
|
void getCtrlsUnder( sint32 x, sint32 y, std::vector< CCtrlBase* > &vICL );
|
||||||
|
void getGroupsUnder (sint32 x, sint32 y, std::vector< CInterfaceGroup* > &vIGL );
|
||||||
|
|
||||||
|
const std::vector< CViewBase* >& getViewsUnderPointer(){ return _ViewsUnderPointer; }
|
||||||
|
const std::vector< CInterfaceGroup* >& getGroupsUnderPointer() { return _GroupsUnderPointer; }
|
||||||
|
const std::vector< CCtrlBase* >& getCtrlsUnderPointer() { return _CtrlsUnderPointer; }
|
||||||
|
|
||||||
|
//
|
||||||
|
void clearViewUnders(){ _ViewsUnderPointer.clear(); }
|
||||||
|
void clearGroupsUnders() { _GroupsUnderPointer.clear(); }
|
||||||
|
void clearCtrlsUnders() { _CtrlsUnderPointer.clear(); }
|
||||||
|
|
||||||
|
// Remove all references on a view (called when the ctrl is destroyed)
|
||||||
|
void removeRefOnView( CViewBase *ctrlBase );
|
||||||
|
|
||||||
|
// Remove all references on a ctrl (called when the ctrl is destroyed)
|
||||||
|
void removeRefOnCtrl (CCtrlBase *ctrlBase);
|
||||||
|
|
||||||
|
// Remove all references on a group (called when the group is destroyed)
|
||||||
|
void removeRefOnGroup (CInterfaceGroup *group);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
void checkCoords();
|
||||||
|
// Relative move of pointer
|
||||||
|
void movePointer (sint32 dx, sint32 dy);
|
||||||
|
// Set absolute coordinates of pointer
|
||||||
|
void movePointerAbs(sint32 px, sint32 py);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capture
|
||||||
|
*/
|
||||||
|
CCtrlBase *getCapturePointerLeft() { return _CapturePointerLeft; }
|
||||||
|
CCtrlBase *getCapturePointerRight() { return _CapturePointerRight; }
|
||||||
|
CCtrlBase *getCaptureKeyboard() { return _CaptureKeyboard; }
|
||||||
|
CCtrlBase *getOldCaptureKeyboard() { return _OldCaptureKeyboard; }
|
||||||
|
CCtrlBase *getDefaultCaptureKeyboard() { return _DefaultCaptureKeyboard; }
|
||||||
|
|
||||||
|
void setCapturePointerLeft(CCtrlBase *c);
|
||||||
|
void setCapturePointerRight(CCtrlBase *c);
|
||||||
|
void setOldCaptureKeyboard(CCtrlBase *c){ _OldCaptureKeyboard = c; }
|
||||||
|
// NB: setCaptureKeyboard(NULL) has not the same effect as resetCaptureKeyboard(). it allows the capture
|
||||||
|
// to come back to the last captured window (resetCaptureKeyboard() not)
|
||||||
|
void setCaptureKeyboard(CCtrlBase *c);
|
||||||
|
/** Set the default box to use when no keyboard has been previously captured
|
||||||
|
* The given dialog should be static
|
||||||
|
*/
|
||||||
|
void setDefaultCaptureKeyboard(CCtrlBase *c){ _DefaultCaptureKeyboard = c; }
|
||||||
|
|
||||||
|
void resetCaptureKeyboard();
|
||||||
|
|
||||||
|
// True if the keyboard is captured
|
||||||
|
bool isKeyboardCaptured() const {return _CaptureKeyboard!=NULL;}
|
||||||
|
|
||||||
|
// register a view that wants to be notified at each frame (receive the msg 'clocktick')
|
||||||
|
void registerClockMsgTarget(CCtrlBase *vb);
|
||||||
|
void unregisterClockMsgTarget(CCtrlBase *vb);
|
||||||
|
bool isClockMsgTarget(CCtrlBase *vb) const;
|
||||||
|
void sendClockTickEvent();
|
||||||
|
|
||||||
|
void notifyElementCaptured(CCtrlBase *c);
|
||||||
|
|
||||||
|
// Add a group into the windows list of its master goup
|
||||||
|
void makeWindow( CInterfaceGroup *group );
|
||||||
|
|
||||||
|
// Remove a group from the windows list of its master group
|
||||||
|
void unMakeWindow( CInterfaceGroup *group, bool noWarning = false );
|
||||||
|
|
||||||
|
void setGlobalColor( NLMISC::CRGBA col );
|
||||||
|
NLMISC::CRGBA getGlobalColor() const{ return _GlobalColor; }
|
||||||
|
|
||||||
|
void setContentAlpha( uint8 alpha );
|
||||||
|
uint8 getContentAlpha() const{ return _ContentAlpha; }
|
||||||
|
|
||||||
|
NLMISC::CRGBA getGlobalColorForContent() const { return _GlobalColorForContent; }
|
||||||
|
void setGlobalColorForContent( NLMISC::CRGBA col ){ _GlobalColorForContent = col; }
|
||||||
|
void resetColorProps();
|
||||||
|
|
||||||
|
/// Get options by name
|
||||||
|
CInterfaceOptions* getOptions( const std::string &optName );
|
||||||
|
void addOptions( std::string name, CInterfaceOptions *options );
|
||||||
|
void removeOptions( std::string name );
|
||||||
|
void removeAllOptions();
|
||||||
|
|
||||||
|
static IParser *parser;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CWidgetManager();
|
||||||
|
~CWidgetManager();
|
||||||
|
|
||||||
|
static CWidgetManager *instance;
|
||||||
|
std::vector< SMasterGroup > _MasterGroups;
|
||||||
|
std::vector< SModalWndInfo > _ModalStack;
|
||||||
|
static std::string _CtrlLaunchingModalId;
|
||||||
|
NLMISC::CRefPtr< CCtrlBase > curContextHelp;
|
||||||
|
CViewPointerBase *_Pointer;
|
||||||
|
|
||||||
|
// Options description
|
||||||
|
std::map< std::string, NLMISC::CSmartPtr< CInterfaceOptions > > _OptionsMap;
|
||||||
|
|
||||||
|
NLMISC::CRefPtr< CInterfaceGroup > _WindowUnder;
|
||||||
|
|
||||||
|
// Capture
|
||||||
|
NLMISC::CRefPtr<CCtrlBase> _CaptureKeyboard;
|
||||||
|
NLMISC::CRefPtr<CCtrlBase> _OldCaptureKeyboard;
|
||||||
|
NLMISC::CRefPtr<CCtrlBase> _DefaultCaptureKeyboard;
|
||||||
|
NLMISC::CRefPtr<CCtrlBase> _CapturePointerLeft;
|
||||||
|
NLMISC::CRefPtr<CCtrlBase> _CapturePointerRight;
|
||||||
|
|
||||||
|
// What is under pointer
|
||||||
|
std::vector< CViewBase* > _ViewsUnderPointer;
|
||||||
|
std::vector< CCtrlBase* > _CtrlsUnderPointer;
|
||||||
|
std::vector< CInterfaceGroup* > _GroupsUnderPointer;
|
||||||
|
|
||||||
|
// view that should be notified from clock msg
|
||||||
|
std::vector<CCtrlBase*> _ClockMsgTargets;
|
||||||
|
|
||||||
|
NLMISC::CRGBA _GlobalColor;
|
||||||
|
NLMISC::CRGBA _GlobalColorForContent;
|
||||||
|
uint8 _ContentAlpha;
|
||||||
|
|
||||||
|
NLMISC::CCDBNodeLeaf *_RProp;
|
||||||
|
NLMISC::CCDBNodeLeaf *_GProp;
|
||||||
|
NLMISC::CCDBNodeLeaf *_BProp;
|
||||||
|
NLMISC::CCDBNodeLeaf *_AProp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
static CWidgetManager* getInstance();
|
|
||||||
static void release();
|
|
||||||
|
|
||||||
CInterfaceGroup* getMasterGroupFromId( const std::string &MasterGroupName );
|
|
||||||
std::vector< SMasterGroup > &getAllMasterGroup(){ return _MasterGroups; }
|
|
||||||
SMasterGroup& getMasterGroup( uint8 i ) { return _MasterGroups[ i ]; }
|
|
||||||
CInterfaceGroup* getWindowFromId( const std::string &groupId );
|
|
||||||
void addWindowToMasterGroup( const std::string &sMasterGroupName, CInterfaceGroup *pIG );
|
|
||||||
void removeWindowFromMasterGroup( const std::string &sMasterGroupName, CInterfaceGroup *pIG );
|
|
||||||
void removeAllMasterGroups();
|
|
||||||
|
|
||||||
void activateMasterGroup (const std::string &sMasterGroupName, bool bActive);
|
|
||||||
|
|
||||||
CInterfaceElement* getElementFromId( const std::string &sEltId );
|
|
||||||
CInterfaceElement* getElementFromId( const std::string &sStart, const std::string &sEltId );
|
|
||||||
|
|
||||||
/// Get the window from an element (ui:interface:###)
|
|
||||||
CInterfaceGroup* getWindow(CInterfaceElement*);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the top window
|
|
||||||
* \param win : pointer to the window to be set on top
|
|
||||||
*/
|
|
||||||
void setTopWindow (CInterfaceGroup *pWin);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the back window
|
|
||||||
* \param win : pointer to the window to be set on top
|
|
||||||
*/
|
|
||||||
void setBackWindow (CInterfaceGroup *pWin);
|
|
||||||
|
|
||||||
/** get the top window in the first activated masterGroup
|
|
||||||
*/
|
|
||||||
CInterfaceGroup* getTopWindow (uint8 nPriority = WIN_PRIORITY_NORMAL) const;
|
|
||||||
|
|
||||||
/** get the back window in the first activated masterGroup
|
|
||||||
*/
|
|
||||||
CInterfaceGroup* getBackWindow (uint8 nPriority = WIN_PRIORITY_NORMAL) const;
|
|
||||||
|
|
||||||
/** get the last escapable top window in the first activated masterGroup
|
|
||||||
*/
|
|
||||||
CInterfaceGroup* getLastEscapableTopWindow() const;
|
|
||||||
|
|
||||||
void setWindowPriority (CInterfaceGroup *pWin, uint8 nPriority);
|
|
||||||
|
|
||||||
/** return the priority of the Last Window setTopWindow()-ed.
|
|
||||||
*/
|
|
||||||
uint8 getLastTopWindowPriority() const;
|
|
||||||
|
|
||||||
bool hasModal() const;
|
|
||||||
|
|
||||||
SModalWndInfo& getModal();
|
|
||||||
|
|
||||||
bool isPreviousModal( CInterfaceGroup *wnd ) const;
|
|
||||||
|
|
||||||
void enableModalWindow (CCtrlBase *ctrlLaunchingModal, CInterfaceGroup *pIG);
|
|
||||||
void enableModalWindow (CCtrlBase *ctrlLaunchingModal, const std::string &groupName);
|
|
||||||
// Disable all modals windows
|
|
||||||
void disableModalWindow ();
|
|
||||||
|
|
||||||
/** Push a modal window that becomes the current modal window
|
|
||||||
*/
|
|
||||||
void pushModalWindow(CCtrlBase *ctrlLaunchingModal, CInterfaceGroup *pIG);
|
|
||||||
void pushModalWindow (CCtrlBase *ctrlLaunchingModal, const std::string &groupName);
|
|
||||||
void popModalWindow();
|
|
||||||
// pop all top modal windows with the given category (a string stored in the modal)
|
|
||||||
void popModalWindowCategory(const std::string &category);
|
|
||||||
|
|
||||||
CCtrlBase *getCtrlLaunchingModal ()
|
|
||||||
{
|
|
||||||
if (_ModalStack.empty()) return NULL;
|
|
||||||
return _ModalStack.back().CtrlLaunchingModal;
|
|
||||||
}
|
|
||||||
/// get the currently active modal window, or NULL if none
|
|
||||||
CInterfaceGroup *getModalWindow() const
|
|
||||||
{
|
|
||||||
if (_ModalStack.empty()) return NULL;
|
|
||||||
return _ModalStack.back().ModalWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCurContextHelp( CCtrlBase *curContextHelp ){ this->curContextHelp = curContextHelp; }
|
|
||||||
CCtrlBase* getCurContextHelp(){ return curContextHelp; }
|
|
||||||
|
|
||||||
float _DeltaTimeStopingContextHelp;
|
|
||||||
|
|
||||||
CViewPointerBase* getPointer(){ return _Pointer; }
|
|
||||||
void setPointer( CViewPointerBase *pointer ){ _Pointer = pointer; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the window under a spot
|
|
||||||
* \param : X coord of the spot
|
|
||||||
* \param : Y coord of the spot
|
|
||||||
* \return : pointer to the window
|
|
||||||
*/
|
|
||||||
CInterfaceGroup* getWindowUnder (sint32 x, sint32 y);
|
|
||||||
CInterfaceGroup* getCurrentWindowUnder() { return _WindowUnder; }
|
|
||||||
void setCurrentWindowUnder( CInterfaceGroup *group ){ _WindowUnder = group; }
|
|
||||||
CInterfaceGroup* getGroupUnder (sint32 x, sint32 y);
|
|
||||||
|
|
||||||
void getViewsUnder( sint32 x, sint32 y, std::vector< CViewBase* > &vVB );
|
|
||||||
void getCtrlsUnder( sint32 x, sint32 y, std::vector< CCtrlBase* > &vICL );
|
|
||||||
void getGroupsUnder (sint32 x, sint32 y, std::vector< CInterfaceGroup* > &vIGL );
|
|
||||||
|
|
||||||
const std::vector< CViewBase* >& getViewsUnderPointer(){ return _ViewsUnderPointer; }
|
|
||||||
const std::vector< CInterfaceGroup* >& getGroupsUnderPointer() { return _GroupsUnderPointer; }
|
|
||||||
const std::vector< CCtrlBase* >& getCtrlsUnderPointer() { return _CtrlsUnderPointer; }
|
|
||||||
|
|
||||||
//
|
|
||||||
void clearViewUnders(){ _ViewsUnderPointer.clear(); }
|
|
||||||
void clearGroupsUnders() { _GroupsUnderPointer.clear(); }
|
|
||||||
void clearCtrlsUnders() { _CtrlsUnderPointer.clear(); }
|
|
||||||
|
|
||||||
// Remove all references on a view (called when the ctrl is destroyed)
|
|
||||||
void removeRefOnView( CViewBase *ctrlBase );
|
|
||||||
|
|
||||||
// Remove all references on a ctrl (called when the ctrl is destroyed)
|
|
||||||
void removeRefOnCtrl (CCtrlBase *ctrlBase);
|
|
||||||
|
|
||||||
// Remove all references on a group (called when the group is destroyed)
|
|
||||||
void removeRefOnGroup (CInterfaceGroup *group);
|
|
||||||
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
void checkCoords();
|
|
||||||
// Relative move of pointer
|
|
||||||
void movePointer (sint32 dx, sint32 dy);
|
|
||||||
// Set absolute coordinates of pointer
|
|
||||||
void movePointerAbs(sint32 px, sint32 py);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Capture
|
|
||||||
*/
|
|
||||||
CCtrlBase *getCapturePointerLeft() { return _CapturePointerLeft; }
|
|
||||||
CCtrlBase *getCapturePointerRight() { return _CapturePointerRight; }
|
|
||||||
CCtrlBase *getCaptureKeyboard() { return _CaptureKeyboard; }
|
|
||||||
CCtrlBase *getOldCaptureKeyboard() { return _OldCaptureKeyboard; }
|
|
||||||
CCtrlBase *getDefaultCaptureKeyboard() { return _DefaultCaptureKeyboard; }
|
|
||||||
|
|
||||||
void setCapturePointerLeft(CCtrlBase *c);
|
|
||||||
void setCapturePointerRight(CCtrlBase *c);
|
|
||||||
void setOldCaptureKeyboard(CCtrlBase *c){ _OldCaptureKeyboard = c; }
|
|
||||||
// NB: setCaptureKeyboard(NULL) has not the same effect as resetCaptureKeyboard(). it allows the capture
|
|
||||||
// to come back to the last captured window (resetCaptureKeyboard() not)
|
|
||||||
void setCaptureKeyboard(CCtrlBase *c);
|
|
||||||
/** Set the default box to use when no keyboard has been previously captured
|
|
||||||
* The given dialog should be static
|
|
||||||
*/
|
|
||||||
void setDefaultCaptureKeyboard(CCtrlBase *c){ _DefaultCaptureKeyboard = c; }
|
|
||||||
|
|
||||||
void resetCaptureKeyboard();
|
|
||||||
|
|
||||||
// True if the keyboard is captured
|
|
||||||
bool isKeyboardCaptured() const {return _CaptureKeyboard!=NULL;}
|
|
||||||
|
|
||||||
// register a view that wants to be notified at each frame (receive the msg 'clocktick')
|
|
||||||
void registerClockMsgTarget(CCtrlBase *vb);
|
|
||||||
void unregisterClockMsgTarget(CCtrlBase *vb);
|
|
||||||
bool isClockMsgTarget(CCtrlBase *vb) const;
|
|
||||||
void sendClockTickEvent();
|
|
||||||
|
|
||||||
void notifyElementCaptured(CCtrlBase *c);
|
|
||||||
|
|
||||||
// Add a group into the windows list of its master goup
|
|
||||||
void makeWindow( CInterfaceGroup *group );
|
|
||||||
|
|
||||||
// Remove a group from the windows list of its master group
|
|
||||||
void unMakeWindow( CInterfaceGroup *group, bool noWarning = false );
|
|
||||||
|
|
||||||
void setGlobalColor( NLMISC::CRGBA col );
|
|
||||||
NLMISC::CRGBA getGlobalColor() const{ return _GlobalColor; }
|
|
||||||
|
|
||||||
void setContentAlpha( uint8 alpha );
|
|
||||||
uint8 getContentAlpha() const{ return _ContentAlpha; }
|
|
||||||
|
|
||||||
NLMISC::CRGBA getGlobalColorForContent() const { return _GlobalColorForContent; }
|
|
||||||
void setGlobalColorForContent( NLMISC::CRGBA col ){ _GlobalColorForContent = col; }
|
|
||||||
void resetColorProps();
|
|
||||||
|
|
||||||
/// Get options by name
|
|
||||||
CInterfaceOptions* getOptions( const std::string &optName );
|
|
||||||
void addOptions( std::string name, CInterfaceOptions *options );
|
|
||||||
void removeOptions( std::string name );
|
|
||||||
void removeAllOptions();
|
|
||||||
|
|
||||||
static IParser *parser;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CWidgetManager();
|
|
||||||
~CWidgetManager();
|
|
||||||
|
|
||||||
static CWidgetManager *instance;
|
|
||||||
std::vector< SMasterGroup > _MasterGroups;
|
|
||||||
std::vector< SModalWndInfo > _ModalStack;
|
|
||||||
static std::string _CtrlLaunchingModalId;
|
|
||||||
NLMISC::CRefPtr< CCtrlBase > curContextHelp;
|
|
||||||
CViewPointerBase *_Pointer;
|
|
||||||
|
|
||||||
// Options description
|
|
||||||
std::map< std::string, NLMISC::CSmartPtr< CInterfaceOptions > > _OptionsMap;
|
|
||||||
|
|
||||||
NLMISC::CRefPtr< CInterfaceGroup > _WindowUnder;
|
|
||||||
|
|
||||||
// Capture
|
|
||||||
NLMISC::CRefPtr<CCtrlBase> _CaptureKeyboard;
|
|
||||||
NLMISC::CRefPtr<CCtrlBase> _OldCaptureKeyboard;
|
|
||||||
NLMISC::CRefPtr<CCtrlBase> _DefaultCaptureKeyboard;
|
|
||||||
NLMISC::CRefPtr<CCtrlBase> _CapturePointerLeft;
|
|
||||||
NLMISC::CRefPtr<CCtrlBase> _CapturePointerRight;
|
|
||||||
|
|
||||||
// What is under pointer
|
|
||||||
std::vector< CViewBase* > _ViewsUnderPointer;
|
|
||||||
std::vector< CCtrlBase* > _CtrlsUnderPointer;
|
|
||||||
std::vector< CInterfaceGroup* > _GroupsUnderPointer;
|
|
||||||
|
|
||||||
// view that should be notified from clock msg
|
|
||||||
std::vector<CCtrlBase*> _ClockMsgTargets;
|
|
||||||
|
|
||||||
NLMISC::CRGBA _GlobalColor;
|
|
||||||
NLMISC::CRGBA _GlobalColorForContent;
|
|
||||||
uint8 _ContentAlpha;
|
|
||||||
|
|
||||||
NLMISC::CCDBNodeLeaf *_RProp;
|
|
||||||
NLMISC::CCDBNodeLeaf *_GProp;
|
|
||||||
NLMISC::CCDBNodeLeaf *_BProp;
|
|
||||||
NLMISC::CCDBNodeLeaf *_AProp;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,200 +24,204 @@
|
||||||
|
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
// ***************************************************************************
|
namespace NLGUI
|
||||||
CCtrlBase::~CCtrlBase()
|
|
||||||
{
|
{
|
||||||
CWidgetManager::getInstance()->removeRefOnCtrl (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CCtrlBase::handleEvent(const NLGUI::CEventDescriptor &event)
|
CCtrlBase::~CCtrlBase()
|
||||||
{
|
|
||||||
if (event.getType() == NLGUI::CEventDescriptor::system)
|
|
||||||
{
|
{
|
||||||
NLGUI::CEventDescriptorSystem &eds = (NLGUI::CEventDescriptorSystem&)event;
|
CWidgetManager::getInstance()->removeRefOnCtrl (this);
|
||||||
if (eds.getEventTypeExtended() == NLGUI::CEventDescriptorSystem::activecalledonparent)
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
bool CCtrlBase::handleEvent(const NLGUI::CEventDescriptor &event)
|
||||||
|
{
|
||||||
|
if (event.getType() == NLGUI::CEventDescriptor::system)
|
||||||
{
|
{
|
||||||
if (!((NLGUI::CEventDescriptorActiveCalledOnParent &) eds).getActive())
|
NLGUI::CEventDescriptorSystem &eds = (NLGUI::CEventDescriptorSystem&)event;
|
||||||
|
if (eds.getEventTypeExtended() == NLGUI::CEventDescriptorSystem::activecalledonparent)
|
||||||
{
|
{
|
||||||
// the mouse capture should be lost when the ctrl is hidden
|
if (!((NLGUI::CEventDescriptorActiveCalledOnParent &) eds).getActive())
|
||||||
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
|
|
||||||
{
|
{
|
||||||
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
|
// the mouse capture should be lost when the ctrl is hidden
|
||||||
|
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
|
||||||
|
{
|
||||||
|
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
|
||||||
|
}
|
||||||
|
if (CWidgetManager::getInstance()->getCapturePointerRight() == this)
|
||||||
|
{
|
||||||
|
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
|
||||||
|
}
|
||||||
|
// NB : don't call return here because derived class may be interested
|
||||||
|
// in handling event more speciffically
|
||||||
}
|
}
|
||||||
if (CWidgetManager::getInstance()->getCapturePointerRight() == this)
|
}
|
||||||
{
|
}
|
||||||
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
|
return false;
|
||||||
}
|
}
|
||||||
// NB : don't call return here because derived class may be interested
|
|
||||||
// in handling event more speciffically
|
// ***************************************************************************
|
||||||
|
bool CCtrlBase::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
|
{
|
||||||
|
if(!CViewBase::parse(cur, parentGroup))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CXMLAutoPtr prop;
|
||||||
|
|
||||||
|
// get static toolTip
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip" );
|
||||||
|
if (prop)
|
||||||
|
{
|
||||||
|
const char *propPtr = prop;
|
||||||
|
|
||||||
|
_ContextHelp = ucstring(propPtr);
|
||||||
|
|
||||||
|
if (strlen(propPtr) > 2)
|
||||||
|
{
|
||||||
|
if ((propPtr[0] == 'u') && (propPtr[1] == 'i'))
|
||||||
|
_ContextHelp = CI18N::get ((const char *) prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Force I18N tooltip
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_i18n" );
|
||||||
|
if ((bool)prop && strlen((const char*)prop)>0)
|
||||||
|
{
|
||||||
|
_ContextHelp = CI18N::get ((const char *) prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get dynamic toolTip ActionHandler
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"on_tooltip" );
|
||||||
|
if (prop)
|
||||||
|
{
|
||||||
|
_OnContextHelp= (const char*)prop;
|
||||||
|
}
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"on_tooltip_params" );
|
||||||
|
if (prop)
|
||||||
|
{
|
||||||
|
_OnContextHelpParams= (const char*)prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tooltip parent
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_parent" );
|
||||||
|
_ToolTipParent= TTCtrl;
|
||||||
|
if(prop)
|
||||||
|
{
|
||||||
|
if(stricmp((const char*)prop, "win")==0)
|
||||||
|
_ToolTipParent= TTWindow;
|
||||||
|
else if(stricmp((const char*)prop, "mouse")==0)
|
||||||
|
_ToolTipParent= TTMouse;
|
||||||
|
else if(stricmp((const char*)prop, "special")==0)
|
||||||
|
_ToolTipParent= TTSpecialWindow;
|
||||||
|
else
|
||||||
|
_ToolTipParent= TTCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tooltip special parent
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_special_parent" );
|
||||||
|
_ToolTipSpecialParent= CStringShared();
|
||||||
|
if(prop)
|
||||||
|
{
|
||||||
|
_ToolTipSpecialParent= std::string((const char*)prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tooltip posref
|
||||||
|
THotSpot tmpParentHS, tmpChildHS;
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_posref" );
|
||||||
|
convertTooltipHotSpot(prop, tmpParentHS, tmpChildHS);
|
||||||
|
_ToolTipParentPosRef= tmpParentHS;
|
||||||
|
_ToolTipPosRef= tmpChildHS;
|
||||||
|
|
||||||
|
// Alternative tooltip posref : this one will be chosen
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_posref_alt" );
|
||||||
|
convertTooltipHotSpot(prop, tmpParentHS, tmpChildHS);
|
||||||
|
_ToolTipParentPosRefAlt = tmpParentHS;
|
||||||
|
_ToolTipPosRefAlt = tmpChildHS;
|
||||||
|
|
||||||
|
// ToolTip instant
|
||||||
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"instant_help");
|
||||||
|
_ToolTipInstant= true;
|
||||||
|
if (prop) _ToolTipInstant = convertBool(prop);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CCtrlBase::convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS)
|
||||||
|
{
|
||||||
|
parentHS = Hotspot_TTAuto;
|
||||||
|
childHS = Hotspot_TTAuto;
|
||||||
|
if(prop)
|
||||||
|
{
|
||||||
|
const char *ptr= (const char*)prop;
|
||||||
|
if(stricmp(ptr, "auto")==0)
|
||||||
|
{
|
||||||
|
parentHS = Hotspot_TTAuto;
|
||||||
|
childHS = Hotspot_TTAuto;
|
||||||
|
}
|
||||||
|
// valid ref?
|
||||||
|
else if(strlen(ptr)>=5)
|
||||||
|
{
|
||||||
|
THotSpot parentPosRef;
|
||||||
|
THotSpot posRef;
|
||||||
|
CInterfaceElement::convertHotSpotCouple(ptr, parentPosRef, posRef);
|
||||||
|
parentHS = parentPosRef;
|
||||||
|
childHS = posRef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
bool CCtrlBase::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
|
||||||
{
|
|
||||||
if(!CViewBase::parse(cur, parentGroup))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CXMLAutoPtr prop;
|
// ***************************************************************************
|
||||||
|
bool CCtrlBase::emptyContextHelp() const
|
||||||
// get static toolTip
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip" );
|
|
||||||
if (prop)
|
|
||||||
{
|
{
|
||||||
const char *propPtr = prop;
|
ucstring help;
|
||||||
|
getContextHelp(help);
|
||||||
_ContextHelp = ucstring(propPtr);
|
std::string sTmp = _OnContextHelp;
|
||||||
|
return help.empty() && sTmp.empty();
|
||||||
if (strlen(propPtr) > 2)
|
|
||||||
{
|
|
||||||
if ((propPtr[0] == 'u') && (propPtr[1] == 'i'))
|
|
||||||
_ContextHelp = CI18N::get ((const char *) prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Force I18N tooltip
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_i18n" );
|
|
||||||
if ((bool)prop && strlen((const char*)prop)>0)
|
|
||||||
{
|
|
||||||
_ContextHelp = CI18N::get ((const char *) prop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get dynamic toolTip ActionHandler
|
// ***************************************************************************
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"on_tooltip" );
|
void CCtrlBase::visit(CInterfaceElementVisitor *visitor)
|
||||||
if (prop)
|
|
||||||
{
|
{
|
||||||
_OnContextHelp= (const char*)prop;
|
nlassert(visitor);
|
||||||
}
|
visitor->visitCtrl(this);
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"on_tooltip_params" );
|
CInterfaceElement::visit(visitor);
|
||||||
if (prop)
|
|
||||||
{
|
|
||||||
_OnContextHelpParams= (const char*)prop;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip parent
|
// ***************************************************************************
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_parent" );
|
void CCtrlBase::serial(NLMISC::IStream &f)
|
||||||
_ToolTipParent= TTCtrl;
|
|
||||||
if(prop)
|
|
||||||
{
|
{
|
||||||
if(stricmp((const char*)prop, "win")==0)
|
CViewBase::serial(f);
|
||||||
_ToolTipParent= TTWindow;
|
f.serial(_ContextHelp);
|
||||||
else if(stricmp((const char*)prop, "mouse")==0)
|
f.serial(_OnContextHelp);
|
||||||
_ToolTipParent= TTMouse;
|
f.serial(_OnContextHelpParams);
|
||||||
else if(stricmp((const char*)prop, "special")==0)
|
f.serial(_ToolTipSpecialParent);
|
||||||
_ToolTipParent= TTSpecialWindow;
|
f.serialEnum(_ToolTipParent);
|
||||||
else
|
//
|
||||||
_ToolTipParent= TTCtrl;
|
|
||||||
|
THotSpot tmpToolTipParentPosRef = _ToolTipParentPosRef;
|
||||||
|
THotSpot tmpToolTipPosRef = _ToolTipPosRef;
|
||||||
|
THotSpot tmpToolTipParentPosRefAlt = _ToolTipParentPosRefAlt;
|
||||||
|
THotSpot tmpToolTipPosRefAlt = _ToolTipPosRefAlt;
|
||||||
|
|
||||||
|
f.serialEnum(tmpToolTipParentPosRef);
|
||||||
|
f.serialEnum(tmpToolTipPosRef);
|
||||||
|
f.serialEnum(tmpToolTipParentPosRefAlt);
|
||||||
|
f.serialEnum(tmpToolTipPosRefAlt);
|
||||||
|
|
||||||
|
_ToolTipParentPosRef = tmpToolTipParentPosRef;
|
||||||
|
_ToolTipPosRef = tmpToolTipPosRef;
|
||||||
|
_ToolTipParentPosRefAlt = tmpToolTipParentPosRefAlt;
|
||||||
|
_ToolTipPosRefAlt = tmpToolTipPosRefAlt;
|
||||||
|
//
|
||||||
|
nlSerialBitBool(f, _ToolTipInstant);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip special parent
|
// ***************************************************************************
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_special_parent" );
|
std::string CCtrlBase::getContextHelpWindowName() const
|
||||||
_ToolTipSpecialParent= CStringShared();
|
|
||||||
if(prop)
|
|
||||||
{
|
{
|
||||||
_ToolTipSpecialParent= std::string((const char*)prop);
|
return "context_help";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip posref
|
|
||||||
THotSpot tmpParentHS, tmpChildHS;
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_posref" );
|
|
||||||
convertTooltipHotSpot(prop, tmpParentHS, tmpChildHS);
|
|
||||||
_ToolTipParentPosRef= tmpParentHS;
|
|
||||||
_ToolTipPosRef= tmpChildHS;
|
|
||||||
|
|
||||||
// Alternative tooltip posref : this one will be chosen
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"tooltip_posref_alt" );
|
|
||||||
convertTooltipHotSpot(prop, tmpParentHS, tmpChildHS);
|
|
||||||
_ToolTipParentPosRefAlt = tmpParentHS;
|
|
||||||
_ToolTipPosRefAlt = tmpChildHS;
|
|
||||||
|
|
||||||
// ToolTip instant
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"instant_help");
|
|
||||||
_ToolTipInstant= true;
|
|
||||||
if (prop) _ToolTipInstant = convertBool(prop);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CCtrlBase::convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS)
|
|
||||||
{
|
|
||||||
parentHS = Hotspot_TTAuto;
|
|
||||||
childHS = Hotspot_TTAuto;
|
|
||||||
if(prop)
|
|
||||||
{
|
|
||||||
const char *ptr= (const char*)prop;
|
|
||||||
if(stricmp(ptr, "auto")==0)
|
|
||||||
{
|
|
||||||
parentHS = Hotspot_TTAuto;
|
|
||||||
childHS = Hotspot_TTAuto;
|
|
||||||
}
|
|
||||||
// valid ref?
|
|
||||||
else if(strlen(ptr)>=5)
|
|
||||||
{
|
|
||||||
THotSpot parentPosRef;
|
|
||||||
THotSpot posRef;
|
|
||||||
CInterfaceElement::convertHotSpotCouple(ptr, parentPosRef, posRef);
|
|
||||||
parentHS = parentPosRef;
|
|
||||||
childHS = posRef;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
bool CCtrlBase::emptyContextHelp() const
|
|
||||||
{
|
|
||||||
ucstring help;
|
|
||||||
getContextHelp(help);
|
|
||||||
std::string sTmp = _OnContextHelp;
|
|
||||||
return help.empty() && sTmp.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CCtrlBase::visit(CInterfaceElementVisitor *visitor)
|
|
||||||
{
|
|
||||||
nlassert(visitor);
|
|
||||||
visitor->visitCtrl(this);
|
|
||||||
CInterfaceElement::visit(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CCtrlBase::serial(NLMISC::IStream &f)
|
|
||||||
{
|
|
||||||
CViewBase::serial(f);
|
|
||||||
f.serial(_ContextHelp);
|
|
||||||
f.serial(_OnContextHelp);
|
|
||||||
f.serial(_OnContextHelpParams);
|
|
||||||
f.serial(_ToolTipSpecialParent);
|
|
||||||
f.serialEnum(_ToolTipParent);
|
|
||||||
//
|
|
||||||
|
|
||||||
THotSpot tmpToolTipParentPosRef = _ToolTipParentPosRef;
|
|
||||||
THotSpot tmpToolTipPosRef = _ToolTipPosRef;
|
|
||||||
THotSpot tmpToolTipParentPosRefAlt = _ToolTipParentPosRefAlt;
|
|
||||||
THotSpot tmpToolTipPosRefAlt = _ToolTipPosRefAlt;
|
|
||||||
|
|
||||||
f.serialEnum(tmpToolTipParentPosRef);
|
|
||||||
f.serialEnum(tmpToolTipPosRef);
|
|
||||||
f.serialEnum(tmpToolTipParentPosRefAlt);
|
|
||||||
f.serialEnum(tmpToolTipPosRefAlt);
|
|
||||||
|
|
||||||
_ToolTipParentPosRef = tmpToolTipParentPosRef;
|
|
||||||
_ToolTipPosRef = tmpToolTipPosRef;
|
|
||||||
_ToolTipParentPosRefAlt = tmpToolTipParentPosRefAlt;
|
|
||||||
_ToolTipPosRefAlt = tmpToolTipPosRefAlt;
|
|
||||||
//
|
|
||||||
nlSerialBitBool(f, _ToolTipInstant);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
std::string CCtrlBase::getContextHelpWindowName() const
|
|
||||||
{
|
|
||||||
return "context_help";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,32 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "nel/gui/ctrl_draggable.h"
|
#include "nel/gui/ctrl_draggable.h"
|
||||||
|
|
||||||
CCtrlDraggable* CCtrlDraggable::_LastDraggedSheet = NULL;
|
namespace NLGUI
|
||||||
|
|
||||||
CCtrlDraggable::CCtrlDraggable(const TCtorParam ¶m) :
|
|
||||||
CCtrlBase( param )
|
|
||||||
{
|
{
|
||||||
dragged = false;
|
|
||||||
draggable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
CCtrlDraggable* CCtrlDraggable::_LastDraggedSheet = NULL;
|
||||||
|
|
||||||
|
CCtrlDraggable::CCtrlDraggable(const TCtorParam ¶m) :
|
||||||
|
CCtrlBase( param )
|
||||||
|
{
|
||||||
|
dragged = false;
|
||||||
|
draggable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,51 +16,57 @@
|
||||||
|
|
||||||
#include "nel/gui/ctrl_scroll_base.h"
|
#include "nel/gui/ctrl_scroll_base.h"
|
||||||
|
|
||||||
CCtrlScrollBase::CCtrlScrollBase( const TCtorParam ¶m ) :
|
namespace NLGUI
|
||||||
CCtrlBase( param )
|
|
||||||
{
|
{
|
||||||
_Target = NULL;
|
|
||||||
|
CCtrlScrollBase::CCtrlScrollBase( const TCtorParam ¶m ) :
|
||||||
|
CCtrlBase( param )
|
||||||
|
{
|
||||||
|
_Target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCtrlScrollBase::~CCtrlScrollBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCtrlScrollBase::setTarget( CInterfaceGroup *pIG )
|
||||||
|
{
|
||||||
|
// Necessary because it's supposed to be an abstract class,
|
||||||
|
// however reflection requires the class to be instantiated.
|
||||||
|
nlassert( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
sint32 CCtrlScrollBase::moveTrackX( sint32 dx )
|
||||||
|
{
|
||||||
|
// Necessary because it's supposed to be an abstract class,
|
||||||
|
// however reflection requires the class to be instantiated.
|
||||||
|
nlassert( false );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sint32 CCtrlScrollBase::moveTrackY( sint32 dy )
|
||||||
|
{
|
||||||
|
// Necessary because it's supposed to be an abstract class,
|
||||||
|
// however reflection requires the class to be instantiated.
|
||||||
|
nlassert( false );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCtrlScrollBase::moveTargetX( sint32 dx )
|
||||||
|
{
|
||||||
|
// Necessary because it's supposed to be an abstract class,
|
||||||
|
// however reflection requires the class to be instantiated.
|
||||||
|
nlassert( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCtrlScrollBase::moveTargetY( sint32 dy )
|
||||||
|
{
|
||||||
|
// Necessary because it's supposed to be an abstract class,
|
||||||
|
// however reflection requires the class to be instantiated.
|
||||||
|
nlassert( false );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCtrlScrollBase::~CCtrlScrollBase()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCtrlScrollBase::setTarget( CInterfaceGroup *pIG )
|
|
||||||
{
|
|
||||||
// Necessary because it's supposed to be an abstract class,
|
|
||||||
// however reflection requires the class to be instantiated.
|
|
||||||
nlassert( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
sint32 CCtrlScrollBase::moveTrackX( sint32 dx )
|
|
||||||
{
|
|
||||||
// Necessary because it's supposed to be an abstract class,
|
|
||||||
// however reflection requires the class to be instantiated.
|
|
||||||
nlassert( false );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sint32 CCtrlScrollBase::moveTrackY( sint32 dy )
|
|
||||||
{
|
|
||||||
// Necessary because it's supposed to be an abstract class,
|
|
||||||
// however reflection requires the class to be instantiated.
|
|
||||||
nlassert( false );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCtrlScrollBase::moveTargetX( sint32 dx )
|
|
||||||
{
|
|
||||||
// Necessary because it's supposed to be an abstract class,
|
|
||||||
// however reflection requires the class to be instantiated.
|
|
||||||
nlassert( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCtrlScrollBase::moveTargetY( sint32 dy )
|
|
||||||
{
|
|
||||||
// Necessary because it's supposed to be an abstract class,
|
|
||||||
// however reflection requires the class to be instantiated.
|
|
||||||
nlassert( false );
|
|
||||||
}
|
|
|
@ -17,76 +17,81 @@
|
||||||
|
|
||||||
#include "nel/gui/group_container_base.h"
|
#include "nel/gui/group_container_base.h"
|
||||||
|
|
||||||
CGroupContainerBase::CGroupContainerBase( const CViewBase::TCtorParam ¶m ) :
|
namespace NLGUI
|
||||||
CInterfaceGroup( param )
|
|
||||||
{
|
{
|
||||||
_ContentAlpha = 255;
|
|
||||||
_ContainerAlpha = 255;
|
CGroupContainerBase::CGroupContainerBase( const CViewBase::TCtorParam ¶m ) :
|
||||||
_RolloverAlphaContainer = 0;
|
CInterfaceGroup( param )
|
||||||
_RolloverAlphaContent = 0;
|
{
|
||||||
_Locked = false;
|
_ContentAlpha = 255;
|
||||||
_UseGlobalAlpha = true;
|
_ContainerAlpha = 255;
|
||||||
}
|
_RolloverAlphaContainer = 0;
|
||||||
|
_RolloverAlphaContent = 0;
|
||||||
CGroupContainerBase::~CGroupContainerBase()
|
_Locked = false;
|
||||||
{
|
_UseGlobalAlpha = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGroupContainerBase::removeAllContainers()
|
CGroupContainerBase::~CGroupContainerBase()
|
||||||
{
|
{
|
||||||
// Necessary because it's supposed to be an abstract class,
|
}
|
||||||
// however reflection requires the class to be instantiated.
|
|
||||||
nlassert( false );
|
void CGroupContainerBase::removeAllContainers()
|
||||||
}
|
{
|
||||||
|
// Necessary because it's supposed to be an abstract class,
|
||||||
void CGroupContainerBase::setLocked( bool locked )
|
// however reflection requires the class to be instantiated.
|
||||||
{
|
nlassert( false );
|
||||||
// Necessary because it's supposed to be an abstract class,
|
}
|
||||||
// however reflection requires the class to be instantiated.
|
|
||||||
nlassert( false );
|
void CGroupContainerBase::setLocked( bool locked )
|
||||||
}
|
{
|
||||||
|
// Necessary because it's supposed to be an abstract class,
|
||||||
|
// however reflection requires the class to be instantiated.
|
||||||
// ***************************************************************************
|
nlassert( false );
|
||||||
void CGroupContainerBase::triggerAlphaSettingsChangedAH()
|
}
|
||||||
{
|
|
||||||
if (_AHOnAlphaSettingsChanged != NULL)
|
|
||||||
CAHManager::getInstance()->runActionHandler(_AHOnAlphaSettingsChanged, this, _AHOnAlphaSettingsChangedParams);
|
// ***************************************************************************
|
||||||
}
|
void CGroupContainerBase::triggerAlphaSettingsChangedAH()
|
||||||
|
{
|
||||||
|
if (_AHOnAlphaSettingsChanged != NULL)
|
||||||
// ***************************************************************************
|
CAHManager::getInstance()->runActionHandler(_AHOnAlphaSettingsChanged, this, _AHOnAlphaSettingsChangedParams);
|
||||||
void CGroupContainerBase::setUseGlobalAlpha(bool use)
|
}
|
||||||
{
|
|
||||||
_UseGlobalAlpha = use;
|
|
||||||
triggerAlphaSettingsChangedAH();
|
// ***************************************************************************
|
||||||
}
|
void CGroupContainerBase::setUseGlobalAlpha(bool use)
|
||||||
|
{
|
||||||
// ***************************************************************************
|
_UseGlobalAlpha = use;
|
||||||
void CGroupContainerBase::setContainerAlpha(uint8 alpha)
|
triggerAlphaSettingsChangedAH();
|
||||||
{
|
}
|
||||||
_ContainerAlpha = alpha;
|
|
||||||
triggerAlphaSettingsChangedAH();
|
// ***************************************************************************
|
||||||
}
|
void CGroupContainerBase::setContainerAlpha(uint8 alpha)
|
||||||
|
{
|
||||||
// ***************************************************************************
|
_ContainerAlpha = alpha;
|
||||||
void CGroupContainerBase::setContentAlpha(uint8 alpha)
|
triggerAlphaSettingsChangedAH();
|
||||||
{
|
}
|
||||||
_ContentAlpha = alpha;
|
|
||||||
triggerAlphaSettingsChangedAH();
|
// ***************************************************************************
|
||||||
}
|
void CGroupContainerBase::setContentAlpha(uint8 alpha)
|
||||||
|
{
|
||||||
// ***************************************************************************
|
_ContentAlpha = alpha;
|
||||||
void CGroupContainerBase::setRolloverAlphaContent(uint8 alpha)
|
triggerAlphaSettingsChangedAH();
|
||||||
{
|
}
|
||||||
_RolloverAlphaContent = alpha;
|
|
||||||
triggerAlphaSettingsChangedAH();
|
// ***************************************************************************
|
||||||
}
|
void CGroupContainerBase::setRolloverAlphaContent(uint8 alpha)
|
||||||
|
{
|
||||||
// ***************************************************************************
|
_RolloverAlphaContent = alpha;
|
||||||
void CGroupContainerBase::setRolloverAlphaContainer(uint8 alpha)
|
triggerAlphaSettingsChangedAH();
|
||||||
{
|
}
|
||||||
_RolloverAlphaContainer = alpha;
|
|
||||||
triggerAlphaSettingsChangedAH();
|
// ***************************************************************************
|
||||||
|
void CGroupContainerBase::setRolloverAlphaContainer(uint8 alpha)
|
||||||
|
{
|
||||||
|
_RolloverAlphaContainer = alpha;
|
||||||
|
triggerAlphaSettingsChangedAH();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,36 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "nel/gui/group_editbox_base.h"
|
#include "nel/gui/group_editbox_base.h"
|
||||||
|
|
||||||
CGroupEditBoxBase *CGroupEditBoxBase::_CurrSelection = NULL;
|
namespace NLGUI
|
||||||
|
|
||||||
CGroupEditBoxBase::CGroupEditBoxBase( const TCtorParam ¶m ) :
|
|
||||||
CInterfaceGroup( param )
|
|
||||||
{
|
|
||||||
_RecoverFocusOnEnter = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGroupEditBoxBase::~CGroupEditBoxBase()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CGroupEditBoxBase *CGroupEditBoxBase::_CurrSelection = NULL;
|
||||||
|
|
||||||
|
CGroupEditBoxBase::CGroupEditBoxBase( const TCtorParam ¶m ) :
|
||||||
|
CInterfaceGroup( param )
|
||||||
|
{
|
||||||
|
_RecoverFocusOnEnter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGroupEditBoxBase::~CGroupEditBoxBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,226 +24,232 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
NLMISC_REGISTER_OBJECT(CViewBase, CGroupFrame, std::string, "frame");
|
namespace NLGUI
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
vector<CGroupFrame::SDisplayType> CGroupFrame::_DispTypes;
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
CGroupFrame::CGroupFrame(const TCtorParam ¶m)
|
|
||||||
: CInterfaceGroup(param)
|
|
||||||
{
|
{
|
||||||
_DisplayFrame = true;
|
|
||||||
_Color = CRGBA(255,255,255,255);
|
|
||||||
_DispType = 0;
|
|
||||||
_DisplayFrameDefined= false;
|
|
||||||
_ColorDefined= false;
|
|
||||||
_DispTypeDefined= false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
NLMISC_REGISTER_OBJECT(CViewBase, CGroupFrame, std::string, "frame");
|
||||||
bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
|
||||||
{
|
|
||||||
if(!CInterfaceGroup::parse(cur, parentGroup))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// display
|
// ***************************************************************************
|
||||||
CXMLAutoPtr ptr((const char*) xmlGetProp (cur, (xmlChar*)"display"));
|
vector<CGroupFrame::SDisplayType> CGroupFrame::_DispTypes;
|
||||||
_DisplayFrame = true;
|
|
||||||
_DisplayFrameDefined= false;
|
// ***************************************************************************
|
||||||
if (ptr)
|
CGroupFrame::CGroupFrame(const TCtorParam ¶m)
|
||||||
|
: CInterfaceGroup(param)
|
||||||
{
|
{
|
||||||
_DisplayFrame = convertBool (ptr);
|
_DisplayFrame = true;
|
||||||
_DisplayFrameDefined= true;
|
_Color = CRGBA(255,255,255,255);
|
||||||
|
_DispType = 0;
|
||||||
|
_DisplayFrameDefined= false;
|
||||||
|
_ColorDefined= false;
|
||||||
|
_DispTypeDefined= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// color
|
// ***************************************************************************
|
||||||
ptr = (char*) xmlGetProp( cur, (xmlChar*)"color" );
|
bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
_Color = CRGBA(255,255,255,255);
|
|
||||||
_ColorDefined= false;
|
|
||||||
if (ptr)
|
|
||||||
{
|
{
|
||||||
_Color = convertColor (ptr);
|
if(!CInterfaceGroup::parse(cur, parentGroup))
|
||||||
_ColorDefined= true;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// Get the borders texture
|
// display
|
||||||
_DispTypeDefined= false;
|
CXMLAutoPtr ptr((const char*) xmlGetProp (cur, (xmlChar*)"display"));
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
_DisplayFrame = true;
|
||||||
|
_DisplayFrameDefined= false;
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
_DisplayFrame = convertBool (ptr);
|
||||||
|
_DisplayFrameDefined= true;
|
||||||
|
}
|
||||||
|
|
||||||
ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
|
// color
|
||||||
CInterfaceOptions *pIO = NULL;
|
ptr = (char*) xmlGetProp( cur, (xmlChar*)"color" );
|
||||||
|
_Color = CRGBA(255,255,255,255);
|
||||||
|
_ColorDefined= false;
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
_Color = convertColor (ptr);
|
||||||
|
_ColorDefined= true;
|
||||||
|
}
|
||||||
|
|
||||||
if (ptr)
|
// Get the borders texture
|
||||||
pIO = CWidgetManager::getInstance()->getOptions(ptr);
|
_DispTypeDefined= false;
|
||||||
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
|
|
||||||
// The first type in display type struct is the default display type
|
ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
|
||||||
if (_DispTypes.size() == 0)
|
CInterfaceOptions *pIO = NULL;
|
||||||
{
|
|
||||||
SDisplayType dt;
|
|
||||||
dt.Name = "default";
|
|
||||||
// get texture ids.
|
|
||||||
dt.BorderIds[TextTL]= rVR.getTextureIdFromName ("w_modal_tl.tga");
|
|
||||||
dt.BorderIds[TextTM]= rVR.getTextureIdFromName ("w_modal_t.tga");
|
|
||||||
dt.BorderIds[TextTR]= rVR.getTextureIdFromName ("w_modal_tr.tga");
|
|
||||||
// middle
|
|
||||||
dt.BorderIds[TextML]= rVR.getTextureIdFromName ("w_modal_l.tga");
|
|
||||||
dt.BorderIds[TextMM]= rVR.getTextureIdFromName ("w_modal_blank.tga");
|
|
||||||
dt.BorderIds[TextMR]= rVR.getTextureIdFromName ("w_modal_r.tga");
|
|
||||||
// bottom
|
|
||||||
dt.BorderIds[TextBL]= rVR.getTextureIdFromName ("w_modal_bl.tga");
|
|
||||||
dt.BorderIds[TextBM]= rVR.getTextureIdFromName ("w_modal_b.tga");
|
|
||||||
dt.BorderIds[TextBR]= rVR.getTextureIdFromName ("w_modal_br.tga");
|
|
||||||
// get size
|
|
||||||
rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
|
|
||||||
rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
|
|
||||||
_DispTypes.push_back(dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pIO != NULL)
|
if (ptr)
|
||||||
{
|
pIO = CWidgetManager::getInstance()->getOptions(ptr);
|
||||||
_DispTypeDefined= true;
|
|
||||||
|
|
||||||
// Look if we find the type...
|
// The first type in display type struct is the default display type
|
||||||
uint32 i;
|
if (_DispTypes.size() == 0)
|
||||||
for (i = 0; i < _DispTypes.size(); ++i)
|
|
||||||
if (_DispTypes[i].Name == string((const char*)ptr))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == _DispTypes.size())
|
|
||||||
{
|
{
|
||||||
SDisplayType dt;
|
SDisplayType dt;
|
||||||
dt.Name = string((const char*)ptr);
|
dt.Name = "default";
|
||||||
// get texture ids.
|
// get texture ids.
|
||||||
dt.BorderIds[TextTL]= rVR.getTextureIdFromName (pIO->getValStr("tx_tl"));
|
dt.BorderIds[TextTL]= rVR.getTextureIdFromName ("w_modal_tl.tga");
|
||||||
dt.BorderIds[TextTM]= rVR.getTextureIdFromName (pIO->getValStr("tx_t"));
|
dt.BorderIds[TextTM]= rVR.getTextureIdFromName ("w_modal_t.tga");
|
||||||
dt.BorderIds[TextTR]= rVR.getTextureIdFromName (pIO->getValStr("tx_tr"));
|
dt.BorderIds[TextTR]= rVR.getTextureIdFromName ("w_modal_tr.tga");
|
||||||
// middle
|
// middle
|
||||||
dt.BorderIds[TextML]= rVR.getTextureIdFromName (pIO->getValStr("tx_l"));
|
dt.BorderIds[TextML]= rVR.getTextureIdFromName ("w_modal_l.tga");
|
||||||
dt.BorderIds[TextMM]= rVR.getTextureIdFromName (pIO->getValStr("tx_blank"));
|
dt.BorderIds[TextMM]= rVR.getTextureIdFromName ("w_modal_blank.tga");
|
||||||
dt.BorderIds[TextMR]= rVR.getTextureIdFromName (pIO->getValStr("tx_r"));
|
dt.BorderIds[TextMR]= rVR.getTextureIdFromName ("w_modal_r.tga");
|
||||||
// bottom
|
// bottom
|
||||||
dt.BorderIds[TextBL]= rVR.getTextureIdFromName (pIO->getValStr("tx_bl"));
|
dt.BorderIds[TextBL]= rVR.getTextureIdFromName ("w_modal_bl.tga");
|
||||||
dt.BorderIds[TextBM]= rVR.getTextureIdFromName (pIO->getValStr("tx_b"));
|
dt.BorderIds[TextBM]= rVR.getTextureIdFromName ("w_modal_b.tga");
|
||||||
dt.BorderIds[TextBR]= rVR.getTextureIdFromName (pIO->getValStr("tx_br"));
|
dt.BorderIds[TextBR]= rVR.getTextureIdFromName ("w_modal_br.tga");
|
||||||
|
|
||||||
// Tile
|
|
||||||
dt.TileBorder[TextTM] = (uint8)pIO->getValSInt32("tile_t");
|
|
||||||
dt.TileBorder[TextML] = (uint8)pIO->getValSInt32("tile_l");
|
|
||||||
dt.TileBorder[TextMM] = (uint8)pIO->getValSInt32("tile_blank");
|
|
||||||
dt.TileBorder[TextMR] = (uint8)pIO->getValSInt32("tile_r");
|
|
||||||
dt.TileBorder[TextBM] = (uint8)pIO->getValSInt32("tile_b");
|
|
||||||
|
|
||||||
// get size
|
// get size
|
||||||
rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
|
rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
|
||||||
rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
|
rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
|
||||||
_DispTypes.push_back(dt);
|
_DispTypes.push_back(dt);
|
||||||
}
|
}
|
||||||
_DispType = (uint8)i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_DispType = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (pIO != NULL)
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CGroupFrame::draw ()
|
|
||||||
{
|
|
||||||
if (_DisplayFrame)
|
|
||||||
{
|
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
||||||
|
|
||||||
// get global color
|
|
||||||
CRGBA col;
|
|
||||||
if(getModulateGlobalColor())
|
|
||||||
col.modulateFromColor( _Color, CWidgetManager::getInstance()->getGlobalColor() );
|
|
||||||
else
|
|
||||||
col= _Color;
|
|
||||||
|
|
||||||
// draw the background
|
|
||||||
sint xId = 0, yId = 0;
|
|
||||||
for (yId = 0; yId < 3; yId++)
|
|
||||||
{
|
{
|
||||||
for (xId = 0; xId < 3; xId++)
|
_DispTypeDefined= true;
|
||||||
|
|
||||||
|
// Look if we find the type...
|
||||||
|
uint32 i;
|
||||||
|
for (i = 0; i < _DispTypes.size(); ++i)
|
||||||
|
if (_DispTypes[i].Name == string((const char*)ptr))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == _DispTypes.size())
|
||||||
{
|
{
|
||||||
sint32 x = _XReal;
|
SDisplayType dt;
|
||||||
sint32 y = _YReal;
|
dt.Name = string((const char*)ptr);
|
||||||
sint32 w, h;
|
// get texture ids.
|
||||||
// top
|
dt.BorderIds[TextTL]= rVR.getTextureIdFromName (pIO->getValStr("tx_tl"));
|
||||||
if (yId == 0)
|
dt.BorderIds[TextTM]= rVR.getTextureIdFromName (pIO->getValStr("tx_t"));
|
||||||
{
|
dt.BorderIds[TextTR]= rVR.getTextureIdFromName (pIO->getValStr("tx_tr"));
|
||||||
y += _HReal-_DispTypes[_DispType].TopBorder;
|
// middle
|
||||||
h = _DispTypes[_DispType].TopBorder;
|
dt.BorderIds[TextML]= rVR.getTextureIdFromName (pIO->getValStr("tx_l"));
|
||||||
}
|
dt.BorderIds[TextMM]= rVR.getTextureIdFromName (pIO->getValStr("tx_blank"));
|
||||||
// Middle
|
dt.BorderIds[TextMR]= rVR.getTextureIdFromName (pIO->getValStr("tx_r"));
|
||||||
else if (yId == 1)
|
// bottom
|
||||||
{
|
dt.BorderIds[TextBL]= rVR.getTextureIdFromName (pIO->getValStr("tx_bl"));
|
||||||
y += _DispTypes[_DispType].BottomBorder;
|
dt.BorderIds[TextBM]= rVR.getTextureIdFromName (pIO->getValStr("tx_b"));
|
||||||
h = _HReal-_DispTypes[_DispType].TopBorder-_DispTypes[_DispType].BottomBorder;
|
dt.BorderIds[TextBR]= rVR.getTextureIdFromName (pIO->getValStr("tx_br"));
|
||||||
}
|
|
||||||
// Bottom
|
|
||||||
else
|
|
||||||
{
|
|
||||||
h = _DispTypes[_DispType].BottomBorder;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Left
|
// Tile
|
||||||
if (xId == 0)
|
dt.TileBorder[TextTM] = (uint8)pIO->getValSInt32("tile_t");
|
||||||
{
|
dt.TileBorder[TextML] = (uint8)pIO->getValSInt32("tile_l");
|
||||||
w = _DispTypes[_DispType].LeftBorder;
|
dt.TileBorder[TextMM] = (uint8)pIO->getValSInt32("tile_blank");
|
||||||
}
|
dt.TileBorder[TextMR] = (uint8)pIO->getValSInt32("tile_r");
|
||||||
else if (xId == 1)
|
dt.TileBorder[TextBM] = (uint8)pIO->getValSInt32("tile_b");
|
||||||
{
|
|
||||||
x += _DispTypes[_DispType].LeftBorder;
|
|
||||||
w = _WReal-_DispTypes[_DispType].LeftBorder-_DispTypes[_DispType].RightBorder;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x += _WReal-_DispTypes[_DispType].RightBorder;
|
|
||||||
w = _DispTypes[_DispType].RightBorder;
|
|
||||||
}
|
|
||||||
|
|
||||||
// render
|
// get size
|
||||||
uint8 tile = _DispTypes[_DispType].TileBorder[yId*3+xId];
|
rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
|
||||||
if (tile == 0)
|
rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
|
||||||
rVR.drawRotFlipBitmap (_RenderLayer, x, y, w, h, 0, false, _DispTypes[_DispType].BorderIds[yId*3+xId], col);
|
_DispTypes.push_back(dt);
|
||||||
else
|
}
|
||||||
rVR.drawRotFlipBitmapTiled (_RenderLayer, x, y, w, h, 0, false, _DispTypes[_DispType].BorderIds[yId*3+xId], tile-1, col);
|
_DispType = (uint8)i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_DispType = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CGroupFrame::draw ()
|
||||||
|
{
|
||||||
|
if (_DisplayFrame)
|
||||||
|
{
|
||||||
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
|
|
||||||
|
// get global color
|
||||||
|
CRGBA col;
|
||||||
|
if(getModulateGlobalColor())
|
||||||
|
col.modulateFromColor( _Color, CWidgetManager::getInstance()->getGlobalColor() );
|
||||||
|
else
|
||||||
|
col= _Color;
|
||||||
|
|
||||||
|
// draw the background
|
||||||
|
sint xId = 0, yId = 0;
|
||||||
|
for (yId = 0; yId < 3; yId++)
|
||||||
|
{
|
||||||
|
for (xId = 0; xId < 3; xId++)
|
||||||
|
{
|
||||||
|
sint32 x = _XReal;
|
||||||
|
sint32 y = _YReal;
|
||||||
|
sint32 w, h;
|
||||||
|
// top
|
||||||
|
if (yId == 0)
|
||||||
|
{
|
||||||
|
y += _HReal-_DispTypes[_DispType].TopBorder;
|
||||||
|
h = _DispTypes[_DispType].TopBorder;
|
||||||
|
}
|
||||||
|
// Middle
|
||||||
|
else if (yId == 1)
|
||||||
|
{
|
||||||
|
y += _DispTypes[_DispType].BottomBorder;
|
||||||
|
h = _HReal-_DispTypes[_DispType].TopBorder-_DispTypes[_DispType].BottomBorder;
|
||||||
|
}
|
||||||
|
// Bottom
|
||||||
|
else
|
||||||
|
{
|
||||||
|
h = _DispTypes[_DispType].BottomBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Left
|
||||||
|
if (xId == 0)
|
||||||
|
{
|
||||||
|
w = _DispTypes[_DispType].LeftBorder;
|
||||||
|
}
|
||||||
|
else if (xId == 1)
|
||||||
|
{
|
||||||
|
x += _DispTypes[_DispType].LeftBorder;
|
||||||
|
w = _WReal-_DispTypes[_DispType].LeftBorder-_DispTypes[_DispType].RightBorder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += _WReal-_DispTypes[_DispType].RightBorder;
|
||||||
|
w = _DispTypes[_DispType].RightBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
// render
|
||||||
|
uint8 tile = _DispTypes[_DispType].TileBorder[yId*3+xId];
|
||||||
|
if (tile == 0)
|
||||||
|
rVR.drawRotFlipBitmap (_RenderLayer, x, y, w, h, 0, false, _DispTypes[_DispType].BorderIds[yId*3+xId], col);
|
||||||
|
else
|
||||||
|
rVR.drawRotFlipBitmapTiled (_RenderLayer, x, y, w, h, 0, false, _DispTypes[_DispType].BorderIds[yId*3+xId], tile-1, col);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// draw the components
|
||||||
|
CInterfaceGroup::draw();
|
||||||
}
|
}
|
||||||
// draw the components
|
|
||||||
CInterfaceGroup::draw();
|
// ***************************************************************************
|
||||||
|
void CGroupFrame::copyOptionFrom(const CGroupFrame &other)
|
||||||
|
{
|
||||||
|
CInterfaceGroup::copyOptionFrom(other);
|
||||||
|
|
||||||
|
// Copy option only if they were not explicitly defined in xml
|
||||||
|
if(!_DisplayFrameDefined)
|
||||||
|
_DisplayFrame = other._DisplayFrame;
|
||||||
|
if(!_ColorDefined)
|
||||||
|
_Color = other._Color;
|
||||||
|
if(!_DispTypeDefined)
|
||||||
|
_DispType = other._DispType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CGroupFrame::setColorAsString(const string & col)
|
||||||
|
{
|
||||||
|
_Color = convertColor (col.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
string CGroupFrame::getColorAsString() const
|
||||||
|
{
|
||||||
|
return NLMISC::toString(_Color.R) + " " + NLMISC::toString(_Color.G) + " " + NLMISC::toString(_Color.B) + " " + NLMISC::toString(_Color.A);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CGroupFrame::copyOptionFrom(const CGroupFrame &other)
|
|
||||||
{
|
|
||||||
CInterfaceGroup::copyOptionFrom(other);
|
|
||||||
|
|
||||||
// Copy option only if they were not explicitly defined in xml
|
|
||||||
if(!_DisplayFrameDefined)
|
|
||||||
_DisplayFrame = other._DisplayFrame;
|
|
||||||
if(!_ColorDefined)
|
|
||||||
_Color = other._Color;
|
|
||||||
if(!_DispTypeDefined)
|
|
||||||
_DispType = other._DispType;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CGroupFrame::setColorAsString(const string & col)
|
|
||||||
{
|
|
||||||
_Color = convertColor (col.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
string CGroupFrame::getColorAsString() const
|
|
||||||
{
|
|
||||||
return NLMISC::toString(_Color.R) + " " + NLMISC::toString(_Color.G) + " " + NLMISC::toString(_Color.B) + " " + NLMISC::toString(_Color.A);
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,156 +20,159 @@
|
||||||
#include "nel/gui/interface_element.h"
|
#include "nel/gui/interface_element.h"
|
||||||
#include "nel/misc/xml_auto_ptr.h"
|
#include "nel/misc/xml_auto_ptr.h"
|
||||||
#include "nel/gui/view_renderer.h"
|
#include "nel/gui/view_renderer.h"
|
||||||
|
#include "nel/misc/i_xml.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "nel/misc/i_xml.h"
|
namespace NLGUI
|
||||||
|
|
||||||
NLMISC_REGISTER_OBJECT(CViewBase, CGroupModal, std::string, "modal");
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
CGroupModal::CGroupModal(const TCtorParam ¶m)
|
|
||||||
: CGroupFrame(param)
|
|
||||||
{
|
{
|
||||||
SpawnOnMousePos= true;
|
|
||||||
ExitClickOut= true;
|
|
||||||
ExitClickL= false;
|
|
||||||
ExitClickR= false;
|
|
||||||
ExitKeyPushed = false;
|
|
||||||
ForceInsideScreen= false;
|
|
||||||
SpawnMouseX= SpawnMouseY= 0;
|
|
||||||
_MouseDeltaX= _MouseDeltaY= 0;
|
|
||||||
//By default, modal are escapable
|
|
||||||
_Escapable= true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
NLMISC_REGISTER_OBJECT(CViewBase, CGroupModal, std::string, "modal");
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CGroupModal::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
CGroupModal::CGroupModal(const TCtorParam ¶m)
|
||||||
{
|
: CGroupFrame(param)
|
||||||
if(!CGroupFrame::parse(cur, parentGroup))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// read modal option
|
|
||||||
CXMLAutoPtr prop;
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"mouse_pos");
|
|
||||||
if ( prop ) SpawnOnMousePos= convertBool(prop);
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"exit_click_out");
|
|
||||||
if ( prop ) ExitClickOut= convertBool(prop);
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"exit_click_l");
|
|
||||||
if ( prop ) ExitClickL= convertBool(prop);
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"exit_click_r");
|
|
||||||
if ( prop ) ExitClickR= convertBool(prop);
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"exit_click_b");
|
|
||||||
if ( prop ) ExitClickR= ExitClickL= convertBool(prop);
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"force_inside_screen");
|
|
||||||
if ( prop ) ForceInsideScreen= convertBool(prop);
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"category");
|
|
||||||
if ( prop ) Category= (const char *) prop;
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"onclick_out");
|
|
||||||
if ( prop ) OnClickOut = (const char *) prop;
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"onclick_out_params");
|
|
||||||
if ( prop ) OnClickOutParams = (const char *) prop;
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out");
|
|
||||||
if ( prop ) OnPostClickOut = (const char *) prop;
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out_params");
|
|
||||||
if ( prop ) OnPostClickOutParams = (const char *) prop;
|
|
||||||
prop = xmlGetProp (cur, (xmlChar*)"exit_key_pushed");
|
|
||||||
if ( prop ) ExitKeyPushed= convertBool(prop);
|
|
||||||
|
|
||||||
// Force parent hotspot for spawn on mouse
|
|
||||||
if(SpawnOnMousePos)
|
|
||||||
setParentPosRef(Hotspot_BL);
|
|
||||||
|
|
||||||
// bkup x/y as the deltas.
|
|
||||||
_MouseDeltaX= getX();
|
|
||||||
_MouseDeltaY= getY();
|
|
||||||
|
|
||||||
// Modals are disabled by default
|
|
||||||
_Active = false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CGroupModal::updateCoords ()
|
|
||||||
{
|
|
||||||
// if snap to mouse pos.
|
|
||||||
if(SpawnOnMousePos)
|
|
||||||
{
|
{
|
||||||
// Special for menu for instance: If the size is bigger or equal to the screen, keep 0, because will be clipped just after
|
SpawnOnMousePos= true;
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
ExitClickOut= true;
|
||||||
uint32 w,h;
|
ExitClickL= false;
|
||||||
rVR.getScreenSize(w,h);
|
ExitClickR= false;
|
||||||
if(_W>=(sint32)w && _H>=(sint32)h)
|
ExitKeyPushed = false;
|
||||||
|
ForceInsideScreen= false;
|
||||||
|
SpawnMouseX= SpawnMouseY= 0;
|
||||||
|
_MouseDeltaX= _MouseDeltaY= 0;
|
||||||
|
//By default, modal are escapable
|
||||||
|
_Escapable= true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
bool CGroupModal::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
|
{
|
||||||
|
if(!CGroupFrame::parse(cur, parentGroup))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// read modal option
|
||||||
|
CXMLAutoPtr prop;
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"mouse_pos");
|
||||||
|
if ( prop ) SpawnOnMousePos= convertBool(prop);
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"exit_click_out");
|
||||||
|
if ( prop ) ExitClickOut= convertBool(prop);
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"exit_click_l");
|
||||||
|
if ( prop ) ExitClickL= convertBool(prop);
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"exit_click_r");
|
||||||
|
if ( prop ) ExitClickR= convertBool(prop);
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"exit_click_b");
|
||||||
|
if ( prop ) ExitClickR= ExitClickL= convertBool(prop);
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"force_inside_screen");
|
||||||
|
if ( prop ) ForceInsideScreen= convertBool(prop);
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"category");
|
||||||
|
if ( prop ) Category= (const char *) prop;
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"onclick_out");
|
||||||
|
if ( prop ) OnClickOut = (const char *) prop;
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"onclick_out_params");
|
||||||
|
if ( prop ) OnClickOutParams = (const char *) prop;
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out");
|
||||||
|
if ( prop ) OnPostClickOut = (const char *) prop;
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out_params");
|
||||||
|
if ( prop ) OnPostClickOutParams = (const char *) prop;
|
||||||
|
prop = xmlGetProp (cur, (xmlChar*)"exit_key_pushed");
|
||||||
|
if ( prop ) ExitKeyPushed= convertBool(prop);
|
||||||
|
|
||||||
|
// Force parent hotspot for spawn on mouse
|
||||||
|
if(SpawnOnMousePos)
|
||||||
|
setParentPosRef(Hotspot_BL);
|
||||||
|
|
||||||
|
// bkup x/y as the deltas.
|
||||||
|
_MouseDeltaX= getX();
|
||||||
|
_MouseDeltaY= getY();
|
||||||
|
|
||||||
|
// Modals are disabled by default
|
||||||
|
_Active = false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CGroupModal::updateCoords ()
|
||||||
|
{
|
||||||
|
// if snap to mouse pos.
|
||||||
|
if(SpawnOnMousePos)
|
||||||
{
|
{
|
||||||
_X= _Y= 0;
|
// Special for menu for instance: If the size is bigger or equal to the screen, keep 0, because will be clipped just after
|
||||||
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
|
uint32 w,h;
|
||||||
|
rVR.getScreenSize(w,h);
|
||||||
|
if(_W>=(sint32)w && _H>=(sint32)h)
|
||||||
|
{
|
||||||
|
_X= _Y= 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// change coords
|
||||||
|
_X= SpawnMouseX+_MouseDeltaX;
|
||||||
|
_Y= SpawnMouseY+_MouseDeltaY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// update group
|
||||||
|
CGroupFrame::updateCoords();
|
||||||
|
|
||||||
|
// if snap to mouse pos or ForceInsideScreen
|
||||||
|
if(SpawnOnMousePos || ForceInsideScreen)
|
||||||
{
|
{
|
||||||
// change coords
|
bool clipped = false;
|
||||||
_X= SpawnMouseX+_MouseDeltaX;
|
// repos the group according to real size. clip against screen
|
||||||
_Y= SpawnMouseY+_MouseDeltaY;
|
if(_XReal<0)
|
||||||
|
{
|
||||||
|
_X+= -_XReal;
|
||||||
|
clipped = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!SpawnOnMousePos)
|
||||||
|
_X = _MouseDeltaX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_XReal+_WReal>_Parent->getW())
|
||||||
|
{
|
||||||
|
_X-= _XReal+_WReal-_Parent->getW();
|
||||||
|
clipped =true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((!SpawnOnMousePos) && (_XReal>=0))
|
||||||
|
_X = _MouseDeltaX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_YReal<0)
|
||||||
|
{
|
||||||
|
_Y+= -_YReal;
|
||||||
|
clipped =true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!SpawnOnMousePos)
|
||||||
|
_Y = _MouseDeltaY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_YReal+_HReal>_Parent->getH())
|
||||||
|
{
|
||||||
|
_Y-= _YReal+_HReal-_Parent->getH();
|
||||||
|
clipped =true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((!SpawnOnMousePos) && (_YReal>=0))
|
||||||
|
_Y = _MouseDeltaY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clipped)
|
||||||
|
{
|
||||||
|
CGroupFrame::updateCoords();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update group
|
|
||||||
CGroupFrame::updateCoords();
|
|
||||||
|
|
||||||
// if snap to mouse pos or ForceInsideScreen
|
|
||||||
if(SpawnOnMousePos || ForceInsideScreen)
|
|
||||||
{
|
|
||||||
bool clipped = false;
|
|
||||||
// repos the group according to real size. clip against screen
|
|
||||||
if(_XReal<0)
|
|
||||||
{
|
|
||||||
_X+= -_XReal;
|
|
||||||
clipped = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!SpawnOnMousePos)
|
|
||||||
_X = _MouseDeltaX;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_XReal+_WReal>_Parent->getW())
|
|
||||||
{
|
|
||||||
_X-= _XReal+_WReal-_Parent->getW();
|
|
||||||
clipped =true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((!SpawnOnMousePos) && (_XReal>=0))
|
|
||||||
_X = _MouseDeltaX;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_YReal<0)
|
|
||||||
{
|
|
||||||
_Y+= -_YReal;
|
|
||||||
clipped =true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!SpawnOnMousePos)
|
|
||||||
_Y = _MouseDeltaY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_YReal+_HReal>_Parent->getH())
|
|
||||||
{
|
|
||||||
_Y-= _YReal+_HReal-_Parent->getH();
|
|
||||||
clipped =true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((!SpawnOnMousePos) && (_YReal>=0))
|
|
||||||
_Y = _MouseDeltaY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clipped)
|
|
||||||
{
|
|
||||||
CGroupFrame::updateCoords();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -23,103 +23,106 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
// ***************************************************************************
|
namespace NLGUI
|
||||||
const CInterfaceOptionValue CInterfaceOptionValue::NullValue;
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CInterfaceOptionValue::init(const std::string &str)
|
|
||||||
{
|
{
|
||||||
_Str= str;
|
|
||||||
fromString(str, _Int);
|
|
||||||
fromString(str, _Float);
|
|
||||||
_Color= CInterfaceElement::convertColor (str.c_str());
|
|
||||||
_Boolean= CInterfaceElement::convertBool(str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const CInterfaceOptionValue CInterfaceOptionValue::NullValue;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ***************************************************************************
|
||||||
// CInterfaceOptions
|
void CInterfaceOptionValue::init(const std::string &str)
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
CInterfaceOptions::CInterfaceOptions()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
CInterfaceOptions::~CInterfaceOptions()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
bool CInterfaceOptions::parse (xmlNodePtr cur)
|
|
||||||
{
|
|
||||||
cur = cur->children;
|
|
||||||
bool ok = true;
|
|
||||||
while (cur)
|
|
||||||
{
|
{
|
||||||
if ( !stricmp((char*)cur->name,"param") )
|
_Str= str;
|
||||||
{
|
fromString(str, _Int);
|
||||||
CXMLAutoPtr ptr, val;
|
fromString(str, _Float);
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
_Color= CInterfaceElement::convertColor (str.c_str());
|
||||||
val = xmlGetProp (cur, (xmlChar*)"value");
|
_Boolean= CInterfaceElement::convertBool(str.c_str());
|
||||||
if (!ptr || !val)
|
|
||||||
{
|
|
||||||
nlinfo("param with no name or no value");
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string name = NLMISC::toLower(string((const char*)ptr));
|
|
||||||
string value = (string((const char*)val));
|
|
||||||
_ParamValue[name].init(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
}
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CInterfaceOptions::copyBasicMap(const CInterfaceOptions &other)
|
|
||||||
{
|
|
||||||
_ParamValue= other._ParamValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ----------------------------------------------------------------------------
|
||||||
const CInterfaceOptionValue &CInterfaceOptions::getValue(const string &sParamName) const
|
// CInterfaceOptions
|
||||||
{
|
// ----------------------------------------------------------------------------
|
||||||
string sLwrParamName = strlwr (sParamName);
|
|
||||||
std::map<std::string, CInterfaceOptionValue>::const_iterator it = _ParamValue.find (sLwrParamName);
|
|
||||||
if (it != _ParamValue.end())
|
|
||||||
return it->second;
|
|
||||||
else
|
|
||||||
return CInterfaceOptionValue::NullValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ----------------------------------------------------------------------------
|
||||||
const std::string &CInterfaceOptions::getValStr(const std::string &sParamName) const
|
CInterfaceOptions::CInterfaceOptions()
|
||||||
{
|
{
|
||||||
return getValue(sParamName).getValStr();
|
}
|
||||||
}
|
|
||||||
// ***************************************************************************
|
|
||||||
sint32 CInterfaceOptions::getValSInt32(const std::string &sParamName) const
|
|
||||||
{
|
|
||||||
return getValue(sParamName).getValSInt32();
|
|
||||||
}
|
|
||||||
// ***************************************************************************
|
|
||||||
float CInterfaceOptions::getValFloat(const std::string &sParamName) const
|
|
||||||
{
|
|
||||||
return getValue(sParamName).getValFloat();
|
|
||||||
}
|
|
||||||
// ***************************************************************************
|
|
||||||
NLMISC::CRGBA CInterfaceOptions::getValColor(const std::string &sParamName) const
|
|
||||||
{
|
|
||||||
return getValue(sParamName).getValColor();
|
|
||||||
}
|
|
||||||
// ***************************************************************************
|
|
||||||
bool CInterfaceOptions::getValBool(const std::string &sParamName) const
|
|
||||||
{
|
|
||||||
return getValue(sParamName).getValBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
CInterfaceOptions::~CInterfaceOptions()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
bool CInterfaceOptions::parse (xmlNodePtr cur)
|
||||||
|
{
|
||||||
|
cur = cur->children;
|
||||||
|
bool ok = true;
|
||||||
|
while (cur)
|
||||||
|
{
|
||||||
|
if ( !stricmp((char*)cur->name,"param") )
|
||||||
|
{
|
||||||
|
CXMLAutoPtr ptr, val;
|
||||||
|
ptr = xmlGetProp (cur, (xmlChar*)"name");
|
||||||
|
val = xmlGetProp (cur, (xmlChar*)"value");
|
||||||
|
if (!ptr || !val)
|
||||||
|
{
|
||||||
|
nlinfo("param with no name or no value");
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string name = NLMISC::toLower(string((const char*)ptr));
|
||||||
|
string value = (string((const char*)val));
|
||||||
|
_ParamValue[name].init(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CInterfaceOptions::copyBasicMap(const CInterfaceOptions &other)
|
||||||
|
{
|
||||||
|
_ParamValue= other._ParamValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
const CInterfaceOptionValue &CInterfaceOptions::getValue(const string &sParamName) const
|
||||||
|
{
|
||||||
|
string sLwrParamName = strlwr (sParamName);
|
||||||
|
std::map<std::string, CInterfaceOptionValue>::const_iterator it = _ParamValue.find (sLwrParamName);
|
||||||
|
if (it != _ParamValue.end())
|
||||||
|
return it->second;
|
||||||
|
else
|
||||||
|
return CInterfaceOptionValue::NullValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
const std::string &CInterfaceOptions::getValStr(const std::string &sParamName) const
|
||||||
|
{
|
||||||
|
return getValue(sParamName).getValStr();
|
||||||
|
}
|
||||||
|
// ***************************************************************************
|
||||||
|
sint32 CInterfaceOptions::getValSInt32(const std::string &sParamName) const
|
||||||
|
{
|
||||||
|
return getValue(sParamName).getValSInt32();
|
||||||
|
}
|
||||||
|
// ***************************************************************************
|
||||||
|
float CInterfaceOptions::getValFloat(const std::string &sParamName) const
|
||||||
|
{
|
||||||
|
return getValue(sParamName).getValFloat();
|
||||||
|
}
|
||||||
|
// ***************************************************************************
|
||||||
|
NLMISC::CRGBA CInterfaceOptions::getValColor(const std::string &sParamName) const
|
||||||
|
{
|
||||||
|
return getValue(sParamName).getValColor();
|
||||||
|
}
|
||||||
|
// ***************************************************************************
|
||||||
|
bool CInterfaceOptions::getValBool(const std::string &sParamName) const
|
||||||
|
{
|
||||||
|
return getValue(sParamName).getValBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -18,27 +18,32 @@
|
||||||
#include "nel/gui/interface_group.h"
|
#include "nel/gui/interface_group.h"
|
||||||
#include "nel/gui/widget_manager.h"
|
#include "nel/gui/widget_manager.h"
|
||||||
|
|
||||||
CViewBase::~CViewBase()
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
CWidgetManager::getInstance()->removeRefOnView (this);
|
|
||||||
}
|
CViewBase::~CViewBase()
|
||||||
|
{
|
||||||
// ***************************************************************************
|
CWidgetManager::getInstance()->removeRefOnView (this);
|
||||||
void CViewBase::dumpSize(uint depth /*=0*/) const
|
}
|
||||||
{
|
|
||||||
std::string result;
|
// ***************************************************************************
|
||||||
result.resize(depth * 4, ' ');
|
void CViewBase::dumpSize(uint depth /*=0*/) const
|
||||||
std::string::size_type pos = _Id.find_last_of(':');
|
{
|
||||||
std::string shortID = pos == std::string::npos ? _Id : _Id.substr(pos);
|
std::string result;
|
||||||
result += NLMISC::toString("id=%s, w=%d, h=%d, x=%d, y=%d, wreal=%d, hreal=%d, xreal=%d, yreal=%d", shortID.c_str(), (int) _W, (int) _H, (int) _X, (int) _Y, (int) _WReal, (int) _HReal, (int) _XReal, (int) _YReal);
|
result.resize(depth * 4, ' ');
|
||||||
nlinfo(result.c_str());
|
std::string::size_type pos = _Id.find_last_of(':');
|
||||||
}
|
std::string shortID = pos == std::string::npos ? _Id : _Id.substr(pos);
|
||||||
|
result += NLMISC::toString("id=%s, w=%d, h=%d, x=%d, y=%d, wreal=%d, hreal=%d, xreal=%d, yreal=%d", shortID.c_str(), (int) _W, (int) _H, (int) _X, (int) _Y, (int) _WReal, (int) _HReal, (int) _XReal, (int) _YReal);
|
||||||
// ***************************************************************************
|
nlinfo(result.c_str());
|
||||||
void CViewBase::visit(CInterfaceElementVisitor *visitor)
|
}
|
||||||
{
|
|
||||||
nlassert(visitor);
|
// ***************************************************************************
|
||||||
visitor->visitView(this);
|
void CViewBase::visit(CInterfaceElementVisitor *visitor)
|
||||||
CInterfaceElement::visit(visitor);
|
{
|
||||||
|
nlassert(visitor);
|
||||||
|
visitor->visitView(this);
|
||||||
|
CInterfaceElement::visit(visitor);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,122 +1,142 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "nel/gui/view_pointer_base.h"
|
#include "nel/gui/view_pointer_base.h"
|
||||||
|
|
||||||
CViewPointerBase::CViewPointerBase( const CViewBase::TCtorParam ¶m ) :
|
namespace NLGUI
|
||||||
CViewBase( param )
|
|
||||||
{
|
{
|
||||||
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
|
|
||||||
_PointerDown = false;
|
|
||||||
_PointerVisible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CViewPointerBase::~CViewPointerBase()
|
CViewPointerBase::CViewPointerBase( const CViewBase::TCtorParam ¶m ) :
|
||||||
{
|
CViewBase( param )
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::setPointerPos (sint32 x, sint32 y)
|
|
||||||
{
|
|
||||||
if (_PointerDown)
|
|
||||||
{
|
{
|
||||||
if (!_PointerDrag)
|
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
|
||||||
|
_PointerDown = false;
|
||||||
|
_PointerVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CViewPointerBase::~CViewPointerBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::setPointerPos (sint32 x, sint32 y)
|
||||||
|
{
|
||||||
|
if (_PointerDown)
|
||||||
{
|
{
|
||||||
if (((_PointerX - _PointerDownX) != 0) ||
|
if (!_PointerDrag)
|
||||||
((_PointerY - _PointerDownY) != 0))
|
|
||||||
{
|
{
|
||||||
_PointerDrag = true;
|
if (((_PointerX - _PointerDownX) != 0) ||
|
||||||
|
((_PointerY - _PointerDownY) != 0))
|
||||||
|
{
|
||||||
|
_PointerDrag = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_PointerOldX = getX();
|
||||||
|
_PointerOldY = getY();
|
||||||
|
|
||||||
|
_PointerX = x;
|
||||||
|
_PointerY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
_PointerOldX = getX();
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
_PointerOldY = getY();
|
void CViewPointerBase::setPointerDispPos (sint32 x, sint32 y)
|
||||||
|
|
||||||
_PointerX = x;
|
|
||||||
_PointerY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::setPointerDispPos (sint32 x, sint32 y)
|
|
||||||
{
|
|
||||||
setX (x);
|
|
||||||
setY (y);
|
|
||||||
updateCoords ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::resetPointerPos ()
|
|
||||||
{
|
|
||||||
_PointerOldX = _PointerX;
|
|
||||||
_PointerOldY = _PointerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::setPointerDown (bool pd)
|
|
||||||
{
|
|
||||||
_PointerDown = pd;
|
|
||||||
|
|
||||||
if (_PointerDown == true)
|
|
||||||
{
|
{
|
||||||
_PointerDownX = _PointerX;
|
setX (x);
|
||||||
_PointerDownY = _PointerY;
|
setY (y);
|
||||||
|
updateCoords ();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::resetPointerPos ()
|
||||||
|
{
|
||||||
|
_PointerOldX = _PointerX;
|
||||||
|
_PointerOldY = _PointerY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::setPointerDown (bool pd)
|
||||||
|
{
|
||||||
|
_PointerDown = pd;
|
||||||
|
|
||||||
|
if (_PointerDown == true)
|
||||||
|
{
|
||||||
|
_PointerDownX = _PointerX;
|
||||||
|
_PointerDownY = _PointerY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_PointerDown == false)
|
||||||
|
_PointerDrag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::setPointerDownString (const std::string &s)
|
||||||
|
{
|
||||||
|
_PointerDownString = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// +++ GET +++
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = _PointerX;
|
||||||
|
y = _PointerY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerDispPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = getX();
|
||||||
|
y = getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerOldPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = _PointerOldX;
|
||||||
|
y = _PointerOldY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerDownPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = _PointerDownX;
|
||||||
|
y = _PointerDownY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerBase::getPointerDown ()
|
||||||
|
{
|
||||||
|
return _PointerDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerBase::getPointerDrag ()
|
||||||
|
{
|
||||||
|
return _PointerDrag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
std::string CViewPointerBase::getPointerDownString ()
|
||||||
|
{
|
||||||
|
return _PointerDownString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_PointerDown == false)
|
|
||||||
_PointerDrag = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::setPointerDownString (const std::string &s)
|
|
||||||
{
|
|
||||||
_PointerDownString = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// +++ GET +++
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::getPointerPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = _PointerX;
|
|
||||||
y = _PointerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::getPointerDispPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = getX();
|
|
||||||
y = getY();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::getPointerOldPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = _PointerOldX;
|
|
||||||
y = _PointerOldY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointerBase::getPointerDownPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = _PointerDownX;
|
|
||||||
y = _PointerDownY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointerBase::getPointerDown ()
|
|
||||||
{
|
|
||||||
return _PointerDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointerBase::getPointerDrag ()
|
|
||||||
{
|
|
||||||
return _PointerDrag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
std::string CViewPointerBase::getPointerDownString ()
|
|
||||||
{
|
|
||||||
return _PointerDownString;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
|
using namespace NLGUI;
|
||||||
|
|
||||||
// TODO nico : that stuff was coded in a hurry, but could be good to add it to NL3D with a better packaging later...
|
// TODO nico : that stuff was coded in a hurry, but could be good to add it to NL3D with a better packaging later...
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ using namespace NL3D;
|
||||||
#include "../user_entity.h"
|
#include "../user_entity.h"
|
||||||
#include "../connection.h"
|
#include "../connection.h"
|
||||||
|
|
||||||
|
using namespace NLGUI;
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
// GLOBAL //
|
// GLOBAL //
|
||||||
////////////
|
////////////
|
||||||
|
|
|
@ -23,7 +23,10 @@
|
||||||
#include "nel/gui/action_handler.h"
|
#include "nel/gui/action_handler.h"
|
||||||
#include "interface_manager.h"
|
#include "interface_manager.h"
|
||||||
|
|
||||||
class CInterfaceGroup;
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CInterfaceGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
|
|
||||||
class CBotChatPage;
|
class CBotChatPage;
|
||||||
class CPrerequisitInfos;
|
class CPrerequisitInfos;
|
||||||
class CInterfaceGroup;
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CInterfaceGroup;
|
||||||
|
}
|
||||||
|
|
||||||
class IMissionPrereqInfosWaiter
|
class IMissionPrereqInfosWaiter
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,11 @@
|
||||||
|
|
||||||
#include "nel/misc/rgba.h"
|
#include "nel/misc/rgba.h"
|
||||||
|
|
||||||
class CViewBase;
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CViewBase;
|
||||||
|
}
|
||||||
|
|
||||||
class ucstring;
|
class ucstring;
|
||||||
namespace NLMISC{
|
namespace NLMISC{
|
||||||
class CCDBNodeLeaf;
|
class CCDBNodeLeaf;
|
||||||
|
@ -46,7 +50,7 @@ public:
|
||||||
* \param col the color of the text
|
* \param col the color of the text
|
||||||
* \param justified Should be true for justified text (stretch spaces of line to fill the full width)
|
* \param justified Should be true for justified text (stretch spaces of line to fill the full width)
|
||||||
*/
|
*/
|
||||||
CViewBase *createMsgText(const ucstring &msg, NLMISC::CRGBA col, bool justified = false);
|
NLGUI::CViewBase *createMsgText(const ucstring &msg, NLMISC::CRGBA col, bool justified = false);
|
||||||
// Singleton access
|
// Singleton access
|
||||||
static CChatTextManager &getInstance();
|
static CChatTextManager &getInstance();
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,15 @@
|
||||||
|
|
||||||
#include "game_share/chat_group.h"
|
#include "game_share/chat_group.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CCtrlBase;
|
||||||
|
}
|
||||||
|
|
||||||
class CChatWindow;
|
class CChatWindow;
|
||||||
class CGroupContainer;
|
class CGroupContainer;
|
||||||
class CGroupEditBox;
|
class CGroupEditBox;
|
||||||
class CCtrlBase;
|
|
||||||
class CViewText;
|
class CViewText;
|
||||||
|
|
||||||
/** Interface to react to a chat box entry
|
/** Interface to react to a chat box entry
|
||||||
|
@ -240,7 +245,7 @@ public:
|
||||||
// Remove a chat window by its pointer
|
// Remove a chat window by its pointer
|
||||||
void removeChatWindow(CChatWindow *cw);
|
void removeChatWindow(CChatWindow *cw);
|
||||||
/// from a ctrl of a chat box that triggered a menu, or an event, retrieve the associated chat box
|
/// from a ctrl of a chat box that triggered a menu, or an event, retrieve the associated chat box
|
||||||
CChatWindow *getChatWindowFromCaller(CCtrlBase *caller);
|
CChatWindow *getChatWindowFromCaller(NLGUI::CCtrlBase *caller);
|
||||||
// Singleton pattern applied to the chat window manager
|
// Singleton pattern applied to the chat window manager
|
||||||
static CChatWindowManager &getInstance();
|
static CChatWindowManager &getInstance();
|
||||||
// try to rename a window
|
// try to rename a window
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
|
|
||||||
|
|
||||||
class CDBCtrlSheet;
|
class CDBCtrlSheet;
|
||||||
class IActionHandler;
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class IActionHandler;
|
||||||
|
}
|
||||||
|
|
||||||
/** Infos about a selection group
|
/** Infos about a selection group
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -107,10 +107,6 @@
|
||||||
#include "../npc_icon.h"
|
#include "../npc_icon.h"
|
||||||
|
|
||||||
#include "nel/gui/lua_helper.h"
|
#include "nel/gui/lua_helper.h"
|
||||||
namespace NLGUI
|
|
||||||
{
|
|
||||||
extern void luaDebuggerMainLoop();
|
|
||||||
}
|
|
||||||
using namespace NLGUI;
|
using namespace NLGUI;
|
||||||
#include "nel/gui/lua_ihm.h"
|
#include "nel/gui/lua_ihm.h"
|
||||||
#include "lua_ihm_ryzom.h"
|
#include "lua_ihm_ryzom.h"
|
||||||
|
@ -128,9 +124,14 @@ using namespace NLGUI;
|
||||||
|
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
extern void luaDebuggerMainLoop();
|
||||||
|
extern NLMISC::CStringMapper *_UIStringMapper;
|
||||||
|
}
|
||||||
|
|
||||||
extern CClientChatManager ChatMngr;
|
extern CClientChatManager ChatMngr;
|
||||||
extern CContinentManager ContinentMngr;
|
extern CContinentManager ContinentMngr;
|
||||||
extern CStringMapper *_UIStringMapper;
|
|
||||||
extern bool IsInRingSession;
|
extern bool IsInRingSession;
|
||||||
extern CEventsListener EventsListener;
|
extern CEventsListener EventsListener;
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,12 @@ extern bool g_hidden;
|
||||||
|
|
||||||
// #define AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
// #define AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CInterfaceOptions;
|
||||||
|
}
|
||||||
|
|
||||||
class CGroupContainer;
|
class CGroupContainer;
|
||||||
class CInterfaceOptions;
|
|
||||||
class CInterfaceAnim;
|
class CInterfaceAnim;
|
||||||
class CGroupMenu;
|
class CGroupMenu;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include "nel/gui/interface_options.h"
|
#include "nel/gui/interface_options.h"
|
||||||
|
|
||||||
|
using namespace NLGUI;
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
class COptionsLayer : public CInterfaceOptions
|
class COptionsLayer : public CInterfaceOptions
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,17 +29,20 @@
|
||||||
#include "nel/gui/widget_manager.h"
|
#include "nel/gui/widget_manager.h"
|
||||||
using namespace NLGUI;
|
using namespace NLGUI;
|
||||||
|
|
||||||
// ***************************************************************************
|
namespace NLGUI
|
||||||
class CInterfaceElement;
|
{
|
||||||
class CInterfaceGroup;
|
class CInterfaceElement;
|
||||||
|
class CInterfaceGroup;
|
||||||
|
class CInterfaceOptions;
|
||||||
|
class CInterfaceLink;
|
||||||
|
class CCtrlBase;
|
||||||
|
}
|
||||||
|
|
||||||
class CGroupContainer;
|
class CGroupContainer;
|
||||||
class CGroupList;
|
class CGroupList;
|
||||||
class CInterfaceOptions;
|
|
||||||
class CInterfaceAnim;
|
class CInterfaceAnim;
|
||||||
class CViewPointer;
|
class CViewPointer;
|
||||||
class CInterfaceLink;
|
|
||||||
class CBrickJob;
|
class CBrickJob;
|
||||||
class CCtrlBase;
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,16 @@
|
||||||
|
|
||||||
#include "nel/misc/resource_ptr.h"
|
#include "nel/misc/resource_ptr.h"
|
||||||
|
|
||||||
class CInterfaceElement *getInterfaceResource(const std::string &key);
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CInterfaceElement;
|
||||||
|
class CCtrlBase;
|
||||||
|
class CInterfaceGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace NLGUI;
|
||||||
|
|
||||||
|
CInterfaceElement *getInterfaceResource(const std::string &key);
|
||||||
|
|
||||||
/** Interface element ptr
|
/** Interface element ptr
|
||||||
* This pointer uses the NLMISC::CResourcePtr
|
* This pointer uses the NLMISC::CResourcePtr
|
||||||
|
@ -47,13 +56,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Some pointers
|
// Some pointers
|
||||||
typedef CInterfacePtr<class CInterfaceElement>::TInterfacePtr CInterfaceElementPtr;
|
typedef CInterfacePtr<CInterfaceElement>::TInterfacePtr CInterfaceElementPtr;
|
||||||
typedef CInterfacePtr<class CInterfaceGroup>::TInterfacePtr CInterfaceGroupPtr;
|
typedef CInterfacePtr<CInterfaceGroup>::TInterfacePtr CInterfaceGroupPtr;
|
||||||
typedef CInterfacePtr<class CCtrlTextButton>::TInterfacePtr CCtrlTextButtonPtr;
|
typedef CInterfacePtr<class CCtrlTextButton>::TInterfacePtr CCtrlTextButtonPtr;
|
||||||
typedef CInterfacePtr<class CViewText>::TInterfacePtr CViewTextPtr;
|
typedef CInterfacePtr<class CViewText>::TInterfacePtr CViewTextPtr;
|
||||||
typedef CInterfacePtr<class CViewTextMenu>::TInterfacePtr CViewTextMenuPtr;
|
typedef CInterfacePtr<class CViewTextMenu>::TInterfacePtr CViewTextMenuPtr;
|
||||||
typedef CInterfacePtr<class CViewTextMenu>::TInterfacePtr CViewTextMenuPtr;
|
typedef CInterfacePtr<CCtrlBase>::TInterfacePtr CCtrlBasePtr;
|
||||||
typedef CInterfacePtr<class CCtrlBase>::TInterfacePtr CCtrlBasePtr;
|
|
||||||
typedef CInterfacePtr<class CCtrlBaseButton>::TInterfacePtr CCtrlBaseButtonPtr;
|
typedef CInterfacePtr<class CCtrlBaseButton>::TInterfacePtr CCtrlBaseButtonPtr;
|
||||||
typedef CInterfacePtr<class CGroupContainer>::TInterfacePtr CGroupContainerPtr;
|
typedef CInterfacePtr<class CGroupContainer>::TInterfacePtr CGroupContainerPtr;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,11 @@
|
||||||
#include "nel/gui/view_pointer_base.h"
|
#include "nel/gui/view_pointer_base.h"
|
||||||
|
|
||||||
class CGroupContainer;
|
class CGroupContainer;
|
||||||
class CCtrlBase;
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CCtrlBase;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class describing the pointer
|
* class describing the pointer
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CObjectTable;
|
||||||
* - one for the ui (displaying instance in the object tree for example)
|
* - one for the ui (displaying instance in the object tree for example)
|
||||||
* - one for the property sheet of the instance
|
* - one for the property sheet of the instance
|
||||||
*/
|
*/
|
||||||
class CDisplayerBase : public NLMISC::IClassable, public CReflectableRefPtrTarget
|
class CDisplayerBase : public NLMISC::IClassable, public NLGUI::CReflectableRefPtrTarget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef NLMISC::CSmartPtr<CDisplayerBase> TSmartPtr;
|
typedef NLMISC::CSmartPtr<CDisplayerBase> TSmartPtr;
|
||||||
|
|
Loading…
Reference in a new issue