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