1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] display device description as tooltip

This commit is contained in:
Pete Batard 2011-11-21 20:25:32 +00:00
parent f263369e55
commit 22fa3fc131
3 changed files with 10 additions and 3 deletions

View file

@ -57,7 +57,7 @@ char szFolderPath[MAX_PATH];
HWND hStatus; HWND hStatus;
float fScale = 1.0f; float fScale = 1.0f;
static HWND hDeviceList, hCapacity, hFileSystem; static HWND hDeviceList, hCapacity, hFileSystem, hDeviceToolTip = NULL;
static StrArray DriveID; static StrArray DriveID;
#ifdef RUFUS_DEBUG #ifdef RUFUS_DEBUG
@ -509,6 +509,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
case IDCANCEL: case IDCANCEL:
PostQuitMessage(0); PostQuitMessage(0);
StrArrayDestroy(&DriveID); StrArrayDestroy(&DriveID);
DestroyAllTooltips();
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
case IDC_ABOUT: case IDC_ABOUT:
@ -520,7 +521,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
nDeviceIndex = ComboBox_GetCurSel(hDeviceList); nDeviceIndex = ComboBox_GetCurSel(hDeviceList);
if (nDeviceIndex != CB_ERR) { if (nDeviceIndex != CB_ERR) {
PopulateProperties(ComboBox_GetCurSel(hDeviceList)); 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; break;
} }

View file

@ -68,6 +68,9 @@ extern char *WindowsErrorString(void);
extern void CenterDialog(HWND hDlg); extern void CenterDialog(HWND hDlg);
extern void CreateStatusBar(void); extern void CreateStatusBar(void);
extern INT_PTR CreateAboutBox(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 */ /* Basic String Array */
typedef struct { typedef struct {

View file

@ -634,7 +634,8 @@ HWND CreateTooltip(HWND hControl, char* message, int duration)
if (ttlist[i].hTip == NULL) break; if (ttlist[i].hTip == NULL) break;
} }
if (i == MAX_TOOLTIPS) { if (i == MAX_TOOLTIPS) {
return (HWND)NULL; // No more space uprintf("Maximum number of tooltips reached\n");
return (HWND)NULL;
} }
// Create the tooltip window // Create the tooltip window