[libhandy] deck: Add get_adjacent_child()



commit 77477ff6c3217a3c185383a1298da338baa76463
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Jun 2 00:17:29 2020 +0500

    deck: Add get_adjacent_child()
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/275
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 src/hdy-deck.c | 22 ++++++++++++++++++++++
 src/hdy-deck.h |  2 ++
 2 files changed, 24 insertions(+)
---
diff --git a/src/hdy-deck.c b/src/hdy-deck.c
index ef435b2a..8fcdd48f 100644
--- a/src/hdy-deck.c
+++ b/src/hdy-deck.c
@@ -463,6 +463,28 @@ hdy_deck_get_can_swipe_forward (HdyDeck *self)
   return hdy_stackable_box_get_can_swipe_forward (HDY_GET_HELPER (self));
 }
 
+/**
+ * hdy_deck_get_adjacent_child
+ * @self: a #HdyDeck
+ * @direction: the direction
+ *
+ * Gets the previous or next child, or %NULL if it doesn't exist. This will be
+ * the same widget hdy_deck_navigate() will navigate to.
+ *
+ * Returns: (nullable) (transfer none): the previous or next child, or
+ *   %NULL if it doesn't exist.
+ *
+ * Since: 1.0
+ */
+GtkWidget *
+hdy_deck_get_adjacent_child (HdyDeck                *self,
+                             HdyNavigationDirection  direction)
+{
+  g_return_val_if_fail (HDY_IS_DECK (self), NULL);
+
+  return hdy_stackable_box_get_adjacent_child (HDY_GET_HELPER (self), direction);
+}
+
 /**
  * hdy_deck_navigate
  * @self: a #HdyDeck
diff --git a/src/hdy-deck.h b/src/hdy-deck.h
index 725bf768..99c9dc75 100644
--- a/src/hdy-deck.h
+++ b/src/hdy-deck.h
@@ -65,6 +65,8 @@ gboolean         hdy_deck_get_can_swipe_forward (HdyDeck *self);
 void             hdy_deck_set_can_swipe_forward (HdyDeck  *self,
                                                  gboolean  can_swipe_forward);
 
+GtkWidget       *hdy_deck_get_adjacent_child (HdyDeck                *self,
+                                              HdyNavigationDirection  direction);
 gboolean         hdy_deck_navigate (HdyDeck                *self,
                                     HdyNavigationDirection  direction);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]