*Added tooltip to scrollbararrows and Tabs in settings.

This commit is contained in:
dimok321 2009-05-05 17:24:19 +00:00
parent 8edbd2e1b1
commit 7ed41e0491
4 changed files with 63 additions and 34 deletions

View File

@ -172,24 +172,6 @@ void GuiButton::Draw()
label[i]->Draw();
}
//draw ToolTip
/*
if(state == STATE_SELECTED && toolTip)
{
if (time2 == 0)
time(&time2);
time(&time1);
if (difftime(time1, time2) >= 2) {
toolTip->Draw();
if (toolTipTxt)
{
toolTipTxt->Draw();
}
}
}
*/
this->UpdateEffects();
}
void GuiButton::DrawTooltip()

View File

@ -12,6 +12,7 @@
#include <unistd.h>
#include "gui_gamebrowser.h"
#include "../cfg.h"
#include "main.h"
#define GAMESELECTSIZE 30
extern const int vol;
@ -83,6 +84,16 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co
arrowUpBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130);
arrowUpBtn->SetSoundClick(btnSoundClick);
snprintf(imgPath, sizeof(imgPath), "%stooltip.png", themePath);
ttarrow = new GuiImageData(imgPath, tooltip_png);
ttarrowUpImg = new GuiImage(ttarrow);
ttarrowUpTxt = new GuiText("Scroll up", 20, (GXColor){0, 0, 0, 255});
if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0){
arrowUpBtn->SetToolTip(ttarrowUpImg,ttarrowUpTxt, -45, 0);
}
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
arrowDownBtn->SetParent(this);
arrowDownBtn->SetImage(arrowDownImg);
@ -95,6 +106,13 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co
arrowDownBtn->SetEffectOnOver(EFFECT_SCALE, 50, 130);
arrowDownBtn->SetSoundClick(btnSoundClick);
ttarrowDownImg = new GuiImage(ttarrow);
ttarrowDownTxt = new GuiText("Scroll down", 20, (GXColor){0, 0, 0, 255});
if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0){
arrowDownBtn->SetToolTip(ttarrowDownImg,ttarrowDownTxt, -5,-35);
}
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
scrollbarBoxBtn->SetParent(this);
scrollbarBoxBtn->SetImage(scrollbarBoxImg);
@ -173,6 +191,11 @@ GuiGameBrowser::~GuiGameBrowser()
delete bgGameImg;
delete bgGames;
delete bgGamesEntry;
delete ttarrow;
delete ttarrowUpImg;
delete ttarrowDownImg;
delete ttarrowDownTxt;
delete ttarrowUpTxt;
delete trigA;
delete btnSoundClick;
@ -285,6 +308,7 @@ void GuiGameBrowser::Draw()
if(next >= 0)
{
game[i]->Draw();
game[i]->DrawTooltip();
next = this->FindMenuItem(next, 1);
}
else
@ -296,6 +320,9 @@ void GuiGameBrowser::Draw()
arrowUpBtn->Draw();
arrowDownBtn->Draw();
scrollbarBoxBtn->Draw();
arrowUpBtn->DrawTooltip();
arrowDownBtn->DrawTooltip();
scrollbarBoxBtn->DrawTooltip();
}
this->UpdateEffects();
}

View File

@ -65,16 +65,22 @@ class GuiGameBrowser : public GuiElement
GuiImage * scrollbarImg;
GuiImage * arrowDownImg;
GuiImage * arrowDownOverImg;
GuiImage * ttarrowUpImg;
GuiImage * ttarrowDownImg;
GuiImage * arrowUpImg;
GuiImage * arrowUpOverImg;
GuiImage * scrollbarBoxImg;
GuiImage * scrollbarBoxOverImg;
GuiText * ttarrowDownTxt;
GuiText * ttarrowUpTxt;
GuiImageData * bgGames;
GuiImageData * bgGamesEntry;
GuiImageData * scrollbar;
GuiImageData * arrowDown;
GuiImageData * arrowDownOver;
GuiImageData * ttarrow;
GuiImageData * arrowUp;
GuiImageData * arrowUpOver;
GuiImageData * scrollbarBox;

View File

@ -3280,7 +3280,6 @@ static int MenuSettings()
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
settingsbackgroundbtn.SetPosition(0, 0);
settingsbackgroundbtn.SetImage(&settingsbackground);
settingsbackgroundbtn.SetTrigger(&trigA);
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
@ -3306,6 +3305,14 @@ static int MenuSettings()
page1Btn.SetSoundClick(&btnClick);
page1Btn.SetTrigger(&trigA);
GuiImageData ttpage(tooltip_png);
GuiText ttpage1Txt("Go to Page 1", 20, (GXColor){0, 0, 0, 255});
GuiImage ttpage1Img(&ttpage);
if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0)
page1Btn.SetToolTip(&ttpage1Img,&ttpage1Txt,105, 15);
GuiImage page2Img(&page2);
GuiImage page2dImg(&page2d);
GuiButton page2Btn(page2.GetWidth(), page2.GetHeight());
@ -3315,6 +3322,13 @@ static int MenuSettings()
page2Btn.SetSoundOver(&btnSoundOver);
page2Btn.SetSoundClick(&btnClick);
page2Btn.SetTrigger(&trigA);
GuiText ttpage2Txt("Go to Page 2", 20, (GXColor){0, 0, 0, 255});
GuiImage ttpage2Img(&ttpage);
if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0)
page2Btn.SetToolTip(&ttpage2Img,&ttpage2Txt,105,0);
////////////////////////////////