2018-12-12 15:24:41 +00:00
|
|
|
/* gtklayoutmanager.h: Layout manager base class
|
2019-03-20 15:37:15 +00:00
|
|
|
* Copyright 2019 The GNOME Foundation
|
2018-12-12 15:24:41 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2019-03-20 15:37:15 +00:00
|
|
|
#include <gsk/gsk.h>
|
2018-12-12 17:20:28 +00:00
|
|
|
#include <gtk/gtktypes.h>
|
|
|
|
#include <gtk/gtkwidget.h>
|
2018-12-19 16:01:17 +00:00
|
|
|
#include <gtk/gtklayoutchild.h>
|
2018-12-12 15:24:41 +00:00
|
|
|
|
|
|
|
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"
|
2021-05-20 13:17:04 +00:00
|
|
|
* or "height for width"; see `GtkSizeRequestMode`
|
2018-12-12 15:24:41 +00:00
|
|
|
* @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
|
2021-05-20 13:17:04 +00:00
|
|
|
* @layout_child_type: the type of `GtkLayoutChild` used by this layout manager
|
|
|
|
* @create_layout_child: a virtual function, used to create a `GtkLayoutChild`
|
2019-03-20 15:37:15 +00:00
|
|
|
* meta object for the layout properties
|
2019-06-10 13:43:14 +00:00
|
|
|
* @root: a virtual function, called when the widget using the layout
|
2021-05-20 13:17:04 +00:00
|
|
|
* manager is attached to a `GtkRoot`
|
2019-06-10 13:43:14 +00:00
|
|
|
* @unroot: a virtual function, called when the widget using the layout
|
2021-05-20 13:17:04 +00:00
|
|
|
* manager is detached from a `GtkRoot`
|
2018-12-12 15:24:41 +00:00
|
|
|
*
|
|
|
|
* The `GtkLayoutManagerClass` structure contains only private data, and
|
|
|
|
* should only be accessed through the provided API, or when subclassing
|
2021-05-20 13:17:04 +00:00
|
|
|
* `GtkLayoutManager`.
|
2018-12-12 15:24:41 +00:00
|
|
|
*/
|
|
|
|
struct _GtkLayoutManagerClass
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
/*< public >*/
|
2018-12-19 16:01:17 +00:00
|
|
|
GtkSizeRequestMode (* get_request_mode) (GtkLayoutManager *manager,
|
|
|
|
GtkWidget *widget);
|
2018-12-12 15:24:41 +00:00
|
|
|
|
2018-12-19 16:01:17 +00:00
|
|
|
void (* measure) (GtkLayoutManager *manager,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GtkOrientation orientation,
|
|
|
|
int for_size,
|
|
|
|
int *minimum,
|
|
|
|
int *natural,
|
|
|
|
int *minimum_baseline,
|
|
|
|
int *natural_baseline);
|
2018-12-12 15:24:41 +00:00
|
|
|
|
2018-12-19 16:01:17 +00:00
|
|
|
void (* allocate) (GtkLayoutManager *manager,
|
|
|
|
GtkWidget *widget,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int baseline);
|
|
|
|
|
2019-03-28 16:58:00 +00:00
|
|
|
GType layout_child_type;
|
|
|
|
|
2020-09-12 13:31:52 +00:00
|
|
|
/**
|
|
|
|
* GtkLayoutManagerClass::create_layout_child:
|
2021-05-20 13:17:04 +00:00
|
|
|
* @manager: the `GtkLayoutManager`
|
2020-09-12 13:31:52 +00:00
|
|
|
* @widget: the widget using the @manager
|
|
|
|
* @for_child: the child of @widget
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
* Create a `GtkLayoutChild` instance for the given @for_child widget.
|
2020-09-12 13:31:52 +00:00
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
* Returns: (transfer full): a `GtkLayoutChild`
|
2020-09-12 13:31:52 +00:00
|
|
|
*/
|
2018-12-19 16:01:17 +00:00
|
|
|
GtkLayoutChild * (* create_layout_child) (GtkLayoutManager *manager,
|
2019-03-20 15:37:15 +00:00
|
|
|
GtkWidget *widget,
|
|
|
|
GtkWidget *for_child);
|
2018-12-12 15:24:41 +00:00
|
|
|
|
2019-06-10 13:43:14 +00:00
|
|
|
void (* root) (GtkLayoutManager *manager);
|
|
|
|
void (* unroot) (GtkLayoutManager *manager);
|
|
|
|
|
2018-12-12 15:24:41 +00:00
|
|
|
/*< 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
|
2019-03-20 15:37:15 +00:00
|
|
|
GtkSizeRequestMode gtk_layout_manager_get_request_mode (GtkLayoutManager *manager);
|
2018-12-12 15:24:41 +00:00
|
|
|
|
2018-12-12 17:20:28 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
GtkWidget * gtk_layout_manager_get_widget (GtkLayoutManager *manager);
|
|
|
|
|
2018-12-12 15:24:41 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
void gtk_layout_manager_layout_changed (GtkLayoutManager *manager);
|
|
|
|
|
2018-12-19 16:01:17 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
GtkLayoutChild * gtk_layout_manager_get_layout_child (GtkLayoutManager *manager,
|
2019-03-20 15:37:15 +00:00
|
|
|
GtkWidget *child);
|
2018-12-19 16:01:17 +00:00
|
|
|
|
2018-12-12 15:24:41 +00:00
|
|
|
G_END_DECLS
|