summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2010-03-03 19:37:41 -0800
committerRichard Linden <none@none>2010-03-03 19:37:41 -0800
commit69f9c0bcf9764a1b682bfdd5baa3f340922dcbaa (patch)
tree0add9cfef233a0b93bb2f0d85b57cc41d8f1deb4 /indra/llui
parentc3c04adaa56c895018e1d2dd32b94469aaf44347 (diff)
WIP - replace top ctrl with LLPopupView
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp14
-rw-r--r--indra/llui/llcombobox.h1
-rw-r--r--indra/llui/llfloater.cpp2
-rw-r--r--indra/llui/llfocusmgr.cpp4
-rw-r--r--indra/llui/llfocusmgr.h2
-rw-r--r--indra/llui/llui.cpp9
-rw-r--r--indra/llui/llui.h2
7 files changed, 24 insertions, 10 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index de3bf719ee..c679717807 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -160,7 +160,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
createLineEditor(p);
- setTopLostCallback(boost::bind(&LLComboBox::hideList, this));
+ mTopLostSignalConnection = setTopLostCallback(boost::bind(&LLComboBox::hideList, this));
}
void LLComboBox::initFromParams(const LLComboBox::Params& p)
@@ -187,6 +187,9 @@ BOOL LLComboBox::postBuild()
LLComboBox::~LLComboBox()
{
// children automatically deleted, including mMenu, mButton
+
+ // explicitly disconect this signal, since base class destructor might fire top lost
+ mTopLostSignalConnection.disconnect();
}
@@ -612,16 +615,14 @@ void LLComboBox::showList()
mList->setFocus(TRUE);
- // register ourselves as a "top" control
- // effectively putting us into a special draw layer
- // and not affecting the bounding rectangle calculation
- LLUI::addPopup(this);
-
// Show the list and push the button down
mButton->setToggleState(TRUE);
mList->setVisible(TRUE);
+ LLUI::addPopup(this);
+
setUseBoundingRect(TRUE);
+ updateBoundingRect();
}
void LLComboBox::hideList()
@@ -645,6 +646,7 @@ void LLComboBox::hideList()
setUseBoundingRect(FALSE);
LLUI::removePopup(this);
+ updateBoundingRect();
}
}
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 4f27588467..aa1e708bec 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -231,5 +231,6 @@ private:
commit_callback_t mTextEntryCallback;
commit_callback_t mSelectionCallback;
S32 mLastSelectedIndex;
+ boost::signals2::connection mTopLostSignalConnection;
};
#endif
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index b93b72abf6..c45be34d43 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1354,7 +1354,7 @@ void LLFloater::bringToFront( S32 x, S32 y )
// virtual
void LLFloater::setVisibleAndFrontmost(BOOL take_focus)
{
- gFocusMgr.setTopCtrl(NULL);
+ LLUI::clearPopups();
setVisible(TRUE);
setFrontmost(take_focus);
}
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index ad2940e685..b3af258456 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -437,9 +437,9 @@ void LLFocusMgr::setAppHasFocus(BOOL focus)
}
// release focus from "top ctrl"s, which generally hides them
- if (!focus && mTopCtrl)
+ if (!focus)
{
- setTopCtrl(NULL);
+ LLUI::clearPopups();
}
mAppHasFocus = focus;
}
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index 5b08c628d4..86d3ccf111 100644
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -65,10 +65,10 @@ public:
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
+ virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
protected:
virtual void onFocusReceived();
virtual void onFocusLost();
- virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
focus_signal_t* mFocusLostCallback;
focus_signal_t* mFocusReceivedCallback;
focus_signal_t* mFocusChangedCallback;
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 64df1dbc7a..5121ef5351 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1905,6 +1905,15 @@ void LLUI::removePopup(LLView* viewp)
}
}
+//static
+void LLUI::clearPopups()
+{
+ if (sClearPopupsFunc)
+ {
+ sClearPopupsFunc();
+ }
+}
+
//static
// spawn_x and spawn_y are top left corner of view in screen GL coordinates
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 824d76f526..30f3623ded 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -212,8 +212,10 @@ public:
static F32 getMouseIdleTime() { return sMouseIdleTimer.getElapsedTimeF32(); }
static void resetMouseIdleTimer() { sMouseIdleTimer.reset(); }
static LLWindow* getWindow() { return sWindow; }
+
static void addPopup(LLView*);
static void removePopup(LLView*);
+ static void clearPopups();
// Ensures view does not overlap mouse cursor, but is inside
// the view's parent rectangle. Used for tooltips, inspectors.