summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2011-09-26 18:51:43 -0700
committerRichard Nelson <richard@lindenlab.com>2011-09-26 18:51:43 -0700
commit7fd0e8c69e6dced4a770da4fac10c154eac5899f (patch)
tree42da3dccaa4ef4c9025e34341e633eae305d3c25 /indra/llui
parent756532ba8a0a29ca7e5991d8a4f48ddac3bf06ac (diff)
fixed toolbar context menu
deprecated pointless LLView::deleteViewByHandle
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llmenugl.cpp2
-rw-r--r--indra/llui/lltoolbar.cpp18
-rw-r--r--indra/llui/lltoolbar.h11
-rw-r--r--indra/llui/lltoolbarview.cpp6
-rw-r--r--indra/llui/llview.cpp7
-rw-r--r--indra/llui/llview.h1
6 files changed, 16 insertions, 29 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 6cac841cde..badba7a416 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -947,7 +947,7 @@ LLMenuItemBranchGL::LLMenuItemBranchGL(const LLMenuItemBranchGL::Params& p)
LLMenuItemBranchGL::~LLMenuItemBranchGL()
{
- LLView::deleteViewByHandle(mBranchHandle);
+ delete mBranchHandle.get();
}
// virtual
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 278c04aef8..bd45cf4656 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -116,12 +116,12 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
LLToolBar::~LLToolBar()
{
- LLView::deleteViewByHandle(mPopupMenuHandle);
+ delete mPopupMenuHandle.get();
}
-BOOL LLToolBar::postBuild()
+void LLToolBar::createContextMenu()
{
- if (!mReadOnly)
+ if (!mPopupMenuHandle.get())
{
LLUICtrl::CommitCallbackRegistry::Registrar& commit_reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar();
commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2));
@@ -129,11 +129,7 @@ BOOL LLToolBar::postBuild()
LLUICtrl::EnableCallbackRegistry::Registrar& enable_reg = LLUICtrl::EnableCallbackRegistry::defaultRegistrar();
enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2));
- //
- // Setup the context menu
- //
-
- LLMenuGL* menu = LLUICtrlFactory::instance().createFromFile<LLMenuGL>("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
+ LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
if (menu)
{
@@ -146,8 +142,6 @@ BOOL LLToolBar::postBuild()
llwarns << "Unable to load toolbars context menu." << llendl;
}
}
-
- return TRUE;
}
void LLToolBar::initFromParams(const LLToolBar::Params& p)
@@ -278,10 +272,12 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
if (handle_it_here)
{
- LLMenuGL * menu = (LLMenuGL *) mPopupMenuHandle.get();
+ createContextMenu();
+ LLContextMenu * menu = (LLContextMenu *) mPopupMenuHandle.get();
if (menu)
{
+ menu->show(x, y);
LLMenuGL::showPopup(this, menu, x, y);
}
}
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index f7562b29d2..657e928319 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -119,8 +119,8 @@ public:
// virtuals
void draw();
- BOOL postBuild();
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
bool addCommand(const LLCommandId& commandId);
bool hasCommand(const LLCommandId& commandId) const;
@@ -133,13 +133,12 @@ protected:
void initFromParams(const Params&);
- BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- BOOL isSettingChecked(const LLSD& userdata);
- void onSettingEnable(const LLSD& userdata);
-
private:
+ void createContextMenu();
void updateLayoutAsNeeded();
void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth);
+ BOOL isSettingChecked(const LLSD& userdata);
+ void onSettingEnable(const LLSD& userdata);
const bool mReadOnly;
@@ -164,7 +163,7 @@ private:
LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT];
- LLHandle<LLView> mPopupMenuHandle;
+ LLHandle<class LLContextMenu> mPopupMenuHandle;
};
diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp
index 21d3785c82..6ae10fbf1d 100644
--- a/indra/llui/lltoolbarview.cpp
+++ b/indra/llui/lltoolbarview.cpp
@@ -90,9 +90,9 @@ void LLToolBarView::draw()
LLRect bottom_rect, left_rect, right_rect;
- if (mToolbarBottom) bottom_rect = mToolbarBottom->getRect();
- if (mToolbarLeft) left_rect = mToolbarLeft->getRect();
- if (mToolbarRight) right_rect = mToolbarRight->getRect();
+ if (mToolbarBottom) mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this);
+ if (mToolbarLeft) mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this);
+ if (mToolbarRight) mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this);
if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight()))
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 60452b9ae4..e10c2f0d1e 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1826,13 +1826,6 @@ LLView* LLView::findNextSibling(LLView* child)
return (next_it != mChildList.end()) ? *next_it : NULL;
}
-void LLView::deleteViewByHandle(LLHandle<LLView> handle)
-{
- LLView* viewp = handle.get();
-
- delete viewp;
-}
-
LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, BOOL allow_partial_outside)
{
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 594a5eec6b..7a1b2e4ba0 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -482,7 +482,6 @@ public:
// return query for iterating over focus roots in tab order
static const LLCtrlQuery & getFocusRootsQuery();
- static void deleteViewByHandle(LLHandle<LLView> handle);
static LLWindow* getWindow(void) { return LLUI::sWindow; }
// Set up params after XML load before calling new(),