OLD | NEW |
(Empty) | |
| 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 |
| 5 #ifndef REMOTING_CLIENT_DISPLAY_DRAWABLE_H_ |
| 6 #define REMOTING_CLIENT_DISPLAY_DRAWABLE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 |
| 11 namespace remoting { |
| 12 |
| 13 class Canvas; |
| 14 |
| 15 // Interface for drawing on a Canvas from a renderer. |
| 16 class Drawable { |
| 17 public: |
| 18 Drawable() {} |
| 19 virtual ~Drawable() {} |
| 20 |
| 21 // Sets the canvas on which the object will be drawn. |
| 22 // If |canvas| is nullptr, nothing will happen when calling Draw(). |
| 23 virtual void SetCanvas(base::WeakPtr<Canvas> canvas) = 0; |
| 24 |
| 25 // Draws the object on the canvas. |
| 26 // Returns true if there is a pending next frame. |
| 27 virtual bool Draw() = 0; |
| 28 |
| 29 // Used for the renderer to keep a stack of drawables. |
| 30 virtual base::WeakPtr<Drawable> GetWeakPtr() = 0; |
| 31 |
| 32 // ZIndex is a recommendation for Z Index of drawable components. |
| 33 enum ZIndex { |
| 34 DESKTOP = 100, |
| 35 CURSOR_FEEDBACK = 200, |
| 36 CURSOR = 300, |
| 37 }; |
| 38 |
| 39 // A higher Z Index shiould be draw ontop of a lower z index. Elements with |
| 40 // the same Z Index should draw in order inserted into the renderer. |
| 41 virtual int GetZIndex() = 0; |
| 42 |
| 43 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(Drawable); |
| 45 }; |
| 46 |
| 47 } // namespace remoting |
| 48 |
| 49 #endif // REMOTING_CLIENT_DISPLAY_DRAWABLE_H_ |
OLD | NEW |