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 <Looper.h> 13 #include <ObjectList.h> 14 15 16 class BMessage; 17 18 class DrawingEngine; 19 class HWInterface; 20 class HWInterfaceListener; 21 class Screen; 22 23 24 typedef BObjectList<Screen> ScreenList; 25 26 27 class ScreenOwner { 28 public: 29 virtual ~ScreenOwner() {}; 30 virtual void ScreenRemoved(Screen* screen) = 0; 31 virtual void ScreenAdded(Screen* screen) = 0; 32 virtual void ScreenChanged(Screen* screen) = 0; 33 34 virtual bool ReleaseScreen(Screen* screen) = 0; 35 }; 36 37 38 class ScreenManager : public BLooper { 39 public: 40 ScreenManager(); 41 virtual ~ScreenManager(); 42 43 Screen* ScreenAt(int32 index) const; 44 int32 CountScreens() const; 45 46 status_t AcquireScreens(ScreenOwner* owner, int32* wishList, 47 int32 wishCount, const char* target, bool force, 48 ScreenList& list); 49 void ReleaseScreens(ScreenList& list); 50 51 void ScreenChanged(Screen* screen); 52 53 virtual void MessageReceived(BMessage* message); 54 55 private: 56 struct screen_item { 57 Screen* screen; 58 ScreenOwner* owner; 59 HWInterfaceListener* listener; 60 }; 61 62 void _ScanDrivers(); 63 screen_item* _AddHWInterface(HWInterface* interface); 64 65 BObjectList<screen_item> fScreenList; 66 }; 67 68 extern ScreenManager *gScreenManager; 69 70 #endif /* SCREEN_MANAGER_H */ 71