1 /* 2 * Copyright 2001-2005, Haiku Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Frans van Nispen (xlr8@tref.nl) 7 */ 8 #ifndef _STRING_VIEW_H 9 #define _STRING_VIEW_H 10 11 12 #include <BeBuild.h> 13 #include <View.h> 14 15 16 class BStringView : public BView{ 17 public: 18 BStringView(BRect bounds, const char* name, 19 const char* text, 20 uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, 21 uint32 flags = B_WILL_DRAW); 22 BStringView(const char* name, const char* text, 23 uint32 flags = B_WILL_DRAW); 24 BStringView(BMessage* data); 25 virtual ~BStringView(); 26 27 static BArchivable* Instantiate(BMessage* data); 28 virtual status_t Archive(BMessage* data, bool deep = true) const; 29 30 void SetText(const char* text); 31 const char* Text() const; 32 void SetAlignment(alignment flag); 33 alignment Alignment() const; 34 35 virtual void AttachedToWindow(); 36 virtual void Draw(BRect bounds); 37 38 virtual void MessageReceived(BMessage* message); 39 virtual void MouseDown(BPoint point); 40 virtual void MouseUp(BPoint point); 41 virtual void MouseMoved(BPoint point, uint32 transit, 42 const BMessage* dragMessage); 43 virtual void DetachedFromWindow(); 44 virtual void FrameMoved(BPoint newPosition); 45 virtual void FrameResized(float newWidth, float newHeight); 46 47 virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, 48 BMessage* specifier, int32 form, 49 const char* property); 50 51 virtual void ResizeToPreferred(); 52 virtual void GetPreferredSize(float* _width, float* _height); 53 virtual void MakeFocus(bool state = true); 54 virtual void AllAttached(); 55 virtual void AllDetached(); 56 virtual status_t GetSupportedSuites(BMessage* data); 57 58 virtual void SetFont(const BFont* font, 59 uint32 mask = B_FONT_ALL); 60 61 virtual void InvalidateLayout(bool descendants = false); 62 63 virtual BSize MinSize(); 64 virtual BSize MaxSize(); 65 virtual BSize PreferredSize(); 66 67 private: 68 virtual status_t Perform(perform_code d, void* arg); 69 virtual void _ReservedStringView1(); 70 virtual void _ReservedStringView2(); 71 virtual void _ReservedStringView3(); 72 73 BSize _ValidatePreferredSize(); 74 75 BStringView &operator=(const BStringView&); 76 77 char* fText; 78 alignment fAlign; 79 BSize fPreferredSize; 80 uint32 _reserved[1]; 81 }; 82 83 #endif // _STRING_VIEW_H 84