Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: components/mus/public/cpp/window.h

Issue 1465803003: mus: Let clients set the cursor of their window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do it the other way + explicit checks that it is a mouse pointer. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const gfx::Rect& bounds() const { return bounds_; } 71 const gfx::Rect& bounds() const { return bounds_; }
72 void SetBounds(const gfx::Rect& bounds); 72 void SetBounds(const gfx::Rect& bounds);
73 73
74 const gfx::Insets& client_area() const { return client_area_; } 74 const gfx::Insets& client_area() const { return client_area_; }
75 void SetClientArea(const gfx::Insets& new_client_area); 75 void SetClientArea(const gfx::Insets& new_client_area);
76 76
77 // Visibility (also see IsDrawn()). When created windows are hidden. 77 // Visibility (also see IsDrawn()). When created windows are hidden.
78 bool visible() const { return visible_; } 78 bool visible() const { return visible_; }
79 void SetVisible(bool value); 79 void SetVisible(bool value);
80 80
81 // Cursors
82 mojom::Cursor predefined_cursor() const { return cursor_id_; }
83 void SetPredefinedCursor(mus::mojom::Cursor cursor_id);
84
81 // A Window is drawn if the Window and all its ancestors are visible and the 85 // A Window is drawn if the Window and all its ancestors are visible and the
82 // Window is attached to the root. 86 // Window is attached to the root.
83 bool IsDrawn() const; 87 bool IsDrawn() const;
84 88
85 const mojom::ViewportMetrics& viewport_metrics() { 89 const mojom::ViewportMetrics& viewport_metrics() {
86 return *viewport_metrics_; 90 return *viewport_metrics_;
87 } 91 }
88 92
89 scoped_ptr<WindowSurface> RequestSurface(mojom::SurfaceType type); 93 scoped_ptr<WindowSurface> RequestSurface(mojom::SurfaceType type);
90 94
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void LocalAddTransientWindow(Window* transient_window); 221 void LocalAddTransientWindow(Window* transient_window);
218 void LocalRemoveTransientWindow(Window* transient_window); 222 void LocalRemoveTransientWindow(Window* transient_window);
219 // Returns true if the order actually changed. 223 // Returns true if the order actually changed.
220 bool LocalReorder(Window* relative, mojom::OrderDirection direction); 224 bool LocalReorder(Window* relative, mojom::OrderDirection direction);
221 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); 225 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds);
222 void LocalSetClientArea(const gfx::Insets& new_client_area); 226 void LocalSetClientArea(const gfx::Insets& new_client_area);
223 void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics, 227 void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics,
224 const mojom::ViewportMetrics& new_metrics); 228 const mojom::ViewportMetrics& new_metrics);
225 void LocalSetDrawn(bool drawn); 229 void LocalSetDrawn(bool drawn);
226 void LocalSetVisible(bool visible); 230 void LocalSetVisible(bool visible);
231 void LocalSetPredefinedCursor(mojom::Cursor cursor_id);
227 void LocalSetSharedProperty(const std::string& name, 232 void LocalSetSharedProperty(const std::string& name,
228 const std::vector<uint8_t>* data); 233 const std::vector<uint8_t>* data);
229 234
230 // Notifies this winodw that its stacking position has changed. 235 // Notifies this winodw that its stacking position has changed.
231 void NotifyWindowStackingChanged(); 236 void NotifyWindowStackingChanged();
232 // Methods implementing visibility change notifications. See WindowObserver 237 // Methods implementing visibility change notifications. See WindowObserver
233 // for more details. 238 // for more details.
234 void NotifyWindowVisibilityChanged(Window* target); 239 void NotifyWindowVisibilityChanged(Window* target);
235 // Notifies this window's observers. Returns false if |this| was deleted 240 // Notifies this window's observers. Returns false if |this| was deleted
236 // during the call (by an observer), otherwise true. 241 // during the call (by an observer), otherwise true.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 274
270 base::ObserverList<WindowObserver> observers_; 275 base::ObserverList<WindowObserver> observers_;
271 276
272 gfx::Rect bounds_; 277 gfx::Rect bounds_;
273 gfx::Insets client_area_; 278 gfx::Insets client_area_;
274 279
275 mojom::ViewportMetricsPtr viewport_metrics_; 280 mojom::ViewportMetricsPtr viewport_metrics_;
276 281
277 bool visible_; 282 bool visible_;
278 283
284 mojom::Cursor cursor_id_;
285
279 SharedProperties properties_; 286 SharedProperties properties_;
280 287
281 // Drawn state is derived from the visible state and the parent's visible 288 // Drawn state is derived from the visible state and the parent's visible
282 // state. This field is only used if the window has no parent (eg it's a 289 // state. This field is only used if the window has no parent (eg it's a
283 // root). 290 // root).
284 bool drawn_; 291 bool drawn_;
285 292
286 // Value struct to keep the name and deallocator for this property. 293 // Value struct to keep the name and deallocator for this property.
287 // Key cannot be used for this purpose because it can be char* or 294 // Key cannot be used for this purpose because it can be char* or
288 // WindowProperty<>. 295 // WindowProperty<>.
289 struct Value { 296 struct Value {
290 const char* name; 297 const char* name;
291 int64_t value; 298 int64_t value;
292 PropertyDeallocator deallocator; 299 PropertyDeallocator deallocator;
293 }; 300 };
294 301
295 std::map<const void*, Value> prop_map_; 302 std::map<const void*, Value> prop_map_;
296 303
297 MOJO_DISALLOW_COPY_AND_ASSIGN(Window); 304 MOJO_DISALLOW_COPY_AND_ASSIGN(Window);
298 }; 305 };
299 306
300 } // namespace mus 307 } // namespace mus
301 308
302 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ 309 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/tests/test_window_tree.cc ('k') | components/mus/public/cpp/window_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698