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