diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llhandle.h | 2 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 2 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 7 |
4 files changed, 18 insertions, 17 deletions
diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index a43f095d67..a198a26c22 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -99,9 +99,9 @@ public: { return lhs.mTombStone > rhs.mTombStone; } -protected: protected: + template<typename T> friend class LLHandle; LLPointer<LLTombStone<T> > mTombStone; private: diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 76d0187712..66fe8304e2 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -326,7 +326,7 @@ protected: std::vector<S32> mPreeditPositions; LLPreeditor::standouts_t mPreeditStandouts; - LLHandle<LLView> mContextMenuHandle; + LLHandle<LLContextMenu> mContextMenuHandle; private: // Instances that by default point to the statics but can be overidden in XML. diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 67993988fe..64f84bae7c 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3694,9 +3694,7 @@ public: LLContextMenuBranch(const Params&); virtual ~LLContextMenuBranch() - { - delete mBranch; - } + {} // called to rebuild the draw label virtual void buildDrawLabel( void ); @@ -3704,21 +3702,21 @@ public: // onCommit() - do the primary funcationality of the menu item. virtual void onCommit( void ); - LLContextMenu* getBranch() { return mBranch; } + LLContextMenu* getBranch() { return mBranch.get(); } void setHighlight( BOOL highlight ); protected: void showSubMenu(); - LLContextMenu* mBranch; + LLHandle<LLContextMenu> mBranch; }; LLContextMenuBranch::LLContextMenuBranch(const LLContextMenuBranch::Params& p) : LLMenuItemGL(p), - mBranch( p.branch ) + mBranch( p.branch()->getHandle() ) { - mBranch->hide(); - mBranch->setParentMenuItem(this); + mBranch.get()->hide(); + mBranch.get()->setParentMenuItem(this); } // called to rebuild the draw label @@ -3727,12 +3725,12 @@ void LLContextMenuBranch::buildDrawLabel( void ) { // default enablement is this -- if any of the subitems are // enabled, this item is enabled. JC - U32 sub_count = mBranch->getItemCount(); + U32 sub_count = mBranch.get()->getItemCount(); U32 i; BOOL any_enabled = FALSE; for (i = 0; i < sub_count; i++) { - LLMenuItemGL* item = mBranch->getItem(i); + LLMenuItemGL* item = mBranch.get()->getItem(i); item->buildDrawLabel(); if (item->getEnabled() && !item->getDrawTextDisabled() ) { @@ -3754,13 +3752,13 @@ void LLContextMenuBranch::buildDrawLabel( void ) void LLContextMenuBranch::showSubMenu() { - LLMenuItemGL* menu_item = mBranch->getParentMenuItem(); + LLMenuItemGL* menu_item = mBranch.get()->getParentMenuItem(); if (menu_item != NULL && menu_item->getVisible()) { S32 center_x; S32 center_y; localPointToScreen(getRect().getWidth(), getRect().getHeight() , ¢er_x, ¢er_y); - mBranch->show(center_x, center_y); + mBranch.get()->show(center_x, center_y); } } @@ -3780,7 +3778,7 @@ void LLContextMenuBranch::setHighlight( BOOL highlight ) } else { - mBranch->hide(); + mBranch.get()->hide(); } } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 19b738312e..bb17bf4102 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -670,9 +670,12 @@ public: BOOL appendContextSubMenu(LLContextMenu *menu); + LLHandle<LLContextMenu> getHandle() { mHandle.bind(this); return mHandle; } + protected: - BOOL mHoveredAnyItem; - LLMenuItemGL* mHoverItem; + BOOL mHoveredAnyItem; + LLMenuItemGL* mHoverItem; + LLRootHandle<LLContextMenu> mHandle; }; |