1 // InfoWindowManager.h 2 // 3 // * PURPOSE 4 // Manages all the ParameterWindows and control panels. 5 // Will not let you open multiple windows referring to 6 // the same node, and takes care of quitting them all 7 // when shut down. 8 // 9 // * HISTORY 10 // c.lenz 17feb2000 Begun 11 // 12 13 #ifndef __InfoWindowManager_H__ 14 #define __InfoWindowManager_H__ 15 16 // Application Kit 17 #include <Looper.h> 18 // Interface Kit 19 #include <Point.h> 20 21 class BList; 22 class BWindow; 23 24 #include "cortex_defs.h" 25 __BEGIN_CORTEX_NAMESPACE 26 27 class Connection; 28 class NodeRef; 29 30 class InfoWindowManager : 31 public BLooper { 32 33 public: // *** constants 34 35 // the screen position where the first window should 36 // be displayed 37 static const BPoint M_INIT_POSITION; 38 39 // horizontal/vertical offset by which subsequent 40 // windows positions are shifted 41 static const BPoint M_DEFAULT_OFFSET; 42 43 enum message_t { 44 M_INFO_WINDOW_REQUESTED = InfoView_message_base, 45 46 M_LIVE_NODE_WINDOW_CLOSED, 47 48 M_DORMANT_NODE_WINDOW_CLOSED, 49 50 M_CONNECTION_WINDOW_CLOSED, 51 52 M_INPUT_WINDOW_CLOSED, 53 54 M_OUTPUT_WINDOW_CLOSED 55 }; 56 57 private: // *** ctor/dtor 58 59 // hidden ctor; is called only from inside Instance() 60 InfoWindowManager(); 61 62 public: 63 64 // quits all registered info windows 65 virtual ~InfoWindowManager(); 66 67 public: // *** singleton access 68 69 // access to the one and only instance of this class 70 static InfoWindowManager *Instance(); 71 72 // will delete the singleton instance and take down all 73 // open windows 74 static void shutDown(); 75 76 public: // *** operations 77 78 status_t openWindowFor( 79 const NodeRef *ref); 80 81 status_t openWindowFor( 82 const dormant_node_info &info); 83 84 status_t openWindowFor( 85 const Connection &connection); 86 87 status_t openWindowFor( 88 const media_input &input); 89 90 status_t openWindowFor( 91 const media_output &output); 92 93 public: // *** BLooper impl 94 95 virtual void MessageReceived( 96 BMessage *message); 97 98 private: // *** internal operations 99 100 // management of windows for live nodes 101 bool _addWindowFor( 102 const NodeRef *ref, 103 BWindow *window); 104 bool _findWindowFor( 105 int32 nodeID, 106 BWindow **outWindow); 107 void _removeWindowFor( 108 int32 nodeID); 109 110 // management of windows for dormant nodes 111 bool _addWindowFor( 112 const dormant_node_info &info, 113 BWindow *window); 114 bool _findWindowFor( 115 const dormant_node_info &info, 116 BWindow **outWindow); 117 void _removeWindowFor( 118 const dormant_node_info &info); 119 120 // management of windows for connections 121 bool _addWindowFor( 122 const Connection &connection, 123 BWindow *window); 124 bool _findWindowFor( 125 const media_source &source, 126 const media_destination &destination, 127 BWindow **outWindow); 128 void _removeWindowFor( 129 const media_source &source, 130 const media_destination &destination); 131 132 // management of windows for media_inputs 133 bool _addWindowFor( 134 const media_input &input, 135 BWindow *window); 136 bool _findWindowFor( 137 const media_destination &destination, 138 BWindow **outWindow); 139 void _removeWindowFor( 140 const media_destination &destination); 141 142 // management of windows for media_outputs 143 bool _addWindowFor( 144 const media_output &output, 145 BWindow *window); 146 bool _findWindowFor( 147 const media_source &source, 148 BWindow **outWindow); 149 void _removeWindowFor( 150 const media_source &source); 151 152 private: // *** data members 153 154 // list of all currently open windows about live nodes 155 BList *m_liveNodeWindows; 156 157 // list of all currently open windows about dormant nodes 158 BList *m_dormantNodeWindows; 159 160 // list of all currently open windows about connections 161 BList *m_connectionWindows; 162 163 // list of all currently open windows about media_inputs 164 BList *m_inputWindows; 165 166 // list of all currently open windows about media_outputs 167 BList *m_outputWindows; 168 169 // the BPoint at which the last InfoWindow was initially 170 // opened 171 BPoint m_nextWindowPosition; 172 173 private: // *** static members 174 175 // the magic singleton instance 176 static InfoWindowManager *s_instance; 177 }; 178 179 __END_CORTEX_NAMESPACE 180 #endif /*__InfoWindowManager_H__*/ 181