summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-07-14 19:06:17 +0000
committerJames Cook <james@lindenlab.com>2009-07-14 19:06:17 +0000
commit83a6ea234f32bf30d1f16b276d128debb2aeea02 (patch)
tree0950d0cccb1effa90c1da7f479adb591f3de3d68 /indra/llui
parent9ecdbd8b72fec5182d2a5f843c9e4a050069ed51 (diff)
Merge skinning-15 to viewer-2. Fixes include:
DEV-35175 Spawning context menu should not move mouse cursor (Note: introduces regression where menu can fall off bottom of screen, will fix shortly) DEV-35143 Modal alerts appear behind side tray DEV-35141 Landmarks image and description outside of landmarks Merging revisions 126418-126419,126726-126727,126856-126857,127010-127011,127014-127016 of svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-15 into G:\viewer-2.0.0-3, respecting ancestry
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp45
-rw-r--r--indra/llui/llfloater.h32
-rw-r--r--indra/llui/llmenugl.cpp10
-rw-r--r--indra/llui/llmenugl.h2
-rw-r--r--indra/llui/llpanel.cpp7
-rw-r--r--indra/llui/lluictrl.cpp4
-rw-r--r--indra/llui/lluictrl.h6
-rw-r--r--indra/llui/llview.cpp24
-rw-r--r--indra/llui/llview.h1
9 files changed, 89 insertions, 42 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index f89bee6cfb..153e025385 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -631,7 +631,7 @@ void LLFloater::closeFloater(bool app_quitting)
}
// Let floater do cleanup.
- mCloseSignal(this, getValue());
+ mCloseSignal(this, getValue(), app_quitting);
onClose(app_quitting);
}
}
@@ -1730,7 +1730,7 @@ void LLFloater::initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig
else
{
std::string function_name = cb.function_name;
- open_callback_t* func = (CallbackRegistry<open_callback_t>::getValue(function_name));
+ open_callback_t* func = (OpenCallbackRegistry::getValue(function_name));
if (func)
{
if (cb.parameter.isProvided())
@@ -1745,6 +1745,45 @@ void LLFloater::initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig
}
}
+void LLFloater::initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig)
+{
+ if (cb.function.isProvided())
+ {
+ if (cb.parameter.isProvided())
+ sig.connect(boost::bind(cb.function(), _1, cb.parameter, _3));
+ else
+ sig.connect(cb.function());
+ }
+ else
+ {
+ std::string function_name = cb.function_name;
+ close_callback_t* func = (CloseCallbackRegistry::getValue(function_name));
+ if (func)
+ {
+ if (cb.parameter.isProvided())
+ sig.connect(boost::bind((*func), _1, cb.parameter,_3));
+ else
+ sig.connect(*func);
+ }
+ else if (!function_name.empty())
+ {
+ llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl;
+ }
+ }
+}
+
+namespace LLInitParam
+{
+
+ template<>
+ bool ParamCompare<LLFloater::close_callback_t>::equals(
+ const LLFloater::close_callback_t &a,
+ const LLFloater::close_callback_t &b)
+ {
+ return false;
+ }
+}
+
/////////////////////////////////////////////////////
// LLFloaterView
@@ -2505,7 +2544,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
initOpenCallback(p.open_callback, mOpenSignal);
// close callback
if (p.close_callback.isProvided())
- initOpenCallback(p.close_callback, mCloseSignal);
+ initCloseCallback(p.close_callback, mCloseSignal);
}
void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floater, LLXMLNodePtr output_node)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index c23978b9da..5a609a2e40 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -108,14 +108,19 @@ public:
typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> open_callback_t;
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> open_signal_t;
- typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> close_callback_t;
- typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> close_signal_t;
-
+ typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_callback_t;
+ typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_signal_t;
+
struct OpenCallbackParam : public LLInitParam::Block<OpenCallbackParam, CallbackParam >
{
Optional<open_callback_t> function;
};
-
+
+ struct CloseCallbackParam : public LLInitParam::Block<CloseCallbackParam, CallbackParam >
+ {
+ Optional<close_callback_t> function;
+ };
+
struct Params
: public LLInitParam::Block<Params, LLPanel::Params>
{
@@ -132,8 +137,8 @@ public:
save_rect,
save_visibility;
- Optional<OpenCallbackParam> open_callback,
- close_callback;
+ Optional<OpenCallbackParam> open_callback;
+ Optional<CloseCallbackParam> close_callback;
Params() :
title("title"),
@@ -306,6 +311,7 @@ protected:
void destroy() { die(); } // Don't call this directly. You probably want to call close(). JC
void initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig);
+ void initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig);
private:
void setForeground(BOOL b); // called only by floaterview
@@ -318,13 +324,14 @@ private:
void addDragHandle();
public:
- typedef CallbackRegistry<open_callback_t> OpenCallbackRegistry;
+ class OpenCallbackRegistry : public CallbackRegistry<open_callback_t, OpenCallbackRegistry> {};
+ class CloseCallbackRegistry : public CallbackRegistry<close_callback_t, CloseCallbackRegistry> {};
protected:
std::string mRectControl;
std::string mVisibilityControl;
open_signal_t mOpenSignal;
- open_signal_t mCloseSignal;
+ close_signal_t mCloseSignal;
LLSD mKey; // Key used for retrieving instances; set (for now) by LLFLoaterReg
private:
@@ -486,6 +493,15 @@ public:
extern LLFloaterView* gFloaterView;
+namespace LLInitParam
+{
+ template<>
+ bool ParamCompare<LLFloater::close_callback_t>::equals(
+ const LLFloater::close_callback_t &a,
+ const LLFloater::close_callback_t &b);
+}
+
+
#endif // LL_FLOATER_H
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 4d2374a7e8..d24eb1ec56 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3532,7 +3532,7 @@ void LLContextMenuBranch::showSubMenu()
S32 center_x;
S32 center_y;
localPointToScreen(getRect().getWidth(), getRect().getHeight() , &center_x, &center_y);
- mBranch->show( center_x, center_y, FALSE);
+ mBranch->show( center_x, center_y);
}
// onCommit() - do the primary funcationality of the menu item.
@@ -3580,7 +3580,7 @@ void LLContextMenu::setVisible(BOOL visible)
hide();
}
-void LLContextMenu::show(S32 x, S32 y,BOOL adjustCursor)
+void LLContextMenu::show(S32 x, S32 y)
{
arrangeAndClear();
@@ -3604,12 +3604,6 @@ void LLContextMenu::show(S32 x, S32 y,BOOL adjustCursor)
const_cast<LLRect&>(getRect()).setCenterAndSize(local_x + width/2, local_y - height/2, width, height);
arrange();
-
- if (translateIntoRect(menu_region_rect,FALSE) && adjustCursor)
- {
- LLUI::setCursorPositionLocal(getParent(), getRect().mLeft , getRect().mTop);
- }
-
LLView::setVisible(TRUE);
}
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index ef27c2c9c8..897b43a614 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -659,7 +659,7 @@ public:
virtual void draw ();
- virtual void show (S32 x, S32 y, BOOL adjustCursor = TRUE);
+ virtual void show (S32 x, S32 y);
virtual void hide ();
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index de102e47ac..b18a750178 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -418,10 +418,11 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
void LLPanel::initFromParams(const LLPanel::Params& p)
{
- // The LLPanel constructor doesn't correctly receive Params yet
- setEnabled(p.enabled);
+ //setting these here since panel constructor not called with params
+ //and LLView::initFromParams will use them to set visible and enabled
setVisible(p.visible);
-
+ setEnabled(p.enabled);
+
// control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible
LLUICtrl::initFromParams(p);
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 7d33a5ad1a..2a6dd97f31 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -191,7 +191,7 @@ void LLUICtrl::initFromParams(const Params& p)
}
else
{
- commit_callback_t* initfunc = (CallbackRegistry<commit_callback_t>::getValue(p.init_callback.function_name));
+ commit_callback_t* initfunc = (CommitCallbackRegistry::getValue(p.init_callback.function_name));
if (initfunc)
{
(*initfunc)(this, p.init_callback.parameter);
@@ -233,7 +233,7 @@ void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t
else
{
std::string function_name = cb.function_name;
- commit_callback_t* func = (CallbackRegistry<commit_callback_t>::getValue(function_name));
+ commit_callback_t* func = (CommitCallbackRegistry::getValue(function_name));
if (func)
{
if (cb.parameter.isProvided())
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index f4c7cf36f2..ff37efb5f7 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -269,11 +269,11 @@ public:
}
};
- template <typename F> class CallbackRegistry : public LLRegistrySingleton<std::string, F, CallbackRegistry<F> >
+ template <typename F, typename DERIVED> class CallbackRegistry : public LLRegistrySingleton<std::string, F, DERIVED >
{};
- typedef CallbackRegistry<commit_callback_t> CommitCallbackRegistry;
- typedef CallbackRegistry<enable_callback_t> EnableCallbackRegistry;
+ class CommitCallbackRegistry : public CallbackRegistry<commit_callback_t, CommitCallbackRegistry>{};
+ class EnableCallbackRegistry : public CallbackRegistry<enable_callback_t, EnableCallbackRegistry>{};
protected:
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index f01aacb797..2f9a6e7d46 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -401,32 +401,28 @@ bool LLCompareByTabOrder::operator() (const LLView* const a, const LLView* const
return (a_score == b_score) ? a < b : a_score < b_score;
}
-BOOL LLView::isInVisibleChain() const
+bool LLView::trueToRoot(const boost::function<bool (const LLView*)>& predicate) const
{
const LLView* cur_view = this;
while(cur_view)
{
- if (!cur_view->getVisible())
+ if(!predicate(cur_view))
{
- return FALSE;
+ return false;
}
cur_view = cur_view->getParent();
}
- return TRUE;
+ return true;
+}
+
+BOOL LLView::isInVisibleChain() const
+{
+ return trueToRoot(&LLView::getVisible);
}
BOOL LLView::isInEnabledChain() const
{
- const LLView* cur_view = this;
- while(cur_view)
- {
- if (!cur_view->getEnabled())
- {
- return FALSE;
- }
- cur_view = cur_view->getParent();
- }
- return TRUE;
+ return trueToRoot(&LLView::getEnabled);
}
// virtual
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 5f6341daa6..9138b04258 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -321,6 +321,7 @@ public:
S32 getDefaultTabGroup() const { return mDefaultTabGroup; }
S32 getLastTabGroup() { return mLastTabGroup; }
+ bool trueToRoot(const boost::function<bool (const LLView*)>& predicate) const;
BOOL isInVisibleChain() const;
BOOL isInEnabledChain() const;