xref: /haiku/src/apps/cortex/support/MediaIcon.h (revision f75a7bf508f3156d63a14f8fd77c5e0ca4d08c42)
1 // MediaIcon.h (Cortex/Support)
2 //
3 // * PURPOSE
4 //
5 //   Easy construction of an icon-representation for common
6 //   kinds of nodes
7 //
8 // * NOTES
9 //
10 //	 5dec99 i've included some workarounds for the buggy GetDormantNodeFor()
11 //			 function
12 //   24oct99 simple to use but *not* very efficient!
13 //
14 // * HISTORY
15 //   c.lenz		17oct99		Begun
16 //	 c.lenz		5dec99		Bugfixes & support of application icons
17 //
18 
19 #ifndef __MediaIcon_H__
20 #define __MediaIcon_H__
21 
22 // Interface Kit
23 #include <Bitmap.h>
24 #include <InterfaceDefs.h>
25 // Media Kit
26 #include <MediaDefs.h>
27 // Storage Kit
28 #include <Mime.h>
29 
30 class BRegion;
31 struct dormant_flavor_info;
32 
33 #include "cortex_defs.h"
34 __BEGIN_CORTEX_NAMESPACE
35 
36 class MediaIcon :
37 	public BBitmap {
38 
39 public:					// *** ctor/dtor
40 
41 						MediaIcon(
42 							const live_node_info &nodeInfo,
43 							icon_size size);
44 
45 						MediaIcon(
46 							const dormant_node_info &nodeInfo,
47 							icon_size size);
48 
49 	virtual				~MediaIcon();
50 
51 private:				// *** internal accessors
52 
53 	// return the basic node_kind
54 	bool				_isPhysicalInput() const;
55 	bool				_isPhysicalOutput() const;
56 	bool				_isProducer() const;
57 	bool				_isFilter() const;
58 	bool				_isConsumer() const;
59 
60 	// special cases (media-type independant)
61 	bool				_isSystemMixer() const;
62 	bool				_isFileInterface() const;
63 	bool				_isTimeSource() const;
64 
65 private:				// *** internal operations
66 
67 	void				_findIconFor(
68 							const live_node_info &nodeInfo);
69 
70 	void				_findIconFor(
71 							const dormant_node_info &nodeInfo);
72 
73 	void				_findDefaultIconFor(
74 							bool audioIn,
75 							bool audioOut,
76 							bool videoIn,
77 							bool videoOut);
78 
79 	static void			_getMediaTypesFor(
80 							const live_node_info &nodeInfo,
81 							bool *audioIn,
82 							bool *audioOut,
83 							bool *videoIn,
84 							bool *videoOut);
85 
86 	static void			_getMediaTypesFor(
87 							const dormant_flavor_info &flavorInfo,
88 							bool *audioIn,
89 							bool *audioOut,
90 							bool *videoIn,
91 							bool *videoOut);
92 
93 private:				// *** data
94 
95 	// the icon size: B_LARGE_ICON or B_MINI_ICON
96 	icon_size			m_size;
97 
98 	// the node kinds (e.g. B_BUFFER_PRODUCER)
99 	uint32				m_nodeKind;
100 };
101 
102 __END_CORTEX_NAMESPACE
103 #endif /* __MediaIcon_H__ */
104