vfs: check userland buffers before reading them.
[haiku.git] / src / servers / app / decorator / DecorManager.h
blobeeb8864b5454b9ed27d4548e5abd214e0b27e38d
1 /*
2 * Copyright (c) 2001-2005, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
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
14 #include <image.h>
15 #include <String.h>
16 #include <Locker.h>
17 #include <ObjectList.h>
18 #include <Entry.h>
19 #include <DecorInfo.h>
21 #include "Decorator.h"
23 class Desktop;
24 class DesktopListener;
25 class DrawingEngine;
26 class Window;
27 class WindowBehaviour;
30 typedef BObjectList<DesktopListener> DesktopListenerList;
33 // special name to test for use of non-fs-tied default decorator
34 // this just keeps things clean and simple is all
36 class DecorAddOn {
37 public:
38 DecorAddOn(image_id id, const char* name);
39 virtual ~DecorAddOn();
41 virtual status_t InitCheck() const;
43 image_id ImageID() const { return fImageID; }
45 Decorator* AllocateDecorator(Desktop* desktop,
46 DrawingEngine* engine, BRect rect,
47 const char* title, window_look look,
48 uint32 flags);
50 virtual WindowBehaviour* AllocateWindowBehaviour(Window* window);
52 virtual const DesktopListenerList& GetDesktopListeners();
54 protected:
55 virtual Decorator* _AllocateDecorator(DesktopSettings& settings,
56 BRect rect, Desktop* desktop);
58 DesktopListenerList fDesktopListeners;
60 private:
61 image_id fImageID;
62 BString fName;
66 class DecorManager {
67 public:
68 DecorManager();
69 ~DecorManager();
71 Decorator* AllocateDecorator(Window *window);
72 WindowBehaviour* AllocateWindowBehaviour(Window *window);
73 void CleanupForWindow(Window *window);
75 status_t PreviewDecorator(BString path, Window *window);
77 const DesktopListenerList& GetDesktopListeners();
79 BString GetCurrentDecorator() const;
80 status_t SetDecorator(BString path, Desktop *desktop);
82 private:
83 DecorAddOn* _LoadDecor(BString path, status_t &error);
84 bool _LoadSettingsFromDisk();
85 bool _SaveSettingsToDisk();
87 private:
88 DecorAddOn fDefaultDecor;
89 DecorAddOn* fCurrentDecor;
90 DecorAddOn* fPreviewDecor;
92 Window* fPreviewWindow;
93 BString fCurrentDecorPath;
96 extern DecorManager gDecorManager;
98 #endif /* DECOR_MANAGER_H */