aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmediaremotectrl.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llmediaremotectrl.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/linden/indra/newview/llmediaremotectrl.h b/linden/indra/newview/llmediaremotectrl.h
new file mode 100644
index 0000000..b1694c0
--- /dev/null
+++ b/linden/indra/newview/llmediaremotectrl.h
@@ -0,0 +1,122 @@
1/**
2 * @file llmediaremotectrl.h
3 * @brief A remote control for media (video and music)
4 *
5 * Copyright (c) 2005-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLMEDIAREMOTECTRL_H
29#define LL_LLMEDIAREMOTECTRL_H
30
31#include "llpanel.h"
32#include "llvolumesliderctrl.h"
33#include "lleventemitter.h"
34
35////////////////////////////////////////////////////////////////////////////////
36//
37class LLMediaRemoteCtrlEvent
38{
39 public:
40 LLMediaRemoteCtrlEvent ( LLUICtrl* controlIn, F32 valueIn ):
41 control ( controlIn ),
42 value ( valueIn )
43 {
44 };
45
46 virtual ~LLMediaRemoteCtrlEvent () { }
47
48 LLUICtrl* getControl () const { return control; };
49 F32 getValue () const { return value; };
50
51 private:
52 LLUICtrl* control;
53 F32 value;
54};
55
56////////////////////////////////////////////////////////////////////////////////
57//
58class LLMediaRemoteCtrlObserver
59{
60public:
61 typedef LLMediaRemoteCtrlEvent EventType;
62 virtual ~LLMediaRemoteCtrlObserver() {}
63 virtual void onVolumeChange ( const EventType& eventIn ) { };
64 virtual void onStopButtonPressed ( const EventType& eventIn ) { };
65 virtual void onPlayButtonPressed ( const EventType& eventIn ) { };
66 virtual void onPauseButtonPressed ( const EventType& eventIn ) { };
67};
68
69////////////////////////////////////////////////////////////////////////////////
70//
71class LLMediaRemoteCtrl :
72 public LLPanel
73{
74 public:
75 LLMediaRemoteCtrl ( const std::string& name,
76 const std::string& label,
77 const LLRect& rect,
78 const std::string& xml_file );
79
80 virtual ~LLMediaRemoteCtrl ();
81
82 virtual EWidgetType getWidgetType() const;
83 virtual LLString getWidgetTag() const;
84
85 // set current transport state of remote control
86 enum TransportState { Stop, Play, Pause };
87 void setTransportState ( TransportState transportStateIn, BOOL pauseEnabled );
88 TransportState getTransportState ();
89 void setVolume ( F32 volumeIn );
90
91 // allow consumers to observe remote control events
92 virtual BOOL addObserver ( LLMediaRemoteCtrlObserver* observerIn )
93 {
94 return mediaRemoteCtrlEventEmitter.addObserver ( observerIn );
95 };
96 virtual BOOL remObserver ( LLMediaRemoteCtrlObserver* observerIn )
97 {
98 return mediaRemoteCtrlEventEmitter.remObserver ( observerIn );
99 };
100
101 private:
102 LLVolumeSliderCtrl* mVolumeSlider;
103 LLRect volumeSliderRect;
104
105 TransportState transportState;
106
107 LLTextBox* titleLabel;
108 LLButton* playButton;
109 LLButton* pauseButton;
110 LLButton* stopButton;
111
112 // event emitter
113 eventEmitter < LLMediaRemoteCtrlObserver > mediaRemoteCtrlEventEmitter;
114
115 // callbacks
116 static void onCommitVolume ( LLUICtrl* ctrl, void* data );
117 static void onPlayButton ( void* data );
118 static void onPauseButton ( void* data );
119 static void onStopButton ( void* data );
120};
121
122#endif