diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/llui/lllineeditor.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/llui/lllineeditor.cpp')
-rw-r--r-- | linden/indra/llui/lllineeditor.cpp | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 1ca17fe..ec156ba 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | 5 | * Copyright (c) 2001-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -115,7 +116,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, | |||
115 | S32 max_length_bytes, | 116 | S32 max_length_bytes, |
116 | void (*commit_callback)(LLUICtrl* caller, void* user_data ), | 117 | void (*commit_callback)(LLUICtrl* caller, void* user_data ), |
117 | void (*keystroke_callback)(LLLineEditor* caller, void* user_data ), | 118 | void (*keystroke_callback)(LLLineEditor* caller, void* user_data ), |
118 | void (*focus_lost_callback)(LLLineEditor* caller, void* user_data ), | 119 | void (*focus_lost_callback)(LLUICtrl* caller, void* user_data ), |
119 | void* userdata, | 120 | void* userdata, |
120 | LLLinePrevalidateFunc prevalidate_func, | 121 | LLLinePrevalidateFunc prevalidate_func, |
121 | LLViewBorder::EBevel border_bevel, | 122 | LLViewBorder::EBevel border_bevel, |
@@ -132,7 +133,6 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, | |||
132 | mCommitOnFocusLost( TRUE ), | 133 | mCommitOnFocusLost( TRUE ), |
133 | mRevertOnEsc( TRUE ), | 134 | mRevertOnEsc( TRUE ), |
134 | mKeystrokeCallback( keystroke_callback ), | 135 | mKeystrokeCallback( keystroke_callback ), |
135 | mFocusLostCallback( focus_lost_callback ), | ||
136 | mIsSelecting( FALSE ), | 136 | mIsSelecting( FALSE ), |
137 | mSelectionStart( 0 ), | 137 | mSelectionStart( 0 ), |
138 | mSelectionEnd( 0 ), | 138 | mSelectionEnd( 0 ), |
@@ -166,6 +166,8 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, | |||
166 | mGLFont = LLFontGL::sSansSerifSmall; | 166 | mGLFont = LLFontGL::sSansSerifSmall; |
167 | } | 167 | } |
168 | 168 | ||
169 | setFocusLostCallback(focus_lost_callback); | ||
170 | |||
169 | mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft; | 171 | mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft; |
170 | mMaxHPixels = mRect.getWidth() - mMinHPixels - mBorderThickness - mBorderRight; | 172 | mMaxHPixels = mRect.getWidth() - mMinHPixels - mBorderThickness - mBorderRight; |
171 | 173 | ||
@@ -186,7 +188,6 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect, | |||
186 | 188 | ||
187 | LLLineEditor::~LLLineEditor() | 189 | LLLineEditor::~LLLineEditor() |
188 | { | 190 | { |
189 | mFocusLostCallback = NULL; | ||
190 | mCommitOnFocusLost = FALSE; | 191 | mCommitOnFocusLost = FALSE; |
191 | 192 | ||
192 | gFocusMgr.releaseFocusIfNeeded( this ); | 193 | gFocusMgr.releaseFocusIfNeeded( this ); |
@@ -211,11 +212,8 @@ LLString LLLineEditor::getWidgetTag() const | |||
211 | 212 | ||
212 | void LLLineEditor::onFocusLost() | 213 | void LLLineEditor::onFocusLost() |
213 | { | 214 | { |
214 | if( mFocusLostCallback ) | 215 | LLUICtrl::onFocusLost(); |
215 | { | 216 | |
216 | mFocusLostCallback( this, mCallbackUserData ); | ||
217 | } | ||
218 | |||
219 | if( mCommitOnFocusLost && mText.getString() != mPrevText) | 217 | if( mCommitOnFocusLost && mText.getString() != mPrevText) |
220 | { | 218 | { |
221 | onCommit(); | 219 | onCommit(); |
@@ -502,7 +500,7 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) | |||
502 | startSelection(); | 500 | startSelection(); |
503 | } | 501 | } |
504 | 502 | ||
505 | gFocusMgr.setMouseCapture( this, &LLLineEditor::onMouseCaptureLost ); | 503 | gFocusMgr.setMouseCapture( this ); |
506 | } | 504 | } |
507 | 505 | ||
508 | // delay cursor flashing | 506 | // delay cursor flashing |
@@ -515,14 +513,14 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) | |||
515 | BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) | 513 | BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) |
516 | { | 514 | { |
517 | BOOL handled = FALSE; | 515 | BOOL handled = FALSE; |
518 | if (gFocusMgr.getMouseCapture() != this && (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight))) | 516 | if (!hasMouseCapture() && (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight))) |
519 | { | 517 | { |
520 | return LLUICtrl::handleHover(x, y, mask); | 518 | return LLUICtrl::handleHover(x, y, mask); |
521 | } | 519 | } |
522 | 520 | ||
523 | if( getVisible() ) | 521 | if( getVisible() ) |
524 | { | 522 | { |
525 | if( (gFocusMgr.getMouseCapture() == this) && mIsSelecting ) | 523 | if( (hasMouseCapture()) && mIsSelecting ) |
526 | { | 524 | { |
527 | if (x != mLastSelectionX || y != mLastSelectionY) | 525 | if (x != mLastSelectionX || y != mLastSelectionY) |
528 | { | 526 | { |
@@ -580,9 +578,9 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) | |||
580 | { | 578 | { |
581 | BOOL handled = FALSE; | 579 | BOOL handled = FALSE; |
582 | 580 | ||
583 | if( gFocusMgr.getMouseCapture() == this ) | 581 | if( hasMouseCapture() ) |
584 | { | 582 | { |
585 | gFocusMgr.setMouseCapture( NULL, NULL ); | 583 | gFocusMgr.setMouseCapture( NULL ); |
586 | handled = TRUE; | 584 | handled = TRUE; |
587 | } | 585 | } |
588 | 586 | ||
@@ -1916,11 +1914,9 @@ BOOL LLLineEditor::prevalidateASCII(const LLWString &str) | |||
1916 | return rv; | 1914 | return rv; |
1917 | } | 1915 | } |
1918 | 1916 | ||
1919 | //static | 1917 | void LLLineEditor::onMouseCaptureLost() |
1920 | void LLLineEditor::onMouseCaptureLost( LLMouseHandler* old_captor ) | ||
1921 | { | 1918 | { |
1922 | LLLineEditor* self = (LLLineEditor*) old_captor; | 1919 | endSelection(); |
1923 | self->endSelection(); | ||
1924 | } | 1920 | } |
1925 | 1921 | ||
1926 | 1922 | ||
@@ -1935,11 +1931,6 @@ void LLLineEditor::setKeystrokeCallback(void (*keystroke_callback)(LLLineEditor* | |||
1935 | mKeystrokeCallback = keystroke_callback; | 1931 | mKeystrokeCallback = keystroke_callback; |
1936 | } | 1932 | } |
1937 | 1933 | ||
1938 | void LLLineEditor::setFocusLostCallback(void (*keystroke_callback)(LLLineEditor* caller, void* user_data)) | ||
1939 | { | ||
1940 | mFocusLostCallback = keystroke_callback; | ||
1941 | } | ||
1942 | |||
1943 | // virtual | 1934 | // virtual |
1944 | LLXMLNodePtr LLLineEditor::getXML(bool save_children) const | 1935 | LLXMLNodePtr LLLineEditor::getXML(bool save_children) const |
1945 | { | 1936 | { |