← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2840: less annoying setting tooltips

 

------------------------------------------------------------
revno: 2840
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-01-28 00:03:27 +0100
message:
  less annoying setting tooltips
modified:
  win32/SettingsDialog.cpp
  win32/WinUtil.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/SettingsDialog.cpp'
--- win32/SettingsDialog.cpp	2012-01-23 20:18:58 +0000
+++ win32/SettingsDialog.cpp	2012-01-27 23:03:27 +0000
@@ -262,23 +262,22 @@
 		if(table)
 			table->onSelectionChanged([dialog, widget] { dialog->handleChildHelp(widget); });
 
-		// associate a tooltip with widgets that may provide a valid cshelp id.
-		auto id = widget->getHelpId();
-		if((id >= IDH_CSHELP_BEGIN && id <= IDH_CSHELP_END) || table) {
-			dialog->tip->addTool(widget);
+		/* associate a tooltip callback with every widget; a tooltip will be shown for those that
+		provide a valid cshelp id; the tooltip will disappear when hovering others (to be as
+		discreet as possible). */
+		dialog->tip->addTool(widget);
 
-			// special refresh logic for tables as they may have different help ids for each item.
-			if(table) {
-				table->onMouseMove([dialog, table](const dwt::MouseEvent&) -> bool {
-					const auto id = table->getHelpId();
-					static int prevId = -1;
-					if(static_cast<int>(id) != prevId) {
-						prevId = static_cast<int>(id);
-						dialog->tip->sendMessage(TTM_UPDATE);
-					}
-					return false;
-				});
-			}
+		// special refresh logic for tables as they may have different help ids for each item.
+		if(table) {
+			table->onMouseMove([dialog, table](const dwt::MouseEvent&) -> bool {
+				const auto id = table->getHelpId();
+				static int prevId = -1;
+				if(static_cast<int>(id) != prevId) {
+					prevId = static_cast<int>(id);
+					dialog->tip->sendMessage(TTM_UPDATE);
+				}
+				return false;
+			});
 		}
 	}
 	return TRUE;

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2012-01-22 20:27:14 +0000
+++ win32/WinUtil.cpp	2012-01-27 23:03:27 +0000
@@ -1075,6 +1075,10 @@
 	if(id >= IDH_CSHELP_BEGIN && id <= IDH_CSHELP_END) {
 		// context-sensitive help
 		new HelpPopup<true>(widget, Text::toT(getHelpText(id)), timeout);
+
+	} else if(helpPopup) {
+		// close the previous one.
+		helpPopup->close();
 	}
 }