mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 15:16:12 +00:00
Changed: Refactor CViewLink to be able to use custom action handlers
This commit is contained in:
parent
3ae1a9f3ac
commit
b724f9698c
4 changed files with 16 additions and 16 deletions
|
@ -206,12 +206,6 @@ namespace NLGUI
|
|||
invalidateContent();
|
||||
}
|
||||
|
||||
// Set the HTML group used for links
|
||||
void setBrowseGroup (CInterfaceElement *group)
|
||||
{
|
||||
_BrowseGroup = group;
|
||||
}
|
||||
|
||||
/// \from CInterfaceElement
|
||||
void onInvalidateContent();
|
||||
sint32 getMaxUsedW() const;
|
||||
|
@ -293,9 +287,6 @@ namespace NLGUI
|
|||
// The links
|
||||
std::vector<CLink> _Links;
|
||||
|
||||
// The HTML group used
|
||||
CInterfaceElement *_BrowseGroup;
|
||||
|
||||
private:
|
||||
std::string _HardText;
|
||||
uint32 _TextId;
|
||||
|
|
|
@ -50,10 +50,21 @@ namespace NLGUI
|
|||
void setHTMLView( CGroupHTML *html);
|
||||
bool getMouseOverShape(std::string &texName, uint8 &rot, NLMISC::CRGBA &col);
|
||||
|
||||
void setActionOnLeftClick(const std::string &actionHandler) { _AHOnLeftClick = actionHandler; };
|
||||
void setParamsOnLeftClick(const std::string &actionParams) { _AHOnLeftClickParams = actionParams; };
|
||||
|
||||
const std::string &getActionOnLeftClick() const { return _AHOnLeftClick; }
|
||||
const std::string &getParamsOnLeftClick() const { return _AHOnLeftClickParams; }
|
||||
protected:
|
||||
|
||||
// The main HTML group
|
||||
CGroupHTML *HTML;
|
||||
|
||||
// Left mouse click action
|
||||
// Don't use CStringShared as URLs change past values would be permanently remembered.
|
||||
std::string _AHOnLeftClick;
|
||||
std::string _AHOnLeftClickParams;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3773,7 +3773,6 @@ namespace NLGUI
|
|||
CGroupParagraph *newParagraph = new CGroupParagraph(CViewBase::TCtorParam());
|
||||
newParagraph->setResizeFromChildH(true);
|
||||
|
||||
newParagraph->setBrowseGroup (this);
|
||||
newParagraph->setIndent(_Indent);
|
||||
|
||||
// Add to the group
|
||||
|
@ -4127,6 +4126,9 @@ namespace NLGUI
|
|||
if (!newLink->Link.empty())
|
||||
{
|
||||
newLink->setHTMLView (this);
|
||||
|
||||
newLink->setActionOnLeftClick("browse");
|
||||
newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link);
|
||||
}
|
||||
}
|
||||
newLink->setText(tmpStr);
|
||||
|
|
|
@ -59,7 +59,6 @@ namespace NLGUI
|
|||
_TopSpace = 0;
|
||||
_Indent = 0;
|
||||
_FirstViewIndentView = false;
|
||||
_BrowseGroup = NULL;
|
||||
_TextId = 0;
|
||||
}
|
||||
|
||||
|
@ -868,11 +867,8 @@ namespace NLGUI
|
|||
ctrl->setParentPosRef (Hotspot_TL);
|
||||
ctrl->setPosRef (Hotspot_TL);
|
||||
ctrl->setActive(true);
|
||||
if (_BrowseGroup)
|
||||
{
|
||||
ctrl->setActionOnLeftClick("browse");
|
||||
ctrl->setParamsOnLeftClick("name="+_BrowseGroup->getId()+"|url="+link.Link->Link);
|
||||
}
|
||||
ctrl->setActionOnLeftClick(link.Link->getActionOnLeftClick());
|
||||
ctrl->setParamsOnLeftClick(link.Link->getParamsOnLeftClick());
|
||||
ctrl->setScale(true);
|
||||
addCtrl(ctrl);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue