xref: /haiku/src/apps/cortex/support/MediaIcon.h (revision 0e50eab75e25d0d82090e22dbff766dfaa6f5e86)
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 
32 #include "cortex_defs.h"
33 __BEGIN_CORTEX_NAMESPACE
34 
35 class MediaIcon :
36 	public BBitmap {
37 
38 public:					// *** ctor/dtor
39 
40 						MediaIcon(
41 							const live_node_info &nodeInfo,
42 							icon_size size);
43 
44 						MediaIcon(
45 							const dormant_node_info &nodeInfo,
46 							icon_size size);
47 
48 	virtual				~MediaIcon();
49 
50 private:				// *** internal accessors
51 
52 	// return the basic node_kind
53 	bool				_isPhysicalInput() const;
54 	bool				_isPhysicalOutput() const;
55 	bool				_isProducer() const;
56 	bool				_isFilter() const;
57 	bool				_isConsumer() const;
58 
59 	// special cases (media-type independant)
60 	bool				_isSystemMixer() const;
61 	bool				_isFileInterface() const;
62 	bool				_isTimeSource() const;
63 
64 private:				// *** internal operations
65 
66 	void				_findIconFor(
67 							const live_node_info &nodeInfo);
68 
69 	void				_findIconFor(
70 							const dormant_node_info &nodeInfo);
71 
72 	void				_findDefaultIconFor(
73 							bool audioIn,
74 							bool audioOut,
75 							bool videoIn,
76 							bool videoOut);
77 
78 	static void			_getMediaTypesFor(
79 							const live_node_info &nodeInfo,
80 							bool *audioIn,
81 							bool *audioOut,
82 							bool *videoIn,
83 							bool *videoOut);
84 
85 	static void			_getMediaTypesFor(
86 							const dormant_flavor_info &flavorInfo,
87 							bool *audioIn,
88 							bool *audioOut,
89 							bool *videoIn,
90 							bool *videoOut);
91 
92 private:				// *** data
93 
94 	// the icon size: B_LARGE_ICON or B_MINI_ICON
95 	icon_size			m_size;
96 
97 	// the node kinds (e.g. B_BUFFER_PRODUCER)
98 	uint32				m_nodeKind;
99 };
100 
101 __END_CORTEX_NAMESPACE
102 #endif /* __MediaIcon_H__ */
103