1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef VALUE_HANDLER_ROSTER_H 6 #define VALUE_HANDLER_ROSTER_H 7 8 9 #include <Locker.h> 10 #include <ObjectList.h> 11 12 13 class TableCellValueRenderer; 14 class Value; 15 class ValueFormatter; 16 class ValueHandler; 17 18 19 typedef BObjectList<ValueHandler> ValueHandlerList; 20 21 22 class ValueHandlerRoster { 23 public: 24 ValueHandlerRoster(); 25 ~ValueHandlerRoster(); 26 27 static ValueHandlerRoster* Default(); 28 static status_t CreateDefault(); 29 static void DeleteDefault(); 30 31 status_t Init(); 32 status_t RegisterDefaultHandlers(); 33 34 status_t FindValueHandler(Value* value, 35 ValueHandler*& _handler); 36 // returns a reference 37 status_t GetValueFormatter(Value* value, 38 ValueFormatter*& _formatter); 39 // returns a reference 40 status_t GetTableCellValueRenderer(Value* value, 41 TableCellValueRenderer*& _renderer); 42 // returns a reference 43 44 bool RegisterHandler(ValueHandler* handler); 45 void UnregisterHandler(ValueHandler* handler); 46 47 private: 48 BLocker fLock; 49 ValueHandlerList fValueHandlers; 50 static ValueHandlerRoster* sDefaultInstance; 51 }; 52 53 54 #endif // VALUE_HANDLER_ROSTER_H 55