forked from AuroraMiddleware/gtk
3f0f7c73e0
If we want to inspect the type of layout properties exposed by a GtkLayoutManager, we need a way to connect the layout manager type to the GtkLayoutChild type it creates. In order to do so, we can set the GtkLayoutChild type on a field of the GtkLayoutManagerClass structure. Storing the GtkLayoutChild type on the class structure of the layout manager also allows us to implement a default create_layout_child() virtual function.
113 lines
5.2 KiB
C
113 lines
5.2 KiB
C
/* gtklayoutmanager.h: Layout manager base class
|
|
* Copyright 2019 The GNOME Foundation
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Author: Emmanuele Bassi
|
|
*/
|
|
#pragma once
|
|
|
|
#include <gsk/gsk.h>
|
|
#include <gtk/gtktypes.h>
|
|
#include <gtk/gtkwidget.h>
|
|
#include <gtk/gtklayoutchild.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define GTK_TYPE_LAYOUT_MANAGER (gtk_layout_manager_get_type ())
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
G_DECLARE_DERIVABLE_TYPE (GtkLayoutManager, gtk_layout_manager, GTK, LAYOUT_MANAGER, GObject)
|
|
|
|
/**
|
|
* GtkLayoutManagerClass:
|
|
* @get_request_mode: a virtual function, used to return the preferred
|
|
* request mode for the layout manager; for instance, "width for height"
|
|
* or "height for width"; see #GtkSizeRequestMode
|
|
* @measure: a virtual function, used to measure the minimum and preferred
|
|
* sizes of the widget using the layout manager for a given orientation
|
|
* @allocate: a virtual function, used to allocate the size of the widget
|
|
* using the layout manager
|
|
* @layout_child_type: the type of #GtkLayoutChild used by this layout manager
|
|
* @create_layout_child: a virtual function, used to create a #GtkLayoutChild
|
|
* meta object for the layout properties
|
|
*
|
|
* The `GtkLayoutManagerClass` structure contains only private data, and
|
|
* should only be accessed through the provided API, or when subclassing
|
|
* #GtkLayoutManager.
|
|
*/
|
|
struct _GtkLayoutManagerClass
|
|
{
|
|
/*< private >*/
|
|
GObjectClass parent_class;
|
|
|
|
/*< public >*/
|
|
GtkSizeRequestMode (* get_request_mode) (GtkLayoutManager *manager,
|
|
GtkWidget *widget);
|
|
|
|
void (* measure) (GtkLayoutManager *manager,
|
|
GtkWidget *widget,
|
|
GtkOrientation orientation,
|
|
int for_size,
|
|
int *minimum,
|
|
int *natural,
|
|
int *minimum_baseline,
|
|
int *natural_baseline);
|
|
|
|
void (* allocate) (GtkLayoutManager *manager,
|
|
GtkWidget *widget,
|
|
int width,
|
|
int height,
|
|
int baseline);
|
|
|
|
GType layout_child_type;
|
|
|
|
GtkLayoutChild * (* create_layout_child) (GtkLayoutManager *manager,
|
|
GtkWidget *widget,
|
|
GtkWidget *for_child);
|
|
|
|
/*< private >*/
|
|
gpointer _padding[16];
|
|
};
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
void gtk_layout_manager_measure (GtkLayoutManager *manager,
|
|
GtkWidget *widget,
|
|
GtkOrientation orientation,
|
|
int for_size,
|
|
int *minimum,
|
|
int *natural,
|
|
int *minimum_baseline,
|
|
int *natural_baseline);
|
|
GDK_AVAILABLE_IN_ALL
|
|
void gtk_layout_manager_allocate (GtkLayoutManager *manager,
|
|
GtkWidget *widget,
|
|
int width,
|
|
int height,
|
|
int baseline);
|
|
GDK_AVAILABLE_IN_ALL
|
|
GtkSizeRequestMode gtk_layout_manager_get_request_mode (GtkLayoutManager *manager);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
GtkWidget * gtk_layout_manager_get_widget (GtkLayoutManager *manager);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
void gtk_layout_manager_layout_changed (GtkLayoutManager *manager);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
GtkLayoutChild * gtk_layout_manager_get_layout_child (GtkLayoutManager *manager,
|
|
GtkWidget *child);
|
|
|
|
G_END_DECLS
|