repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / cortex / ParameterView / ParameterWindowManager.h
blobd4bf787b6a4eac1decd7db3c9ebaeaaeaf62f4d2
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 // ParameterWindowManager.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 __ParameterWindowManager_H__
45 #define __ParameterWindowManager_H__
47 #include <Looper.h>
48 #include <Point.h>
50 class BList;
51 class BWindow;
53 #include "cortex_defs.h"
54 __BEGIN_CORTEX_NAMESPACE
56 class NodeRef;
58 class ParameterWindowManager :
59 public BLooper {
61 public: // *** constants
63 // the screen position where the first window should
64 // be displayed
65 static const BPoint M_INIT_POSITION;
67 // horizontal/vertical offset by which subsequent
68 // parameter windows positions are shifted
69 static const BPoint M_DEFAULT_OFFSET;
71 private: // *** ctor/dtor
73 // hidden ctor; is called only from inside Instance()
74 ParameterWindowManager();
76 public:
78 // quits all registered parameter windows and control
79 // panels
80 virtual ~ParameterWindowManager();
82 public: // *** singleton access
84 // access to the one and only instance of this class
85 static ParameterWindowManager *Instance();
87 // will delete the singleton instance and take down all
88 // open windows
89 static void shutDown();
91 public: // *** operations
93 // request a ParameterWindow to be openened for the given
94 // NodeRef; registeres the window
95 status_t openWindowFor(
96 const NodeRef *ref);
98 // request to call StartControlPanel() for the given
99 // NodeRef; registeres the panels messenger
100 status_t startControlPanelFor(
101 const NodeRef *ref);
103 public: // *** BLooper impl
105 virtual void MessageReceived(
106 BMessage *message);
108 private: // *** internal operations
110 // ParameterWindow management
111 bool _addWindowFor(
112 const NodeRef *ref,
113 BWindow *window);
114 bool _findWindowFor(
115 int32 nodeID,
116 BWindow **outWindow);
117 void _removeWindowFor(
118 int32 nodeID);
120 // ControlPanel management
121 bool _addPanelFor(
122 int32 id,
123 const BMessenger &messenger);
124 bool _findPanelFor(
125 int32 nodeID,
126 BMessenger *outMessenger);
127 void _removePanelFor(
128 int32 nodeID);
130 private: // *** data members
132 // a list of window_map_entry objects, ie parameter windows
133 // identified by the node_id
134 BList *m_windowList;
136 // a list of window_map_entry objects, this time for
137 // node control panels
138 BList *m_panelList;
140 // the BPoint at which the last InfoWindow was initially
141 // opened
142 BPoint m_lastWindowPosition;
144 private: // *** static members
146 // the magic singleton instance
147 static ParameterWindowManager *s_instance;
150 __END_CORTEX_NAMESPACE
151 #endif /*__ParameterWindowManager_H__*/