OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 ASH_COMMON_DEVTOOLS_UI_ELEMENT_H_ | |
6 #define ASH_COMMON_DEVTOOLS_UI_ELEMENT_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "ash/wm_window.h" | |
12 #include "base/macros.h" | |
13 #include "ui/gfx/geometry/rect.h" | |
14 #include "ui/views/view.h" | |
15 | |
16 namespace ash { | |
17 | |
18 namespace devtools { | |
19 | |
20 class UIElementDelegate; | |
21 | |
22 // UIElement type. | |
23 enum UIElementType { WINDOW, WIDGET, VIEW }; | |
24 | |
25 class ASH_EXPORT UIElement { | |
26 public: | |
27 UIElement(); | |
sadrul
2017/04/19 18:21:39
Move this into a protected ctor.
Change the ctor
thanhph
2017/04/24 15:56:50
Done. I also added parent as an input.
| |
28 virtual ~UIElement(); | |
29 | |
30 int GetNodeId() const; | |
31 void SetNodeId(int node_id); | |
32 | |
33 UIElement* GetParent(); | |
34 void SetParent(UIElement* parent); | |
35 | |
36 UIElementDelegate* GetUIElementDelegate(); | |
37 void SetUIElementDelegate(UIElementDelegate* ui_element_delegate); | |
38 | |
39 UIElementType GetType() const; | |
40 void SetType(UIElementType type); | |
41 | |
42 std::vector<UIElement*>& GetChildren(); | |
43 void SetChildren(std::vector<UIElement*>& children); | |
44 | |
45 virtual void Destroy() = 0; | |
46 virtual bool GetBounds(gfx::Rect* bounds) = 0; | |
47 virtual bool SetBounds(const gfx::Rect& bounds) = 0; | |
48 virtual bool GetVisible(bool* visible) = 0; | |
49 virtual bool SetVisible(bool visible) = 0; | |
50 virtual std::pair<WmWindow*, gfx::Rect> GetNodeWindowAndBounds() = 0; | |
51 | |
52 template <typename BackingT, typename T> | |
53 static BackingT* GetBackingElement(UIElement* element) { | |
54 return T::From(element); | |
55 }; | |
56 | |
57 private: | |
58 int node_id_; | |
59 std::vector<UIElement*> children_; | |
60 UIElementType type_; | |
61 UIElement* parent_; | |
62 UIElementDelegate* ui_element_delegate_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(UIElement); | |
65 }; | |
66 | |
67 } // namespace devtools | |
68 } // namespace ash | |
69 | |
70 #endif // ASH_COMMON_DEVTOOLS_UI_ELEMENT_H_ | |
OLD | NEW |