Commit 4cabeda1 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko Committed by Adrien Plazas

Add HdyPaginator

Implement a Glade adaptor based on GtkStack one. Add fake "Edit page" and
"Number of pages" properties, and "Insert Page Before", "Insert Page After"
and "Remove Page" actions, similarly to GtkStack.
parent ab34eef8
......@@ -48,6 +48,7 @@
<xi:include href="xml/hdy-header-bar.xml"/>
<xi:include href="xml/hdy-header-group.xml"/>
<xi:include href="xml/hdy-leaflet.xml"/>
<xi:include href="xml/hdy-paginator.xml"/>
<xi:include href="xml/hdy-preferences-group.xml"/>
<xi:include href="xml/hdy-preferences-page.xml"/>
<xi:include href="xml/hdy-preferences-row.xml"/>
......
This diff is collapsed.
/*
* Copyright (C) 2019 Alexander Mikhaylenko <exalm7659@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <gladeui/glade.h>
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
void glade_hdy_paginator_post_create (GladeWidgetAdaptor *adaptor,
GObject *container,
GladeCreateReason reason);
void glade_hdy_paginator_child_action_activate (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *object,
const gchar *action_path);
void glade_hdy_paginator_set_property (GladeWidgetAdaptor *adaptor,
GObject *object,
const gchar *id,
const GValue *value);
void glade_hdy_paginator_get_property (GladeWidgetAdaptor *adaptor,
GObject *object,
const gchar *id,
GValue *value);
gboolean glade_hdy_paginator_verify_property (GladeWidgetAdaptor *adaptor,
GObject *object,
const gchar *id,
const GValue *value);
void glade_hdy_paginator_add_child (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *child);
void glade_hdy_paginator_remove_child (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *child);
void glade_hdy_paginator_replace_child (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *current,
GObject *new_widget);
......@@ -30,6 +30,49 @@
</properties>
</glade-widget-class>
<glade-widget-class name="HdyLeaflet" generic-name="leaflet" title="Leaflet"/>
<glade-widget-class name="HdyPaginator" generic-name="paginator" title="Paginator" since="0.0.11">
<post-create-function>glade_hdy_paginator_post_create</post-create-function>
<add-child-function>glade_hdy_paginator_add_child</add-child-function>
<remove-child-function>glade_hdy_paginator_remove_child</remove-child-function>
<replace-child-function>glade_hdy_paginator_replace_child</replace-child-function>
<child-action-activate-function>glade_hdy_paginator_child_action_activate</child-action-activate-function>
<get-property-function>glade_hdy_paginator_get_property</get-property-function>
<set-property-function>glade_hdy_paginator_set_property</set-property-function>
<verify-function>glade_hdy_paginator_verify_property</verify-function>
<packing-actions>
<action id="insert_page_before" name="Insert Page Before" stock="list-add"/>
<action id="insert_page_after" name="Insert Page After" stock="list-add"/>
<action id="remove_page" name="Remove Page" stock="list-remove"/>
</packing-actions>
<properties>
<property id="pages" name="Number of pages" save="False" default="1">
<parameter-spec>
<type>GParamInt</type>
<min>1</min>
</parameter-spec>
<tooltip>The number of pages in the stack</tooltip>
</property>
<property id="page" name="Edit page" save="False" default="0">
<parameter-spec>
<type>GParamInt</type>
<min>0</min>
</parameter-spec>
<tooltip>Set the currently active page to edit, this property will not be saved</tooltip>
</property>
<property id="indicator-style">
<displayable-values>
<!-- HdyPaginatorIndicatorStyle enumeration value -->
<value id="HDY_PAGINATOR_INDICATOR_STYLE_NONE" name="None"/>
<!-- HdyPaginatorIndicatorStyle enumeration value -->
<value id="HDY_PAGINATOR_INDICATOR_STYLE_DOTS" name="Dots"/>
<!-- HdyPaginatorIndicatorStyle enumeration value -->
<value id="HDY_PAGINATOR_INDICATOR_STYLE_LINES" name="Lines"/>
</displayable-values>
</property>
<property id="above-child" disabled="True" />
<property id="visible-window" disabled="True" />
</properties>
</glade-widget-class>
<glade-widget-class name="HdyPreferencesGroup" generic-name="preferencesgroup" title="Preferences Group" since="0.0.10"/>
<glade-widget-class name="HdyPreferencesPage" generic-name="preferencespage" title="Preferences Page" since="0.0.10">
<properties>
......@@ -57,6 +100,7 @@
<glade-widget-class-ref name="HdyHeaderBar"/>
<glade-widget-class-ref name="HdyHeaderGroup"/>
<glade-widget-class-ref name="HdyLeaflet"/>
<glade-widget-class-ref name="HdyPaginator"/>
<glade-widget-class-ref name="HdyPreferencesGroup"/>
<glade-widget-class-ref name="HdyPreferencesPage"/>
<glade-widget-class-ref name="HdyPreferencesRow"/>
......
......@@ -19,6 +19,7 @@ endif
libglade_hdy_sources = [
'glade-hdy-header-group.c',
'glade-hdy-paginator.c',
]
libglade_hdy_deps = [
......
......@@ -6,6 +6,7 @@
<file preprocess="xml-stripblanks">hdy-dialer.ui</file>
<file preprocess="xml-stripblanks">hdy-dialer-button.ui</file>
<file preprocess="xml-stripblanks">hdy-expander-row.ui</file>
<file preprocess="xml-stripblanks">hdy-paginator.ui</file>
<file preprocess="xml-stripblanks">hdy-preferences-group.ui</file>
<file preprocess="xml-stripblanks">hdy-preferences-page.ui</file>
<file preprocess="xml-stripblanks">hdy-preferences-window.ui</file>
......
......@@ -41,6 +41,7 @@ G_BEGIN_DECLS
#include "hdy-leaflet.h"
#include "hdy-list-box.h"
#include "hdy-main.h"
#include "hdy-paginator.h"
#include "hdy-preferences-group.h"
#include "hdy-preferences-page.h"
#include "hdy-preferences-row.h"
......
......@@ -6,6 +6,7 @@
#include "hdy-fold.h"
#include "hdy-header-bar.h"
#include "hdy-leaflet.h"
#include "hdy-paginator.h"
#include "hdy-squeezer.h"
#include "hdy-view-switcher.h"
......
This diff is collapsed.
/*
* Copyright (C) 2019 Alexander Mikhaylenko <exalm7659@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <gtk/gtk.h>
#include "hdy-enums.h"
G_BEGIN_DECLS
#define HDY_TYPE_PAGINATOR (hdy_paginator_get_type())
G_DECLARE_FINAL_TYPE (HdyPaginator, hdy_paginator, HDY, PAGINATOR, GtkEventBox)
typedef enum {
HDY_PAGINATOR_INDICATOR_STYLE_NONE,
HDY_PAGINATOR_INDICATOR_STYLE_DOTS,
HDY_PAGINATOR_INDICATOR_STYLE_LINES,
} HdyPaginatorIndicatorStyle;
HdyPaginator *hdy_paginator_new (void);
void hdy_paginator_prepend (HdyPaginator *self,
GtkWidget *child);
void hdy_paginator_insert (HdyPaginator *self,
GtkWidget *child,
gint position);
void hdy_paginator_reorder (HdyPaginator *self,
GtkWidget *child,
gint position);
void hdy_paginator_scroll_to (HdyPaginator *self,
GtkWidget *widget);
void hdy_paginator_scroll_to_full (HdyPaginator *self,
GtkWidget *widget,
gint64 duration);
guint hdy_paginator_get_n_pages (HdyPaginator *self);
gdouble hdy_paginator_get_position (HdyPaginator *self);
gboolean hdy_paginator_get_interactive (HdyPaginator *self);
void hdy_paginator_set_interactive (HdyPaginator *self,
gboolean interactive);
HdyPaginatorIndicatorStyle hdy_paginator_get_indicator_style (HdyPaginator *self);
void hdy_paginator_set_indicator_style (HdyPaginator *self,
HdyPaginatorIndicatorStyle style);
guint hdy_paginator_get_indicator_spacing (HdyPaginator *self);
void hdy_paginator_set_indicator_spacing (HdyPaginator *self,
guint spacing);
gboolean hdy_paginator_get_center_content (HdyPaginator *self);
void hdy_paginator_set_center_content (HdyPaginator *self,
gboolean center_content);
guint hdy_paginator_get_spacing (HdyPaginator *self);
void hdy_paginator_set_spacing (HdyPaginator *self,
guint spacing);
guint hdy_paginator_get_animation_duration (HdyPaginator *self);
void hdy_paginator_set_animation_duration (HdyPaginator *self,
guint duration);
G_END_DECLS
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="HdyPaginator" parent="GtkEventBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="empty_box">
<property name="visible">False</property>
</object>
</child>
<child>
<object class="HdyPaginatorBox" id="scrolling_box">
<property name="visible">True</property>
<property name="expand">True</property>
<signal name="notify::n-pages" handler="notify_n_pages_cb" swapped="true"/>
<signal name="notify::position" handler="notify_position_cb" swapped="true"/>
<signal name="notify::spacing" handler="notify_spacing_cb" swapped="true"/>
</object>
</child>
<child>
<object class="GtkDrawingArea" id="indicators">
<property name="visible">False</property>
<signal name="draw" handler="draw_indicators_cb" swapped="true"/>
</object>
</child>
</object>
</child>
</template>
<object class="GtkSizeGroup" id="sizegroup">
<property name="mode">both</property>
<widgets>
<widget name="empty_box"/>
<widget name="indicators"/>
</widgets>
</object>
</interface>
......@@ -11,6 +11,7 @@ hdy_enum_headers = ['hdy-arrows.h',
'hdy-fold.h',
'hdy-header-bar.h',
'hdy-leaflet.h',
'hdy-paginator.h',
'hdy-squeezer.h',
'hdy-view-switcher.h',
]
......@@ -76,6 +77,7 @@ src_headers = [
'hdy-leaflet.h',
'hdy-list-box.h',
'hdy-main.h',
'hdy-paginator.h',
'hdy-preferences-group.h',
'hdy-preferences-page.h',
'hdy-preferences-row.h',
......@@ -118,6 +120,7 @@ src_sources = [
'hdy-leaflet.c',
'hdy-list-box.c',
'hdy-main.c',
'hdy-paginator.c',
'hdy-paginator-box.c',
'hdy-preferences-group.c',
'hdy-preferences-page.c',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment