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

Side by Side Diff: chrome/browser/gtk/gtk_floating_container.h

Issue 115835: Implement GtkFloatingContainer (Closed)
Patch Set: Cleanups Created 11 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/gtk/gtk_floating_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 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.
4
5 #ifndef CHROME_BROWSER_GTK_GTK_FLOATING_CONTAINER_H_
6 #define CHROME_BROWSER_GTK_GTK_FLOATING_CONTAINER_H_
7
8 #include <gdk/gdk.h>
9 #include <gtk/gtk.h>
10
11 // A specialized container, which is a cross between a GtkBin and a
12 // GtkFixed. This container dervies from GtkBin and the implementation of
13 // gtk_container_add() is the same: only one GtkWidget can be added through
14 // that interface. The GtkBin portion contains normal content and is given the
15 // same allocation that this container has.
16 //
17 // In addition, any number of widgets can be through the
18 // gtk_floating_container_add_floating() method, which provides functionality
19 // similar to a GtkFixed. Unlike a GtkFixed, coordinates are not set when you
20 // gtk_fixed_put(). The location of the floating widgets is determined while
21 // running the "set-floating-position" signal, which is emitted during this
22 // container's "size-allocate" handler.
23 //
24 // The "set-floating-position" signal is (semi-)mandatory if you want widgets
25 // placed anywhere other than the origin and should have the following
26 // signature:
27 //
28 // void (*set_floating_position)(GtkFloatingContainer* container,
29 // GtkAllocation* allocation);
30 //
31 // Your handler should, for each floating widget, set the "x" and "y" child
32 // properties.
33
34 G_BEGIN_DECLS
35
36 #define GTK_TYPE_FLOATING_CONTAINER \
37 (gtk_floating_container_get_type())
38 #define GTK_FLOATING_CONTAINER(obj) \
39 (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FLOATING_CONTAINER, \
40 GtkFloatingContainer))
41 #define GTK_FLOATING_CONTAINER_CLASS(klass) \
42 (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FLOATING_CONTAINER, \
43 GtkFloatingContainerClass))
44 #define GTK_IS_FLOATING_CONTAINER(obj) \
45 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_FLOATING_CONTAINER))
46 #define GTK_IS_FLOATING_CONTAINER_CLASS(klass) \
47 (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_FLOATING_CONTAINER))
48 #define GTK_FLOATING_CONTAINER_GET_CLASS(obj) \
49 (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_FLOATING_CONTAINER, \
50 GtkFloatingContainerClass))
51
52 typedef struct _GtkFloatingContainer GtkFloatingContainer;
53 typedef struct _GtkFloatingContainerClass GtkFloatingContainerClass;
54 typedef struct _GtkFloatingContainerChild GtkFloatingContainerChild;
55
56 struct _GtkFloatingContainer {
57 // Parent class.
58 GtkBin bin;
59
60 // A GList of all our floating children, in GtkFloatingContainerChild
61 // structs. Owned by the GtkFloatingContainer.
62 GList* floating_children;
63 };
64
65 struct _GtkFloatingContainerClass {
66 GtkBinClass parent_class;
67 };
68
69 // Internal structure used to associate a widget and its x/y child properties.
70 struct _GtkFloatingContainerChild {
71 GtkWidget* widget;
72 gint x;
73 gint y;
74 };
75
76 GType gtk_floating_container_get_type() G_GNUC_CONST;
77 GtkWidget* gtk_floating_container_new();
78 void gtk_floating_container_add_floating(GtkFloatingContainer* container,
79 GtkWidget* widget);
80 // Use gtk_container_remove to remove all widgets; both widgets added with
81 // gtk_container_add() and gtk_floating_container_add_floating().
82
83 G_END_DECLS
84
85 #endif // CHROME_BROWSER_GTK_GTK_FLOATING_CONTAINER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/gtk_floating_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698