[email protected] | 93270d00 | 2011-01-19 22:32:59 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 14a000d | 2010-04-29 21:44:24 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "chrome/browser/platform_util.h" | ||||
6 | |||||
7 | #include <gtk/gtk.h> | ||||
8 | |||||
[email protected] | 14a000d | 2010-04-29 21:44:24 | [diff] [blame] | 9 | namespace platform_util { |
10 | |||||
11 | gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | ||||
12 | // A detached widget won't have a toplevel window as an ancestor, so we can't | ||||
13 | // assume that the query for toplevel will return a window. | ||||
14 | GtkWidget* toplevel = gtk_widget_get_ancestor(view, GTK_TYPE_WINDOW); | ||||
15 | return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL; | ||||
16 | } | ||||
17 | |||||
[email protected] | ba6680f | 2010-11-01 20:35:08 | [diff] [blame] | 18 | gfx::NativeView GetParent(gfx::NativeView view) { |
19 | return gtk_widget_get_parent(view); | ||||
20 | } | ||||
21 | |||||
[email protected] | 14a000d | 2010-04-29 21:44:24 | [diff] [blame] | 22 | bool IsWindowActive(gfx::NativeWindow window) { |
23 | return gtk_window_is_active(window); | ||||
24 | } | ||||
25 | |||||
[email protected] | 9fa8af6 | 2010-06-03 17:15:22 | [diff] [blame] | 26 | void ActivateWindow(gfx::NativeWindow window) { |
27 | gtk_window_present(window); | ||||
28 | } | ||||
29 | |||||
[email protected] | 14a000d | 2010-04-29 21:44:24 | [diff] [blame] | 30 | bool IsVisible(gfx::NativeView view) { |
[email protected] | 74b9241 | 2011-07-22 19:39:08 | [diff] [blame] | 31 | return gtk_widget_get_visible(view); |
[email protected] | 14a000d | 2010-04-29 21:44:24 | [diff] [blame] | 32 | } |
33 | |||||
[email protected] | 14a000d | 2010-04-29 21:44:24 | [diff] [blame] | 34 | } // namespace platform_util |