1a0795c6fSMarcus Overhagen // ParameterWindow.h (Cortex/ParameterWindow) 2a0795c6fSMarcus Overhagen // 3a0795c6fSMarcus Overhagen // * PURPOSE 4a0795c6fSMarcus Overhagen // Window subclass to contain BMediaTheme generated 'parameter 5a0795c6fSMarcus Overhagen // views' and offers elegant resizing/zooming behaviour. 6a0795c6fSMarcus Overhagen // 7a0795c6fSMarcus Overhagen // The ParameterWindow currently listens to the MediaRoster for 8a0795c6fSMarcus Overhagen // changes of the parameter web, but this should change when the 9a0795c6fSMarcus Overhagen // provided BMediaTheme becomes more 'intelligent'. 10a0795c6fSMarcus Overhagen // 11a0795c6fSMarcus Overhagen // Support for selecting alternate themes is planned, but not 12a0795c6fSMarcus Overhagen // yet finished (see the 'Themes' menu) 13a0795c6fSMarcus Overhagen // 14a0795c6fSMarcus Overhagen // * HISTORY 15a0795c6fSMarcus Overhagen // c.lenz 24nov99 Begun 16a0795c6fSMarcus Overhagen // c.lenz 17feb00 Added scrollbar support, migrated the 17a0795c6fSMarcus Overhagen // basic management functionality to new 18a0795c6fSMarcus Overhagen // class ParameterWindowManager 19a0795c6fSMarcus Overhagen // 20a0795c6fSMarcus Overhagen 21a0795c6fSMarcus Overhagen #ifndef __ParameterWindow_H__ 22a0795c6fSMarcus Overhagen #define __ParameterWindow_H__ 23a0795c6fSMarcus Overhagen 24a0795c6fSMarcus Overhagen // Interface Kit 25a0795c6fSMarcus Overhagen #include <Window.h> 26a0795c6fSMarcus Overhagen // Media Kit 27a0795c6fSMarcus Overhagen #include <MediaNode.h> 28a0795c6fSMarcus Overhagen 29*f6e4cbb9SAxel Dörfler class BMediaTheme; 30a0795c6fSMarcus Overhagen class BMessenger; 31a0795c6fSMarcus Overhagen 32a0795c6fSMarcus Overhagen #include "cortex_defs.h" 33a0795c6fSMarcus Overhagen __BEGIN_CORTEX_NAMESPACE 34a0795c6fSMarcus Overhagen 35a0795c6fSMarcus Overhagen class NodeRef; 36a0795c6fSMarcus Overhagen 37a0795c6fSMarcus Overhagen class ParameterWindow : 38a0795c6fSMarcus Overhagen public BWindow { 39a0795c6fSMarcus Overhagen 40a0795c6fSMarcus Overhagen public: // *** messages 41a0795c6fSMarcus Overhagen 42a0795c6fSMarcus Overhagen enum message_t { 43a0795c6fSMarcus Overhagen 44a0795c6fSMarcus Overhagen // OUTBOUND 45a0795c6fSMarcus Overhagen // fields: 46a0795c6fSMarcus Overhagen // B_INT32_TYPE "nodeID 47a0795c6fSMarcus Overhagen M_CLOSED = ParameterWindow_message_base, 48a0795c6fSMarcus Overhagen 49a0795c6fSMarcus Overhagen // OUTBOUND 50a0795c6fSMarcus Overhagen // fields: 51a0795c6fSMarcus Overhagen // B_INT32_TYPE "nodeID" 52a0795c6fSMarcus Overhagen // B_MESSENGER_TYPE "messenger" 53a0795c6fSMarcus Overhagen M_CONTROL_PANEL_STARTED, 54a0795c6fSMarcus Overhagen 55a0795c6fSMarcus Overhagen // INBOUND 56a0795c6fSMarcus Overhagen // fields: 57a0795c6fSMarcus Overhagen // B_BOOL_TYPE "replace" 58a0795c6fSMarcus Overhagen M_START_CONTROL_PANEL, 59a0795c6fSMarcus Overhagen 60a0795c6fSMarcus Overhagen // INBOUND 61a0795c6fSMarcus Overhagen // fields: 62a0795c6fSMarcus Overhagen // B_INT32_TYPE "themeID" 63a0795c6fSMarcus Overhagen M_THEME_SELECTED 64a0795c6fSMarcus Overhagen }; 65a0795c6fSMarcus Overhagen 66a0795c6fSMarcus Overhagen public: // *** ctor/dtor 67a0795c6fSMarcus Overhagen 68a0795c6fSMarcus Overhagen ParameterWindow( 69a0795c6fSMarcus Overhagen BPoint position, 70a0795c6fSMarcus Overhagen live_node_info &nodeInfo, 71a0795c6fSMarcus Overhagen BMessenger *notifyTarget = 0); 72a0795c6fSMarcus Overhagen 73a0795c6fSMarcus Overhagen virtual ~ParameterWindow(); 74a0795c6fSMarcus Overhagen 75a0795c6fSMarcus Overhagen public: // *** BWindow impl 76a0795c6fSMarcus Overhagen 77a0795c6fSMarcus Overhagen // remember that frame was changed manually 78a0795c6fSMarcus Overhagen virtual void FrameResized( 79a0795c6fSMarcus Overhagen float width, 80a0795c6fSMarcus Overhagen float height); 81a0795c6fSMarcus Overhagen 82a0795c6fSMarcus Overhagen // closes the window when the node is released 83a0795c6fSMarcus Overhagen virtual void MessageReceived( 84a0795c6fSMarcus Overhagen BMessage *message); 85a0795c6fSMarcus Overhagen 86a0795c6fSMarcus Overhagen // stop watching the MediaRoster, tell the notifyTarget 87a0795c6fSMarcus Overhagen virtual bool QuitRequested(); 88a0795c6fSMarcus Overhagen 89a0795c6fSMarcus Overhagen // extend basic Zoom() functionality to 'minimize' the 90a0795c6fSMarcus Overhagen // window when currently at max size 91a0795c6fSMarcus Overhagen virtual void Zoom( 92a0795c6fSMarcus Overhagen BPoint origin, 93a0795c6fSMarcus Overhagen float width, 94a0795c6fSMarcus Overhagen float height); 95a0795c6fSMarcus Overhagen 96a0795c6fSMarcus Overhagen private: // *** internal operations 97a0795c6fSMarcus Overhagen 98a0795c6fSMarcus Overhagen // is called from the ctor for window-positioning 99a0795c6fSMarcus Overhagen void _init(); 100a0795c6fSMarcus Overhagen 101a0795c6fSMarcus Overhagen // adds or updates the parameter view using the given 102a0795c6fSMarcus Overhagen // theme 103a0795c6fSMarcus Overhagen void _updateParameterView( 104a0795c6fSMarcus Overhagen BMediaTheme *theme = 0); 105a0795c6fSMarcus Overhagen 106a0795c6fSMarcus Overhagen // resizes the window to fit in the current screen rect 107a0795c6fSMarcus Overhagen void _constrainToScreen(); 108a0795c6fSMarcus Overhagen 109a0795c6fSMarcus Overhagen // tries to start the nodes control panel through the 110a0795c6fSMarcus Overhagen // MediaRoster 111a0795c6fSMarcus Overhagen status_t _startControlPanel(); 112a0795c6fSMarcus Overhagen 113a0795c6fSMarcus Overhagen private: // *** data members 114a0795c6fSMarcus Overhagen 115a0795c6fSMarcus Overhagen media_node m_node; 116a0795c6fSMarcus Overhagen 117a0795c6fSMarcus Overhagen BView *m_parameters; 118a0795c6fSMarcus Overhagen 119a0795c6fSMarcus Overhagen BMessenger *m_notifyTarget; 120a0795c6fSMarcus Overhagen 121a0795c6fSMarcus Overhagen BRect m_manualSize; 122a0795c6fSMarcus Overhagen 123a0795c6fSMarcus Overhagen BRect m_idealSize; 124a0795c6fSMarcus Overhagen 125a0795c6fSMarcus Overhagen bool m_zoomed; 126a0795c6fSMarcus Overhagen 127a0795c6fSMarcus Overhagen bool m_zooming; 128a0795c6fSMarcus Overhagen }; 129a0795c6fSMarcus Overhagen 130a0795c6fSMarcus Overhagen __END_CORTEX_NAMESPACE 131a0795c6fSMarcus Overhagen #endif /* __ParameterWindow_H__ */ 132