← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2295: grey out fav hub buttons depending on the selection

 

------------------------------------------------------------
revno: 2295
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-11-18 19:23:40 +0100
message:
  grey out fav hub buttons depending on the selection
modified:
  help/window_favorite_hubs.html
  win32/FavHubsFrame.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 'help/window_favorite_hubs.html'
--- help/window_favorite_hubs.html	2010-11-13 17:50:36 +0000
+++ help/window_favorite_hubs.html	2010-11-18 18:23:40 +0000
@@ -46,7 +46,7 @@
   <dd cshelp="IDH_FAVORITE_HUBS_MOVE_DOWN">Move down selected hubs in the list.</dd>
   <dt>Remove</dt>
   <dd cshelp="IDH_FAVORITE_HUBS_REMOVE">Remove selected hubs from the favorite hubs list.</dd>
-  <dt>Group</dt>
+  <dt>Move to group</dt>
   <dd cshelp="IDH_FAVORITE_HUBS_GROUP">Open a menu with the available favorite hub groups in order to move the selected hubs to the choosen group.</dd>
   <dt>Manage groups</dt>
   <dd cshelp="IDH_FAVORITE_HUBS_MANAGE_GROUPS">

=== modified file 'win32/FavHubsFrame.cpp'
--- win32/FavHubsFrame.cpp	2010-11-13 17:50:36 +0000
+++ win32/FavHubsFrame.cpp	2010-11-18 18:23:40 +0000
@@ -74,15 +74,19 @@
 	{
 		ButtonPtr button;
 		Button::Seed cs = WinUtil::Seeds::button;
+		cs.style |= WS_DISABLED;
 
 		cs.caption = T_("&Connect");
 		button = grid->addChild(cs);
 		button->setHelpId(IDH_FAVORITE_HUBS_CONNECT);
 		button->onClicked(std::bind(&FavHubsFrame::openSelected, this));
 		addWidget(button);
+		hubs->onSelectionChanged([this, button] { button->setEnabled(hubs->hasSelected()); });
 
 		cs.caption = T_("&New...");
+		cs.style &= ~WS_DISABLED;
 		button = grid->addChild(cs);
+		cs.style |= WS_DISABLED;
 		button->setHelpId(IDH_FAVORITE_HUBS_NEW);
 		button->onClicked(std::bind(&FavHubsFrame::handleAdd, this));
 		addWidget(button);
@@ -92,32 +96,38 @@
 		button->setHelpId(IDH_FAVORITE_HUBS_PROPERTIES);
 		button->onClicked(std::bind(&FavHubsFrame::handleProperties, this));
 		addWidget(button);
+		hubs->onSelectionChanged([this, button] { button->setEnabled(hubs->countSelected() == 1); });
 
 		cs.caption = T_("Move &Up");
 		button = grid->addChild(cs);
 		button->setHelpId(IDH_FAVORITE_HUBS_MOVE_UP);
 		button->onClicked(std::bind(&FavHubsFrame::handleMove, this, true));
 		addWidget(button);
+		hubs->onSelectionChanged([this, button] { button->setEnabled(hubs->hasSelected()); });
 
 		cs.caption = T_("Move &Down");
 		button = grid->addChild(cs);
 		button->setHelpId(IDH_FAVORITE_HUBS_MOVE_DOWN);
 		button->onClicked(std::bind(&FavHubsFrame::handleMove, this, false));
 		addWidget(button);
+		hubs->onSelectionChanged([this, button] { button->setEnabled(hubs->hasSelected()); });
 
 		cs.caption = T_("&Remove");
 		button = grid->addChild(cs);
 		button->setHelpId(IDH_FAVORITE_HUBS_REMOVE);
 		button->onClicked(std::bind(&FavHubsFrame::handleRemove, this));
 		addWidget(button);
+		hubs->onSelectionChanged([this, button] { button->setEnabled(hubs->hasSelected()); });
 
-		cs.caption = T_("&Group");
+		cs.caption = T_("&Move to group");
 		button = grid->addChild(cs);
 		button->setHelpId(IDH_FAVORITE_HUBS_GROUP);
 		button->onClicked([this] { handleGroup(); });
 		addWidget(button);
+		hubs->onSelectionChanged([this, button] { button->setEnabled(hubs->hasSelected()); });
 
-		cs.caption = T_("&Manage groups");
+		cs.caption = T_("Manage &groups");
+		cs.style &= ~WS_DISABLED;
 		button = grid->addChild(cs);
 		button->setHelpId(IDH_FAVORITE_HUBS_MANAGE_GROUPS);
 		button->onClicked(std::bind(&FavHubsFrame::handleGroups, this));
@@ -333,12 +343,11 @@
 	menu->appendItem(T_("&Remove"), std::bind(&FavHubsFrame::handleRemove, this), dwt::IconPtr(), selected);
 	menu->appendSeparator();
 	if(selected) {
-		MenuPtr group = menu->appendPopup(T_("&Group"));
-		fillGroupMenu(group);
+		fillGroupMenu(menu->appendPopup(T_("&Move to group")));
 	} else {
-		menu->appendItem(T_("&Group"), 0, dwt::IconPtr(), selected);
+		menu->appendItem(T_("&Move to group"), 0, dwt::IconPtr(), selected);
 	}
-	menu->appendItem(T_("&Manage groups"), std::bind(&FavHubsFrame::handleGroups, this));
+	menu->appendItem(T_("Manage &groups"), std::bind(&FavHubsFrame::handleGroups, this));
 
 	menu->open(pt);
 	return true;