From 7ed41e0491385688a2ec16c8a7bca0f82a306263 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Tue, 5 May 2009 17:24:19 +0000 Subject: [PATCH] *Added tooltip to scrollbararrows and Tabs in settings. --- source/libwiigui/gui_button.cpp | 18 ----------- source/libwiigui/gui_gamebrowser.cpp | 27 ++++++++++++++++ source/libwiigui/gui_gamebrowser.h | 6 ++++ source/menu.cpp | 46 ++++++++++++++++++---------- 4 files changed, 63 insertions(+), 34 deletions(-) diff --git a/source/libwiigui/gui_button.cpp b/source/libwiigui/gui_button.cpp index 11940bf1..0b774e27 100644 --- a/source/libwiigui/gui_button.cpp +++ b/source/libwiigui/gui_button.cpp @@ -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() diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index f8278a45..a52a687e 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -12,6 +12,7 @@ #include #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(); } diff --git a/source/libwiigui/gui_gamebrowser.h b/source/libwiigui/gui_gamebrowser.h index 6b6661f8..5b588a85 100644 --- a/source/libwiigui/gui_gamebrowser.h +++ b/source/libwiigui/gui_gamebrowser.h @@ -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; diff --git a/source/menu.cpp b/source/menu.cpp index fab3767a..551be485 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1043,7 +1043,7 @@ int GameWindowPrompt() choice = 3; promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50); } - + else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == no)){//next game promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50); changed = 1; @@ -1061,7 +1061,7 @@ int GameWindowPrompt() btnLeft.ResetState(); break; } - + else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == yes)){//previous game promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50); changed = 2; @@ -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); @@ -3305,7 +3304,15 @@ static int MenuSettings() page1Btn.SetSoundOver(&btnSoundOver); 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,8 +3322,15 @@ 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); + //////////////////////////////// - + const char * text = "Unlock"; if (CFG.godmode == 1) @@ -3390,7 +3404,7 @@ static int MenuSettings() { mainWindow->Append(&page1Btn); mainWindow->Append(&page2Btn); - + sprintf(options2.name[0], "Tooltips"); sprintf(options2.name[1], "Password"); sprintf(options2.name[2], "Boot Loader in"); @@ -3472,7 +3486,7 @@ static int MenuSettings() else if (Settings.volume == v90) sprintf (options2.value[7],"90"); else if (Settings.volume == v100) sprintf (options2.value[7],"100"); else if (Settings.volume == v0) sprintf (options2.value[7],"Off"); - + sprintf (options2.value[8]," "); ret = optionBrowser2.GetClickedOption(); @@ -3526,13 +3540,13 @@ static int MenuSettings() if (Settings.cios == ios249) sprintf (options2.value[2],"cIOS 249"); else if (Settings.cios == ios222) sprintf (options2.value[2],"cIOS 222"); - + if (Settings.xflip == no) sprintf (options2.value[3],"No"); else if (Settings.xflip == yes) sprintf (options2.value[3],"Yes"); - + if (Settings.qboot == no) sprintf (options2.value[4],"No"); else if (Settings.qboot == yes) sprintf (options2.value[4],"Yes"); - + sprintf (options2.value[5]," "); sprintf (options2.value[6]," "); sprintf (options2.value[7]," "); @@ -3547,7 +3561,7 @@ static int MenuSettings() break; case 1: // Modify Password if ( CFG.godmode == 1) - { + { mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&page1Btn); mainWindow->Remove(&page2Btn); @@ -3589,7 +3603,7 @@ static int MenuSettings() Sys_Shutdown(); if(reset == 1) Sys_Reboot(); - + if(page1Btn.GetState() == STATE_CLICKED) { pageToDisplay = 1; @@ -3598,8 +3612,8 @@ static int MenuSettings() page2Btn.SetImage(&page2dImg); menu = MENU_NONE; break; - } - + } + if(page2Btn.GetState() == STATE_CLICKED) { pageToDisplay = 2; @@ -3609,7 +3623,7 @@ static int MenuSettings() page2Btn.SetImage(&page2Img); break; } - + if(backBtn.GetState() == STATE_CLICKED) { //Add the procedure call to save the global configuration @@ -4050,7 +4064,7 @@ int MainMenu(int menu) int currentMenu = menu; char imgPath[100]; - #ifdef HW_RVL + #ifdef HW_RVL snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path); pointer[0] = new GuiImageData(imgPath, player1_point_png); snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", CFG.theme_path);