vfs: check userland buffers before reading them.
[haiku.git] / src / apps / cortex / TransportView / TransportView.h
bloba82639df4ee8a597f459111d7027d7112a944cf8
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 // TransportView.h
33 // * PURPOSE
34 // UI component (view) providing access to a selected
35 // NodeGroup's properties & transport controls.
37 // * HISTORY
38 // e.moon 18aug99 Begun.
40 #ifndef __TransportView_H__
41 #define __TransportView_H__
43 #include <list>
45 #include <View.h>
46 #include <PopUpMenu.h>
48 class BButton;
49 class BInvoker;
50 class BStringView;
51 class BTextControl;
52 class BMenuField;
53 class BMenu;
55 #include "cortex_defs.h"
56 __BEGIN_CORTEX_NAMESPACE
58 class NodeManager;
59 class NodeGroup;
61 class NumericValControl;
63 class _GroupInfoView;
64 class TransportWindow;
66 class TransportView :
67 public BView {
68 typedef BView _inherited;
70 enum message_t {
71 // _value: string
72 M_SET_NAME = TransportView_message_base
75 public: // *** ctors/dtor
76 virtual ~TransportView(); //nyi
78 TransportView(
79 NodeManager* nodeManager,
80 const char* name); //nyi
82 public: // *** BView
83 virtual void AttachedToWindow();
84 virtual void AllAttached();
85 virtual void DetachedFromWindow();
86 virtual void FrameResized(
87 float width,
88 float height);
89 virtual void KeyDown(
90 const char* bytes,
91 int32 count);
92 virtual void MouseDown(
93 BPoint where);
95 public: // *** BHandler
96 virtual void MessageReceived(
97 BMessage* message); //nyi
99 private: // *** BHandler impl.
100 void _handleSelectGroup(
101 BMessage* message);
103 protected: // *** internal operations
105 // select the given group; initialize controls
106 // (if 0, gray out all controls)
107 void _selectGroup(
108 uint32 groupID);
110 void _observeGroup();
111 void _releaseGroup();
113 void _initTimeSources();
115 protected: // *** controls
117 void _constructControls(); //nyi
119 void _disableControls();
120 void _enableControls();
122 void _updateTransportButtons();
123 void _updateTimeSource();
124 void _updateRunMode();
126 // convert a position control's value to bigtime_t
127 // [e.moon 11oct99]
128 bigtime_t _scalePosition(
129 double value);
131 void _populateRunModeMenu(
132 BMenu* menu);
133 void _populateTimeSourceMenu(
134 BMenu* menu);
136 // add the given invoker to be retargeted to this
137 // view (used for controls whose messages need a bit more
138 // processing before being forwarded to the NodeGroup.)
139 void _addLocalTarget(
140 BInvoker* invoker);
142 void _addGroupTarget(
143 BInvoker* invoker);
145 void _refreshTransportSettings();
147 // [e.moon 2dec99]
148 void _timeSourceCreated(
149 BMessage* message); //nyi
150 void _timeSourceDeleted(
151 BMessage* message); //nyi
153 protected: // *** layout
155 void _initLayout();
156 void _updateLayout();
158 private:
159 friend class _GroupInfoView;
160 friend class TransportWindow;
162 // logical
163 NodeManager* m_manager;
164 NodeGroup* m_group;
166 // controls
167 _GroupInfoView* m_infoView;
168 BMenuField* m_runModeView;
169 BMenuField* m_timeSourceView;
171 BStringView* m_fromLabel;
172 NumericValControl* m_regionStartView;
173 BStringView* m_toLabel;
174 NumericValControl* m_regionEndView;
176 BButton* m_startButton;
177 BButton* m_stopButton;
178 BButton* m_prerollButton;
180 typedef std::list<BInvoker*> target_set;
181 target_set m_localTargets;
182 target_set m_groupTargets;
184 // layout
185 class _layout_state;
186 _layout_state* m_layout;
189 __END_CORTEX_NAMESPACE
190 #endif /*__TransportView_H__*/