CefFindHandler.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Implement this interface to handle events related to find results. The
  10. /// methods of this class will be called on the UI thread.
  11. /// </summary>
  12. public abstract unsafe partial class CefFindHandler
  13. {
  14. private void on_find_result(cef_find_handler_t* self, cef_browser_t* browser, int identifier, int count, cef_rect_t* selectionRect, int activeMatchOrdinal, int finalUpdate)
  15. {
  16. CheckSelf(self);
  17. var mBrowser = CefBrowser.FromNative(browser);
  18. var mSelectionRect = new CefRectangle(selectionRect->x, selectionRect->y, selectionRect->width, selectionRect->height);
  19. OnFindResult(mBrowser, identifier, count, mSelectionRect, activeMatchOrdinal, finalUpdate != 0);
  20. }
  21. /// <summary>
  22. /// Called to report find results returned by CefBrowserHost::Find().
  23. /// |identifer| is the identifier passed to Find(), |count| is the number of
  24. /// matches currently identified, |selectionRect| is the location of where the
  25. /// match was found (in window coordinates), |activeMatchOrdinal| is the
  26. /// current position in the search results, and |finalUpdate| is true if this
  27. /// is the last find notification.
  28. /// </summary>
  29. protected abstract void OnFindResult(CefBrowser browser, int identifier, int count, CefRectangle selectionRect, int activeMatchOrdinal, bool finalUpdate);
  30. }
  31. }