#include <gtk/gtk.h>

gchar *format_value(GtkScale *const scale,
	gdouble const value, gpointer const user_data)
{
	return g_strdup_printf("REALLY\nbig\nlabel:\n%f", value);
}


int main(int argc, char **argv)
{
	gtk_init(&argc, &argv);

	GtkWidget *const vscale1 = gtk_scale_new_with_range(
		GTK_ORIENTATION_VERTICAL,
		0, 1234567, 10000
	);
	gtk_scale_set_value_pos(GTK_SCALE(vscale1), GTK_POS_TOP);
	gtk_widget_set_halign(GTK_WIDGET(vscale1), GTK_ALIGN_START);
	gtk_widget_set_vexpand(GTK_WIDGET(vscale1), TRUE);
	gtk_range_set_value(GTK_RANGE(vscale1), 5678);

	GtkWidget *const vscale2 = gtk_scale_new_with_range(
		GTK_ORIENTATION_VERTICAL,
		0, 1234567, 10000
	);
	gtk_scale_set_value_pos(GTK_SCALE(vscale2), GTK_POS_LEFT);
	gtk_widget_set_halign(GTK_WIDGET(vscale2), GTK_ALIGN_START);
	gtk_widget_set_vexpand(GTK_WIDGET(vscale2), TRUE);
	gtk_range_set_value(GTK_RANGE(vscale2), 5678);

	GtkWidget *const hscale1 = gtk_scale_new_with_range(
		GTK_ORIENTATION_HORIZONTAL,
		0, 1234567, 10000
	);
	gtk_scale_set_value_pos(GTK_SCALE(hscale1), GTK_POS_LEFT);
	gtk_widget_set_hexpand(GTK_WIDGET(hscale1), TRUE);
	gtk_range_set_value(GTK_RANGE(hscale1), 54321);

	GtkWidget *const hscale2 = gtk_scale_new_with_range(
		GTK_ORIENTATION_HORIZONTAL,
		0, 1234567, 10000
	);
	gtk_scale_set_value_pos(GTK_SCALE(hscale2), GTK_POS_LEFT);
	g_signal_connect(G_OBJECT(hscale2), "format-value",
		G_CALLBACK(format_value), NULL);
	gtk_widget_set_hexpand(GTK_WIDGET(hscale2), TRUE);
	gtk_range_set_value(GTK_RANGE(hscale2), 999);

	GtkWidget *const hscale3 = gtk_scale_new_with_range(
		GTK_ORIENTATION_HORIZONTAL,
		0, 1234567, 10000
	);
	gtk_scale_set_value_pos(GTK_SCALE(hscale3), GTK_POS_TOP);
	g_signal_connect(G_OBJECT(hscale3), "format-value",
		G_CALLBACK(format_value), NULL);
	gtk_widget_set_hexpand(GTK_WIDGET(hscale3), TRUE);
	gtk_range_set_value(GTK_RANGE(hscale3), 999);

	GtkWidget *const grid = gtk_grid_new();
	gtk_orientable_set_orientation(GTK_ORIENTABLE(grid),
		GTK_ORIENTATION_VERTICAL);
	gtk_container_add(GTK_CONTAINER(grid), vscale1);
	gtk_container_add(GTK_CONTAINER(grid), vscale2);
	gtk_container_add(GTK_CONTAINER(grid), hscale1);
	gtk_container_add(GTK_CONTAINER(grid), hscale2);
	gtk_container_add(GTK_CONTAINER(grid), hscale3);

	GtkWidget *const window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(G_OBJECT(window), "destroy", gtk_main_quit, NULL);
	gtk_window_set_default_size(GTK_WINDOW(window), 500, 500);
        gtk_container_add(GTK_CONTAINER(window), grid);
	gtk_widget_show_all( GTK_WIDGET(window) );

	gtk_main();
	return 0;
}
