llpreviewnotecard.h

Go to the documentation of this file.
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 // Class LLPreviewNotecard
00041 //
00042 // This class allows us to edit notecards
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 
00058         // llpreview    
00059         virtual bool saveItem(LLPointer<LLInventoryItem>* itemptr);
00060 
00061         // llview
00062         virtual void draw();
00063         virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
00064         virtual void setEnabled( BOOL enabled );
00065         virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00066 
00067         // llfloater
00068         virtual BOOL canClose();
00069 
00070         // llpanel
00071         virtual BOOL    postBuild();
00072 
00073         // reach into the text editor, and grab the drag item
00074         const LLInventoryItem* getDragItem();
00075 
00076 
00077         // return true if there is any embedded inventory.
00078         bool hasEmbeddedInventory();
00079 
00080         // After saving a notecard, the tcp based upload system will
00081         // change the asset, therefore, we need to re-fetch it from the
00082         // asset system. :(
00083         void refreshFromInventory();
00084 
00085 protected:
00086 
00087         virtual void loadAsset();
00088         bool saveIfNeeded(LLInventoryItem* copyitem = NULL);
00089 
00090         static LLPreviewNotecard* getInstance(const LLUUID& uuid);
00091 
00092         static void onLoadComplete(LLVFS *vfs,
00093                                                            const LLUUID& asset_uuid,
00094                                                            LLAssetType::EType type,
00095                                                            void* user_data, S32 status, LLExtStat ext_status);
00096 
00097         static void onClickSave(void* data);
00098 
00099         static void onSaveComplete(const LLUUID& asset_uuid,
00100                                                            void* user_data,
00101                                                            S32 status, LLExtStat ext_status);
00102 
00103         static void handleSaveChangesDialog(S32 option, void* userdata);
00104 
00105 protected:
00106         LLViewerTextEditor* mEditor;
00107         LLButton* mSaveBtn;
00108 
00109         LLUUID mAssetID;
00110 
00111         LLUUID mNotecardItemID;
00112         LLUUID mObjectID;
00113 };
00114 
00115 
00116 #endif // LL_LLPREVIEWNOTECARD_H

Generated on Thu Jul 1 06:09:02 2010 for Second Life Viewer by  doxygen 1.4.7