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         virtual ~LLPreviewNotecard();
00058         
00059         // llpreview    
00060         virtual bool saveItem(LLPointer<LLInventoryItem>* itemptr);
00061 
00062         // llview
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         // llfloater
00069         virtual BOOL canClose();
00070 
00071         // llpanel
00072         virtual BOOL    postBuild();
00073 
00074         // reach into the text editor, and grab the drag item
00075         const LLInventoryItem* getDragItem();
00076 
00077 
00078         // return true if there is any embedded inventory.
00079         bool hasEmbeddedInventory();
00080 
00081         // After saving a notecard, the tcp based upload system will
00082         // change the asset, therefore, we need to re-fetch it from the
00083         // asset system. :(
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

Generated on Fri May 16 08:33:57 2008 for SecondLife by  doxygen 1.5.5