1 /* 2 * Copyright 2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Mikael Konradson, mikael.konradson@gmail.com 7 */ 8 #ifndef FONT_DEMO_VIEW_H 9 #define FONT_DEMO_VIEW_H 10 11 12 #include <View.h> 13 #include <Region.h> 14 #include <String.h> 15 16 class BShape; 17 class BBitmap; 18 19 20 class FontDemoView : public BView { 21 public: 22 FontDemoView(BRect rect); 23 virtual ~FontDemoView(); 24 25 virtual void Draw(BRect updateRect); 26 virtual void MessageReceived(BMessage* message); 27 virtual void FrameResized(float width, float height); 28 29 virtual void SetFontSize(float size); 30 const float FontSize() const { return fFont.Size(); } 31 32 void SetDrawBoundingBoxes(bool state); 33 bool BoundingBoxes() const { return fBoundingBoxes; } 34 35 void SetFontShear(float shear); 36 const float Shear() const { return fFont.Shear(); } 37 38 void SetFontRotation(float rotation); 39 const float Rotation() const { return fFont.Rotation(); } 40 41 void SetString(BString string); 42 BString String() const; 43 44 void SetAntialiasing(bool state); 45 46 void SetSpacing(float space); 47 const float Spacing() const { return fSpacing; } 48 49 void SetOutlineLevel(int8 outline); 50 const int8 OutLineLevel() const { return fOutLineLevel; } 51 52 private: 53 void _AddShapes(BString string); 54 void _DrawView(BView* view); 55 56 BView* _GetView(BRect rect); 57 void _NewBitmap(BRect rect); 58 59 BBitmap* fBitmap; 60 BView* fBufferView; 61 62 BString fString; 63 float fFontSize; 64 float fSpacing; 65 int8 fOutLineLevel; 66 drawing_mode fDrawingMode; 67 68 BRegion fBoxRegion; 69 BFont fFont; 70 bool fBoundingBoxes; 71 bool fDrawShapes; 72 BShape** fShapes; 73 }; 74 75 #endif // FONT_DEMO_VIEW_H 76 77 78