From 9e309135d403f0f99f586015ffd194a8914ae504 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sun, 5 Aug 2012 16:34:31 +0100 Subject: [PATCH] Load element icons in element search, fixes #73 --- src/elementsearch/ElementSearchActivity.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/elementsearch/ElementSearchActivity.cpp b/src/elementsearch/ElementSearchActivity.cpp index 1ee41e1b8..c8b0b8224 100644 --- a/src/elementsearch/ElementSearchActivity.cpp +++ b/src/elementsearch/ElementSearchActivity.cpp @@ -115,7 +115,15 @@ void ElementSearchActivity::searchTools(std::string query) if(!firstResult) firstResult = tool; - ToolButton * tempButton = new ToolButton(current+viewPosition, ui::Point(30, 18), tool->GetName()); + VideoBuffer * tempTexture = tool->GetTexture(26, 14); + ToolButton * tempButton; + + if(tempTexture) + tempButton = new ToolButton(current+viewPosition, ui::Point(30, 18), "", tool->GetDescription()); + else + tempButton = new ToolButton(current+viewPosition, ui::Point(30, 18), tool->GetName(), tool->GetDescription()); + + tempButton->Appearance.SetTexture(tempTexture); tempButton->Appearance.BackgroundInactive = ui::Colour(tool->colRed, tool->colGreen, tool->colBlue); tempButton->SetActionCallback(new ToolAction(this, tool));