PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llmodaldialog.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 83 lines | 37 code | 17 blank | 29 comment | 0 complexity | 0e38f0cf8a216783f5789dc94d3e4302 MD5 | raw file
 1/** 
 2 * @file llmodaldialog.h
 3 * @brief LLModalDialog base class
 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_LLMODALDIALOG_H
28#define LL_LLMODALDIALOG_H
29
30#include "llfloater.h"
31#include "llframetimer.h"
32
33class LLModalDialog;
34
35// By default, a ModalDialog is modal, i.e. no other window can have focus
36// However, for the sake of code reuse and simplicity, if mModal == false,
37// the dialog behaves like a normal floater
38// https://wiki.lindenlab.com/mediawiki/index.php?title=LLModalDialog&oldid=81385
39class LLModalDialog : public LLFloater
40{
41public:
42	LLModalDialog( const LLSD& key, BOOL modal = true );
43	/*virtual*/ ~LLModalDialog();
44	
45	/*virtual*/ BOOL 	postBuild();
46	
47	/*virtual*/ void	openFloater(const LLSD& key = LLSD());
48	/*virtual*/ void	onOpen(const LLSD& key);
49	
50	/*virtual*/ void 	reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
51	
52	/*virtual*/ BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
53	/*virtual*/ BOOL	handleMouseUp(S32 x, S32 y, MASK mask);
54	/*virtual*/ BOOL	handleHover(S32 x, S32 y, MASK mask);
55	/*virtual*/ BOOL	handleScrollWheel(S32 x, S32 y, S32 clicks);
56	/*virtual*/ BOOL	handleDoubleClick(S32 x, S32 y, MASK mask);
57	/*virtual*/ BOOL	handleRightMouseDown(S32 x, S32 y, MASK mask);
58	/*virtual*/ BOOL	handleKeyHere(KEY key, MASK mask );
59
60	/*virtual*/ void	setVisible(BOOL visible);
61	/*virtual*/ void	draw();
62
63	BOOL 			isModal() const { return mModal; }
64	void			stopModal();
65
66	static void		onAppFocusLost();
67	static void		onAppFocusGained();
68
69	static S32		activeCount() { return sModalStack.size(); }
70	static void		shutdownModals();
71
72protected:
73	void			centerOnScreen();
74
75private:
76	
77	LLFrameTimer 	mVisibleTime;
78	const BOOL		mModal;
79
80	static std::list<LLModalDialog*> sModalStack;  // Top of stack is currently being displayed
81};
82
83#endif  // LL_LLMODALDIALOG_H