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(BMessage* data); 23 virtual ~BStringView(); 24 25 static BArchivable* Instantiate(BMessage* data); 26 virtual status_t Archive(BMessage* data, bool deep = true) const; 27 28 void SetText(const char* text); 29 const char* Text() const; 30 void SetAlignment(alignment flag); 31 alignment Alignment() const; 32 33 virtual void AttachedToWindow(); 34 virtual void Draw(BRect bounds); 35 36 virtual void MessageReceived(BMessage* message); 37 virtual void MouseDown(BPoint point); 38 virtual void MouseUp(BPoint point); 39 virtual void MouseMoved(BPoint point, uint32 transit, 40 const BMessage* dragMessage); 41 virtual void DetachedFromWindow(); 42 virtual void FrameMoved(BPoint newPosition); 43 virtual void FrameResized(float newWidth, float newHeight); 44 45 virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, 46 BMessage* specifier, int32 form, 47 const char* property); 48 49 virtual void ResizeToPreferred(); 50 virtual void GetPreferredSize(float* _width, float* _height); 51 virtual void MakeFocus(bool state = true); 52 virtual void AllAttached(); 53 virtual void AllDetached(); 54 virtual status_t GetSupportedSuites(BMessage* data); 55 56 private: 57 virtual status_t Perform(perform_code d, void* arg); 58 virtual void _ReservedStringView1(); 59 virtual void _ReservedStringView2(); 60 virtual void _ReservedStringView3(); 61 62 BStringView &operator=(const BStringView&); 63 64 char* fText; 65 alignment fAlign; 66 uint32 _reserved[3]; 67 }; 68 69 #endif // _STRING_VIEW_H 70