1*d7f7bf2dSAxel Dörfler /* 2*d7f7bf2dSAxel Dörfler * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>. 3*d7f7bf2dSAxel Dörfler * All rights reserved. Distributed under the terms of the MIT License. 4*d7f7bf2dSAxel Dörfler */ 5*d7f7bf2dSAxel Dörfler #ifndef TEXT_VIEW_H 6*d7f7bf2dSAxel Dörfler #define TEXT_VIEW_H 7*d7f7bf2dSAxel Dörfler 8*d7f7bf2dSAxel Dörfler #include <String.h> 9*d7f7bf2dSAxel Dörfler #include <View.h> 10*d7f7bf2dSAxel Dörfler 11*d7f7bf2dSAxel Dörfler #include "Paragraph.h" 12*d7f7bf2dSAxel Dörfler #include "ParagraphLayout.h" 13*d7f7bf2dSAxel Dörfler 14*d7f7bf2dSAxel Dörfler 15*d7f7bf2dSAxel Dörfler class TextView : public BView { 16*d7f7bf2dSAxel Dörfler public: 17*d7f7bf2dSAxel Dörfler TextView(const char* name = NULL); 18*d7f7bf2dSAxel Dörfler virtual ~TextView(); 19*d7f7bf2dSAxel Dörfler 20*d7f7bf2dSAxel Dörfler virtual void Draw(BRect updateRect); 21*d7f7bf2dSAxel Dörfler 22*d7f7bf2dSAxel Dörfler virtual void AttachedToWindow(); 23*d7f7bf2dSAxel Dörfler virtual void FrameResized(float width, float height); 24*d7f7bf2dSAxel Dörfler 25*d7f7bf2dSAxel Dörfler virtual BSize MinSize(); 26*d7f7bf2dSAxel Dörfler virtual BSize MaxSize(); 27*d7f7bf2dSAxel Dörfler virtual BSize PreferredSize(); 28*d7f7bf2dSAxel Dörfler 29*d7f7bf2dSAxel Dörfler virtual bool HasHeightForWidth(); 30*d7f7bf2dSAxel Dörfler virtual void GetHeightForWidth(float width, float* min, 31*d7f7bf2dSAxel Dörfler float* max, float* preferred); 32*d7f7bf2dSAxel Dörfler 33*d7f7bf2dSAxel Dörfler void SetText(const BString& text); 34*d7f7bf2dSAxel Dörfler void SetParagraphStyle(const ::ParagraphStyle& style); ParagraphStyle()35*d7f7bf2dSAxel Dörfler const ::ParagraphStyle& ParagraphStyle() const 36*d7f7bf2dSAxel Dörfler { return fText.Style(); } 37*d7f7bf2dSAxel Dörfler 38*d7f7bf2dSAxel Dörfler private: 39*d7f7bf2dSAxel Dörfler Paragraph fText; 40*d7f7bf2dSAxel Dörfler ParagraphLayout fTextLayout; 41*d7f7bf2dSAxel Dörfler }; 42*d7f7bf2dSAxel Dörfler 43*d7f7bf2dSAxel Dörfler #endif // TEXT_VIEW_H 44