Truncate Background image name to avoid layout problem
Fixes #7406 Signed-off-by: Siarzhuk Zharski <[email protected]>
This commit is contained in:
committed by
Siarzhuk Zharski
parent
fef016caf6
commit
b4fdcd5e54
@@ -561,7 +561,17 @@ Image::Image(BPath path)
|
|||||||
fBitmap(NULL),
|
fBitmap(NULL),
|
||||||
fPath(path)
|
fPath(path)
|
||||||
{
|
{
|
||||||
name = path.Leaf();
|
const int32 kMaxWidth = 40;
|
||||||
|
fName = path.Leaf();
|
||||||
|
int extra = fName.Length() - kMaxWidth;
|
||||||
|
if (extra > 0) {
|
||||||
|
int offset = fName.FindLast('.');
|
||||||
|
if (offset > 0) {
|
||||||
|
offset++;
|
||||||
|
fName.Truncate(offset - extra) << B_UTF8_ELLIPSIS;
|
||||||
|
fName.Append(path.Leaf() + offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -165,13 +165,13 @@ public:
|
|||||||
~Image();
|
~Image();
|
||||||
|
|
||||||
void UnloadBitmap();
|
void UnloadBitmap();
|
||||||
const char* GetName() {return name.String();}
|
const char* GetName() { return fName.String(); }
|
||||||
BBitmap* GetBitmap();
|
BBitmap* GetBitmap();
|
||||||
BPath GetPath() {return fPath;}
|
BPath GetPath() { return fPath; }
|
||||||
private:
|
private:
|
||||||
BBitmap* fBitmap;
|
BBitmap* fBitmap;
|
||||||
BPath fPath;
|
BPath fPath;
|
||||||
BString name;
|
BString fName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user