Commit 14417306 authored by Guido Gunther's avatar Guido Gunther Committed by Gogs

Merge branch 'arrows' of guido.gunther/libhandy into master

parents bd86a1fa d37f19d3
......@@ -6,6 +6,7 @@
</glade-widget-classes>
<glade-widget-group name="handy" title="Libhandy Widgets">
<glade-widget-class-ref name="HdyArrows"/>
<glade-widget-class-ref name="HdyDialer"/>
<glade-widget-class-ref name="HdyLeaflet"/>
</glade-widget-group>
......
......@@ -36,6 +36,7 @@
<chapter id="core-api">
<title>Widgets and Objects</title>
<xi:include href="xml/hdy-arrows.xml"/>
<xi:include href="xml/hdy-dialer.xml"/>
<xi:include href="xml/hdy-dialer-button.xml"/>
<xi:include href="xml/hdy-dialer-cycle-button.xml"/>
......
......@@ -7,6 +7,7 @@ private_headers = [
]
images = [
'images/arrows.png',
'images/dialer.png',
]
......
......@@ -21,6 +21,9 @@
<link linkend="HdyDialer">
<inlinegraphic fileref="dialer.png" format="PNG"></inlinegraphic>
</link>
<link linkend="HdyArrows">
<inlinegraphic fileref="arrows.png" format="PNG"></inlinegraphic>
</link>
</para>
</refsect2>
</refentry>
......@@ -13,6 +13,9 @@ struct _ExampleWindow
GtkStack *stack;
HdyDialer *dialer;
GtkLabel *display;
GtkWidget *arrows;
GtkAdjustment *adj_arrows_count;
GtkAdjustment *adj_arrows_duration;
};
G_DEFINE_TYPE (ExampleWindow, example_window, GTK_TYPE_APPLICATION_WINDOW)
......@@ -104,6 +107,84 @@ symbol_clicked_cb (HdyDialer *dialer,
}
static void
btn_arrows_up_toggled_cb (GtkToggleButton *btn,
ExampleWindow *self)
{
g_assert (GTK_IS_TOGGLE_BUTTON (btn));
g_assert (EXAMPLE_IS_WINDOW (self));
hdy_arrows_set_direction (HDY_ARROWS (self->arrows), HDY_ARROWS_DIRECTION_UP);
hdy_arrows_animate (HDY_ARROWS (self->arrows));
}
static void
btn_arrows_down_toggled_cb (GtkToggleButton *btn,
ExampleWindow *self)
{
g_assert (GTK_IS_TOGGLE_BUTTON (btn));
g_assert (EXAMPLE_IS_WINDOW (self));
hdy_arrows_set_direction (HDY_ARROWS (self->arrows), HDY_ARROWS_DIRECTION_DOWN);
hdy_arrows_animate (HDY_ARROWS (self->arrows));
}
static void
btn_arrows_left_toggled_cb (GtkToggleButton *btn,
ExampleWindow *self)
{
g_assert (GTK_IS_TOGGLE_BUTTON (btn));
g_assert (EXAMPLE_IS_WINDOW (self));
hdy_arrows_set_direction (HDY_ARROWS (self->arrows), HDY_ARROWS_DIRECTION_LEFT);
hdy_arrows_animate (HDY_ARROWS (self->arrows));
}
static void
btn_arrows_right_toggled_cb (GtkToggleButton *btn,
ExampleWindow *self)
{
g_assert (GTK_IS_TOGGLE_BUTTON (btn));
g_assert (EXAMPLE_IS_WINDOW (self));
hdy_arrows_set_direction (HDY_ARROWS (self->arrows), HDY_ARROWS_DIRECTION_RIGHT);
hdy_arrows_animate (HDY_ARROWS (self->arrows));
}
static void
adj_arrows_count_value_changed_cb (GtkAdjustment *adj,
ExampleWindow *self)
{
gdouble count;
g_assert (GTK_IS_ADJUSTMENT (adj));
g_assert (EXAMPLE_IS_WINDOW (self));
count = gtk_adjustment_get_value (adj);
hdy_arrows_set_count (HDY_ARROWS (self->arrows), count);
hdy_arrows_animate (HDY_ARROWS (self->arrows));
}
static void
adj_arrows_duration_value_changed_cb (GtkAdjustment *adj,
ExampleWindow *self)
{
gdouble duration;
g_assert (GTK_IS_ADJUSTMENT (adj));
g_assert (EXAMPLE_IS_WINDOW (self));
duration = gtk_adjustment_get_value (adj);
hdy_arrows_set_duration (HDY_ARROWS (self->arrows), duration);
hdy_arrows_animate (HDY_ARROWS (self->arrows));
}
ExampleWindow *
example_window_new (GtkApplication *application)
{
......@@ -122,6 +203,10 @@ example_window_constructed (GObject *object)
"notify::number",
G_CALLBACK (number_notify_cb),
self);
gtk_adjustment_set_value (self->adj_arrows_count,
hdy_arrows_get_count (HDY_ARROWS (self->arrows)));
gtk_adjustment_set_value (self->adj_arrows_duration,
hdy_arrows_get_duration (HDY_ARROWS (self->arrows)));
}
......@@ -141,6 +226,9 @@ example_window_class_init (ExampleWindowClass *klass)
gtk_widget_class_bind_template_child (widget_class, ExampleWindow, stack);
gtk_widget_class_bind_template_child (widget_class, ExampleWindow, dialer);
gtk_widget_class_bind_template_child (widget_class, ExampleWindow, display);
gtk_widget_class_bind_template_child (widget_class, ExampleWindow, arrows);
gtk_widget_class_bind_template_child (widget_class, ExampleWindow, adj_arrows_count);
gtk_widget_class_bind_template_child (widget_class, ExampleWindow, adj_arrows_duration);
gtk_widget_class_bind_template_callback_full (widget_class, "key_pressed_cb", G_CALLBACK(example_window_key_pressed_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "notify_fold_cb", G_CALLBACK(example_window_notify_fold_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "notify_visible_child_cb", G_CALLBACK(example_window_notify_visible_child_cb));
......@@ -148,6 +236,12 @@ example_window_class_init (ExampleWindowClass *klass)
gtk_widget_class_bind_template_callback_full (widget_class, "submitted_cb", G_CALLBACK(example_window_submitted_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "symbol_clicked_cb", G_CALLBACK(symbol_clicked_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "deleted_cb", G_CALLBACK(deleted_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "btn_arrows_up_toggled_cb", G_CALLBACK(btn_arrows_up_toggled_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "btn_arrows_down_toggled_cb", G_CALLBACK(btn_arrows_down_toggled_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "btn_arrows_left_toggled_cb", G_CALLBACK(btn_arrows_left_toggled_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "btn_arrows_right_toggled_cb", G_CALLBACK(btn_arrows_right_toggled_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "adj_arrows_count_value_changed_cb", G_CALLBACK(adj_arrows_count_value_changed_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "adj_arrows_duration_value_changed_cb", G_CALLBACK(adj_arrows_duration_value_changed_cb));
}
static void
......
This diff is collapsed.
......@@ -26,6 +26,7 @@ G_BEGIN_DECLS
#endif
#include "hdy-version.h"
#include "hdy-arrows.h"
#include "hdy-dialer-button.h"
#include "hdy-dialer-cycle-button.h"
#include "hdy-dialer.h"
......
This diff is collapsed.
/*
* Copyright (C) 2017 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#ifndef HDY_ARROWS_H
#define HDY_ARROWS_H
#if !defined(HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <gtk/gtk.h>
G_BEGIN_DECLS
/**
* HdyArrowsDirection
* @HDY_ARROWS_DIRECTION_UP: Arrows point upwards.
* @HDY_ARROWS_DIRECTION_DOWN: Arrows point to the left.
* @HDY_ARROWS_DIRECTION_LEFT: Arrows point to the right.
* @HDY_ARROWS_DIRECTION_RIGHT: Arrows point downwards
*/
typedef enum
{
HDY_ARROWS_DIRECTION_UP,
HDY_ARROWS_DIRECTION_DOWN,
HDY_ARROWS_DIRECTION_LEFT,
HDY_ARROWS_DIRECTION_RIGHT,
} HdyArrowsDirection;
#define HDY_TYPE_ARROWS (hdy_arrows_get_type())
G_DECLARE_DERIVABLE_TYPE (HdyArrows, hdy_arrows, HDY, ARROWS, GtkDrawingArea)
/**
* HdyArrowsClass:
* @parent_class: The parent class
*/
struct _HdyArrowsClass
{
GtkDrawingAreaClass parent_class;
};
GtkWidget *hdy_arrows_new (void);
guint hdy_arrows_get_count (HdyArrows *self);
void hdy_arrows_set_count (HdyArrows *self,
guint count);
void hdy_arrows_set_direction (HdyArrows *self,
HdyArrowsDirection direction);
HdyArrowsDirection hdy_arrows_get_direction (HdyArrows *self);
void hdy_arrows_set_duration (HdyArrows *self,
guint duration);
guint hdy_arrows_get_duration (HdyArrows *self);
void hdy_arrows_animate (HdyArrows *self);
G_END_DECLS
#endif /* HDY_ARROWS_H */
/*** BEGIN file-header ***/
#include "config.h"
#include "hdy-enums.h"
#include "hdy-arrows.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static GType etype = 0;
if (G_UNLIKELY(etype == 0)) {
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
}
return etype;
}
/*** END value-tail ***/
/*** BEGIN file-tail ***/
/*** END file-tail ***/
/*** BEGIN file-header ***/
#ifndef HDY_ENUMS_H
#define HDY_ENUMS_H
#if !defined(HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <glib-object.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type (void);
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* DZL_ENUMS_H */
/*** END file-tail ***/
......@@ -7,7 +7,7 @@ libhandy_resources = gnome.compile_resources(
c_name: 'hdy',
)
hdy_enum_headers = []
hdy_enum_headers = ['hdy-arrows.h']
version_data = configuration_data()
version_data.set('HDY_MAJOR_VERSION', handy_version_major)
......@@ -33,7 +33,19 @@ libhandy_public_headers = []
libhandy_public_sources = []
libhandy_private_sources = []
hdy_enums = gnome.mkenums('hdy-enums',
h_template: 'hdy-enums.h.in',
c_template: 'hdy-enums.c.in',
sources: hdy_enum_headers,
install_header: true,
install_dir: libhandy_header_dir,
)
libhandy_public_sources += [hdy_enums[0]]
libhandy_generated_headers += [hdy_enums[1]]
src_headers = [
'hdy-arrows.h',
'hdy-dialer-button.h',
'hdy-dialer-cycle-button.h',
'hdy-dialer.h',
......@@ -44,6 +56,7 @@ src_headers = [
src_sources = [
'gtkprogresstracker.c',
'hdy-arrows.c',
'hdy-dialer-button.c',
'hdy-dialer-cycle-button.c',
'hdy-dialer.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