summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp14
-rw-r--r--indra/llui/llbutton.h4
-rw-r--r--indra/llui/llcheckboxctrl.cpp12
-rw-r--r--indra/llui/llcheckboxctrl.h2
-rw-r--r--indra/llui/lllineeditor.h1
-rw-r--r--indra/llui/lluictrl.h3
6 files changed, 34 insertions, 2 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index d28cf96fa0..d93748d069 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -69,7 +69,8 @@ LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& co
mCurGlowStrength(0.f),
mNeedsHighlight(FALSE),
mCommitOnReturn(TRUE),
- mImagep( NULL )
+ mImagep( NULL ),
+ mIsDirty( FALSE )
{
mUnselectedLabel = name;
mSelectedLabel = name;
@@ -251,8 +252,12 @@ void LLButton::onCommit()
{
(*mClickedCallback)( mCallbackUserData );
}
+
+ mIsDirty = TRUE;
}
+
+
BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
{
BOOL handled = FALSE;
@@ -262,7 +267,8 @@ BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
{
(*mClickedCallback)( mCallbackUserData );
}
- handled = TRUE;
+ handled = TRUE;
+ mIsDirty = TRUE;
}
return handled;
}
@@ -279,6 +285,7 @@ BOOL LLButton::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
(*mClickedCallback)( mCallbackUserData );
}
handled = TRUE;
+ mIsDirty = TRUE;
}
}
return handled;
@@ -339,6 +346,8 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask)
{
(*mClickedCallback)( mCallbackUserData );
}
+
+ mIsDirty = TRUE;
}
mMouseDownTimer.stop();
@@ -741,6 +750,7 @@ void LLButton::setToggleState(BOOL b)
void LLButton::setValue(const LLSD& value )
{
mToggleState = value.asBoolean();
+ mIsDirty = FALSE;
}
LLSD LLButton::getValue() const
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 470c34fb64..ba77220a7b 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -80,6 +80,8 @@ public:
// HACK: "committing" a button is the same as clicking on it.
virtual void onCommit();
+ virtual BOOL isDirty() { return mIsDirty; }; // Returns TRUE if the user has clicked on the button at all
+
void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; }
void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; }
@@ -256,6 +258,8 @@ protected:
LLPointer<LLImageGL> mImagep;
+ BOOL mIsDirty;
+
static LLFrameTimer sFlashingTimer;
};
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 215f6d40ed..6c181acc94 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -247,6 +247,18 @@ void LLCheckBoxCtrl::setControlName(const LLString& control_name, LLView* contex
mButton->setControlName(control_name, context);
}
+
+// virtual Returns TRUE if the user has modified this control.
+BOOL LLCheckBoxCtrl::isDirty()
+{
+ if ( mButton )
+ {
+ return mButton->isDirty();
+ }
+ return FALSE; // Shouldn't get here
+}
+
+
// virtual
LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const
{
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index b2f9c95974..76b197125d 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -90,6 +90,8 @@ public:
static void onButtonPress(void *userdata);
+ virtual BOOL isDirty(); // Returns TRUE if the user has modified this control.
+
protected:
// note: value is stored in toggle state of button
LLButton* mButton;
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index b3eff3c8e2..110e40b92d 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -107,6 +107,7 @@ public:
virtual void setRect(const LLRect& rect);
virtual BOOL acceptsTextInput() const;
virtual void onCommit();
+ virtual BOOL isDirty() { return ( mText.getString() != mPrevText ); }; // Returns TRUE if the user has changed value at all
// assumes UTF8 text
virtual void setValue(const LLSD& value );
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index f07cbec328..7b96ec5655 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -128,6 +128,9 @@ public:
}
};
+ // Returns TRUE if the user has modified this control. Editable controls should override this.
+ virtual BOOL isDirty() { return FALSE; };
+
protected:
virtual void onFocusReceived();
virtual void onFocusLost();