2 * Copyright 2001-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Marc Flerackers (mflerackers@androme.be)
8 #ifndef __LINE_BUFFER_H
9 #define __LINE_BUFFER_H
12 #include <SupportDefs.h>
15 #include "TextViewSupportBuffer.h"
18 long offset
; // offset of first character of line
19 float origin
; // pixel position of top of line
20 float ascent
; // maximum ascent for line
21 float width
; // cached width of line in pixels
25 class BTextView::LineBuffer
: public _BTextViewSupportBuffer_
<STELine
> {
29 virtual ~LineBuffer();
31 void InsertLine(STELine
* inLine
, int32 index
);
32 void RemoveLines(int32 index
, int32 count
= 1);
33 void RemoveLineRange(int32 fromOffset
,
36 int32
OffsetToLine(int32 offset
) const;
37 int32
PixelToLine(float pixel
) const;
39 void BumpOrigin(float delta
, int32 index
);
40 void BumpOffset(int32 delta
, int32 index
);
42 int32
NumLines() const;
43 float MaxWidth() const;
44 STELine
* operator[](int32 index
) const;
49 BTextView::LineBuffer::NumLines() const
51 return fItemCount
- 1;
56 BTextView::LineBuffer::operator[](int32 index
) const
58 return &fBuffer
[index
];
62 #endif // __LINE_BUFFER_H