/indra/newview/llsidepanelinventorysubpanel.cpp
C++ | 145 lines | 92 code | 21 blank | 32 comment | 2 complexity | 5d197b37a1022f4945402fed27db3c40 MD5 | raw file
Possible License(s): LGPL-2.1
1/**
2 * @file llsidepanelinventorysubpanel.cpp
3 * @brief A floater which shows an inventory item's properties.
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#include "llviewerprecompiledheaders.h"
28#include "llsidepanelinventorysubpanel.h"
29
30#include "roles_constants.h"
31
32#include "llagent.h"
33#include "llavataractions.h"
34#include "llbutton.h"
35#include "llfloaterreg.h"
36#include "llgroupactions.h"
37#include "llinventorymodel.h"
38#include "lllineeditor.h"
39#include "llradiogroup.h"
40#include "llviewercontrol.h"
41#include "llviewerobjectlist.h"
42
43
44///----------------------------------------------------------------------------
45/// Class LLSidepanelInventorySubpanel
46///----------------------------------------------------------------------------
47
48// Default constructor
49LLSidepanelInventorySubpanel::LLSidepanelInventorySubpanel(const LLPanel::Params& p)
50 : LLPanel(p),
51 mIsDirty(TRUE),
52 mIsEditing(FALSE),
53 mCancelBtn(NULL),
54 mSaveBtn(NULL)
55{
56}
57
58// Destroys the object
59LLSidepanelInventorySubpanel::~LLSidepanelInventorySubpanel()
60{
61}
62
63// virtual
64BOOL LLSidepanelInventorySubpanel::postBuild()
65{
66 mSaveBtn = getChild<LLButton>("save_btn");
67 mSaveBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onSaveButtonClicked, this));
68
69 mCancelBtn = getChild<LLButton>("cancel_btn");
70 mCancelBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onCancelButtonClicked, this));
71 return TRUE;
72}
73
74void LLSidepanelInventorySubpanel::setVisible(BOOL visible)
75{
76 if (visible)
77 {
78 dirty();
79 }
80 LLPanel::setVisible(visible);
81}
82
83void LLSidepanelInventorySubpanel::setIsEditing(BOOL edit)
84{
85 mIsEditing = edit;
86 mIsDirty = TRUE;
87}
88
89BOOL LLSidepanelInventorySubpanel::getIsEditing() const
90{
91
92 return TRUE; // Default everything to edit mode since we're not using an edit button anymore.
93 // return mIsEditing;
94}
95
96void LLSidepanelInventorySubpanel::reset()
97{
98 mIsDirty = TRUE;
99}
100
101void LLSidepanelInventorySubpanel::draw()
102{
103 if (mIsDirty)
104 {
105 refresh();
106 updateVerbs();
107 mIsDirty = FALSE;
108 }
109
110 LLPanel::draw();
111}
112
113void LLSidepanelInventorySubpanel::dirty()
114{
115 mIsDirty = TRUE;
116 setIsEditing(FALSE);
117}
118
119void LLSidepanelInventorySubpanel::updateVerbs()
120{
121 mSaveBtn->setVisible(mIsEditing);
122 mCancelBtn->setVisible(mIsEditing);
123}
124
125void LLSidepanelInventorySubpanel::onEditButtonClicked()
126{
127 setIsEditing(TRUE);
128 refresh();
129 updateVerbs();
130}
131
132void LLSidepanelInventorySubpanel::onSaveButtonClicked()
133{
134 save();
135 setIsEditing(FALSE);
136 refresh();
137 updateVerbs();
138}
139
140void LLSidepanelInventorySubpanel::onCancelButtonClicked()
141{
142 setIsEditing(FALSE);
143 refresh();
144 updateVerbs();
145}