PageRenderTime 1257ms CodeModel.GetById 1235ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/lltoastalertpanel.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 119 lines | 62 code | 20 blank | 37 comment | 0 complexity | 2160451675ac46f194996955a4d11b6b MD5 | raw file
  1/**
  2 * @file lltoastalertpanel.h
  3 * @brief Panel for alert toasts.
  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_TOASTALERTPANEL_H
 28#define LL_TOASTALERTPANEL_H
 29
 30#include "lltoastpanel.h"
 31#include "llfloater.h"
 32#include "llui.h"
 33#include "llnotificationptr.h"
 34#include "llerror.h"
 35
 36class LLButton;
 37class LLCheckBoxCtrl;
 38class LLLineEditor;
 39
 40/**
 41 * Toast panel for alert notification.
 42 * Alerts notifications doesn't require user interaction.
 43 *
 44 * Replaces class LLAlertDialog.
 45 * https://wiki.lindenlab.com/mediawiki/index.php?title=LLAlertDialog&oldid=81388
 46 */
 47
 48class LLToastAlertPanel
 49	: public LLToastPanel
 50{
 51	LOG_CLASS(LLToastAlertPanel);
 52public:
 53	typedef bool (*display_callback_t)(S32 modal);
 54
 55	class URLLoader
 56	{
 57	public:
 58		virtual void load(const std::string& url, bool force_open_externally = 0) = 0;
 59		virtual ~URLLoader()
 60		{
 61		}
 62	};
 63
 64	static void setURLLoader(URLLoader* loader)
 65	{
 66		sURLLoader = loader;
 67	}
 68	
 69public:
 70	// User's responsibility to call show() after creating these.
 71	LLToastAlertPanel( LLNotificationPtr notep, bool is_modal );
 72
 73	virtual BOOL	handleKeyHere(KEY key, MASK mask );
 74
 75	virtual void	draw();
 76	virtual void	setVisible( BOOL visible );
 77
 78	bool 			setCheckBox( const std::string&, const std::string& );	
 79	void			setCaution(BOOL val = TRUE) { mCaution = val; }
 80	// If mUnique==TRUE only one copy of this message should exist
 81	void			setUnique(BOOL val = TRUE) { mUnique = val; }
 82	void			setEditTextArgs(const LLSD& edit_args);
 83	
 84	void onClickIgnore(LLUICtrl* ctrl);
 85	void onButtonPressed(const LLSD& data, S32 button);
 86	
 87private:
 88	static std::map<std::string, LLToastAlertPanel*> sUniqueActiveMap;
 89
 90	virtual ~LLToastAlertPanel();
 91	// No you can't kill it.  It can only kill itself.
 92
 93	// Does it have a readable title label, or minimize or close buttons?
 94	BOOL hasTitleBar() const;
 95
 96private:
 97	static URLLoader* sURLLoader;
 98	static LLControlGroup* sSettings;
 99
100	struct ButtonData
101	{
102		LLButton* mButton;
103		std::string mURL;
104		U32 mURLExternal;
105	};
106	std::vector<ButtonData> mButtonData;
107
108	S32				mDefaultOption;
109	LLCheckBoxCtrl* mCheck;
110	BOOL			mCaution;
111	BOOL			mUnique;
112	LLUIString		mLabel;
113	LLFrameTimer	mDefaultBtnTimer;
114	// For Dialogs that take a line as text as input:
115	LLLineEditor* mLineEditor;
116
117};
118
119#endif  // LL_TOASTALERTPANEL_H