1 /* 2 * Copyright 2006-2007, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #ifndef PROPERTY_LIST_VIEW_H 10 #define PROPERTY_LIST_VIEW_H 11 12 #include <List.h> 13 #include <View.h> 14 15 #include "MouseWheelFilter.h" 16 #include "Scrollable.h" 17 18 class BClipboard; 19 class BMenu; 20 class BMenuItem; 21 class CommandStack; 22 class Property; 23 class PropertyItemView; 24 class PropertyObject; 25 class ScrollView; 26 class TabFilter; 27 28 class PropertyListView : public BView, 29 public Scrollable, 30 private BList, 31 public MouseWheelTarget { 32 public: 33 PropertyListView(); 34 virtual ~PropertyListView(); 35 36 // BView interface 37 virtual void AttachedToWindow(); 38 virtual void DetachedFromWindow(); 39 virtual void FrameResized(float width, float height); 40 virtual void Draw(BRect updateRect); 41 virtual void MakeFocus(bool focus); 42 virtual void MouseDown(BPoint where); 43 virtual void MessageReceived(BMessage* message); 44 45 #ifdef __HAIKU__ 46 virtual BSize MinSize(); 47 virtual BSize MaxSize(); 48 virtual BSize PreferredSize(); 49 #endif 50 51 // Scrollable interface 52 virtual void ScrollOffsetChanged(BPoint oldOffset, 53 BPoint newOffset); 54 55 // MouseWheelTarget interface 56 virtual bool MouseWheelChanged(float x, float y) { return false; } 57 58 // PropertyListView 59 void SetTo(PropertyObject* object); 60 // takes ownership of the object 61 virtual void PropertyChanged(const Property* previous, 62 const Property* current); 63 // implement to know when a property changed 64 virtual void PasteProperties(const PropertyObject* object); 65 // implement to know when a property changed 66 virtual bool IsEditingMultipleObjects(); 67 68 void SetMenu(BMenu* menu); 69 ::ScrollView* ScrollView() const; 70 void UpdateStrings(); 71 72 // interface for Property framework 73 void UpdateObject(uint32 propertyID); 74 75 bool TabFocus(bool shift); 76 77 void Select(PropertyItemView* item); 78 void DeselectAll(); 79 80 void Clicked(PropertyItemView* item); 81 void DoubleClicked(PropertyItemView* item); 82 83 private: 84 void _UpdateSavedProperties(); 85 86 bool _AddItem(PropertyItemView* item); 87 PropertyItemView* _RemoveItem(int32 index); 88 PropertyItemView* _ItemAt(int32 index) const; 89 int32 _CountItems() const; 90 91 void _MakeEmpty(); 92 93 BRect _ItemsRect() const; 94 void _LayoutItems(); 95 96 void _CheckMenuStatus(); 97 98 BClipboard* fClipboard; 99 100 BMenu* fSelectM; 101 BMenuItem* fSelectAllMI; 102 BMenuItem* fSelectNoneMI; 103 BMenuItem* fInvertSelectionMI; 104 105 BMenu* fPropertyM; 106 BMenuItem* fCopyMI; 107 BMenuItem* fPasteMI; 108 109 PropertyObject* fPropertyObject; 110 PropertyObject* fSavedProperties; 111 112 PropertyItemView* fLastClickedItem; 113 114 bool fSuspendUpdates; 115 116 MouseWheelFilter* fMouseWheelFilter; 117 TabFilter* fTabFilter; 118 }; 119 120 #endif // PROPERTY_LIST_VIEW_H 121