BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / cortex / support / MediaIcon.h
blob9583f90495446da4bec4c6a5ace494b60929e8a5
1 /*
2 * Copyright (c) 1999-2000, Eric Moon.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions, and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 // MediaIcon.h (Cortex/Support)
34 // * PURPOSE
35 //
36 // Easy construction of an icon-representation for common
37 // kinds of nodes
39 // * NOTES
41 // 5dec99 i've included some workarounds for the buggy GetDormantNodeFor()
42 // function
43 // 24oct99 simple to use but *not* very efficient!
45 // * HISTORY
46 // c.lenz 17oct99 Begun
47 // c.lenz 5dec99 Bugfixes & support of application icons
50 #ifndef __MediaIcon_H__
51 #define __MediaIcon_H__
53 // Interface Kit
54 #include <Bitmap.h>
55 #include <InterfaceDefs.h>
56 // Media Kit
57 #include <MediaDefs.h>
58 // Storage Kit
59 #include <Mime.h>
61 class BRegion;
62 struct dormant_flavor_info;
64 #include "cortex_defs.h"
65 __BEGIN_CORTEX_NAMESPACE
67 class MediaIcon :
68 public BBitmap {
70 public: // *** ctor/dtor
72 MediaIcon(
73 const live_node_info &nodeInfo,
74 icon_size size);
76 MediaIcon(
77 const dormant_node_info &nodeInfo,
78 icon_size size);
80 virtual ~MediaIcon();
82 private: // *** internal accessors
84 // return the basic node_kind
85 bool _isPhysicalInput() const;
86 bool _isPhysicalOutput() const;
87 bool _isProducer() const;
88 bool _isFilter() const;
89 bool _isConsumer() const;
91 // special cases (media-type independant)
92 bool _isSystemMixer() const;
93 bool _isFileInterface() const;
94 bool _isTimeSource() const;
96 private: // *** internal operations
98 void _findIconFor(
99 const live_node_info &nodeInfo);
101 void _findIconFor(
102 const dormant_node_info &nodeInfo);
104 void _findDefaultIconFor(
105 bool audioIn,
106 bool audioOut,
107 bool videoIn,
108 bool videoOut);
110 static void _getMediaTypesFor(
111 const live_node_info &nodeInfo,
112 bool *audioIn,
113 bool *audioOut,
114 bool *videoIn,
115 bool *videoOut);
117 static void _getMediaTypesFor(
118 const dormant_flavor_info &flavorInfo,
119 bool *audioIn,
120 bool *audioOut,
121 bool *videoIn,
122 bool *videoOut);
124 private: // *** data
126 // the icon size: B_LARGE_ICON or B_MINI_ICON
127 icon_size m_size;
129 // the node kinds (e.g. B_BUFFER_PRODUCER)
130 uint32 m_nodeKind;
133 __END_CORTEX_NAMESPACE
134 #endif /* __MediaIcon_H__ */