repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / cortex / InfoView / InfoWindowManager.h
blob63906b2f5aa06bb8c033bbca267fb80a573d979c
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 // InfoWindowManager.h
34 // * PURPOSE
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
38 // when shut down.
40 // * HISTORY
41 // c.lenz 17feb2000 Begun
44 #ifndef __InfoWindowManager_H__
45 #define __InfoWindowManager_H__
47 #include <Looper.h>
48 #include <Point.h>
50 class BList;
51 class BWindow;
53 #include "cortex_defs.h"
55 struct dormant_node_info;
56 struct media_destination;
57 struct media_input;
58 struct media_output;
59 struct media_source;
61 __BEGIN_CORTEX_NAMESPACE
63 class Connection;
64 class NodeRef;
66 class InfoWindowManager :
67 public BLooper {
69 public: // *** constants
71 // the screen position where the first window should
72 // be displayed
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;
79 enum message_t {
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()
96 InfoWindowManager();
98 public:
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
109 // open windows
110 static void shutDown();
112 public: // *** operations
114 status_t openWindowFor(
115 const NodeRef *ref);
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(
132 BMessage *message);
134 private: // *** internal operations
136 // management of windows for live nodes
137 bool _addWindowFor(
138 const NodeRef *ref,
139 BWindow *window);
140 bool _findWindowFor(
141 int32 nodeID,
142 BWindow **outWindow);
143 void _removeWindowFor(
144 int32 nodeID);
146 // management of windows for dormant nodes
147 bool _addWindowFor(
148 const dormant_node_info &info,
149 BWindow *window);
150 bool _findWindowFor(
151 const dormant_node_info &info,
152 BWindow **outWindow);
153 void _removeWindowFor(
154 const dormant_node_info &info);
156 // management of windows for connections
157 bool _addWindowFor(
158 const Connection &connection,
159 BWindow *window);
160 bool _findWindowFor(
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
169 bool _addWindowFor(
170 const media_input &input,
171 BWindow *window);
172 bool _findWindowFor(
173 const media_destination &destination,
174 BWindow **outWindow);
175 void _removeWindowFor(
176 const media_destination &destination);
178 // management of windows for media_outputs
179 bool _addWindowFor(
180 const media_output &output,
181 BWindow *window);
182 bool _findWindowFor(
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
206 // opened
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__*/