diff options
Diffstat (limited to 'linden/indra/llui/llview.cpp')
-rw-r--r-- | linden/indra/llui/llview.cpp | 98 |
1 files changed, 93 insertions, 5 deletions
diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index 9cdf481..e3652b7 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp | |||
@@ -85,7 +85,8 @@ LLView::LLView() : | |||
85 | mLastVisible(TRUE), | 85 | mLastVisible(TRUE), |
86 | mUseBoundingRect(FALSE), | 86 | mUseBoundingRect(FALSE), |
87 | mVisible(TRUE), | 87 | mVisible(TRUE), |
88 | mNextInsertionOrdinal(0) | 88 | mNextInsertionOrdinal(0), |
89 | mHoverCursor(UI_CURSOR_ARROW) | ||
89 | { | 90 | { |
90 | } | 91 | } |
91 | 92 | ||
@@ -102,7 +103,8 @@ LLView::LLView(const std::string& name, BOOL mouse_opaque) : | |||
102 | mLastVisible(TRUE), | 103 | mLastVisible(TRUE), |
103 | mUseBoundingRect(FALSE), | 104 | mUseBoundingRect(FALSE), |
104 | mVisible(TRUE), | 105 | mVisible(TRUE), |
105 | mNextInsertionOrdinal(0) | 106 | mNextInsertionOrdinal(0), |
107 | mHoverCursor(UI_CURSOR_ARROW) | ||
106 | { | 108 | { |
107 | } | 109 | } |
108 | 110 | ||
@@ -123,7 +125,8 @@ LLView::LLView( | |||
123 | mLastVisible(TRUE), | 125 | mLastVisible(TRUE), |
124 | mUseBoundingRect(FALSE), | 126 | mUseBoundingRect(FALSE), |
125 | mVisible(TRUE), | 127 | mVisible(TRUE), |
126 | mNextInsertionOrdinal(0) | 128 | mNextInsertionOrdinal(0), |
129 | mHoverCursor(UI_CURSOR_ARROW) | ||
127 | { | 130 | { |
128 | } | 131 | } |
129 | 132 | ||
@@ -657,7 +660,7 @@ BOOL LLView::handleHover(S32 x, S32 y, MASK mask) | |||
657 | if( !handled | 660 | if( !handled |
658 | && blockMouseEvent(x, y) ) | 661 | && blockMouseEvent(x, y) ) |
659 | { | 662 | { |
660 | LLUI::sWindow->setCursor(UI_CURSOR_ARROW); | 663 | LLUI::sWindow->setCursor(mHoverCursor); |
661 | lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; | 664 | lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; |
662 | handled = TRUE; | 665 | handled = TRUE; |
663 | } | 666 | } |
@@ -981,6 +984,30 @@ BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) | |||
981 | } | 984 | } |
982 | return handled; | 985 | return handled; |
983 | } | 986 | } |
987 | |||
988 | BOOL LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) | ||
989 | { | ||
990 | LLView* handled_view = childrenHandleMiddleMouseDown( x, y, mask ); | ||
991 | BOOL handled = (handled_view != NULL); | ||
992 | if( !handled && blockMouseEvent(x, y) ) | ||
993 | { | ||
994 | handled = TRUE; | ||
995 | handled_view = this; | ||
996 | } | ||
997 | |||
998 | return handled; | ||
999 | } | ||
1000 | |||
1001 | BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) | ||
1002 | { | ||
1003 | BOOL handled = childrenHandleMiddleMouseUp( x, y, mask ) != NULL; | ||
1004 | if( !handled && blockMouseEvent(x, y) ) | ||
1005 | { | ||
1006 | handled = TRUE; | ||
1007 | } | ||
1008 | return handled; | ||
1009 | } | ||
1010 | |||
984 | 1011 | ||
985 | LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) | 1012 | LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) |
986 | { | 1013 | { |
@@ -1142,6 +1169,34 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) | |||
1142 | return handled_view; | 1169 | return handled_view; |
1143 | } | 1170 | } |
1144 | 1171 | ||
1172 | LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask) | ||
1173 | { | ||
1174 | LLView* handled_view = NULL; | ||
1175 | |||
1176 | if (getVisible() && getEnabled() ) | ||
1177 | { | ||
1178 | for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) | ||
1179 | { | ||
1180 | LLView* viewp = *child_it; | ||
1181 | S32 local_x = x - viewp->getRect().mLeft; | ||
1182 | S32 local_y = y - viewp->getRect().mBottom; | ||
1183 | if (viewp->pointInView(local_x, local_y) && | ||
1184 | viewp->getVisible() && | ||
1185 | viewp->getEnabled() && | ||
1186 | viewp->handleMiddleMouseDown( local_x, local_y, mask )) | ||
1187 | { | ||
1188 | if (sDebugMouseHandling) | ||
1189 | { | ||
1190 | sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; | ||
1191 | } | ||
1192 | handled_view = viewp; | ||
1193 | break; | ||
1194 | } | ||
1195 | } | ||
1196 | } | ||
1197 | return handled_view; | ||
1198 | } | ||
1199 | |||
1145 | LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) | 1200 | LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) |
1146 | { | 1201 | { |
1147 | LLView* handled_view = NULL; | 1202 | LLView* handled_view = NULL; |
@@ -1227,6 +1282,32 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) | |||
1227 | return handled_view; | 1282 | return handled_view; |
1228 | } | 1283 | } |
1229 | 1284 | ||
1285 | LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) | ||
1286 | { | ||
1287 | LLView* handled_view = NULL; | ||
1288 | if( getVisible() && getEnabled() ) | ||
1289 | { | ||
1290 | for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) | ||
1291 | { | ||
1292 | LLView* viewp = *child_it; | ||
1293 | S32 local_x = x - viewp->getRect().mLeft; | ||
1294 | S32 local_y = y - viewp->getRect().mBottom; | ||
1295 | if (viewp->pointInView(local_x, local_y) && | ||
1296 | viewp->getVisible() && | ||
1297 | viewp->getEnabled() && | ||
1298 | viewp->handleMiddleMouseUp( local_x, local_y, mask )) | ||
1299 | { | ||
1300 | if (sDebugMouseHandling) | ||
1301 | { | ||
1302 | sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; | ||
1303 | } | ||
1304 | handled_view = viewp; | ||
1305 | break; | ||
1306 | } | ||
1307 | } | ||
1308 | } | ||
1309 | return handled_view; | ||
1310 | } | ||
1230 | 1311 | ||
1231 | void LLView::draw() | 1312 | void LLView::draw() |
1232 | { | 1313 | { |
@@ -2544,7 +2625,14 @@ void LLView::initFromXML(LLXMLNodePtr node, LLView* parent) | |||
2544 | node->getAttributeBOOL("visible", visible); | 2625 | node->getAttributeBOOL("visible", visible); |
2545 | setVisible(visible); | 2626 | setVisible(visible); |
2546 | } | 2627 | } |
2547 | 2628 | ||
2629 | if (node->hasAttribute("hover_cursor")) | ||
2630 | { | ||
2631 | std::string cursor_string; | ||
2632 | node->getAttributeString("hover_cursor", cursor_string); | ||
2633 | mHoverCursor = getCursorFromString(cursor_string); | ||
2634 | } | ||
2635 | |||
2548 | node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect); | 2636 | node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect); |
2549 | node->getAttributeBOOL("mouse_opaque", mMouseOpaque); | 2637 | node->getAttributeBOOL("mouse_opaque", mMouseOpaque); |
2550 | 2638 | ||