summaryrefslogtreecommitdiff
path: root/gtk/gtkconstraintsolverprivate.h
blob: 807b0b08d6b5639e6633873a008187f182bd908c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* gtkconstraintsolverprivate.h: Constraint solver based on the Cassowary method
 * Copyright 2019  GNOME Foundation
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * 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 "gtkconstrainttypesprivate.h"

G_BEGIN_DECLS

#define GTK_TYPE_CONSTRAINT_SOLVER (gtk_constraint_solver_get_type())

G_DECLARE_FINAL_TYPE (GtkConstraintSolver, gtk_constraint_solver, GTK, CONSTRAINT_SOLVER, GObject)

GtkConstraintSolver *
gtk_constraint_solver_new (void);

void
gtk_constraint_solver_freeze (GtkConstraintSolver *solver);

void
gtk_constraint_solver_thaw (GtkConstraintSolver *solver);

void
gtk_constraint_solver_resolve (GtkConstraintSolver *solver);

GtkConstraintVariable *
gtk_constraint_solver_create_variable (GtkConstraintSolver *solver,
                                       const char          *prefix,
                                       const char          *name,
                                       double               value);

GtkConstraintRef *
gtk_constraint_solver_add_constraint (GtkConstraintSolver     *solver,
                                      GtkConstraintVariable   *variable,
                                      GtkConstraintRelation    relation,
                                      GtkConstraintExpression *expression,
                                      double                   strength);

void
gtk_constraint_solver_remove_constraint (GtkConstraintSolver *solver,
                                         GtkConstraintRef    *reference);

GtkConstraintRef *
gtk_constraint_solver_add_stay_variable (GtkConstraintSolver   *solver,
                                         GtkConstraintVariable *variable,
                                         double                 strength);

void
gtk_constraint_solver_remove_stay_variable (GtkConstraintSolver   *solver,
                                            GtkConstraintVariable *variable);

gboolean
gtk_constraint_solver_has_stay_variable (GtkConstraintSolver   *solver,
                                         GtkConstraintVariable *variable);

GtkConstraintRef *
gtk_constraint_solver_add_edit_variable (GtkConstraintSolver   *solver,
                                         GtkConstraintVariable *variable,
                                         double                 strength);

void
gtk_constraint_solver_remove_edit_variable (GtkConstraintSolver   *solver,
                                            GtkConstraintVariable *variable);

gboolean
gtk_constraint_solver_has_edit_variable (GtkConstraintSolver   *solver,
                                         GtkConstraintVariable *variable);

void
gtk_constraint_solver_suggest_value (GtkConstraintSolver   *solver,
                                     GtkConstraintVariable *variable,
                                     double                 value);

void
gtk_constraint_solver_begin_edit (GtkConstraintSolver *solver);

void
gtk_constraint_solver_end_edit (GtkConstraintSolver *solver);

void
gtk_constraint_solver_note_added_variable (GtkConstraintSolver *self,
                                           GtkConstraintVariable *variable,
                                           GtkConstraintVariable *subject);

void
gtk_constraint_solver_note_removed_variable (GtkConstraintSolver *self,
                                             GtkConstraintVariable *variable,
                                             GtkConstraintVariable *subject);

void
gtk_constraint_solver_clear (GtkConstraintSolver *solver);

char *
gtk_constraint_solver_to_string (GtkConstraintSolver *solver);

G_END_DECLS