linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #01813
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2218: adjust the top padding of caption-less group-boxes
------------------------------------------------------------
revno: 2218
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Sun 2010-08-29 14:43:11 +0200
message:
adjust the top padding of caption-less group-boxes
modified:
dwt/src/widgets/GroupBox.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/src/widgets/GroupBox.cpp'
--- dwt/src/widgets/GroupBox.cpp 2010-07-10 14:36:48 +0000
+++ dwt/src/widgets/GroupBox.cpp 2010-08-29 12:43:11 +0000
@@ -79,13 +79,15 @@
}
Rectangle GroupBox::shrink(const Rectangle& client) {
- // Taken from http://support.microsoft.com/kb/124315
UpdateCanvas c(this);
-
c.selectFont(getFont());
+
TEXTMETRIC tmNew = { 0 };
c.getTextMetrics(tmNew);
- const int h = tmNew.tmHeight;
+ int h = tmNew.tmHeight;
+
+ if(length() == 0)
+ h /= 2;
return Rectangle(
client.width() > padding.x / 2 ? client.x() + padding.x / 2 : client.width(),
@@ -101,9 +103,14 @@
TEXTMETRIC tmNew = { 0 };
c.getTextMetrics(tmNew);
- const int h = tmNew.tmHeight;
+ int h = tmNew.tmHeight;
- Point txt = c.getTextExtent(getText());
+ Point txt;
+ if(length() > 0) {
+ txt = c.getTextExtent(getText());
+ } else {
+ h /= 2;
+ }
return Point(std::max(child.x, txt.x) + padding.x, child.y + padding.y + h);
}