PageRenderTime 21ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llchatbar.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 112 lines | 51 code | 25 blank | 36 comment | 0 complexity | a9c07a1f4aa4d7a8e1cd4103fe50c997 MD5 | raw file
  1/** 
  2 * @file llchatbar.h
  3 * @brief LLChatBar class definition
  4 *
  5 * $LicenseInfo:firstyear=2002&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_LLCHATBAR_H
 28#define LL_LLCHATBAR_H
 29
 30#include "llpanel.h"
 31#include "llframetimer.h"
 32#include "llchat.h"
 33
 34class LLLineEditor;
 35class LLMessageSystem;
 36class LLUICtrl;
 37class LLUUID;
 38class LLFrameTimer;
 39class LLChatBarGestureObserver;
 40class LLComboBox;
 41
 42
 43class LLChatBar
 44:	public LLPanel
 45{
 46public:
 47	// constructor for inline chat-bars (e.g. hosted in chat history window)
 48	LLChatBar();
 49	~LLChatBar();
 50	virtual BOOL postBuild();
 51
 52	virtual BOOL handleKeyHere(KEY key, MASK mask);
 53
 54	void		refresh();
 55	void		refreshGestures();
 56
 57	// Move cursor into chat input field.
 58	void		setKeyboardFocus(BOOL b);
 59
 60	// Ignore arrow keys for chat bar
 61	void		setIgnoreArrowKeys(BOOL b);
 62
 63	BOOL		inputEditorHasFocus();
 64	std::string	getCurrentChat();
 65
 66	// since chat bar logic is reused for chat history
 67	// gesture combo box might not be a direct child
 68	void		setGestureCombo(LLComboBox* combo);
 69
 70	// Send a chat (after stripping /20foo channel chats).
 71	// "Animate" means the nodding animation for regular text.
 72	void		sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
 73	void		sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
 74
 75	// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.
 76	// Otherwise returns input and channel 0.
 77	LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
 78
 79	// callbacks
 80	void onClickSay(LLUICtrl* ctrl);
 81
 82	static void	onTabClick( void* userdata );
 83	static void	onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
 84	static void	onInputEditorFocusLost();
 85	static void	onInputEditorGainFocus();
 86
 87	void onCommitGesture(LLUICtrl* ctrl);
 88
 89	static void startChat(const char* line);
 90	static void stopChat();
 91
 92protected:
 93	void sendChat(EChatType type);
 94	void updateChat();
 95
 96protected:
 97	LLLineEditor*	mInputEditor;
 98
 99	LLFrameTimer	mGestureLabelTimer;
100
101	// Which non-zero channel did we last chat on?
102	S32				mLastSpecialChatChannel;
103
104	BOOL			mIsBuilt;
105	LLComboBox*		mGestureCombo;
106
107	LLChatBarGestureObserver* mObserver;
108};
109
110extern LLChatBar *gChatBar;
111
112#endif