Top | ![]() |
![]() |
![]() |
![]() |
GtkWidget * | content | Read / Write |
GtkWidget * | flap | Read / Write |
GtkPackType | flap-position | Read / Write |
guint | fold-duration | Read / Write |
HdyFlapFoldPolicy | fold-policy | Read / Write |
gboolean | folded | Read |
gboolean | locked | Read / Write |
gboolean | modal | Read / Write |
guint | reveal-duration | Read / Write |
gboolean | reveal-flap | Read / Write |
double | reveal-progress | Read |
GtkWidget * | separator | Read / Write |
gboolean | swipe-to-close | Read / Write |
gboolean | swipe-to-open | Read / Write |
HdyFlapTransitionType | transition-type | Read / Write |
HdyFlap implements AtkImplementorIface, GtkBuildable, GtkOrientable and HdySwipeable.
The HdyFlap widget can display its children like a GtkBox does or like a GtkOverlay does, according to the “fold-policy” value.
HdyFlap has at most three children: “content”, “flap” and
“separator”. Content is the primary child, flap is displayed next to
it when unfolded, or overlays it when folded. Flap can be shown or hidden by
changing the “reveal-flap” value, as well as via swipe gestures if
“swipe-to-open” and/or “swipe-to-close” are set to TRUE
.
Optionally, a separator can be provided, which would be displayed between the content and the flap when there's no shadow to separate them, depending on the transition type.
“flap” is transparent by default; add the .background style class to it if this is unwanted.
If “modal” is set to TRUE
, content becomes completely inaccessible
when the flap is revealed when folded.
The position of the flap and separator children relative to the content is determined by orientation, as well as “flap-position” value.
Folding the flap will automatically hide the flap widget, and unfolding it will automatically reveal it. If this behavior is not desired, the “locked” property can be used to override it.
Common use cases include sidebars, header bars that need to be able to overlap the window content (for example, in fullscreen mode) and bottom sheets.
The HdyFlap implementation of the GtkBuildable interface supports setting the flap child by specifying “flap” as the “type” attribute of a <child> element, and separator by specifying “separator”. Specifying “content” child type or omitting it results in setting the content child.
HdyFlap has a single CSS node with name flap. The node will get the style classes .folded when it is folded, and .unfolded when it's not.
GtkWidget *
hdy_flap_get_content (HdyFlap *self
);
Gets the content widget for self
Since: 1.2
void hdy_flap_set_content (HdyFlap *self
,GtkWidget *content
);
Sets the content widget for self
, always displayed when unfolded, and
partially visible when folded.
Since: 1.2
GtkWidget *
hdy_flap_get_flap (HdyFlap *self
);
Gets the flap widget for self
Since: 1.2
void hdy_flap_set_flap (HdyFlap *self
,GtkWidget *flap
);
Sets the flap widget for self
, only visible when “reveal-progress” is
greater than 0.
Since: 1.2
GtkWidget *
hdy_flap_get_separator (HdyFlap *self
);
Gets the separator widget for self
.
Since: 1.2
void hdy_flap_set_separator (HdyFlap *self
,GtkWidget *separator
);
Sets the separator widget for self
, displayed between content and flap when
there's no shadow to display. When exactly it's visible depends on the
“transition-type” value. If NULL
, no separator will be used.
Since: 1.2
GtkPackType
hdy_flap_get_flap_position (HdyFlap *self
);
Gets the flap position for self
.
Since: 1.2
void hdy_flap_set_flap_position (HdyFlap *self
,GtkPackType position
);
Sets the flap position for self
. If GTK_PACK_START
, the flap is displayed
before the content, if GTK_PACK_END
, it's displayed after the content.
Since: 1.2
gboolean
hdy_flap_get_reveal_flap (HdyFlap *self
);
Gets whether the flap widget is revealed for self
.
Since: 1.2
void hdy_flap_set_reveal_flap (HdyFlap *self
,gboolean reveal_flap
);
Sets whether the flap widget is revealed for self
.
Since: 1.2
guint
hdy_flap_get_reveal_duration (HdyFlap *self
);
Returns the amount of time (in milliseconds) that reveal transitions in self
will take.
Since: 1.2
void hdy_flap_set_reveal_duration (HdyFlap *self
,guint duration
);
Sets the duration that reveal transitions in self
will take.
Since: 1.2
gdouble
hdy_flap_get_reveal_progress (HdyFlap *self
);
Gets the current reveal transition progress for self
. 0 means fully hidden,
1 means fully revealed. See “reveal-flap”.
Since: 1.2
HdyFlapFoldPolicy
hdy_flap_get_fold_policy (HdyFlap *self
);
Gets the current fold policy of self
. See hdy_flap_set_fold_policy()
.
Since: 1.2
void hdy_flap_set_fold_policy (HdyFlap *self
,HdyFlapFoldPolicy policy
);
Sets the current fold policy for self
. See HdyFlapFoldPolicy for available
policies.
Since: 1.2
guint
hdy_flap_get_fold_duration (HdyFlap *self
);
Returns the amount of time (in milliseconds) that fold transitions in self
will take.
Since: 1.2
void hdy_flap_set_fold_duration (HdyFlap *self
,guint duration
);
Sets the duration that fold transitions in self
will take.
Since: 1.2
gboolean
hdy_flap_get_folded (HdyFlap *self
);
Gets whether self
is currently folded.
See “fold-policy”.
Since: 1.2
gboolean
hdy_flap_get_locked (HdyFlap *self
);
Gets whether self
is locked.
Since: 1.2
void hdy_flap_set_locked (HdyFlap *self
,gboolean locked
);
Sets whether self
is locked.
If FALSE
, folding self
when the flap is revealed automatically closes it,
and unfolding it when the flap is not revealed opens it. If TRUE
,
“reveal-flap” value never changes on its own.
Since: 1.2
HdyFlapTransitionType
hdy_flap_get_transition_type (HdyFlap *self
);
Gets the type of animation that will be used for reveal and fold transitions
in self
.
Since: 1.2
void hdy_flap_set_transition_type (HdyFlap *self
,HdyFlapTransitionType transition_type
);
Sets the type of animation that will be used for reveal and fold transitions
in self
.
“flap” is transparent by default, which means the content will be seen
through it with HDY_FLAP_TRANSITION_TYPE_OVER
transitions; add the
.background style class to it if this is unwanted.
Since: 1.2
gboolean
hdy_flap_get_modal (HdyFlap *self
);
Gets whether the self
is modal. See hdy_flap_set_modal()
.
Since: 1.2
void hdy_flap_set_modal (HdyFlap *self
,gboolean modal
);
Sets whether the self
can be closed with a click.
If modal
is TRUE
, clicking the content widget while flap is revealed, or
pressing Escape key, will close the flap. If FALSE
, clicks are passed
through to the content widget.
Since: 1.2
gboolean
hdy_flap_get_swipe_to_open (HdyFlap *self
);
Gets whether self
can be opened with a swipe gesture.
Since: 1.2
void hdy_flap_set_swipe_to_open (HdyFlap *self
,gboolean swipe_to_open
);
Sets whether self
can be opened with a swipe gesture.
The area that can be swiped depends on the “transition-type” value.
Since: 1.2
gboolean
hdy_flap_get_swipe_to_close (HdyFlap *self
);
Gets whether self
can be closed with a swipe gesture.
Since: 1.2
void hdy_flap_set_swipe_to_close (HdyFlap *self
,gboolean swipe_to_close
);
Sets whether self
can be closed with a swipe gesture.
The area that can be swiped depends on the “transition-type” value.
Since: 1.2
These enumeration values describe the possible folding behavior in a HdyFlap widget.
Since: 1.2
These enumeration values describe the possible transitions between children in a HdyFlap widget, as well as which areas can be swiped via “swipe-to-open” and “swipe-to-close”.
New values may be added to this enum over time.
The flap slides over the content, which is dimmed. When folded, only the flap can be swiped. |
||
The content slides over the flap. Only the content can be swiped. |
||
The flap slides offscreen when hidden, neither the flap nor content overlap each other. Both widgets can be swiped. |
Since: 1.2
“content”
property“content” GtkWidget *
The content widget, always displayed when unfolded, and partially visible when folded.
Owner: HdyFlap
Flags: Read / Write
Since: 1.2
“flap”
property“flap” GtkWidget *
The flap widget, only visible when “reveal-progress” is greater than 0.
Owner: HdyFlap
Flags: Read / Write
Since: 1.2
“flap-position”
property“flap-position” GtkPackType
The flap position for self
. If GTK_PACK_START
, the flap is displayed
before the content, if GTK_PACK_END
, it's displayed after the content.
Owner: HdyFlap
Flags: Read / Write
Default value: GTK_PACK_START
Since: 1.2
“fold-duration”
property“fold-duration” guint
The fold transition animation duration, in milliseconds.
Owner: HdyFlap
Flags: Read / Write
Allowed values: <= G_MAXINT
Default value: 250
Since: 1.2
“fold-policy”
property“fold-policy” HdyFlapFoldPolicy
The current fold policy. See HdyFlapFoldPolicy for available policies.
Owner: HdyFlap
Flags: Read / Write
Default value: HDY_FLAP_FOLD_POLICY_AUTO
Since: 1.2
“folded”
property“folded” gboolean
Whether the flap is currently folded.
See “fold-policy”.
Owner: HdyFlap
Flags: Read
Default value: FALSE
Since: 1.2
“locked”
property“locked” gboolean
Whether the flap is locked.
If FALSE
, folding when the flap is revealed automatically closes it, and
unfolding it when the flap is not revealed opens it. If TRUE
,
“reveal-flap” value never changes on its own.
Owner: HdyFlap
Flags: Read / Write
Default value: FALSE
Since: 1.2
“modal”
property“modal” gboolean
Whether the flap is modal.
If TRUE
, clicking the content widget while flap is revealed, as well as
pressing Escape key, will close the flap. If FALSE
, clicks are passed
through to the content widget.
Owner: HdyFlap
Flags: Read / Write
Default value: TRUE
Since: 1.2
“reveal-duration”
property“reveal-duration” guint
The reveal transition animation duration, in milliseconds.
Owner: HdyFlap
Flags: Read / Write
Allowed values: <= G_MAXINT
Default value: 250
Since: 1.2
“reveal-flap”
property“reveal-flap” gboolean
Whether the flap widget is revealed.
Owner: HdyFlap
Flags: Read / Write
Default value: TRUE
Since: 1.2
“reveal-progress”
property “reveal-progress” double
The current reveal transition progress. 0 means fully hidden, 1 means fully revealed See “reveal-flap”.
Owner: HdyFlap
Flags: Read
Allowed values: [0,1]
Default value: 1
Since: 1.2
“separator”
property“separator” GtkWidget *
The separator widget, displayed between content and flap when there's no
shadow to display. When exactly it's visible depends on the
“transition-type” value. If NULL
, no separator will be used.
Owner: HdyFlap
Flags: Read / Write
Since: 1.2
“swipe-to-close”
property“swipe-to-close” gboolean
Whether the flap can be closed with a swipe gesture.
The area that can be swiped depends on the “transition-type” value.
Owner: HdyFlap
Flags: Read / Write
Default value: TRUE
Since: 1.2
“swipe-to-open”
property“swipe-to-open” gboolean
Whether the flap can be opened with a swipe gesture.
The area that can be swiped depends on the “transition-type” value.
Owner: HdyFlap
Flags: Read / Write
Default value: TRUE
Since: 1.2
“transition-type”
property“transition-type” HdyFlapTransitionType
The type of animation that will be used for reveal and fold transitions
in self
.
“flap” is transparent by default, which means the content will be
seen through it with HDY_FLAP_TRANSITION_TYPE_OVER
transitions; add the
.background style class to it if this is unwanted.
Owner: HdyFlap
Flags: Read / Write
Default value: HDY_FLAP_TRANSITION_TYPE_OVER
Since: 1.2