xref: /haiku/headers/os/media/MediaTheme.h (revision a381c8a06378de22ff08adf4282b4e3f7e50d250)
1 /*
2  * Copyright 2006, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _CONTROL_THEME_H
6 #define _CONTROL_THEME_H
7 
8 
9 #include <Entry.h>
10 #include <MediaDefs.h>
11 
12 class BBitmap;
13 class BControl;
14 class BParameter;
15 class BParameterWeb;
16 class BRect;
17 class BView;
18 
19 
20 class BMediaTheme {
21 	public:
22 		virtual	~BMediaTheme();
23 
24 		const char* Name();
25 		const char* Info();
26 		int32 ID();
27 		bool GetRef(entry_ref* ref);
28 
29 		static BView* ViewFor(BParameterWeb* web, const BRect* hintRect = NULL,
30 			BMediaTheme* usingTheme = NULL);
31 
32 		static status_t SetPreferredTheme(BMediaTheme* defaultTheme = NULL);
33 		static BMediaTheme* PreferredTheme();
34 
35 		virtual	BControl* MakeControlFor(BParameter* control) = 0;
36 
37 		enum bg_kind {
38 			B_GENERAL_BG = 0,
39 			B_SETTINGS_BG,
40 			B_PRESENTATION_BG,
41 			B_EDIT_BG,
42 			B_CONTROL_BG,
43 			B_HILITE_BG
44 		};
45 		enum fg_kind {
46 			B_GENERAL_FG = 0,
47 			B_SETTINGS_FG,
48 			B_PRESENTATION_FG,
49 			B_EDIT_FG,
50 			B_CONTROL_FG,
51 			B_HILITE_FG
52 		};
53 
54 		virtual	BBitmap* BackgroundBitmapFor(bg_kind bg = B_GENERAL_BG);
55 		virtual	rgb_color BackgroundColorFor(bg_kind bg = B_GENERAL_BG);
56 		virtual	rgb_color ForegroundColorFor(fg_kind fg = B_GENERAL_FG);
57 
58 	protected:
59 		BMediaTheme(const char* name, const char* info,
60 			const entry_ref* addOn = NULL, int32 themeID = 0);
61 
62 		virtual	BView* MakeViewFor(BParameterWeb* web,
63 			const BRect* hintRect = NULL) = 0;
64 
65 		static BControl* MakeFallbackViewFor(BParameter* control);
66 
67 	private:
68 		BMediaTheme();		/* private unimplemented */
69 		BMediaTheme(const BMediaTheme& other);
70 		BMediaTheme& operator=(const BMediaTheme& other);
71 
72 		virtual status_t _Reserved_ControlTheme_0(void *);
73 		virtual status_t _Reserved_ControlTheme_1(void *);
74 		virtual status_t _Reserved_ControlTheme_2(void *);
75 		virtual status_t _Reserved_ControlTheme_3(void *);
76 		virtual status_t _Reserved_ControlTheme_4(void *);
77 		virtual status_t _Reserved_ControlTheme_5(void *);
78 		virtual status_t _Reserved_ControlTheme_6(void *);
79 		virtual status_t _Reserved_ControlTheme_7(void *);
80 
81 		char*		fName;
82 		char*		fInfo;
83 		int32		fID;
84 		bool		fIsAddOn;
85 		entry_ref	fAddOnRef;
86 
87 		uint32 _reserved[8];
88 
89 		static BMediaTheme* sDefaultTheme;
90 };
91 
92 
93 // Theme add-ons should export these functions:
94 #if defined(_BUILDING_THEME_ADDON)
95 extern "C" BMediaTheme* make_theme(int32 id, image_id you);
96 extern "C" status_t get_theme_at(int32 index, const char** _name,
97 	const char** _info, int32* _id);
98 #endif	// _BUILDING_THEME_ADDON
99 
100 #endif	// _CONTROL_THEME_H
101