//----------------------------------------------------------------------------// void Editbox::onMouseButtonDown(MouseEventArgs& e) { // base class handling Window::onMouseButtonDown(e); if (e.button == LeftButton) { // grab inputs if (captureInput()) { // handle mouse down clearSelection(); d_dragging = true; d_dragAnchorIdx = getTextIndexFromPosition(e.position); #ifdef CEGUI_BIDI_SUPPORT if (d_bidiVisualMapping->getV2lMapping().size() > d_dragAnchorIdx) d_dragAnchorIdx = d_bidiVisualMapping->getV2lMapping()[d_dragAnchorIdx]; #endif setCaretIndex(d_dragAnchorIdx); } ++e.handled; } }
/************************************************************************* Handler for when mouse moves in the window. *************************************************************************/ void MultiLineEditbox::onMouseMove(MouseEventArgs& e) { // base class processing Window::onMouseMove(e); if (d_dragging) { setCaratIndex(getTextIndexFromPosition(e.position)); setSelection(d_caratPos, d_dragAnchorIdx); } e.handled = true; }
//----------------------------------------------------------------------------// void Editbox::onMouseMove(MouseEventArgs& e) { // base class processing Window::onMouseMove(e); if (d_dragging) { size_t anchorIdx = getTextIndexFromPosition(e.position); #ifdef CEGUI_BIDI_SUPPORT if (d_bidiVisualMapping->getV2lMapping().size() > anchorIdx) anchorIdx = d_bidiVisualMapping->getV2lMapping()[anchorIdx]; #endif setCaretIndex(anchorIdx); setSelection(d_caretPos, d_dragAnchorIdx); } ++e.handled; }
/************************************************************************* Handler for when a mouse button is pushed *************************************************************************/ void MultiLineEditbox::onMouseButtonDown(MouseEventArgs& e) { // base class handling Window::onMouseButtonDown(e); if (e.button == LeftButton) { // grab inputs if (captureInput()) { // handle mouse down clearSelection(); d_dragging = true; d_dragAnchorIdx = getTextIndexFromPosition(e.position); setCaratIndex(d_dragAnchorIdx); } e.handled = true; } }