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. 4 5#ifndef CHROME_BROWSER_UI_GTK_GTK_EXPANDED_CONTAINER_H_ 6#define CHROME_BROWSER_UI_GTK_GTK_EXPANDED_CONTAINER_H_ 7#pragma once 8 9#include <gdk/gdk.h> 10#include <gtk/gtk.h> 11 12// A specialized container derived from GtkFixed, which expands the size of its 13// children to fill the container, in one or both directions. The usage of this 14// container is similar to GtkFixed. 15// 16// The "child-size-request" signal is optional, if you want to expand child 17// widgets to customized size other than the container's size. It should have 18// the following signature: 19// 20// void (*child_size_request)(GtkExpandedContainer* container, 21// GtkWidget* child, 22// GtkRequisition* requisition); 23// 24// This signal is emitted for each child with the requisition set to the size of 25// the container. Your handler may adjust the value of the requisition. If the 26// width or height is set to -1, then that direction will not be expanded, and 27// the original size request of the child will be used. 28 29G_BEGIN_DECLS 30 31#define GTK_TYPE_EXPANDED_CONTAINER \ 32 (gtk_expanded_container_get_type()) 33#define GTK_EXPANDED_CONTAINER(obj) \ 34 (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_EXPANDED_CONTAINER, \ 35 GtkExpandedContainer)) 36#define GTK_EXPANDED_CONTAINER_CLASS(klass) \ 37 (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_EXPANDED_CONTAINER, \ 38 GtkExpandedContainerClass)) 39#define GTK_IS_EXPANDED_CONTAINER(obj) \ 40 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_EXPANDED_CONTAINER)) 41#define GTK_IS_EXPANDED_CONTAINER_CLASS(klass) \ 42 (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_EXPANDED_CONTAINER)) 43#define GTK_EXPANDED_CONTAINER_GET_CLASS(obj) \ 44 (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_EXPANDED_CONTAINER, \ 45 GtkExpandedContainerClass)) 46 47typedef struct _GtkExpandedContainer GtkExpandedContainer; 48typedef struct _GtkExpandedContainerClass GtkExpandedContainerClass; 49 50struct _GtkExpandedContainer { 51 // Parent class. 52 GtkFixed fixed; 53}; 54 55struct _GtkExpandedContainerClass { 56 GtkFixedClass parent_class; 57}; 58 59GType gtk_expanded_container_get_type() G_GNUC_CONST; 60GtkWidget* gtk_expanded_container_new(); 61void gtk_expanded_container_put(GtkExpandedContainer* container, 62 GtkWidget* widget, gint x, gint y); 63void gtk_expanded_container_move(GtkExpandedContainer* container, 64 GtkWidget* widget, gint x, gint y); 65void gtk_expanded_container_set_has_window(GtkExpandedContainer* container, 66 gboolean has_window); 67gboolean gtk_expanded_container_get_has_window(GtkExpandedContainer* container); 68 69G_END_DECLS 70 71#endif // CHROME_BROWSER_UI_GTK_GTK_EXPANDED_CONTAINER_H_ 72