Patch by Obaro Ogbo: Provide a PreferredWidth() implementation for the

Relation attribute column in the Open With panel. So double clicking will
size it properly. Fixes ticket #3035. Thanks a lot!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29779 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-03-29 14:23:59 +00:00
parent 86fb66a8dd
commit 8ad62dec5a
2 changed files with 13 additions and 2 deletions
+12 -2
View File
@@ -1772,6 +1772,16 @@ OpenWithRelationAttributeText::ReadValue()
}
float
OpenWithRelationAttributeText::PreferredWidth(const BPoseView *pose) const
{
BString widthString;
TruncString(&widthString, fRelationText.String(), fRelationText.Length(),
pose, 500, B_TRUNCATE_END);
return pose->StringWidth(widthString.String());
}
void
OpenWithRelationAttributeText::FitValue(BString *result, const BPoseView *view)
{
@@ -1786,8 +1796,8 @@ OpenWithRelationAttributeText::FitValue(BString *result, const BPoseView *view)
launchWithView->OpenWithRelationDescription(fModel, &fRelationText);
fOldWidth = fColumn->Width();
fTruncatedWidth = TruncString(result, fRelationText.String(), fRelationText.Length(),
view, fOldWidth, B_TRUNCATE_END);
fTruncatedWidth = TruncString(result, fRelationText.String(),
fRelationText.Length(), view, fOldWidth, B_TRUNCATE_END);
fDirty = false;
}
+1
View File
@@ -357,6 +357,7 @@ class OpenWithRelationAttributeText : public ScalarAttributeText {
protected:
virtual void FitValue(BString *result, const BPoseView *);
virtual int64 ReadValue();
virtual float PreferredWidth(const BPoseView *) const;
const BPoseView *fPoseView;
BString fRelationText;