summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Nelson <none@none>2010-03-02 14:21:58 -0800
committerRichard Nelson <none@none>2010-03-02 14:21:58 -0800
commit41a30a59fb1b6dea2d531333d0429632f1fef2fe (patch)
tree3ffb4b300541511aeb94f83b491384cb29f5f584 /indra/llui
parenta16574b919b71a67f84ac075ed2c2b717d112d31 (diff)
initial work changing topctrl to popup layer
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp7
-rw-r--r--indra/llui/llfloater.cpp15
-rw-r--r--indra/llui/llfocusmgr.cpp47
-rw-r--r--indra/llui/llfocusmgr.h8
-rw-r--r--indra/llui/llhandle.h7
-rw-r--r--indra/llui/llmodaldialog.cpp6
-rw-r--r--indra/llui/llui.cpp29
-rw-r--r--indra/llui/llui.h10
-rw-r--r--indra/llui/llview.cpp5
9 files changed, 58 insertions, 76 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 9d23daf56d..de3bf719ee 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -615,7 +615,7 @@ void LLComboBox::showList()
// register ourselves as a "top" control
// effectively putting us into a special draw layer
// and not affecting the bounding rectangle calculation
- gFocusMgr.setTopCtrl(this);
+ LLUI::addPopup(this);
// Show the list and push the button down
mButton->setToggleState(TRUE);
@@ -644,10 +644,7 @@ void LLComboBox::hideList()
mList->mouseOverHighlightNthItem(-1);
setUseBoundingRect(FALSE);
- if( gFocusMgr.getTopCtrl() == this )
- {
- gFocusMgr.setTopCtrl(NULL);
- }
+ LLUI::removePopup(this);
}
}
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index b6d73cda3c..b93b72abf6 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -527,10 +527,7 @@ void LLFloater::setVisible( BOOL visible )
if( !visible )
{
- if( gFocusMgr.childIsTopCtrl( this ) )
- {
- gFocusMgr.setTopCtrl(NULL);
- }
+ LLUI::removePopup(this);
if( gFocusMgr.childHasMouseCapture( this ) )
{
@@ -704,10 +701,7 @@ void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent)
void LLFloater::releaseFocus()
{
- if( gFocusMgr.childIsTopCtrl( this ) )
- {
- gFocusMgr.setTopCtrl(NULL);
- }
+ LLUI::removePopup(this);
setFocus(FALSE);
@@ -2503,10 +2497,7 @@ void LLFloaterView::syncFloaterTabOrder()
if (modal_dialog)
{
// If we have a visible modal dialog, make sure that it has focus
- if( gFocusMgr.getTopCtrl() != modal_dialog )
- {
- gFocusMgr.setTopCtrl( modal_dialog );
- }
+ LLUI::addPopup(modal_dialog);
if( !gFocusMgr.childHasKeyboardFocus( modal_dialog ) )
{
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 35fbc7b0a8..ad2940e685 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -38,8 +38,6 @@
const F32 FOCUS_FADE_TIME = 0.3f;
-// NOTE: the LLFocusableElement implementation has been moved here from lluictrl.cpp.
-
LLFocusableElement::LLFocusableElement()
: mFocusLostCallback(NULL),
mFocusReceivedCallback(NULL),
@@ -124,8 +122,7 @@ boost::signals2::connection LLFocusableElement::setTopLostCallback(const focus_s
LLFocusMgr gFocusMgr;
LLFocusMgr::LLFocusMgr()
- :
- mLockedView( NULL ),
+: mLockedView( NULL ),
mMouseCaptor( NULL ),
mKeyboardFocus( NULL ),
mLastKeyboardFocus( NULL ),
@@ -133,16 +130,11 @@ LLFocusMgr::LLFocusMgr()
mKeystrokesOnly(FALSE),
mTopCtrl( NULL ),
mAppHasFocus(TRUE) // Macs don't seem to notify us that we've gotten focus, so default to true
- #ifdef _DEBUG
- , mMouseCaptorName("none")
- , mKeyboardFocusName("none")
- , mTopCtrlName("none")
- #endif
{
}
-void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
+void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
{
if( childHasMouseCapture( view ) )
{
@@ -162,10 +154,7 @@ void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
}
}
- if( childIsTopCtrl( view ) )
- {
- setTopCtrl( NULL );
- }
+ LLUI::removePopup(view);
}
@@ -248,11 +237,6 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL
return;
}
- #ifdef _DEBUG
- LLUICtrl* focus_ctrl = dynamic_cast<LLUICtrl*>(new_focus);
- mKeyboardFocusName = focus_ctrl ? focus_ctrl->getName() : std::string("none");
- #endif
-
// If we've got a default keyboard focus, and the caller is
// releasing keyboard focus, move to the default.
if (mDefaultKeyboardFocus != NULL && mKeyboardFocus == NULL)
@@ -334,20 +318,12 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f
if( mKeyboardFocus == focus )
{
mKeyboardFocus = NULL;
- #ifdef _DEBUG
- mKeyboardFocusName = std::string("none");
- #endif
}
}
void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
{
- //if (mFocusLocked)
- //{
- // return;
- //}
-
if( new_captor != mMouseCaptor )
{
LLMouseHandler* old_captor = mMouseCaptor;
@@ -370,24 +346,14 @@ void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
old_captor->onMouseCaptureLost();
}
- #ifdef _DEBUG
- mMouseCaptorName = new_captor ? new_captor->getName() : std::string("none");
- #endif
}
}
void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor )
{
- //if (mFocusLocked)
- //{
- // return;
- //}
if( mMouseCaptor == captor )
{
mMouseCaptor = NULL;
- #ifdef _DEBUG
- mMouseCaptorName = std::string("none");
- #endif
}
}
@@ -416,10 +382,6 @@ void LLFocusMgr::setTopCtrl( LLUICtrl* new_top )
{
mTopCtrl = new_top;
- #ifdef _DEBUG
- mTopCtrlName = new_top ? new_top->getName() : std::string("none");
- #endif
-
if (old_top)
{
old_top->onTopLost();
@@ -432,9 +394,6 @@ void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view )
if( mTopCtrl == top_view )
{
mTopCtrl = NULL;
- #ifdef _DEBUG
- mTopCtrlName = std::string("none");
- #endif
}
}
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index 83ecd1d301..5b08c628d4 100644
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -119,7 +119,7 @@ public:
BOOL childIsTopCtrl( const LLView* parent ) const;
// All Three
- void releaseFocusIfNeeded( const LLView* top_view );
+ void releaseFocusIfNeeded( LLView* top_view );
void lockFocus();
void unlockFocus();
BOOL focusLocked() const { return mLockedView != NULL; }
@@ -149,12 +149,6 @@ private:
typedef std::map<LLHandle<LLView>, LLHandle<LLView> > focus_history_map_t;
focus_history_map_t mFocusHistory;
-
- #ifdef _DEBUG
- std::string mMouseCaptorName;
- std::string mKeyboardFocusName;
- std::string mTopCtrlName;
- #endif
};
extern LLFocusMgr gFocusMgr;
diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h
index 899f6b9326..8ade327044 100644
--- a/indra/llui/llhandle.h
+++ b/indra/llui/llhandle.h
@@ -67,6 +67,13 @@ public:
return *this;
}
+ template<typename Subclass>
+ LLHandle<T>& operator =(const LLHandle<Subclass>& other)
+ {
+ mTombStone = other.mTombStone;
+ return *this;
+ }
+
bool isDead() const
{
return mTombStone->getTarget() == NULL;
diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp
index 387af05935..6cff68c20b 100644
--- a/indra/llui/llmodaldialog.cpp
+++ b/indra/llui/llmodaldialog.cpp
@@ -111,7 +111,7 @@ void LLModalDialog::onOpen(const LLSD& key)
// This is a modal dialog. It sucks up all mouse and keyboard operations.
gFocusMgr.setMouseCapture( this );
- gFocusMgr.setTopCtrl( this );
+ LLUI::addPopup(this);
setFocus(TRUE);
sModalStack.push_front( this );
@@ -153,7 +153,7 @@ void LLModalDialog::setVisible( BOOL visible )
gFocusMgr.setMouseCapture( this );
// The dialog view is a root view
- gFocusMgr.setTopCtrl( this );
+ LLUI::addPopup(this);
setFocus( TRUE );
}
else
@@ -291,7 +291,7 @@ void LLModalDialog::onAppFocusGained()
// This is a modal dialog. It sucks up all mouse and keyboard operations.
gFocusMgr.setMouseCapture( instance );
instance->setFocus(TRUE);
- gFocusMgr.setTopCtrl( instance );
+ LLUI::addPopup(instance);
instance->centerOnScreen();
}
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index b348ec2d29..64df1dbc7a 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -86,6 +86,9 @@ std::list<std::string> gUntranslated;
/*static*/ LLHelp* LLUI::sHelpImpl = NULL;
/*static*/ std::vector<std::string> LLUI::sXUIPaths;
/*static*/ LLFrameTimer LLUI::sMouseIdleTimer;
+/*static*/ LLUI::add_popup_t LLUI::sAddPopupFunc;
+/*static*/ LLUI::remove_popup_t LLUI::sRemovePopupFunc;
+/*static*/ LLUI::clear_popups_t LLUI::sClearPopupsFunc;
// register filtereditor here
static LLDefaultChildRegistry::Register<LLFilterEditor> register_filter_editor("filter_editor");
@@ -1607,6 +1610,13 @@ void LLUI::cleanupClass()
sImageProvider->cleanUp();
}
+void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups)
+{
+ sAddPopupFunc = add_popup;
+ sRemovePopupFunc = remove_popup;
+ sClearPopupsFunc = clear_popups;
+}
+
//static
void LLUI::dirtyRect(LLRect rect)
{
@@ -1877,6 +1887,25 @@ LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname)
return *sSettingGroups["config"]; // default group
}
+//static
+void LLUI::addPopup(LLView* viewp)
+{
+ if (sAddPopupFunc)
+ {
+ sAddPopupFunc(viewp);
+ }
+}
+
+//static
+void LLUI::removePopup(LLView* viewp)
+{
+ if (sRemovePopupFunc)
+ {
+ sRemovePopupFunc(viewp);
+ }
+}
+
+
//static
// spawn_x and spawn_y are top left corner of view in screen GL coordinates
void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index af8d4ea03b..824d76f526 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -160,12 +160,17 @@ public:
// Methods
//
typedef std::map<std::string, LLControlGroup*> settings_map_t;
+ typedef boost::function<void(LLView*)> add_popup_t;
+ typedef boost::function<void(LLView*)> remove_popup_t;
+ typedef boost::function<void(void)> clear_popups_t;
+
static void initClass(const settings_map_t& settings,
LLImageProviderInterface* image_provider,
LLUIAudioCallback audio_callback = NULL,
const LLVector2 *scale_factor = NULL,
const std::string& language = LLStringUtil::null);
static void cleanupClass();
+ static void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& );
static void pushMatrix();
static void popMatrix();
@@ -207,6 +212,8 @@ 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*);
// Ensures view does not overlap mouse cursor, but is inside
// the view's parent rectangle. Used for tooltips, inspectors.
@@ -227,6 +234,9 @@ private:
static LLImageProviderInterface* sImageProvider;
static std::vector<std::string> sXUIPaths;
static LLFrameTimer sMouseIdleTimer;
+ static add_popup_t sAddPopupFunc;
+ static remove_popup_t sRemovePopupFunc;
+ static clear_popups_t sClearPopupsFunc;
};
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 63e627ceb5..db2c460eec 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -592,11 +592,6 @@ void LLView::setVisible(BOOL visible)
{
if ( mVisible != visible )
{
- if( !visible && (gFocusMgr.getTopCtrl() == this) )
- {
- gFocusMgr.setTopCtrl( NULL );
- }
-
mVisible = visible;
// notify children of visibility change if root, or part of visible hierarchy