PageRenderTime 48ms CodeModel.GetById 41ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llpreviewnotecard.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 107 lines | 43 code | 26 blank | 38 comment | 0 complexity | ed297938a8524d6176f42ab7aa514877 MD5 | raw file
  1/** 
  2 * @file llpreviewnotecard.h
  3 * @brief LLPreviewNotecard class header file
  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_LLPREVIEWNOTECARD_H
 28#define LL_LLPREVIEWNOTECARD_H
 29
 30#include "llpreview.h"
 31#include "llassetstorage.h"
 32#include "lliconctrl.h"
 33
 34//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 35// Class LLPreviewNotecard
 36//
 37// This class allows us to edit notecards
 38//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 39
 40class LLViewerTextEditor;
 41class LLButton;
 42
 43class LLPreviewNotecard : public LLPreview
 44{
 45public:
 46	LLPreviewNotecard(const LLSD& key);
 47	virtual ~LLPreviewNotecard();
 48	
 49	bool saveItem();
 50
 51	// llview
 52	virtual void draw();
 53	virtual BOOL handleKeyHere(KEY key, MASK mask);
 54	virtual void setEnabled( BOOL enabled );
 55
 56	// llfloater
 57	virtual BOOL canClose();
 58
 59	// llpanel
 60	virtual BOOL postBuild();
 61
 62	// reach into the text editor, and grab the drag item
 63	const LLInventoryItem* getDragItem();
 64
 65
 66	// return true if there is any embedded inventory.
 67	bool hasEmbeddedInventory();
 68
 69	// After saving a notecard, the tcp based upload system will
 70	// change the asset, therefore, we need to re-fetch it from the
 71	// asset system. :(
 72	void refreshFromInventory(const LLUUID& item_id = LLUUID::null);
 73
 74protected:
 75
 76	void updateTitleButtons();
 77	virtual void loadAsset();
 78	bool saveIfNeeded(LLInventoryItem* copyitem = NULL);
 79
 80	void deleteNotecard();
 81
 82	static void onLoadComplete(LLVFS *vfs,
 83							   const LLUUID& asset_uuid,
 84							   LLAssetType::EType type,
 85							   void* user_data, S32 status, LLExtStat ext_status);
 86
 87	static void onClickSave(void* data);
 88
 89	static void onClickDelete(void* data);
 90
 91	static void onSaveComplete(const LLUUID& asset_uuid,
 92							   void* user_data,
 93							   S32 status, LLExtStat ext_status);
 94
 95	bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
 96
 97protected:
 98	LLViewerTextEditor* mEditor;
 99	LLButton* mSaveBtn;
100
101	LLUUID mAssetID;
102
103	LLUUID mObjectID;
104};
105
106
107#endif // LL_LLPREVIEWNOTECARD_H