Update header indentation style.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27643 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-09-20 10:09:32 +00:00
parent fc3bed0577
commit 37b9874302

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, Haiku, Inc. * Copyright (c) 2007-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
*/ */
#ifndef _TEXTVIEW_H #ifndef _TEXTVIEW_H
@ -47,308 +47,340 @@ enum undo_state {
}; };
class BTextView : public BView { class BTextView : public BView {
public: public:
BTextView(BRect frame, const char* name, BRect textRect, BTextView(BRect frame, const char* name,
uint32 resizeMask, uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED); BRect textRect, uint32 resizeMask,
BTextView(BRect frame, const char* name, BRect textRect, uint32 flags
const BFont* initialFont, const rgb_color* initialColor, = B_WILL_DRAW | B_PULSE_NEEDED);
uint32 resizeMask, uint32 flags); BTextView(BRect frame, const char* name,
BTextView(BMessage* data); BRect textRect, const BFont* initialFont,
virtual ~BTextView(); const rgb_color* initialColor,
uint32 resizeMask, uint32 flags);
BTextView(BMessage* data);
static BArchivable* Instantiate(BMessage* data); virtual ~BTextView();
virtual status_t Archive(BMessage* data, bool deep = true) const;
virtual void AttachedToWindow(); static BArchivable* Instantiate(BMessage* data);
virtual void DetachedFromWindow(); virtual status_t Archive(BMessage* data, bool deep = true) const;
virtual void Draw(BRect inRect);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* message);
virtual void WindowActivated(bool state);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void Pulse();
virtual void FrameResized(float width, float height);
virtual void MakeFocus(bool focusState = true);
virtual void MessageReceived(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual void AttachedToWindow();
BMessage* specifier, int32 form, const char* property); virtual void DetachedFromWindow();
virtual status_t GetSupportedSuites(BMessage* data); virtual void Draw(BRect updateRect);
virtual status_t Perform(perform_code d, void* arg); virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage);
virtual void WindowActivated(bool state);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void Pulse();
virtual void FrameResized(float width, float height);
virtual void MakeFocus(bool focusState = true);
virtual void MessageReceived(BMessage* message);
void SetText(const char* inText, const text_run_array* inRuns = NULL); virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
void SetText(const char* inText, int32 inLength, BMessage* specifier, int32 form,
const text_run_array* inRuns = NULL); const char* property);
void SetText(BFile* inFile, int32 startOffset, int32 inLength, virtual status_t GetSupportedSuites(BMessage* data);
const text_run_array* inRuns = NULL); virtual status_t Perform(perform_code d, void* arg);
void Insert(const char* inText, const text_run_array* inRuns = NULL); void SetText(const char* inText,
void Insert(const char* inText, int32 inLength, const text_run_array* inRuns = NULL); const text_run_array* inRuns = NULL);
void Insert(int32 startOffset, const char* inText, int32 inLength, const text_run_array* inRuns = NULL); void SetText(const char* inText, int32 inLength,
const text_run_array* inRuns = NULL);
void SetText(BFile* inFile,
int32 startOffset, int32 inLength,
const text_run_array* inRuns = NULL);
void Delete(); void Insert(const char* inText,
void Delete(int32 startOffset, int32 endOffset); const text_run_array* inRuns = NULL);
void Insert(const char* inText, int32 inLength,
const text_run_array* inRuns = NULL);
void Insert(int32 startOffset,
const char* inText, int32 inLength,
const text_run_array* inRuns = NULL);
const char* Text() const; void Delete();
int32 TextLength() const; void Delete(int32 startOffset, int32 endOffset);
void GetText(int32 offset, int32 length, char* buffer) const;
uint8 ByteAt(int32 offset) const;
int32 CountLines() const; const char* Text() const;
int32 CurrentLine() const; int32 TextLength() const;
void GoToLine(int32 lineNum); void GetText(int32 offset, int32 length,
char* buffer) const;
uint8 ByteAt(int32 offset) const;
virtual void Cut(BClipboard* clipboard); int32 CountLines() const;
virtual void Copy(BClipboard* clipboard); int32 CurrentLine() const;
virtual void Paste(BClipboard* clipboard); void GoToLine(int32 lineIndex);
void Clear();
virtual bool AcceptsPaste(BClipboard* clipboard); virtual void Cut(BClipboard* clipboard);
virtual bool AcceptsDrop(const BMessage* inMessage); virtual void Copy(BClipboard* clipboard);
virtual void Paste(BClipboard* clipboard);
void Clear();
virtual void Select(int32 startOffset, int32 endOffset); virtual bool AcceptsPaste(BClipboard* clipboard);
void SelectAll(); virtual bool AcceptsDrop(const BMessage* inMessage);
void GetSelection(int32* outStart, int32* outEnd) const;
void SetFontAndColor(const BFont* inFont, uint32 inMode = B_FONT_ALL, virtual void Select(int32 startOffset, int32 endOffset);
const rgb_color* inColor = NULL); void SelectAll();
void SetFontAndColor(int32 startOffset, int32 endOffset, void GetSelection(int32* outStart,
const BFont* inFont, uint32 inMode = B_FONT_ALL, int32* outEnd) const;
const rgb_color* inColor = NULL);
void GetFontAndColor(int32 inOffset, BFont* outFont, void SetFontAndColor(const BFont* inFont,
rgb_color* outColor = NULL) const; uint32 inMode = B_FONT_ALL,
void GetFontAndColor(BFont* outFont, uint32* sameProperties, const rgb_color* inColor = NULL);
rgb_color* outColor = NULL, bool* sameColor = NULL) const; void SetFontAndColor(int32 startOffset,
int32 endOffset, const BFont* inFont,
uint32 inMode = B_FONT_ALL,
const rgb_color* inColor = NULL);
void SetRunArray(int32 startOffset, int32 endOffset, void GetFontAndColor(int32 inOffset, BFont* outFont,
const text_run_array* inRuns); rgb_color* outColor = NULL) const;
text_run_array* RunArray(int32 startOffset, int32 endOffset, void GetFontAndColor(BFont* outFont,
int32* outSize = NULL) const; uint32* sameProperties,
rgb_color* outColor = NULL,
bool* sameColor = NULL) const;
int32 LineAt(int32 offset) const; void SetRunArray(int32 startOffset, int32 endOffset,
int32 LineAt(BPoint point) const; const text_run_array* inRuns);
BPoint PointAt(int32 inOffset, float* outHeight = NULL) const; text_run_array* RunArray(int32 startOffset, int32 endOffset,
int32 OffsetAt(BPoint point) const; int32* outSize = NULL) const;
int32 OffsetAt(int32 line) const;
virtual void FindWord(int32 inOffset, int32* outFromOffset, int32 LineAt(int32 offset) const;
int32* outToOffset); int32 LineAt(BPoint point) const;
BPoint PointAt(int32 inOffset,
float* outHeight = NULL) const;
int32 OffsetAt(BPoint point) const;
int32 OffsetAt(int32 line) const;
virtual bool CanEndLine(int32 offset); virtual void FindWord(int32 inOffset, int32* outFromOffset,
int32* outToOffset);
float LineWidth(int32 lineNum = 0) const; virtual bool CanEndLine(int32 offset);
float LineHeight(int32 lineNum = 0) const;
float TextHeight(int32 startLine, int32 endLine) const;
void GetTextRegion(int32 startOffset, int32 endOffset, float LineWidth(int32 lineIndex = 0) const;
BRegion* outRegion) const; float LineHeight(int32 lineIndex = 0) const;
float TextHeight(int32 startLine,
int32 endLine) const;
virtual void ScrollToOffset(int32 inOffset); void GetTextRegion(int32 startOffset,
void ScrollToSelection(); int32 endOffset, BRegion* outRegion) const;
void Highlight(int32 startOffset, int32 endOffset); virtual void ScrollToOffset(int32 inOffset);
void ScrollToSelection();
void SetTextRect(BRect rect); void Highlight(int32 startOffset, int32 endOffset);
BRect TextRect() const;
void SetStylable(bool stylable);
bool IsStylable() const;
void SetTabWidth(float width);
float TabWidth() const;
void MakeSelectable(bool selectable = true);
bool IsSelectable() const;
void MakeEditable(bool editable = true);
bool IsEditable() const;
void SetWordWrap(bool wrap);
bool DoesWordWrap() const;
void SetMaxBytes(int32 max);
int32 MaxBytes() const;
void DisallowChar(uint32 aChar);
void AllowChar(uint32 aChar);
void SetAlignment(alignment flag);
alignment Alignment() const;
void SetAutoindent(bool state);
bool DoesAutoindent() const;
void SetColorSpace(color_space colors);
color_space ColorSpace() const;
void MakeResizable(bool resize, BView* resizeView = NULL);
bool IsResizable() const;
void SetDoesUndo(bool undo);
bool DoesUndo() const;
void HideTyping(bool enabled);
bool IsTypingHidden() const;
virtual void ResizeToPreferred(); void SetTextRect(BRect rect);
virtual void GetPreferredSize(float* _width, float* _height); BRect TextRect() const;
virtual void AllAttached(); void SetStylable(bool stylable);
virtual void AllDetached(); bool IsStylable() const;
void SetTabWidth(float width);
float TabWidth() const;
void MakeSelectable(bool selectable = true);
bool IsSelectable() const;
void MakeEditable(bool editable = true);
bool IsEditable() const;
void SetWordWrap(bool wrap);
bool DoesWordWrap() const;
void SetMaxBytes(int32 max);
int32 MaxBytes() const;
void DisallowChar(uint32 aChar);
void AllowChar(uint32 aChar);
void SetAlignment(alignment flag);
alignment Alignment() const;
void SetAutoindent(bool state);
bool DoesAutoindent() const;
void SetColorSpace(color_space colors);
color_space ColorSpace() const;
void MakeResizable(bool resize,
BView* resizeView = NULL);
bool IsResizable() const;
void SetDoesUndo(bool undo);
bool DoesUndo() const;
void HideTyping(bool enabled);
bool IsTypingHidden() const;
static text_run_array* AllocRunArray(int32 entryCount, virtual void ResizeToPreferred();
int32* outSize = NULL); virtual void GetPreferredSize(float* _width, float* _height);
static text_run_array* CopyRunArray(const text_run_array* orig, virtual void AllAttached();
int32 countDelta = 0); virtual void AllDetached();
static void FreeRunArray(text_run_array* array);
static void* FlattenRunArray(const text_run_array* inArray,
int32* outSize = NULL);
static text_run_array* UnflattenRunArray(const void* data,
int32* outSize = NULL);
protected: static text_run_array* AllocRunArray(int32 entryCount,
virtual void InsertText(const char* inText, int32 inLength, int32* outSize = NULL);
int32 inOffset, const text_run_array* inRuns); static text_run_array* CopyRunArray(const text_run_array* orig,
virtual void DeleteText(int32 fromOffset, int32 toOffset); int32 countDelta = 0);
static void FreeRunArray(text_run_array* array);
static void* FlattenRunArray(const text_run_array* inArray,
int32* outSize = NULL);
static text_run_array* UnflattenRunArray(const void* data,
int32* outSize = NULL);
public: protected:
virtual void Undo(BClipboard* clipboard); virtual void InsertText(const char* inText, int32 inLength,
undo_state UndoState(bool* isRedo) const; int32 inOffset,
const text_run_array* inRuns);
virtual void DeleteText(int32 fromOffset, int32 toOffset);
protected: public:
virtual void GetDragParameters(BMessage* drag, BBitmap** _bitmap, virtual void Undo(BClipboard* clipboard);
BPoint* point, BHandler** _handler); undo_state UndoState(bool* isRedo) const;
private: protected:
friend status_t _init_interface_kit_(); virtual void GetDragParameters(BMessage* drag,
friend class _BTextTrackState_; BBitmap** _bitmap, BPoint* point,
BHandler** _handler);
virtual void _ReservedTextView3(); private:
virtual void _ReservedTextView4(); friend status_t _init_interface_kit_();
virtual void _ReservedTextView5(); friend class _BTextTrackState_;
virtual void _ReservedTextView6();
virtual void _ReservedTextView7();
virtual void _ReservedTextView8();
virtual void _ReservedTextView9();
virtual void _ReservedTextView10();
virtual void _ReservedTextView11();
virtual void _ReservedTextView12();
void _InitObject(BRect textRect, const BFont* initialFont, virtual void _ReservedTextView3();
const rgb_color* initialColor); virtual void _ReservedTextView4();
virtual void _ReservedTextView5();
virtual void _ReservedTextView6();
virtual void _ReservedTextView7();
virtual void _ReservedTextView8();
virtual void _ReservedTextView9();
virtual void _ReservedTextView10();
virtual void _ReservedTextView11();
virtual void _ReservedTextView12();
void _HandleBackspace(); void _InitObject(BRect textRect,
void _HandleArrowKey(uint32 inArrowKey); const BFont* initialFont,
void _HandleDelete(); const rgb_color* initialColor);
void _HandlePageKey(uint32 inPageKey);
void _HandleAlphaKey(const char* bytes, int32 numBytes);
void _Refresh(int32 fromOffset, int32 toOffset, bool erase, bool scroll); void _HandleBackspace();
void _RecalculateLineBreaks(int32* startLine, int32* endLine); void _HandleArrowKey(uint32 inArrowKey);
int32 _FindLineBreak(int32 fromOffset, float* outAscent, void _HandleDelete();
float* outDescent, float* ioWidth); void _HandlePageKey(uint32 inPageKey);
void _HandleAlphaKey(const char* bytes,
int32 numBytes);
float _StyledWidth(int32 fromOffset, int32 length, void _Refresh(int32 fromOffset, int32 toOffset,
float* outAscent = NULL, float* outDescent = NULL) const; bool erase, bool scroll);
void _RecalculateLineBreaks(int32* startLine,
int32* endLine);
int32 _FindLineBreak(int32 fromOffset,
float* outAscent, float* outDescent,
float* ioWidth);
float _StyledWidthUTF8Safe(int32 fromOffset, int32 numChars, float _StyledWidth(int32 fromOffset, int32 length,
float* outAscent = NULL, float* outDescent = NULL) const; float* outAscent = NULL,
float* outDescent = NULL) const;
float _StyledWidthUTF8Safe(int32 fromOffset,
int32 numChars, float* outAscent = NULL,
float* outDescent = NULL) const;
float _ActualTabWidth(float location) const; float _ActualTabWidth(float location) const;
void _DoInsertText(const char* inText, int32 inLength, int32 inOffset, void _DoInsertText(const char* inText,
const text_run_array* inRuns, _BTextChangeResult_* outResult); int32 inLength, int32 inOffset,
const text_run_array* inRuns,
_BTextChangeResult_* outResult);
void _DoDeleteText(int32 fromOffset, int32 toOffset, void _DoDeleteText(int32 fromOffset, int32 toOffset,
_BTextChangeResult_* outResult); _BTextChangeResult_* outResult);
void _DrawLine(BView* view, const int32 &startLine, void _DrawLine(BView* view, const int32 &startLine,
const int32& startOffset, const bool& erase, BRect& eraseRect, const int32& startOffset, const bool& erase,
BRegion& inputRegion); BRect& eraseRect, BRegion& inputRegion);
void _DrawLines(int32 startLine, int32 endLine, int32 startOffset = -1, void _DrawLines(int32 startLine, int32 endLine,
bool erase = false); int32 startOffset = -1, bool erase = false);
void _DrawCaret(int32 offset); void _DrawCaret(int32 offset);
void _ShowCaret(); void _ShowCaret();
void _HideCaret(); void _HideCaret();
void _InvertCaret(); void _InvertCaret();
void _DragCaret(int32 offset); void _DragCaret(int32 offset);
void _StopMouseTracking(); void _StopMouseTracking();
bool _PerformMouseUp(BPoint where); bool _PerformMouseUp(BPoint where);
bool _PerformMouseMoved(BPoint where, uint32 code); bool _PerformMouseMoved(BPoint where, uint32 code);
void _TrackMouse(BPoint where, const BMessage* message, void _TrackMouse(BPoint where,
bool force = false); const BMessage* message,
bool force = false);
void _TrackDrag(BPoint where); void _TrackDrag(BPoint where);
void _InitiateDrag(); void _InitiateDrag();
bool _MessageDropped(BMessage* inMessage, BPoint where, BPoint offset); bool _MessageDropped(BMessage* inMessage,
BPoint where, BPoint offset);
void _PerformAutoScrolling(); void _PerformAutoScrolling();
void _UpdateScrollbars(); void _UpdateScrollbars();
void _AutoResize(bool doRedraw = true); void _AutoResize(bool doRedraw = true);
void _NewOffscreen(float padding = 0.0F); void _NewOffscreen(float padding = 0.0);
void _DeleteOffscreen(); void _DeleteOffscreen();
void _Activate(); void _Activate();
void _Deactivate(); void _Deactivate();
void _NormalizeFont(BFont* font); void _NormalizeFont(BFont* font);
void _SetRunArray(int32 startOffset, int32 endOffset, void _SetRunArray(int32 startOffset, int32 endOffset,
const text_run_array* inRuns); const text_run_array* inRuns);
uint32 _CharClassification(int32 offset) const; uint32 _CharClassification(int32 offset) const;
int32 _NextInitialByte(int32 offset) const; int32 _NextInitialByte(int32 offset) const;
int32 _PreviousInitialByte(int32 offset) const; int32 _PreviousInitialByte(int32 offset) const;
bool _GetProperty(BMessage* specifier, int32 form, const char* property, bool _GetProperty(BMessage* specifier, int32 form,
BMessage* reply); const char* property, BMessage* reply);
bool _SetProperty(BMessage* specifier, int32 form,
const char* property, BMessage* reply);
bool _CountProperties(BMessage* specifier,
int32 form, const char* property,
BMessage* reply);
bool _SetProperty(BMessage* specifier, int32 form, const char* property, void _HandleInputMethodChanged(BMessage* message);
BMessage* reply); void _HandleInputMethodLocationRequest();
void _CancelInputMethod();
bool _CountProperties(BMessage* specifier, int32 form, static void LockWidthBuffer();
const char* property, BMessage* reply); static void UnlockWidthBuffer();
void _HandleInputMethodChanged(BMessage* message); _BTextGapBuffer_* fText;
void _HandleInputMethodLocationRequest(); _BLineBuffer_* fLines;
void _CancelInputMethod(); _BStyleBuffer_* fStyles;
BRect fTextRect;
float fMinTextRectWidth;
int32 fSelStart;
int32 fSelEnd;
bool fCaretVisible;
bigtime_t fCaretTime;
int32 fClickOffset;
int32 fClickCount;
bigtime_t fClickTime;
int32 fDragOffset;
uint8 fCursor;
bool fActive;
bool fStylable;
float fTabWidth;
bool fSelectable;
bool fEditable;
bool fWrap;
int32 fMaxBytes;
BList* fDisallowedChars;
alignment fAlignment;
bool fAutoindent;
BBitmap* fOffscreen;
color_space fColorSpace;
bool fResizable;
BView* fContainerView;
_BUndoBuffer_* fUndo;
_BInlineInput_* fInline;
BMessageRunner * fDragRunner;
BMessageRunner * fClickRunner;
BPoint fWhere;
_BTextTrackState_* fTrackingMouse;
_BTextChangeResult_* fTextChange;
static void LockWidthBuffer(); uint32 _reserved[8];
static void UnlockWidthBuffer();
_BTextGapBuffer_* fText; static _BWidthBuffer_* sWidths;
_BLineBuffer_* fLines; static sem_id sWidthSem;
_BStyleBuffer_* fStyles; static int32 sWidthAtom;
BRect fTextRect;
float fMinTextRectWidth;
int32 fSelStart;
int32 fSelEnd;
bool fCaretVisible;
bigtime_t fCaretTime;
int32 fClickOffset;
int32 fClickCount;
bigtime_t fClickTime;
int32 fDragOffset;
uint8 fCursor;
bool fActive;
bool fStylable;
float fTabWidth;
bool fSelectable;
bool fEditable;
bool fWrap;
int32 fMaxBytes;
BList* fDisallowedChars;
alignment fAlignment;
bool fAutoindent;
BBitmap* fOffscreen;
color_space fColorSpace;
bool fResizable;
BView* fContainerView;
_BUndoBuffer_* fUndo;
_BInlineInput_* fInline;
BMessageRunner * fDragRunner;
BMessageRunner * fClickRunner;
BPoint fWhere;
_BTextTrackState_* fTrackingMouse;
_BTextChangeResult_* fTextChange;
uint32 _reserved[8];
static _BWidthBuffer_* sWidths;
static sem_id sWidthSem;
static int32 sWidthAtom;
}; };
#endif // _TEXTVIEW_H #endif // _TEXTVIEW_H