1*c284bb0fSMatt Madia /* 2*c284bb0fSMatt Madia * Copyright (c) 1999-2000, Eric Moon. 3*c284bb0fSMatt Madia * All rights reserved. 4*c284bb0fSMatt Madia * 5*c284bb0fSMatt Madia * Redistribution and use in source and binary forms, with or without 6*c284bb0fSMatt Madia * modification, are permitted provided that the following conditions 7*c284bb0fSMatt Madia * are met: 8*c284bb0fSMatt Madia * 9*c284bb0fSMatt Madia * 1. Redistributions of source code must retain the above copyright 10*c284bb0fSMatt Madia * notice, this list of conditions, and the following disclaimer. 11*c284bb0fSMatt Madia * 12*c284bb0fSMatt Madia * 2. Redistributions in binary form must reproduce the above copyright 13*c284bb0fSMatt Madia * notice, this list of conditions, and the following disclaimer in the 14*c284bb0fSMatt Madia * documentation and/or other materials provided with the distribution. 15*c284bb0fSMatt Madia * 16*c284bb0fSMatt Madia * 3. The name of the author may not be used to endorse or promote products 17*c284bb0fSMatt Madia * derived from this software without specific prior written permission. 18*c284bb0fSMatt Madia * 19*c284bb0fSMatt Madia * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 20*c284bb0fSMatt Madia * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21*c284bb0fSMatt Madia * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*c284bb0fSMatt Madia * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23*c284bb0fSMatt Madia * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24*c284bb0fSMatt Madia * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25*c284bb0fSMatt Madia * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26*c284bb0fSMatt Madia * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 27*c284bb0fSMatt Madia * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28*c284bb0fSMatt Madia * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29*c284bb0fSMatt Madia */ 30*c284bb0fSMatt Madia 31*c284bb0fSMatt Madia 32a0795c6fSMarcus Overhagen // ParameterWindow.h (Cortex/ParameterWindow) 33a0795c6fSMarcus Overhagen // 34a0795c6fSMarcus Overhagen // * PURPOSE 35a0795c6fSMarcus Overhagen // Window subclass to contain BMediaTheme generated 'parameter 36a0795c6fSMarcus Overhagen // views' and offers elegant resizing/zooming behaviour. 37a0795c6fSMarcus Overhagen // 38a0795c6fSMarcus Overhagen // The ParameterWindow currently listens to the MediaRoster for 39a0795c6fSMarcus Overhagen // changes of the parameter web, but this should change when the 40a0795c6fSMarcus Overhagen // provided BMediaTheme becomes more 'intelligent'. 41a0795c6fSMarcus Overhagen // 42a0795c6fSMarcus Overhagen // Support for selecting alternate themes is planned, but not 43a0795c6fSMarcus Overhagen // yet finished (see the 'Themes' menu) 44a0795c6fSMarcus Overhagen // 45a0795c6fSMarcus Overhagen // * HISTORY 46a0795c6fSMarcus Overhagen // c.lenz 24nov99 Begun 47a0795c6fSMarcus Overhagen // c.lenz 17feb00 Added scrollbar support, migrated the 48a0795c6fSMarcus Overhagen // basic management functionality to new 49a0795c6fSMarcus Overhagen // class ParameterWindowManager 50a0795c6fSMarcus Overhagen // 51a0795c6fSMarcus Overhagen 52a0795c6fSMarcus Overhagen #ifndef __ParameterWindow_H__ 53a0795c6fSMarcus Overhagen #define __ParameterWindow_H__ 54a0795c6fSMarcus Overhagen 55a0795c6fSMarcus Overhagen // Interface Kit 56a0795c6fSMarcus Overhagen #include <Window.h> 57a0795c6fSMarcus Overhagen // Media Kit 58a0795c6fSMarcus Overhagen #include <MediaNode.h> 59a0795c6fSMarcus Overhagen 60f6e4cbb9SAxel Dörfler class BMediaTheme; 61a0795c6fSMarcus Overhagen class BMessenger; 62a0795c6fSMarcus Overhagen 63a0795c6fSMarcus Overhagen #include "cortex_defs.h" 64a0795c6fSMarcus Overhagen __BEGIN_CORTEX_NAMESPACE 65a0795c6fSMarcus Overhagen 66a0795c6fSMarcus Overhagen class NodeRef; 67a0795c6fSMarcus Overhagen 68a0795c6fSMarcus Overhagen class ParameterWindow : 69a0795c6fSMarcus Overhagen public BWindow { 70a0795c6fSMarcus Overhagen 71a0795c6fSMarcus Overhagen public: // *** messages 72a0795c6fSMarcus Overhagen 73a0795c6fSMarcus Overhagen enum message_t { 74a0795c6fSMarcus Overhagen 75a0795c6fSMarcus Overhagen // OUTBOUND 76a0795c6fSMarcus Overhagen // fields: 77a0795c6fSMarcus Overhagen // B_INT32_TYPE "nodeID 78a0795c6fSMarcus Overhagen M_CLOSED = ParameterWindow_message_base, 79a0795c6fSMarcus Overhagen 80a0795c6fSMarcus Overhagen // OUTBOUND 81a0795c6fSMarcus Overhagen // fields: 82a0795c6fSMarcus Overhagen // B_INT32_TYPE "nodeID" 83a0795c6fSMarcus Overhagen // B_MESSENGER_TYPE "messenger" 84a0795c6fSMarcus Overhagen M_CONTROL_PANEL_STARTED, 85a0795c6fSMarcus Overhagen 86a0795c6fSMarcus Overhagen // INBOUND 87a0795c6fSMarcus Overhagen // fields: 88a0795c6fSMarcus Overhagen // B_BOOL_TYPE "replace" 89a0795c6fSMarcus Overhagen M_START_CONTROL_PANEL, 90a0795c6fSMarcus Overhagen 91a0795c6fSMarcus Overhagen // INBOUND 92a0795c6fSMarcus Overhagen // fields: 93a0795c6fSMarcus Overhagen // B_INT32_TYPE "themeID" 94a0795c6fSMarcus Overhagen M_THEME_SELECTED 95a0795c6fSMarcus Overhagen }; 96a0795c6fSMarcus Overhagen 97a0795c6fSMarcus Overhagen public: // *** ctor/dtor 98a0795c6fSMarcus Overhagen 99a0795c6fSMarcus Overhagen ParameterWindow( 100a0795c6fSMarcus Overhagen BPoint position, 101a0795c6fSMarcus Overhagen live_node_info &nodeInfo, 102a0795c6fSMarcus Overhagen BMessenger *notifyTarget = 0); 103a0795c6fSMarcus Overhagen 104a0795c6fSMarcus Overhagen virtual ~ParameterWindow(); 105a0795c6fSMarcus Overhagen 106a0795c6fSMarcus Overhagen public: // *** BWindow impl 107a0795c6fSMarcus Overhagen 108a0795c6fSMarcus Overhagen // remember that frame was changed manually 109a0795c6fSMarcus Overhagen virtual void FrameResized( 110a0795c6fSMarcus Overhagen float width, 111a0795c6fSMarcus Overhagen float height); 112a0795c6fSMarcus Overhagen 113a0795c6fSMarcus Overhagen // closes the window when the node is released 114a0795c6fSMarcus Overhagen virtual void MessageReceived( 115a0795c6fSMarcus Overhagen BMessage *message); 116a0795c6fSMarcus Overhagen 117a0795c6fSMarcus Overhagen // stop watching the MediaRoster, tell the notifyTarget 118a0795c6fSMarcus Overhagen virtual bool QuitRequested(); 119a0795c6fSMarcus Overhagen 120a0795c6fSMarcus Overhagen // extend basic Zoom() functionality to 'minimize' the 121a0795c6fSMarcus Overhagen // window when currently at max size 122a0795c6fSMarcus Overhagen virtual void Zoom( 123a0795c6fSMarcus Overhagen BPoint origin, 124a0795c6fSMarcus Overhagen float width, 125a0795c6fSMarcus Overhagen float height); 126a0795c6fSMarcus Overhagen 127a0795c6fSMarcus Overhagen private: // *** internal operations 128a0795c6fSMarcus Overhagen 129a0795c6fSMarcus Overhagen // is called from the ctor for window-positioning 130a0795c6fSMarcus Overhagen void _init(); 131a0795c6fSMarcus Overhagen 132a0795c6fSMarcus Overhagen // adds or updates the parameter view using the given 133a0795c6fSMarcus Overhagen // theme 134a0795c6fSMarcus Overhagen void _updateParameterView( 135a0795c6fSMarcus Overhagen BMediaTheme *theme = 0); 136a0795c6fSMarcus Overhagen 137a0795c6fSMarcus Overhagen // resizes the window to fit in the current screen rect 138a0795c6fSMarcus Overhagen void _constrainToScreen(); 139a0795c6fSMarcus Overhagen 140a0795c6fSMarcus Overhagen // tries to start the nodes control panel through the 141a0795c6fSMarcus Overhagen // MediaRoster 142a0795c6fSMarcus Overhagen status_t _startControlPanel(); 143a0795c6fSMarcus Overhagen 144a0795c6fSMarcus Overhagen private: // *** data members 145a0795c6fSMarcus Overhagen 146a0795c6fSMarcus Overhagen media_node m_node; 147a0795c6fSMarcus Overhagen 148a0795c6fSMarcus Overhagen BView *m_parameters; 149a0795c6fSMarcus Overhagen 150a0795c6fSMarcus Overhagen BMessenger *m_notifyTarget; 151a0795c6fSMarcus Overhagen 152a0795c6fSMarcus Overhagen BRect m_manualSize; 153a0795c6fSMarcus Overhagen 154a0795c6fSMarcus Overhagen BRect m_idealSize; 155a0795c6fSMarcus Overhagen 156a0795c6fSMarcus Overhagen bool m_zoomed; 157a0795c6fSMarcus Overhagen 158a0795c6fSMarcus Overhagen bool m_zooming; 159a0795c6fSMarcus Overhagen }; 160a0795c6fSMarcus Overhagen 161a0795c6fSMarcus Overhagen __END_CORTEX_NAMESPACE 162a0795c6fSMarcus Overhagen #endif /* __ParameterWindow_H__ */ 163