1 /*
2  * Copyright © 2019 Benjamin Otte
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Authors: Benjamin Otte <otte@gnome.org>
18  */
19 
20 #ifndef __GTK_LIST_BASE_PRIVATE_H__
21 #define __GTK_LIST_BASE_PRIVATE_H__
22 
23 #include "gtklistbase.h"
24 
25 #include "gtklistitemmanagerprivate.h"
26 #include "gtkprivate.h"
27 
28 struct _GtkListBase
29 {
30   GtkWidget parent_instance;
31 };
32 
33 struct _GtkListBaseClass
34 {
35   GtkWidgetClass parent_class;
36 
37   const char *         list_item_name;
38   GtkAccessibleRole    list_item_role;
39   gsize                list_item_size;
40   gsize                list_item_augment_size;
41   GtkRbTreeAugmentFunc list_item_augment_func;
42 
43   void                 (* adjustment_value_changed)             (GtkListBase            *self,
44                                                                  GtkOrientation          orientation);
45   gboolean             (* get_allocation_along)                 (GtkListBase            *self,
46                                                                  guint                   pos,
47                                                                  int                    *offset,
48                                                                  int                    *size);
49   gboolean             (* get_allocation_across)                (GtkListBase            *self,
50                                                                  guint                   pos,
51                                                                  int                    *offset,
52                                                                  int                    *size);
53   gboolean             (* get_position_from_allocation)         (GtkListBase            *self,
54                                                                  int                     across,
55                                                                  int                     along,
56                                                                  guint                  *pos,
57                                                                  cairo_rectangle_int_t  *area);
58   GtkBitset *          (* get_items_in_rect)                    (GtkListBase            *self,
59                                                                  const cairo_rectangle_int_t *rect);
60   guint                (* move_focus_along)                     (GtkListBase            *self,
61                                                                  guint                   pos,
62                                                                  int                     steps);
63   guint                (* move_focus_across)                    (GtkListBase            *self,
64                                                                  guint                   pos,
65                                                                  int                     steps);
66 };
67 
68 GtkOrientation         gtk_list_base_get_orientation            (GtkListBase            *self);
69 #define gtk_list_base_get_opposite_orientation(self) OPPOSITE_ORIENTATION(gtk_list_base_get_orientation(self))
70 guint                  gtk_list_base_get_focus_position         (GtkListBase            *self);
71 GtkListItemManager *   gtk_list_base_get_manager                (GtkListBase            *self);
72 GtkScrollablePolicy    gtk_list_base_get_scroll_policy          (GtkListBase            *self,
73                                                                  GtkOrientation          orientation);
74 guint                  gtk_list_base_get_n_items                (GtkListBase            *self);
75 GtkSelectionModel *    gtk_list_base_get_model                  (GtkListBase            *self);
76 gboolean               gtk_list_base_set_model                  (GtkListBase            *self,
77                                                                  GtkSelectionModel      *model);
78 void                   gtk_list_base_update_adjustments         (GtkListBase            *self,
79                                                                  int                     total_across,
80                                                                  int                     total_along,
81                                                                  int                     page_across,
82                                                                  int                     page_along,
83                                                                  int                    *across,
84                                                                  int                    *along);
85 
86 guint                  gtk_list_base_get_anchor                 (GtkListBase            *self);
87 void                   gtk_list_base_set_anchor                 (GtkListBase            *self,
88                                                                  guint                   anchor_pos,
89                                                                  double                  anchor_align_across,
90                                                                  GtkPackType             anchor_side_across,
91                                                                  double                  anchor_align_along,
92                                                                  GtkPackType             anchor_side_along);
93 void                   gtk_list_base_set_anchor_max_widgets     (GtkListBase            *self,
94                                                                  guint                   n_center,
95                                                                  guint                   n_above_below);
96 void                   gtk_list_base_select_item                (GtkListBase            *self,
97                                                                  guint                   pos,
98                                                                  gboolean                modify,
99                                                                  gboolean                extend);
100 gboolean               gtk_list_base_grab_focus_on_item         (GtkListBase            *self,
101                                                                  guint                   pos,
102                                                                  gboolean                select,
103                                                                  gboolean                modify,
104                                                                  gboolean                extend);
105 
106 void                   gtk_list_base_set_enable_rubberband      (GtkListBase            *self,
107                                                                  gboolean                enable);
108 gboolean               gtk_list_base_get_enable_rubberband      (GtkListBase            *self);
109 void                   gtk_list_base_allocate_rubberband        (GtkListBase            *self);
110 
111 void                   gtk_list_base_size_allocate_child        (GtkListBase            *self,
112                                                                  GtkWidget              *child,
113                                                                  int                     x,
114                                                                  int                     y,
115                                                                  int                     width,
116                                                                  int                     height);
117 
118 #endif /* __GTK_LIST_BASE_PRIVATE_H__ */
119