// virtual BOOL LLTabContainer::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect ) { BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect ); if (!handled && getTabCount() > 0) { LLTabTuple* firsttuple = getTab(0); BOOL has_scroll_arrows = (getMaxScrollPos() > 0); LLRect clip; if (mIsVertical) { clip = LLRect(firsttuple->mButton->getRect().mLeft, has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - TABCNTRV_PAD : mPrevArrowBtn->getRect().mTop, firsttuple->mButton->getRect().mRight, has_scroll_arrows ? mNextArrowBtn->getRect().mTop + TABCNTRV_PAD : mNextArrowBtn->getRect().mBottom ); } else { clip = LLRect(has_scroll_arrows ? mPrevArrowBtn->getRect().mRight : mJumpPrevArrowBtn->getRect().mLeft, firsttuple->mButton->getRect().mTop, has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight, firsttuple->mButton->getRect().mBottom ); } if( clip.pointInRect( x, y ) ) { for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; tuple->mButton->setVisible( TRUE ); S32 local_x = x - tuple->mButton->getRect().mLeft; S32 local_y = y - tuple->mButton->getRect().mBottom; handled = tuple->mButton->handleToolTip( local_x, local_y, msg, sticky_rect ); if( handled ) { break; } } } for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; tuple->mButton->setVisible( FALSE ); } } return handled; }
BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (!isMinimized() && isFrontmost()) { LLRect area; childGetRect("search_results", area); if(!area.pointInRect(x, y)) { F32 slider_value = (F32)childGetValue("zoom slider").asReal(); slider_value += ((F32)clicks * -0.3333f); childSetValue("zoom slider", LLSD(slider_value)); return TRUE; } } return LLFloater::handleScrollWheel(x, y, clicks); }
bool LLTransientFloaterMgr::isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y) { std::list< LLHandle<LLView> > dead_handles; bool res = true; for (controls_set_t::iterator it = set.begin(); it != set.end(); it++) { LLView* control_view = NULL; LLHandle<LLView> handle = *it; if (handle.isDead()) { dead_handles.push_back(handle); continue; } control_view = handle.get(); if (!control_view->getVisible()) { continue; } LLRect rect = control_view->calcScreenRect(); // if click inside view rect if (rect.pointInRect(x, y)) { res = false; break; } } for (std::list< LLHandle<LLView> >::iterator it = dead_handles.begin(); it != dead_handles.end(); ++it) { LLHandle<LLView> handle = *it; mGroupControls.find(group)->second.erase(handle); } return res; }
bool LLTransientFloaterMgr::isControlClicked(std::set<LLView*>& set, S32 x, S32 y) { bool res = true; for (controls_set_t::iterator it = set.begin(); it != set.end(); it++) { LLView* control_view = *it; if (!control_view->getVisible()) { continue; } LLRect rect = control_view->calcScreenRect(); // if click inside view rect if (rect.pointInRect(x, y)) { res = false; break; } } return res; }
////////////////////////////////////////////////////////////////////////////// // reverts state once mouse button is released BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask ) { getWindow()->setCursor ( UI_CURSOR_ARROW ); if (getMouseDownInHueRegion() || getMouseDownInLumRegion()) { if (mApplyImmediateCheck->get()) { LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); } } // rect containing palette area LLRect paletteRect ( mPaletteRegionLeft, mPaletteRegionTop, mPaletteRegionLeft + mPaletteRegionWidth, mPaletteRegionTop - mPaletteRegionHeight ); if ( paletteRect.pointInRect ( x, y ) ) { if ( mMouseDownInSwatch ) { S32 curEntry = 0; for ( S32 row = 0; row < numPaletteRows; ++row ) { for ( S32 column = 0; column < numPaletteColumns; ++column ) { S32 left = mPaletteRegionLeft + ( mPaletteRegionWidth * column ) / numPaletteColumns; S32 top = mPaletteRegionTop - ( mPaletteRegionHeight * row ) / numPaletteRows; S32 right = ( mPaletteRegionLeft + ( mPaletteRegionWidth * ( column + 1 ) ) / numPaletteColumns ); S32 bottom = ( mPaletteRegionTop - ( mPaletteRegionHeight * ( row + 1 ) ) / numPaletteRows ); // rect is flipped vertically when testing here LLRect dropRect ( left, top, right, bottom ); if ( dropRect.pointInRect ( x, y ) ) { if ( mPalette [ curEntry ] ) { delete mPalette [ curEntry ]; mPalette [ curEntry ] = new LLColor4 ( getCurR (), getCurG (), getCurB (), 1.0f ); // save off color std::ostringstream codec; codec << "ColorPaletteEntry" << std::setfill ( '0' ) << std::setw ( 2 ) << curEntry + 1; const std::string s ( codec.str () ); LLUIColorTable::instance().setColor(s, *mPalette [ curEntry ] ); } } ++curEntry; } } } } // mouse button not down anymore setMouseDownInHueRegion ( FALSE ); setMouseDownInLumRegion ( FALSE ); // mouse button not down in color swatch anymore mMouseDownInSwatch = false; if (hasMouseCapture()) { gFocusMgr.setMouseCapture(NULL); } // dispatch to base class for the rest of things return LLFloater::handleMouseUp ( x, y, mask ); }
BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask ) { // if we're the front most window if ( isFrontmost () ) { // mouse was pressed within region if ( getMouseDownInHueRegion() || getMouseDownInLumRegion()) { S32 clamped_x, clamped_y; if (getMouseDownInHueRegion()) { clamped_x = llclamp(x, mRGBViewerImageLeft, mRGBViewerImageLeft + mRGBViewerImageWidth); clamped_y = llclamp(y, mRGBViewerImageTop - mRGBViewerImageHeight, mRGBViewerImageTop); } else { clamped_x = llclamp(x, mLumRegionLeft, mLumRegionLeft + mLumRegionWidth); clamped_y = llclamp(y, mLumRegionTop - mLumRegionHeight, mLumRegionTop); } // update the stored RGB/HSL values using the mouse position - returns TRUE if RGB was updated if ( updateRgbHslFromPoint ( clamped_x, clamped_y ) ) { // update text entry fields updateTextEntry (); // RN: apparently changing color when dragging generates too much traffic and results in sporadic updates //// commit changed color to swatch subject //// REVIEW: this gets sent each time a color changes - is this okay ? //if (mApplyImmediateCheck->get()) //{ // LLColorSwatchCtrl::onColorChanged ( getSwatch () ); //} } } highlightEntry = -1; if ( mMouseDownInSwatch ) { getWindow()->setCursor ( UI_CURSOR_ARROWDRAG ); // if cursor if over a palette entry LLRect paletteRect ( mPaletteRegionLeft, mPaletteRegionTop, mPaletteRegionLeft + mPaletteRegionWidth, mPaletteRegionTop - mPaletteRegionHeight ); if ( paletteRect.pointInRect ( x, y ) ) { // find row/column in palette S32 xOffset = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth; S32 yOffset = ( ( mPaletteRegionTop - y - 1 ) * numPaletteRows ) / mPaletteRegionHeight; // calculate the entry 0..n-1 to highlight and set variable to next draw() picks it up highlightEntry = xOffset + yOffset * numPaletteColumns; } return TRUE; } } // dispatch to base class for the rest of things return LLFloater::handleHover ( x, y, mask ); }
BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) { // make it the frontmost gFloaterView->bringToFront(this); // rect containing RGB area LLRect rgbAreaRect ( mRGBViewerImageLeft, mRGBViewerImageTop, mRGBViewerImageLeft + mRGBViewerImageWidth, mRGBViewerImageTop - mRGBViewerImageHeight ); if ( rgbAreaRect.pointInRect ( x, y ) ) { gFocusMgr.setMouseCapture(this); // mouse button down setMouseDownInHueRegion ( TRUE ); // update all values based on initial click updateRgbHslFromPoint ( x, y ); // required by base class return TRUE; } // rect containing RGB area LLRect lumAreaRect ( mLumRegionLeft, mLumRegionTop, mLumRegionLeft + mLumRegionWidth + mLumMarkerSize, mLumRegionTop - mLumRegionHeight ); if ( lumAreaRect.pointInRect ( x, y ) ) { gFocusMgr.setMouseCapture(this); // mouse button down setMouseDownInLumRegion ( TRUE ); // required by base class return TRUE; } // rect containing swatch area LLRect swatchRect ( mSwatchRegionLeft, mSwatchRegionTop, mSwatchRegionLeft + mSwatchRegionWidth, mSwatchRegionTop - mSwatchRegionHeight ); setMouseDownInSwatch( FALSE ); if ( swatchRect.pointInRect ( x, y ) ) { setMouseDownInSwatch( TRUE ); // required - dont drag windows here. return TRUE; } // rect containing palette area LLRect paletteRect ( mPaletteRegionLeft, mPaletteRegionTop, mPaletteRegionLeft + mPaletteRegionWidth, mPaletteRegionTop - mPaletteRegionHeight ); if ( paletteRect.pointInRect ( x, y ) ) { // release keyboard focus so we can change text values if (gFocusMgr.childHasKeyboardFocus(this)) { mSelectBtn->setFocus(TRUE); } // calculate which palette index we selected S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth; S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight; U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c; if ( index <= mPalette.size () ) { LLColor4 selected = *mPalette [ index ]; setCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] ); if (mApplyImmediateCheck->get()) { LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); } updateTextEntry (); } return TRUE; } // dispatch to base class for the rest of things return LLFloater::handleMouseDown ( x, y, mask ); }