* added helper method MaxWidth() to BTextView::LineBuffer
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33702 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -105,3 +105,20 @@ BTextView::LineBuffer::BumpOffset(int32 delta, int32 index)
|
||||
for (long i = index; i < fItemCount; i++)
|
||||
fBuffer[i].offset += delta;
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
BTextView::LineBuffer::MaxWidth() const
|
||||
{
|
||||
if (fItemCount == 0)
|
||||
return 0;
|
||||
|
||||
float maxWidth = 0;
|
||||
STELine* line = &fBuffer[0];
|
||||
for (int32 i = 0; i < fItemCount; i++) {
|
||||
if (maxWidth < line->width)
|
||||
maxWidth = line->width;
|
||||
line++;
|
||||
}
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ struct STELine {
|
||||
long offset; // offset of first character of line
|
||||
float origin; // pixel position of top of line
|
||||
float ascent; // maximum ascent for line
|
||||
float width; // not used for now, but could be
|
||||
float width; // cached width of line in pixels
|
||||
};
|
||||
|
||||
|
||||
@@ -31,11 +31,12 @@ virtual ~LineBuffer();
|
||||
|
||||
int32 OffsetToLine(int32 offset) const;
|
||||
int32 PixelToLine(float pixel) const;
|
||||
|
||||
|
||||
void BumpOrigin(float delta, int32 index);
|
||||
void BumpOffset(int32 delta, int32 index);
|
||||
|
||||
long NumLines() const;
|
||||
float MaxWidth() const;
|
||||
STELine * operator[](int32 index) const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user