mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 07:36:16 +00:00
Add lua function CCtrlBase::setTooltipUtf8 to set tooltip from html page
--HG-- branch : develop
This commit is contained in:
parent
55e687e80d
commit
76ee797e49
2 changed files with 17 additions and 0 deletions
|
@ -151,8 +151,12 @@ namespace NLGUI
|
||||||
// called when keyboard capture has been lost
|
// called when keyboard capture has been lost
|
||||||
virtual void onKeyboardCaptureLost() {}
|
virtual void onKeyboardCaptureLost() {}
|
||||||
|
|
||||||
|
// 'tooltip' property expects string to be ucstring or latin1 which is not possible from html page
|
||||||
|
int luaSetTooltipUtf8(CLuaState &ls);
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
|
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
|
||||||
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
|
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
|
||||||
|
REFLECT_LUA_METHOD("setTooltipUtf8", luaSetTooltipUtf8);
|
||||||
REFLECT_EXPORT_END
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "libxml/globals.h"
|
#include "libxml/globals.h"
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
#include "nel/misc/xml_auto_ptr.h"
|
#include "nel/misc/xml_auto_ptr.h"
|
||||||
|
#include "nel/gui/lua_ihm.h"
|
||||||
#include "nel/gui/ctrl_base.h"
|
#include "nel/gui/ctrl_base.h"
|
||||||
#include "nel/gui/interface_group.h"
|
#include "nel/gui/interface_group.h"
|
||||||
#include "nel/gui/widget_manager.h"
|
#include "nel/gui/widget_manager.h"
|
||||||
|
@ -556,5 +557,17 @@ namespace NLGUI
|
||||||
return itr2->second;
|
return itr2->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
int CCtrlBase::luaSetTooltipUtf8(CLuaState &ls)
|
||||||
|
{
|
||||||
|
const char *funcName = "setTooltipUtf8";
|
||||||
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
|
||||||
|
std::string tooltip = ls.toString(1);
|
||||||
|
|
||||||
|
setDefaultContextHelp(ucstring::makeFromUtf8(tooltip));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue