1 // Copyright 2014 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.
5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_
8 #include "base/basictypes.h"
10 #include "mojo/services/public/cpp/view_manager/view.h"
14 // This class is a friend of a View and contains functions to mutate internal
18 explicit ViewPrivate(View
* view
);
21 // Creates and returns a new View. Caller owns the return value.
22 static View
* LocalCreate();
24 ObserverList
<ViewObserver
>* observers() { return &view_
->observers_
; }
26 void ClearParent() { view_
->parent_
= NULL
; }
28 void set_visible(bool visible
) { view_
->visible_
= visible
; }
30 void set_drawn(bool drawn
) { view_
->drawn_
= drawn
; }
32 void set_id(Id id
) { view_
->id_
= id
; }
34 ViewManager
* view_manager() { return view_
->manager_
; }
35 void set_view_manager(ViewManager
* manager
) {
36 view_
->manager_
= manager
;
39 void set_properties(const std::map
<std::string
, std::vector
<uint8_t>>& data
) {
40 view_
->properties_
= data
;
44 view_
->LocalDestroy();
46 void LocalAddChild(View
* child
) {
47 view_
->LocalAddChild(child
);
49 void LocalRemoveChild(View
* child
) {
50 view_
->LocalRemoveChild(child
);
52 void LocalReorder(View
* relative
, OrderDirection direction
) {
53 view_
->LocalReorder(relative
, direction
);
55 void LocalSetBounds(const Rect
& old_bounds
,
56 const Rect
& new_bounds
) {
57 view_
->LocalSetBounds(old_bounds
, new_bounds
);
59 void LocalSetDrawn(bool drawn
) { view_
->LocalSetDrawn(drawn
); }
64 DISALLOW_COPY_AND_ASSIGN(ViewPrivate
);
69 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_