1/* 2 * Copyright (c) 2001-2005, Haiku, Inc. 3 * Distributed under the terms of the MIT license. 4 * 5 * Author: 6 * DarkWyrm <bpmagic@columbus.rr.com> 7 * Clemens Zeidler <haiku@clemens-zeidler.de> 8 * Joseph Groover <looncraz@satx.rr.com> 9 */ 10#ifndef DECOR_MANAGER_H 11#define DECOR_MANAGER_H 12 13 14#include <image.h> 15#include <String.h> 16#include <Locker.h> 17#include <ObjectList.h> 18#include <Entry.h> 19#include <DecorInfo.h> 20 21#include "Decorator.h" 22 23class Desktop; 24class DesktopListener; 25class DrawingEngine; 26class Window; 27class WindowBehaviour; 28 29 30typedef BObjectList<DesktopListener> DesktopListenerList; 31 32 33// special name to test for use of non-fs-tied default decorator 34// this just keeps things clean and simple is all 35 36class DecorAddOn { 37public: 38 DecorAddOn(image_id id, const char* name); 39 virtual ~DecorAddOn(); 40 41 virtual status_t InitCheck() const; 42 43 image_id ImageID() const { return fImageID; } 44 45 Decorator* AllocateDecorator(Desktop* desktop, 46 DrawingEngine* engine, BRect rect, 47 const char* title, window_look look, 48 uint32 flags); 49 50 virtual WindowBehaviour* AllocateWindowBehaviour(Window* window); 51 52 virtual const DesktopListenerList& GetDesktopListeners(); 53 54protected: 55 virtual Decorator* _AllocateDecorator(DesktopSettings& settings, 56 BRect rect, Desktop* desktop); 57 58 DesktopListenerList fDesktopListeners; 59 60private: 61 image_id fImageID; 62 BString fName; 63}; 64 65 66class DecorManager { 67public: 68 DecorManager(); 69 ~DecorManager(); 70 71 Decorator* AllocateDecorator(Window *window); 72 WindowBehaviour* AllocateWindowBehaviour(Window *window); 73 void CleanupForWindow(Window *window); 74 75 status_t PreviewDecorator(BString path, Window *window); 76 77 const DesktopListenerList& GetDesktopListeners(); 78 79 BString GetCurrentDecorator() const; 80 status_t SetDecorator(BString path, Desktop *desktop); 81 82private: 83 DecorAddOn* _LoadDecor(BString path, status_t &error); 84 bool _LoadSettingsFromDisk(); 85 bool _SaveSettingsToDisk(); 86 87private: 88 DecorAddOn fDefaultDecor; 89 DecorAddOn* fCurrentDecor; 90 DecorAddOn* fPreviewDecor; 91 92 Window* fPreviewWindow; 93 BString fCurrentDecorPath; 94}; 95 96extern DecorManager gDecorManager; 97 98#endif /* DECOR_MANAGER_H */ 99