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

/indra/llui/lltoggleablemenu.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 67 lines | 25 code | 10 blank | 32 comment | 0 complexity | 28a171c04b9827e5d46c7f00912991c6 MD5 | raw file
 1/** 
 2 * @file lltoggleablemenu.h
 3 * @brief Menu toggled by a button press
 4 *
 5 * $LicenseInfo:firstyear=2009&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_LLTOGGLEABLEMENU_H
28#define LL_LLTOGGLEABLEMENU_H
29
30#include "llmenugl.h"
31
32class LLToggleableMenu : public LLMenuGL
33{
34public:
35    //adding blank params to work around registration issue
36    //where LLToggleableMenu was owning the LLMenuGL param
37    //and menu.xml was never loaded
38	struct Params : public LLInitParam::Block<Params, LLMenuGL::Params>
39	{};
40protected:
41	LLToggleableMenu(const Params&);
42	friend class LLUICtrlFactory;
43public:
44	~LLToggleableMenu();
45
46	boost::signals2::connection setVisibilityChangeCallback( const commit_signal_t::slot_type& cb );
47
48	virtual void handleVisibilityChange (BOOL curVisibilityIn);
49
50	const LLRect& getButtonRect() const { return mButtonRect; }
51
52	// Converts the given local button rect to a screen rect
53	void setButtonRect(const LLRect& rect, LLView* current_view);
54	void setButtonRect(LLView* current_view);
55
56	// Returns "true" if menu was not closed by button click
57	// and is not still visible. If menu is visible toggles
58	// its visibility off.
59	bool toggleVisibility();
60	
61protected:
62	bool mClosedByButtonClick;
63	LLRect mButtonRect;
64	commit_signal_t*	mVisibilityChangeSignal;
65};
66
67#endif // LL_LLTOGGLEABLEMENU_H