00001
00032 #ifndef LL_LLPREVIEWNOTECARD_H
00033 #define LL_LLPREVIEWNOTECARD_H
00034
00035 #include "llpreview.h"
00036 #include "llassetstorage.h"
00037 #include "lliconctrl.h"
00038
00039
00040
00041
00042
00043
00044
00045 class LLViewerTextEditor;
00046 class LLButton;
00047
00048 class LLPreviewNotecard : public LLPreview
00049 {
00050 public:
00051 LLPreviewNotecard(const std::string& name, const LLRect& rect, const std::string& title,
00052 const LLUUID& item_id,
00053 const LLUUID& object_id = LLUUID::null,
00054 const LLUUID& asset_id = LLUUID::null,
00055 BOOL show_keep_discard = FALSE,
00056 LLPointer<LLViewerInventoryItem> inv_item = NULL);
00057 virtual ~LLPreviewNotecard();
00058
00059
00060 virtual bool saveItem(LLPointer<LLInventoryItem>* itemptr);
00061
00062
00063 virtual void draw();
00064 virtual BOOL handleKeyHere(KEY key, MASK mask);
00065 virtual void setEnabled( BOOL enabled );
00066 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00067
00068
00069 virtual BOOL canClose();
00070
00071
00072 virtual BOOL postBuild();
00073
00074
00075 const LLInventoryItem* getDragItem();
00076
00077
00078
00079 bool hasEmbeddedInventory();
00080
00081
00082
00083
00084 void refreshFromInventory();
00085
00086 protected:
00087
00088 virtual void loadAsset();
00089 bool saveIfNeeded(LLInventoryItem* copyitem = NULL);
00090
00091 static LLPreviewNotecard* getInstance(const LLUUID& uuid);
00092
00093 static void onLoadComplete(LLVFS *vfs,
00094 const LLUUID& asset_uuid,
00095 LLAssetType::EType type,
00096 void* user_data, S32 status, LLExtStat ext_status);
00097
00098 static void onClickSave(void* data);
00099
00100 static void onSaveComplete(const LLUUID& asset_uuid,
00101 void* user_data,
00102 S32 status, LLExtStat ext_status);
00103
00104 static void handleSaveChangesDialog(S32 option, void* userdata);
00105
00106 virtual const char *getTitleName() const { return "Note"; }
00107
00108 protected:
00109 LLViewerTextEditor* mEditor;
00110 LLButton* mSaveBtn;
00111
00112 LLUUID mAssetID;
00113
00114 LLUUID mNotecardItemID;
00115 LLUUID mObjectID;
00116 };
00117
00118
00119 #endif // LL_LLPREVIEWNOTECARD_H