Implement nacl_irt_memory for non-sfi mode.
[chromium-blink-merge.git] / ui / base / gtk / gtk_floating_container.h
blob0d91a83d2d6394940692446fd1c6b5b0c6281e89
1 // Copyright (c) 2011 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 UI_BASE_GTK_GTK_FLOATING_CONTAINER_H_
6 #define UI_BASE_GTK_GTK_FLOATING_CONTAINER_H_
8 #include <gdk/gdk.h>
9 #include <gtk/gtk.h>
11 #include "ui/base/ui_base_export.h"
13 // A specialized container, which is a cross between a GtkBin and a
14 // GtkFixed. This container dervies from GtkBin and the implementation of
15 // gtk_container_add() is the same: only one GtkWidget can be added through
16 // that interface. The GtkBin portion contains normal content and is given the
17 // same allocation that this container has.
19 // In addition, any number of widgets can be added through the
20 // gtk_floating_container_add_floating() method, which provides functionality
21 // similar to a GtkFixed. Unlike a GtkFixed, coordinates are not set when you
22 // gtk_fixed_put(). The location of the floating widgets is determined while
23 // running the "set-floating-position" signal, which is emitted during this
24 // container's "size-allocate" handler.
26 // The "set-floating-position" signal is (semi-)mandatory if you want widgets
27 // placed anywhere other than the origin and should have the following
28 // signature:
30 // void (*set_floating_position)(GtkFloatingContainer* container,
31 // GtkAllocation* allocation,
32 // gpointer userdata);
34 // Your handler should, for each floating widget, set the "x" and "y" child
35 // properties.
37 G_BEGIN_DECLS
39 #define GTK_TYPE_FLOATING_CONTAINER \
40 (gtk_floating_container_get_type())
41 #define GTK_FLOATING_CONTAINER(obj) \
42 (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FLOATING_CONTAINER, \
43 GtkFloatingContainer))
44 #define GTK_FLOATING_CONTAINER_CLASS(klass) \
45 (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FLOATING_CONTAINER, \
46 GtkFloatingContainerClass))
47 #define GTK_IS_FLOATING_CONTAINER(obj) \
48 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_FLOATING_CONTAINER))
49 #define GTK_IS_FLOATING_CONTAINER_CLASS(klass) \
50 (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_FLOATING_CONTAINER))
51 #define GTK_FLOATING_CONTAINER_GET_CLASS(obj) \
52 (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_FLOATING_CONTAINER, \
53 GtkFloatingContainerClass))
55 typedef struct _GtkFloatingContainer GtkFloatingContainer;
56 typedef struct _GtkFloatingContainerClass GtkFloatingContainerClass;
57 typedef struct _GtkFloatingContainerChild GtkFloatingContainerChild;
59 struct _GtkFloatingContainer {
60 // Parent class.
61 GtkBin bin;
63 // A GList of all our floating children, in GtkFloatingContainerChild
64 // structs. Owned by the GtkFloatingContainer.
65 GList* floating_children;
68 struct _GtkFloatingContainerClass {
69 GtkBinClass parent_class;
72 // Internal structure used to associate a widget and its x/y child properties.
73 struct _GtkFloatingContainerChild {
74 GtkWidget* widget;
75 gint x;
76 gint y;
79 UI_BASE_EXPORT GType gtk_floating_container_get_type() G_GNUC_CONST;
80 UI_BASE_EXPORT GtkWidget* gtk_floating_container_new();
81 UI_BASE_EXPORT void gtk_floating_container_add_floating(
82 GtkFloatingContainer* container,
83 GtkWidget* widget);
84 // Use gtk_container_remove to remove all widgets; both widgets added with
85 // gtk_container_add() and gtk_floating_container_add_floating().
87 G_END_DECLS
89 #endif // UI_BASE_GTK_GTK_FLOATING_CONTAINER_H_