2 * Copyright (c) 1999-2000, Eric Moon.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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 // InfoWindowManager.h
35 // Manages all the ParameterWindows and control panels.
36 // Will not let you open multiple windows referring to
37 // the same node, and takes care of quitting them all
41 // c.lenz 17feb2000 Begun
44 #ifndef __InfoWindowManager_H__
45 #define __InfoWindowManager_H__
53 #include "cortex_defs.h"
55 struct dormant_node_info
;
56 struct media_destination
;
61 __BEGIN_CORTEX_NAMESPACE
66 class InfoWindowManager
:
69 public: // *** constants
71 // the screen position where the first window should
73 static const BPoint M_INIT_POSITION
;
75 // horizontal/vertical offset by which subsequent
76 // windows positions are shifted
77 static const BPoint M_DEFAULT_OFFSET
;
80 M_INFO_WINDOW_REQUESTED
= InfoView_message_base
,
82 M_LIVE_NODE_WINDOW_CLOSED
,
84 M_DORMANT_NODE_WINDOW_CLOSED
,
86 M_CONNECTION_WINDOW_CLOSED
,
88 M_INPUT_WINDOW_CLOSED
,
90 M_OUTPUT_WINDOW_CLOSED
93 private: // *** ctor/dtor
95 // hidden ctor; is called only from inside Instance()
100 // quits all registered info windows
101 virtual ~InfoWindowManager();
103 public: // *** singleton access
105 // access to the one and only instance of this class
106 static InfoWindowManager
*Instance();
108 // will delete the singleton instance and take down all
110 static void shutDown();
112 public: // *** operations
114 status_t
openWindowFor(
117 status_t
openWindowFor(
118 const dormant_node_info
&info
);
120 status_t
openWindowFor(
121 const Connection
&connection
);
123 status_t
openWindowFor(
124 const media_input
&input
);
126 status_t
openWindowFor(
127 const media_output
&output
);
129 public: // *** BLooper impl
131 virtual void MessageReceived(
134 private: // *** internal operations
136 // management of windows for live nodes
142 BWindow
**outWindow
);
143 void _removeWindowFor(
146 // management of windows for dormant nodes
148 const dormant_node_info
&info
,
151 const dormant_node_info
&info
,
152 BWindow
**outWindow
);
153 void _removeWindowFor(
154 const dormant_node_info
&info
);
156 // management of windows for connections
158 const Connection
&connection
,
161 const media_source
&source
,
162 const media_destination
&destination
,
163 BWindow
**outWindow
);
164 void _removeWindowFor(
165 const media_source
&source
,
166 const media_destination
&destination
);
168 // management of windows for media_inputs
170 const media_input
&input
,
173 const media_destination
&destination
,
174 BWindow
**outWindow
);
175 void _removeWindowFor(
176 const media_destination
&destination
);
178 // management of windows for media_outputs
180 const media_output
&output
,
183 const media_source
&source
,
184 BWindow
**outWindow
);
185 void _removeWindowFor(
186 const media_source
&source
);
188 private: // *** data members
190 // list of all currently open windows about live nodes
191 BList
*m_liveNodeWindows
;
193 // list of all currently open windows about dormant nodes
194 BList
*m_dormantNodeWindows
;
196 // list of all currently open windows about connections
197 BList
*m_connectionWindows
;
199 // list of all currently open windows about media_inputs
200 BList
*m_inputWindows
;
202 // list of all currently open windows about media_outputs
203 BList
*m_outputWindows
;
205 // the BPoint at which the last InfoWindow was initially
207 BPoint m_nextWindowPosition
;
209 private: // *** static members
211 // the magic singleton instance
212 static InfoWindowManager
*s_instance
;
215 __END_CORTEX_NAMESPACE
216 #endif /*__InfoWindowManager_H__*/