llviewertexteditor.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_VIEWERTEXTEDITOR_H
00033 #define LL_VIEWERTEXTEDITOR_H
00034 
00035 #include "lltexteditor.h"
00036 
00037 class LLInventoryItem;
00038 class LLEmbeddedItems;
00039 class LLEmbeddedNotecardOpener;
00040 
00041 //
00042 // Classes
00043 //
00044 class LLViewerTextEditor : public LLTextEditor
00045 {
00046         friend class LLEmbeddedItems;
00047         friend class LLTextCmdInsertEmbeddedItem;
00048         
00049 public:
00050         LLViewerTextEditor(const LLString& name,
00051                                            const LLRect& rect,
00052                                            S32 max_length,
00053                                            const LLString& default_text = LLString(),
00054                                            const LLFontGL* glfont = NULL,
00055                                            BOOL allow_embedded_items = FALSE);
00056 
00057         virtual ~LLViewerTextEditor();
00058 
00059         virtual void makePristine();
00060         
00061         static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
00062 
00063         // mousehandler overrides
00064         virtual BOOL    handleMouseDown(S32 x, S32 y, MASK mask);
00065         virtual BOOL    handleMouseUp(S32 x, S32 y, MASK mask);
00066         virtual BOOL    handleRightMouseDown(S32 x, S32 y, MASK mask);
00067         virtual BOOL    handleHover(S32 x, S32 y, MASK mask);
00068         virtual BOOL    handleDoubleClick(S32 x, S32 y, MASK mask );
00069 
00070         virtual BOOL    handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect);
00071         virtual BOOL    handleDragAndDrop(S32 x, S32 y, MASK mask,
00072                                                                                 BOOL drop, EDragAndDropType cargo_type, 
00073                                                                                 void *cargo_data, EAcceptance *accept, LLString& tooltip_msg);
00074 
00075         const LLInventoryItem* getDragItem() { return mDragItem; }
00076         virtual BOOL    importBuffer(const LLString& buffer);
00077         virtual bool    importStream(std::istream& str);
00078         virtual BOOL    exportBuffer(LLString& buffer);
00079         void setNotecardInfo(const LLUUID& notecard_item_id, const LLUUID& object_id)
00080         {
00081                 mNotecardInventoryID = notecard_item_id;
00082                 mObjectID = object_id;
00083         }
00084         
00085         void setASCIIEmbeddedText(const LLString& instr);
00086         void setEmbeddedText(const LLString& instr);
00087         LLString getEmbeddedText();
00088         
00089         LLString appendTime(bool prepend_newline);
00090                 // Appends Second Life time, small font, grey
00091                 // If this starts a line, you need to prepend a newline.
00092 
00093         void copyInventory(const LLInventoryItem* item, U32 callback_id = 0);
00094 
00095         // returns true if there is embedded inventory.
00096         // *HACK: This is only useful because the notecard verifier may
00097         // change the asset if there is embedded inventory. This mechanism
00098         // should be changed to get a different asset id from the verifier
00099         // rather than checking if a re-load is necessary. Phoenix 2007-02-27
00100         bool hasEmbeddedInventory();
00101 
00102 protected:
00103         // Embedded object operations
00104         virtual llwchar pasteEmbeddedItem(llwchar ext_char);
00105         virtual void    bindEmbeddedChars(const LLFontGL* font);
00106         virtual void    unbindEmbeddedChars(const LLFontGL* font);
00107 
00108         BOOL                    getEmbeddedItemToolTipAtPos(S32 pos, LLWString &wmsg);
00109         BOOL                    openEmbeddedItemAtPos( S32 pos );
00110         BOOL                    openEmbeddedItem(LLInventoryItem* item, BOOL saved);
00111 
00112         S32                             insertEmbeddedItem(S32 pos, LLInventoryItem* item);
00113 
00114         void                    openEmbeddedTexture( LLInventoryItem* item );
00115         void                    openEmbeddedSound( LLInventoryItem* item );
00116         void                    openEmbeddedLandmark( LLInventoryItem* item );
00117         void                    openEmbeddedNotecard( LLInventoryItem* item, BOOL saved );
00118         void                    showCopyToInvDialog( LLInventoryItem* item );
00119 
00120         static void             onCopyToInvDialog( S32 option, void* userdata );
00121         static void             onNotecardDialog( S32 option, void* userdata );
00122         
00123 protected:
00124         LLPointer<LLInventoryItem> mDragItem;
00125         BOOL mDragItemSaved;
00126         LLEmbeddedItems* mEmbeddedItemList;
00127 
00128         LLUUID mObjectID;
00129         LLUUID mNotecardInventoryID;
00130 
00131         LLPointer<LLEmbeddedNotecardOpener> mInventoryCallback;
00132 
00133         LLViewHandle mPopupMenuHandle;
00134 };
00135 
00136 #endif  // LL_VIEWERTEXTEDITOR_H

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