Logo Search packages:      
Sourcecode: xulrunner version File versions  Download package

void nsAccessibleWrap::UpdateSystemCaret (  )  [inherited]

System caret support: update the Windows caret position. The system caret works more universally than the MSAA caret For example, Window-Eyes, JAWS, ZoomText and Windows Tablet Edition use it We will use an invisible system caret. Gecko is still responsible for drawing its own caret

Definition at line 1908 of file nsAccessibleWrap.cpp.

References nsIWidget::GetNativeData().

{
  // Move the system caret so that Windows Tablet Edition and tradional ATs with 
  // off-screen model can follow the caret
  ::DestroyCaret();

  nsRefPtr<nsRootAccessible> rootAccessible = GetRootAccessible();
  if (!rootAccessible) {
    return;
  }

  nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
  if (!caretAccessible) {
    return;
  }

  nsIWidget *widget;
  nsRect caretRect = caretAccessible->GetCaretRect(&widget);        
  HWND caretWnd; 
  if (caretRect.IsEmpty() || !(caretWnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW))) {
    return;
  }

  // Create invisible bitmap for caret, otherwise its appearance interferes
  // with Gecko caret
  HBITMAP caretBitMap = CreateBitmap(1, caretRect.height, 1, 1, NULL);
  if (::CreateCaret(caretWnd, caretBitMap, 1, caretRect.height)) {  // Also destroys the last caret
    ::ShowCaret(caretWnd);
    RECT windowRect;
    ::GetWindowRect(caretWnd, &windowRect);
    ::SetCaretPos(caretRect.x - windowRect.left, caretRect.y - windowRect.top);
    ::DeleteObject(caretBitMap);
  }
}


Generated by  Doxygen 1.6.0   Back to index