← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2233: minimum menu width

 

------------------------------------------------------------
revno: 2233
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Sat 2010-09-04 17:54:59 +0200
message:
  minimum menu width
modified:
  dwt/include/dwt/widgets/Menu.h
  dwt/src/widgets/Menu.cpp
  win32/NetworkPage.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 'dwt/include/dwt/widgets/Menu.h'
--- dwt/include/dwt/widgets/Menu.h	2010-08-10 16:28:19 +0000
+++ dwt/include/dwt/widgets/Menu.h	2010-09-04 15:54:59 +0000
@@ -95,6 +95,7 @@
 	static const int pointerGap; /// Gap between item text and sub - menu pointer
 	static const int textIconGap; /// Gap between text and icon
 	static const int textBorderGap; /// Gap between text and rectangel border
+	static const unsigned minWidth; /// Minimum width of a menu item
 
 	HMENU handle() const {
 		return itsHandle;

=== modified file 'dwt/src/widgets/Menu.cpp'
--- dwt/src/widgets/Menu.cpp	2010-09-02 18:16:12 +0000
+++ dwt/src/widgets/Menu.cpp	2010-09-04 15:54:59 +0000
@@ -56,6 +56,7 @@
 const int Menu::pointerGap = 5;
 const int Menu::textIconGap = 8;
 const int Menu::textBorderGap = 4;
+const unsigned Menu::minWidth = 100;
 
 /// @todo menus should re-init the cached default colors on WM_SYSCOLORCHANGE
 
@@ -754,8 +755,11 @@
 	if(drawSidebar)
 		itemWidth += getTextSize(getText(0), itsTitleFont).y; // 0 is the title index
 
-	// adjust item height
-	itemHeight = (std::max)( itemHeight, ( UINT )::GetSystemMetrics( SM_CYMENU ) );
+	// make sure the calculated size is not too small
+	if(popup) {
+		itemWidth = std::max(itemWidth, minWidth);
+		itemHeight = std::max(itemHeight, static_cast<UINT>(::GetSystemMetrics(SM_CYMENU)));
+	}
 	return true;
 }
 

=== modified file 'win32/NetworkPage.cpp'
--- win32/NetworkPage.cpp	2010-09-01 22:17:02 +0000
+++ win32/NetworkPage.cpp	2010-09-04 15:54:59 +0000
@@ -49,7 +49,8 @@
 		cur->column(0).mode = GridInfo::FILL;
 
 		GridPtr cur2 = cur->addChild(Grid::Seed(1, 2));
-		cur2->column(0).mode = GridInfo::FILL;
+		cur2->column(1).mode = GridInfo::FILL;
+		cur2->column(1).align = GridInfo::BOTTOM_RIGHT;
 
 		autoDetect = cur2->addChild(CheckBox::Seed(T_("Enable automatic incoming connection type detection")));
 		autoDetect->setHelpId(IDH_SETTINGS_NETWORK_AUTODETECT);