/indra/newview/lloutputmonitorctrl.h
C Header | 152 lines | 61 code | 25 blank | 66 comment | 0 complexity | 721b79540697f1e0224ea6e59b71eeee MD5 | raw file
Possible License(s): LGPL-2.1
1/** 2 * @file lloutputmonitorctrl.h 3 * @brief LLOutputMonitorCtrl base class 4 * 5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$ 6 * Second Life Viewer Source Code 7 * Copyright (C) 2010, Linden Research, Inc. 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; 12 * version 2.1 of the License only. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 * 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA 24 * $/LicenseInfo$ 25 */ 26 27#ifndef LL_LLOUTPUTMONITORCTRL_H 28#define LL_LLOUTPUTMONITORCTRL_H 29 30#include "v4color.h" 31#include "llview.h" 32#include "llmutelist.h" 33#include "llspeakingindicatormanager.h" 34#include "lluiimage.h" 35 36class LLTextBox; 37class LLUICtrlFactory; 38 39// 40// Classes 41// 42 43class LLOutputMonitorCtrl 44: public LLView, public LLSpeakingIndicator, LLMuteListObserver 45{ 46public: 47 struct Params : public LLInitParam::Block<Params, LLView::Params> 48 { 49 Optional<bool> draw_border; 50 Mandatory<LLUIImage*> image_mute, 51 image_off, 52 image_on, 53 image_level_1, 54 image_level_2, 55 image_level_3; 56 Optional<bool> auto_update; 57 Optional<LLUUID> speaker_id; 58 59 Params(); 60 }; 61protected: 62 bool mBorder; 63 LLOutputMonitorCtrl(const Params&); 64 friend class LLUICtrlFactory; 65 66public: 67 virtual ~LLOutputMonitorCtrl(); 68 69 // llview overrides 70 virtual void draw(); 71 72 void setPower(F32 val); 73 F32 getPower(F32 val) const { return mPower; } 74 75 bool getIsMuted() const { return mIsMuted; } 76 void setIsMuted(bool val) { mIsMuted = val; } 77 78 // For the current user, need to know the PTT state to show 79 // correct button image. 80 void setIsAgentControl(bool val) { mIsAgentControl = val; } 81 82 void setIsTalking(bool val) { mIsTalking = val; } 83 84 /** 85 * Sets avatar UUID to interact with voice channel. 86 * 87 * @param speaker_id LLUUID of an avatar whose voice level is displayed. 88 * @param session_id session UUID for which indicator should be shown only. Passed to LLSpeakingIndicatorManager 89 * If this parameter is set registered indicator will be shown only in voice channel 90 * which has the same session id (EXT-5562). 91 */ 92 void setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id = LLUUID::null); 93 94 //called by mute list 95 virtual void onChange(); 96 97 /** 98 * Implementation of LLSpeakingIndicator interface. 99 * Behavior is implemented via changing visibility. 100 * 101 * If instance is in visible chain now (all parents are visible) it changes visibility 102 * and notify parent about this. 103 * 104 * Otherwise it marks an instance as dirty and stores necessary visibility. 105 * It will be applied in next draw and parent will be notified. 106 */ 107 virtual void switchIndicator(bool switch_on); 108 109private: 110 111 /** 112 * Notifies parent about changed visibility. 113 * 114 * Passes LLSD with "visibility_changed" => <current visibility> value. 115 * For now it is processed by LLAvatarListItem to update (reshape) its children. 116 * Implemented fo complete EXT-3976 117 */ 118 void notifyParentVisibilityChanged(); 119 120 //static LLColor4 sColorMuted; 121 //static LLColor4 sColorNormal; 122 //static LLColor4 sColorOverdriven; 123 static LLColor4 sColorBound; 124 //static S32 sRectsNumber; 125 //static F32 sRectWidthRatio; 126 //static F32 sRectHeightRatio; 127 128 129 130 F32 mPower; 131 bool mIsAgentControl; 132 bool mIsMuted; 133 bool mIsTalking; 134 LLPointer<LLUIImage> mImageMute; 135 LLPointer<LLUIImage> mImageOff; 136 LLPointer<LLUIImage> mImageOn; 137 LLPointer<LLUIImage> mImageLevel1; 138 LLPointer<LLUIImage> mImageLevel2; 139 LLPointer<LLUIImage> mImageLevel3; 140 141 /** whether to deal with LLVoiceClient::getInstance() directly */ 142 bool mAutoUpdate; 143 144 /** uuid of a speaker being monitored */ 145 LLUUID mSpeakerId; 146 147 /** indicates if the instance is dirty and should notify parent */ 148 bool mIsSwitchDirty; 149 bool mShouldSwitchOn; 150}; 151 152#endif