summaryrefslogtreecommitdiff
path: root/indra/newview/lltoastpanel.h
blob: f4c758ade9ef344c3be4d7155ea30fe22277d329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/** 
 * @file lltoastpanel.h
 * @brief Creates a panel of a specific kind for a toast.
 *
 * $LicenseInfo:firstyear=2003&license=viewerlgpl$
 * Second Life Viewer Source Code
 * Copyright (C) 2010, Linden Research, Inc.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 * $/LicenseInfo$
 */

#ifndef LL_LLTOASTPANEL_H
#define LL_LLTOASTPANEL_H

#include "llpanel.h"
#include "lltextbox.h"
#include "llnotificationptr.h"

#include <string>

/**
 * Base class for all panels that can be added to the toast.
 * All toast panels should contain necessary logic for representing certain notification
 * but shouldn't contain logic related to this panel lifetime control and positioning
 * on the parent view.
 */
class LLToastPanel : public LLPanel {
public:
	LLToastPanel(const LLNotificationPtr&);
	virtual ~LLToastPanel() = 0;

	virtual std::string getTitle();
	virtual const std::string& getNotificationName();
	virtual const LLUUID& getID();

	static const S32 MIN_PANEL_HEIGHT;
	static const S32 MAX_TEXT_LENGTH;

	/**
	 * Builder method for constructing notification specific panels.
	 * Normally type of created panels shouldn't be publicated and should be hidden
	 * from other functionality.
	 */
	static LLToastPanel* buidPanelFromNotification(
			const LLNotificationPtr& notification);
protected:
	LLNotificationPtr mNotification;
	void snapToMessageHeight(LLTextBase* message, S32 maxLineCount);
	S32 computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount);
};

class LLCheckBoxCtrl;

// Wrapper with support for 'don't ask again' checkbox
class LLCheckBoxToastPanel : public LLToastPanel
{
public:
	LLCheckBoxToastPanel(const LLNotificationPtr& p_ntf);
	virtual ~LLCheckBoxToastPanel() {};

	// set checkboxes acording to defaults from form
	void			setCheckBoxes(const S32 &h_pad, const S32 &v_pad, LLView *parent_view = NULL);
	// set single checkbox
	bool			setCheckBox(const std::string&, const std::string&, const commit_signal_t::slot_type& cb, const S32 &h_pad, const S32 &v_pad, LLView *parent_view = NULL);
protected:
	void onCommitCheckbox(LLUICtrl* ctrl);

	LLCheckBoxCtrl* mCheck;
};

#endif /* LL_TOASTPANEL_H */