1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #ifndef PROPERTY_ITEM_VIEW_H 10 #define PROPERTY_ITEM_VIEW_H 11 12 #include <View.h> 13 14 class Property; 15 class PropertyEditorView; 16 class PropertyListView; 17 18 class PropertyItemView : public BView { 19 public: 20 PropertyItemView(Property* property); 21 virtual ~PropertyItemView(); 22 23 // BView interface 24 virtual void Draw(BRect updateRect); 25 virtual void FrameResized(float width, float height); 26 virtual void MakeFocus(bool focused); 27 28 virtual void MouseDown(BPoint where); 29 virtual void MouseUp(BPoint where); 30 virtual void MouseMoved(BPoint where, uint32 transit, 31 const BMessage* dragMessage); 32 33 // PropertyItemView 34 float PreferredHeight() const; 35 float PreferredLabelWidth() const; 36 void SetLabelWidth(float width); 37 38 Property* GetProperty() const; 39 bool AdoptProperty(Property* property); 40 41 void SetSelected(bool selected); 42 bool IsSelected() const 43 { return fSelected; } 44 void SetEnabled(bool enabled); 45 bool IsEnabled() const 46 { return fEnabled; } 47 virtual bool IsFocused() const; 48 49 void SetListView(PropertyListView* parent); 50 51 virtual void UpdateObject(); 52 53 private: 54 void _UpdateLowColor(); 55 56 PropertyListView* fParent; 57 PropertyEditorView* fEditorView; 58 bool fSelected; 59 bool fEnabled; 60 float fLabelWidth; 61 }; 62 63 #endif // PROPERTY_ITEM_VIEW_H 64 65 66