xref: /haiku/headers/os/media/MediaTheme.h (revision 52a380120846174213ccce9c4aab0dda17c72083)
1 /*******************************************************************************
2 /
3 /	File:			ControlTheme.h
4 /
5 /   Description:  A BMediaTheme is something which can live in an add-on and is
6 /	responsible for creating BViews or BControls from a BParameterWeb and its
7 /	set of BMControls. This way, different "looks" for Media Kit control panels
8 /	can be achieved.
9 /
10 /	Copyright 1997-98, Be Incorporated, All Rights Reserved
11 /
12 *******************************************************************************/
13 
14 #if !defined(_CONTROL_THEME_H)
15 #define _CONTROL_THEME_H
16 
17 
18 #include <Entry.h>
19 #include <MediaDefs.h>
20 
21 class BParameterWeb;
22 
23 
24 class BMediaTheme
25 {
26 public:
27 virtual	~BMediaTheme();
28 
29 		const char * Name();
30 		const char * Info();
31 		int32 ID();
32 		bool GetRef(
33 				entry_ref * out_ref);
34 
35 static	BView * ViewFor(
36 				BParameterWeb * web,
37 				const BRect * hintRect = NULL,
38 				BMediaTheme * using_theme = NULL);
39 
40 		/* This function takes possession of default_theme, even it if returns error */
41 static	status_t SetPreferredTheme(
42 				BMediaTheme * default_theme = NULL);
43 
44 static	BMediaTheme * PreferredTheme();
45 
46 virtual	BControl * MakeControlFor(
47 				BParameter * control) = 0;
48 
49 		enum bg_kind {
50 			B_GENERAL_BG = 0,
51 			B_SETTINGS_BG,
52 			B_PRESENTATION_BG,
53 			B_EDIT_BG,
54 			B_CONTROL_BG,
55 			B_HILITE_BG
56 		};
57 		enum fg_kind {
58 			B_GENERAL_FG = 0,
59 			B_SETTINGS_FG,
60 			B_PRESENTATION_FG,
61 			B_EDIT_FG,
62 			B_CONTROL_FG,
63 			B_HILITE_FG
64 		};
65 
66 virtual	BBitmap * BackgroundBitmapFor(
67 				bg_kind bg = B_GENERAL_BG);
68 virtual	rgb_color BackgroundColorFor(
69 				bg_kind bg = B_GENERAL_BG);
70 virtual	rgb_color ForegroundColorFor(
71 				fg_kind fg = B_GENERAL_FG);
72 
73 protected:
74 		BMediaTheme(
75 				const char * name,
76 				const char * info,
77 				const entry_ref * add_on = 0,
78 				int32 theme_id = 0);
79 
80 virtual	BView * MakeViewFor(
81 				BParameterWeb * web,
82 				const BRect * hintRect = NULL) = 0;
83 
84 static	BControl * MakeFallbackViewFor(
85 				BParameter * control);
86 
87 private:
88 
89 		BMediaTheme();		/* private unimplemented */
90 		BMediaTheme(
91 				const BMediaTheme & clone);
92 		BMediaTheme & operator=(
93 				const BMediaTheme & clone);
94 
95 		/* Mmmh, stuffing! */
96 virtual		status_t _Reserved_ControlTheme_0(void *);
97 virtual		status_t _Reserved_ControlTheme_1(void *);
98 virtual		status_t _Reserved_ControlTheme_2(void *);
99 virtual		status_t _Reserved_ControlTheme_3(void *);
100 virtual		status_t _Reserved_ControlTheme_4(void *);
101 virtual		status_t _Reserved_ControlTheme_5(void *);
102 virtual		status_t _Reserved_ControlTheme_6(void *);
103 virtual		status_t _Reserved_ControlTheme_7(void *);
104 
105 		char * _mName;
106 		char * _mInfo;
107 		int32 _mID;
108 		bool _mAddOn;
109 		entry_ref _mAddOnRef;
110 		uint32 _reserved_control_theme_[8];
111 
112 static	BMediaTheme * _mDefaultTheme;
113 
114 };
115 
116 /* Theme add-ons should export the functions: */
117 #if defined(_BUILDING_THEME_ADDON)
118 extern "C" _EXPORT BMediaTheme * make_theme(int32 id, image_id you);
119 extern "C" _EXPORT status_t get_theme_at(int32 n, const char ** out_name, const char ** out_info, int32 * out_id);
120 #endif	/* _BUILDING_THEME_ADDON */
121 
122 #endif	/* _CONTROL_THEME_H */
123