word_lookup_client.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_VIEWS_WORD_LOOKUP_CLIENT_H_
  5. #define UI_VIEWS_WORD_LOOKUP_CLIENT_H_
  6. #include "ui/views/views_export.h"
  7. namespace gfx {
  8. struct DecoratedText;
  9. class Point;
  10. } // namespace gfx
  11. namespace views {
  12. // An interface implemented by a view which supports word lookups.
  13. class VIEWS_EXPORT WordLookupClient {
  14. public:
  15. // Retrieves the word displayed at the given |point| along with its styling
  16. // information. |point| is in the coordinate system of the view. If no word is
  17. // displayed at the point, returns a nearby word. |baseline_point| should
  18. // correspond to the baseline point of the leftmost glyph of the |word| in the
  19. // view's coordinates. Returns false, if no word can be retrieved.
  20. virtual bool GetWordLookupDataAtPoint(const gfx::Point& point,
  21. gfx::DecoratedText* decorated_word,
  22. gfx::Point* baseline_point) = 0;
  23. virtual bool GetWordLookupDataFromSelection(
  24. gfx::DecoratedText* decorated_text,
  25. gfx::Point* baseline_point) = 0;
  26. protected:
  27. virtual ~WordLookupClient() = default;
  28. };
  29. } // namespace views
  30. #endif // UI_VIEWS_WORD_LOOKUP_CLIENT_H_