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