From 22fa3fc131984ed070acbf368ccedaccc37cdcaa Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 21 Nov 2011 20:25:32 +0000 Subject: [PATCH] [ui] display device description as tooltip --- rufus.c | 7 +++++-- rufus.h | 3 +++ stdlg.c | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/rufus.c b/rufus.c index dc450324..31f9501e 100644 --- a/rufus.c +++ b/rufus.c @@ -57,7 +57,7 @@ char szFolderPath[MAX_PATH]; HWND hStatus; float fScale = 1.0f; -static HWND hDeviceList, hCapacity, hFileSystem; +static HWND hDeviceList, hCapacity, hFileSystem, hDeviceToolTip = NULL; static StrArray DriveID; #ifdef RUFUS_DEBUG @@ -509,6 +509,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA case IDCANCEL: PostQuitMessage(0); StrArrayDestroy(&DriveID); + DestroyAllTooltips(); EndDialog(hDlg, 0); break; case IDC_ABOUT: @@ -520,7 +521,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA nDeviceIndex = ComboBox_GetCurSel(hDeviceList); if (nDeviceIndex != CB_ERR) { PopulateProperties(ComboBox_GetCurSel(hDeviceList)); - SetDlgItemTextU(hMainDialog, IDC_STATUS, DriveID.Table[nDeviceIndex]); + // Display a tooltip with the OS reported description + DestroyTooltip(hDeviceToolTip); + hDeviceToolTip = CreateTooltip(hDeviceList, DriveID.Table[nDeviceIndex], -1); } break; } diff --git a/rufus.h b/rufus.h index b0455412..e80a0ef5 100644 --- a/rufus.h +++ b/rufus.h @@ -68,6 +68,9 @@ extern char *WindowsErrorString(void); extern void CenterDialog(HWND hDlg); extern void CreateStatusBar(void); extern INT_PTR CreateAboutBox(void); +extern HWND CreateTooltip(HWND hControl, char* message, int duration); +extern void DestroyTooltip(HWND hWnd); +extern void DestroyAllTooltips(void); /* Basic String Array */ typedef struct { diff --git a/stdlg.c b/stdlg.c index f93f29ca..4a198c39 100644 --- a/stdlg.c +++ b/stdlg.c @@ -634,7 +634,8 @@ HWND CreateTooltip(HWND hControl, char* message, int duration) if (ttlist[i].hTip == NULL) break; } if (i == MAX_TOOLTIPS) { - return (HWND)NULL; // No more space + uprintf("Maximum number of tooltips reached\n"); + return (HWND)NULL; } // Create the tooltip window