summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp31
-rw-r--r--indra/llui/llfloater.h3
-rw-r--r--indra/llui/llpanel.cpp22
-rw-r--r--indra/llui/llpanel.h10
4 files changed, 57 insertions, 9 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 09e27a264a..28dfda8faf 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -704,9 +704,15 @@ void LLFloater::openFloater(const LLSD& key)
dirtyRect();
}
+void LLFloater::verifyClose()
+{
+ LLPanel::handleCloseConfirmation();
+}
+
void LLFloater::closeFloater(bool app_quitting)
{
llinfos << "Closing floater " << getName() << llendl;
+
if (app_quitting)
{
LLFloater::sQuitting = true;
@@ -781,7 +787,7 @@ void LLFloater::closeFloater(bool app_quitting)
dirtyRect();
// Close callbacks
- onClose(app_quitting);
+ onClose(app_quitting);
mCloseSignal(this, LLSD(app_quitting));
// Hide or Destroy
@@ -1788,11 +1794,19 @@ void LLFloater::initRectControl()
void LLFloater::closeFrontmostFloater()
{
LLFloater* floater_to_close = gFloaterView->getFrontmostClosableFloater();
- if(floater_to_close)
+ if( floater_to_close )
{
- floater_to_close->closeFloater();
+ if ( floater_to_close->mVerifyUponClose )
+ {
+ floater_to_close->verifyClose();
+ //Closing of the window handle in the subclass - so bug out here.
+ return;
+ }
+ else
+ {
+ floater_to_close->closeFloater();
+ }
}
-
// if nothing took focus after closing focused floater
// give it to next floater (to allow closing multiple windows via keyboard in rapid succession)
if (gFocusMgr.getKeyboardFocus() == NULL)
@@ -2631,7 +2645,14 @@ void LLFloaterView::closeAllChildren(bool app_quitting)
if (floaterp->canClose() && !floaterp->isDead() &&
(app_quitting || floaterp->getVisible()))
{
- floaterp->closeFloater(app_quitting);
+ if ( floaterp->mVerifyUponClose )
+ {
+ floaterp->verifyClose();
+ }
+ else
+ {
+ floaterp->closeFloater(app_quitting);
+ }
}
}
}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 4dba1e645f..bf71b527b3 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -225,6 +225,7 @@ public:
// If allowed, close the floater cleanly, releasing focus.
virtual void closeFloater(bool app_quitting = false);
+ virtual void verifyClose();
// Close the floater or its host. Use when hidding or toggling a floater instance.
virtual void closeHostedFloater();
@@ -303,7 +304,7 @@ public:
/*virtual*/ void setVisible(BOOL visible); // do not override
/*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override
-
+ void handleCloseConfirmation( );
void setFrontmost(BOOL take_focus = TRUE);
virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 67472ad166..01165a5718 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -114,7 +114,9 @@ LLPanel::LLPanel(const LLPanel::Params& p)
mCommitCallbackRegistrar(false),
mEnableCallbackRegistrar(false),
mXMLFilename(p.filename),
- mVisibleSignal(NULL)
+ mVisibleSignal(NULL),
+ mCloseConfirmationSignal(NULL),
+ mVerifyUponClose(false)
// *NOTE: Be sure to also change LLPanel::initFromParams(). We have too
// many classes derived from LLPanel to retrofit them all to pass in params.
{
@@ -127,6 +129,7 @@ LLPanel::LLPanel(const LLPanel::Params& p)
LLPanel::~LLPanel()
{
delete mVisibleSignal;
+ delete mCloseConfirmationSignal;
}
// virtual
@@ -349,6 +352,14 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility )
(*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
}
+
+void LLPanel::handleCloseConfirmation( )
+{
+ if (mCloseConfirmationSignal)
+ {
+ (*mCloseConfirmationSignal)(this, LLSD() );
+ }
+}
void LLPanel::setFocus(BOOL b)
{
if( b && !hasFocus())
@@ -959,10 +970,17 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::
{
mVisibleSignal = new commit_signal_t();
}
-
return mVisibleSignal->connect(cb);
}
+boost::signals2::connection LLPanel::setCloseConfirmationCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mCloseConfirmationSignal)
+ {
+ mCloseConfirmationSignal = new commit_signal_t();
+ }
+ return mCloseConfirmationSignal->connect(cb);
+}
static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels");
//-----------------------------------------------------------------------------
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index e63b41f97c..1b0beaa5c8 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -116,6 +116,8 @@ public:
/*virtual*/ void draw();
/*virtual*/ BOOL handleKeyHere( KEY key, MASK mask );
/*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
+ void handleCloseConfirmation( );
+
// From LLFocusableElement
/*virtual*/ void setFocus( BOOL b );
@@ -251,6 +253,10 @@ public:
std::string getXMLFilename() { return mXMLFilename; };
boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setCloseConfirmationCallback( const commit_signal_t::slot_type& cb );
+
+public:
+ const BOOL confirmClose() const { return mVerifyUponClose; }
protected:
// Override to set not found list
@@ -260,6 +266,7 @@ protected:
EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar;
commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
+ commit_signal_t* mCloseConfirmationSignal;
std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer
typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t;
@@ -267,7 +274,8 @@ protected:
// for setting the xml filename when building panel in context dependent cases
std::string mXMLFilename;
-
+ //Specific close-down logic in subclass
+ BOOL mVerifyUponClose;
private:
BOOL mBgVisible; // any background at all?
BOOL mBgOpaque; // use opaque color or image