1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
3bf215546Sopenharmony_ci * Distributed under the terms of the MIT License.
4bf215546Sopenharmony_ci *
5bf215546Sopenharmony_ci * Authors:
6bf215546Sopenharmony_ci *		Philippe Houdoin <philippe.houdoin@free.fr>
7bf215546Sopenharmony_ci */
8bf215546Sopenharmony_ci#ifndef _GLRENDERER_ROSTER_H
9bf215546Sopenharmony_ci#define _GLRENDERER_ROSTER_H
10bf215546Sopenharmony_ci
11bf215546Sopenharmony_ci
12bf215546Sopenharmony_ci#include <GLRenderer.h>
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_ci#include <vector>
15bf215546Sopenharmony_ci
16bf215546Sopenharmony_ci
17bf215546Sopenharmony_citypedef BGLRenderer* (*InstantiateRenderer) (BGLView* view, ulong options);
18bf215546Sopenharmony_ci
19bf215546Sopenharmony_cistruct renderer_item {
20bf215546Sopenharmony_ci	InstantiateRenderer entry;
21bf215546Sopenharmony_ci	entry_ref	ref;
22bf215546Sopenharmony_ci	ino_t		node;
23bf215546Sopenharmony_ci	image_id	image;
24bf215546Sopenharmony_ci};
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_citypedef std::vector<renderer_item> RendererMap;
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ciclass GLRendererRoster {
30bf215546Sopenharmony_ci	public:
31bf215546Sopenharmony_ci		static GLRendererRoster *Roster();
32bf215546Sopenharmony_ci		BGLRenderer* GetRenderer(BGLView *view, ulong options);
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci	private:
35bf215546Sopenharmony_ci		GLRendererRoster();
36bf215546Sopenharmony_ci		virtual ~GLRendererRoster();
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ci		void AddDefaultPaths();
39bf215546Sopenharmony_ci		status_t AddPath(const char* path);
40bf215546Sopenharmony_ci		status_t AddRenderer(InstantiateRenderer entry, image_id image,
41bf215546Sopenharmony_ci			const entry_ref* ref, ino_t node);
42bf215546Sopenharmony_ci		status_t CreateRenderer(const entry_ref& ref);
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_ci		static GLRendererRoster* fInstance;
45bf215546Sopenharmony_ci		bool		fSafeMode;
46bf215546Sopenharmony_ci		const char*	fABISubDirectory;
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci		RendererMap fRenderers;
49bf215546Sopenharmony_ci};
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_ci
52bf215546Sopenharmony_ci#endif	/* _GLRENDERER_ROSTER_H */
53