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