blob: 03481b96c4c92cf26cfc9d829ee25b4444bbc951 [file] [log] [blame]
[email protected]93270d002011-01-19 22:32:591// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]14a000d2010-04-29 21:44:242// 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]14a000d2010-04-29 21:44:249namespace platform_util {
10
11gfx::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]ba6680f2010-11-01 20:35:0818gfx::NativeView GetParent(gfx::NativeView view) {
19 return gtk_widget_get_parent(view);
20}
21
[email protected]14a000d2010-04-29 21:44:2422bool IsWindowActive(gfx::NativeWindow window) {
23 return gtk_window_is_active(window);
24}
25
[email protected]9fa8af62010-06-03 17:15:2226void ActivateWindow(gfx::NativeWindow window) {
27 gtk_window_present(window);
28}
29
[email protected]14a000d2010-04-29 21:44:2430bool IsVisible(gfx::NativeView view) {
[email protected]74b92412011-07-22 19:39:0831 return gtk_widget_get_visible(view);
[email protected]14a000d2010-04-29 21:44:2432}
33
[email protected]14a000d2010-04-29 21:44:2434} // namespace platform_util