Home | History | Annotate | Download | only in client
      1 // Copyright (c) 2012 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 
      5 #ifndef UI_AURA_SCREEN_POSITION_CLIENT_H_
      6 #define UI_AURA_SCREEN_POSITION_CLIENT_H_
      7 
      8 #include "ui/aura/aura_export.h"
      9 #include "ui/aura/window.h"
     10 
     11 namespace gfx {
     12 class Display;
     13 class Rect;
     14 }
     15 
     16 namespace aura {
     17 class Window;
     18 namespace client {
     19 
     20 // An interface implemented by an object that changes coordinates within a root
     21 // Window into system coordinates.
     22 class AURA_EXPORT ScreenPositionClient {
     23  public:
     24   virtual ~ScreenPositionClient() {}
     25 
     26   // Converts the |screen_point| from a given |window|'s coordinate space
     27   // into screen coordinate space.
     28   virtual void ConvertPointToScreen(const Window* window,
     29                                     gfx::Point* point) = 0;
     30   virtual void ConvertPointFromScreen(const Window* window,
     31                                       gfx::Point* point) = 0;
     32   // Converts the |screen_point| from root window host's coordinate of
     33   // into screen coordinate space.
     34   // A typical example of using this function instead of ConvertPointToScreen is
     35   // when X's native input is captured by a drag operation.
     36   // See the comments for ash::GetRootWindowRelativeToWindow for details.
     37   virtual void ConvertHostPointToScreen(Window* root_window,
     38                                         gfx::Point* point) = 0;
     39   // Sets the bounds of the window. The implementation is responsible
     40   // for finding out and translating the right coordinates for the |window|.
     41   virtual void SetBounds(Window* window,
     42                          const gfx::Rect& bounds,
     43                          const gfx::Display& display) = 0;
     44 };
     45 
     46 // Sets/Gets the activation client on the Window.
     47 AURA_EXPORT void SetScreenPositionClient(Window* root_window,
     48                                          ScreenPositionClient* client);
     49 AURA_EXPORT ScreenPositionClient* GetScreenPositionClient(
     50     const Window* root_window);
     51 
     52 }  // namespace clients
     53 }  // namespace aura
     54 
     55 #endif  // UI_AURA_SCREEN_POSITION_CLIENT_H_
     56