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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user