Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pellegrino Prevete
libhandy
Commits
a4c36c19
Commit
a4c36c19
authored
Oct 26, 2018
by
Adrien Plazas
Committed by
Guido Gunther
Nov 27, 2018
Browse files
arrow: Use a measure() method
This will simplify porting to GTK+ 4.
parent
809be537
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/hdy-arrows.c
View file @
a4c36c19
...
...
@@ -344,40 +344,49 @@ hdy_arrows_get_property (GObject *object,
}
/* This private method is prefixed by the call name because it will be a virtual
* method in GTK+ 4.
*/
static
void
get_preferred_width
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
)
hdy_arrows_measure
(
GtkWidget
*
widget
,
GtkOrientation
orientation
,
int
for_size
,
int
*
minimum
,
int
*
natural
,
int
*
minimum_baseline
,
int
*
natural_baseline
)
{
HdyArrows
*
self
=
HDY_ARROWS
(
widget
);
HdyArrowsPrivate
*
priv
=
hdy_arrows_get_instance_private
(
self
);
guint
thickness
,
facter
;
if
(
priv
->
direction
==
HDY_ARROWS_DIRECTION_LEFT
||
priv
->
direction
==
HDY_ARROWS_DIRECTION_RIGHT
)
facter
=
2
;
else
facter
=
3
;
guint
thickness
,
facter
,
size
;
thickness
=
get_thickness
(
self
);
*
minimum
=
*
natural
=
thickness
*
priv
->
count
*
facter
;
facter
=
priv
->
direction
==
HDY_ARROWS_DIRECTION_LEFT
||
priv
->
direction
==
HDY_ARROWS_DIRECTION_RIGHT
?
2
:
3
;
size
=
thickness
*
priv
->
count
*
facter
;
if
(
minimum
)
*
minimum
=
size
;
if
(
natural
)
*
natural
=
size
;
}
static
void
get_preferred_
height
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
)
get_preferred_
width
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
)
{
HdyArrows
*
self
=
HDY_ARROWS
(
widget
);
HdyArrowsPrivate
*
priv
=
hdy_arrows_get_instance_private
(
self
);
guint
thickness
,
facter
;
thickness
=
get_thickness
(
self
);
hdy_arrows_measure
(
widget
,
GTK_ORIENTATION_HORIZONTAL
,
0
,
minimum
,
natural
,
NULL
,
NULL
);
}
if
(
priv
->
direction
==
HDY_ARROWS_DIRECTION_UP
||
priv
->
direction
==
HDY_ARROWS_DIRECTION_DOWN
)
facter
=
3
;
else
facter
=
2
;
*
minimum
=
*
natural
=
thickness
*
priv
->
count
*
facter
;
static
void
get_preferred_height
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
)
{
hdy_arrows_measure
(
widget
,
GTK_ORIENTATION_HORIZONTAL
,
0
,
minimum
,
natural
,
NULL
,
NULL
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment