PageRenderTime 31ms CodeModel.GetById 15ms app.highlight 10ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llui/llscrollingpanellist.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 85 lines | 37 code | 15 blank | 33 comment | 0 complexity | 5e5427c21be36a8e4f8ce11093a5ddbc MD5 | raw file
 1/** 
 2 * @file llscrollingpanellist.h
 3 *
 4 * $LicenseInfo:firstyear=2006&license=viewerlgpl$
 5 * Second Life Viewer Source Code
 6 * Copyright (C) 2010, Linden Research, Inc.
 7 * 
 8 * This library is free software; you can redistribute it and/or
 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation;
11 * version 2.1 of the License only.
12 * 
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 * 
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 * 
22 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
23 * $/LicenseInfo$
24 */
25
26#ifndef LL_LLSCROLLINGPANELLIST_H
27#define LL_LLSCROLLINGPANELLIST_H
28
29#include <vector>
30
31#include "llui.h"
32#include "lluictrlfactory.h"
33#include "llview.h"
34#include "llpanel.h"
35
36/*
37 * Pure virtual class represents a scrolling panel.
38 */
39class LLScrollingPanel : public LLPanel
40{
41public:
42	LLScrollingPanel(const LLPanel::Params& params) : LLPanel(params) {}
43	virtual void updatePanel(BOOL allow_modify) = 0;
44};
45
46
47/*
48 * A set of panels that are displayed in a vertical sequence inside a scroll container.
49 */
50class LLScrollingPanelList : public LLUICtrl
51{
52public:
53	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
54	{};
55	LLScrollingPanelList(const Params& p)
56	:	LLUICtrl(p) 
57	{}
58	
59	static const S32 GAP_BETWEEN_PANELS = 6;
60
61	typedef std::deque<LLScrollingPanel*>	panel_list_t;
62
63	virtual void setValue(const LLSD& value) {};
64
65	virtual void		draw();
66
67	void				clearPanels();
68	S32					addPanel( LLScrollingPanel* panel );
69	void				removePanel( LLScrollingPanel* panel );
70	void				removePanel( U32 panel_index );
71	void				updatePanels(BOOL allow_modify);
72	const panel_list_t&	getPanelList() { return mPanelList; }
73
74private:
75	void				updatePanelVisiblilty();
76
77	/**
78	 * Notify parent about size change, makes sense when used inside accordion
79	 */
80	void				notifySizeChanged(S32 height);
81
82	panel_list_t		mPanelList;
83};
84
85#endif //LL_LLSCROLLINGPANELLIST_H