1 /* 2 * Copyright 2005, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, axeld@pinc-software.de 7 */ 8 #ifndef SCREEN_MANAGER_H 9 #define SCREEN_MANAGER_H 10 11 12 #include <AutoDeleter.h> 13 #include <Looper.h> 14 #include <ObjectList.h> 15 16 17 class BMessage; 18 19 class DrawingEngine; 20 class HWInterface; 21 class HWInterfaceListener; 22 class Screen; 23 24 25 typedef BObjectList<Screen> ScreenList; 26 27 28 class ScreenOwner { 29 public: 30 virtual ~ScreenOwner() {}; 31 virtual void ScreenRemoved(Screen* screen) = 0; 32 virtual void ScreenAdded(Screen* screen) = 0; 33 virtual void ScreenChanged(Screen* screen) = 0; 34 35 virtual bool ReleaseScreen(Screen* screen) = 0; 36 }; 37 38 39 class ScreenManager : public BLooper { 40 public: 41 ScreenManager(); 42 virtual ~ScreenManager(); 43 44 Screen* ScreenAt(int32 index) const; 45 int32 CountScreens() const; 46 47 status_t AcquireScreens(ScreenOwner* owner, int32* wishList, 48 int32 wishCount, const char* target, bool force, 49 ScreenList& list); 50 void ReleaseScreens(ScreenList& list); 51 52 void ScreenChanged(Screen* screen); 53 54 virtual void MessageReceived(BMessage* message); 55 56 private: 57 struct screen_item { 58 ObjectDeleter<Screen> screen; 59 ScreenOwner* owner; 60 ObjectDeleter<HWInterfaceListener> 61 listener; 62 }; 63 64 void _ScanDrivers(); 65 screen_item* _AddHWInterface(HWInterface* interface); 66 67 BObjectList<screen_item> fScreenList; 68 }; 69 70 extern ScreenManager *gScreenManager; 71 72 #endif /* SCREEN_MANAGER_H */ 73