#include <gtk/gtk.h>

int main (int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *box;
  GtkWidget *box2;
  GtkWidget *frame;
  GtkWidget *scale;
  GIcon *icon;
  gdouble marks[3] = { 0.0, 50.0, 100.0 };
  const gchar *labels[3] = { 
    "<small>Left</small>", 
    "<small>Middle</small>", 
    "<small>Right</small>" 
  };

  gdouble bath_marks[4] = { 0.0, 33.3, 66.6, 100.0 };
  const gchar *bath_labels[4] = { 
    "<span color='blue' size='small'>Cold</span>", 
    "<span size='small'>Baby bath</span>", 
    "<span size='small'>Hot tub</span>", 
    "<span color='Red' size='small'>Hot</span>" 
  };

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Ranges with marks");
  box = gtk_vbox_new (FALSE, 5);

#if 1
  frame = gtk_frame_new ("No marks");
  scale = gtk_hscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

  frame = gtk_frame_new ("Simple marks");
  scale = gtk_hscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_BOTTOM);
  gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM);
  gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
 
  frame = gtk_frame_new ("Labeled marks");
  scale = gtk_hscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[0], GTK_POS_BOTTOM, labels[0]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, labels[1]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, labels[2]);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
  
  frame = gtk_frame_new ("Some labels");
  scale = gtk_hscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[0], GTK_POS_BOTTOM, labels[0]);
  gtk_scale_add_mark      (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, labels[2]);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
  
  frame = gtk_frame_new ("Above and below");
  scale = gtk_hscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[0], GTK_POS_TOP, bath_labels[0]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[1], GTK_POS_BOTTOM, bath_labels[1]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[2], GTK_POS_BOTTOM, bath_labels[2]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[3], GTK_POS_TOP, bath_labels[3]);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

  frame = gtk_frame_new ("Icons");
  scale = gtk_hscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  icon = g_themed_icon_new (GTK_STOCK_ABOUT);
  gtk_scale_add_mark_icon (GTK_SCALE (scale), 20.0, GTK_POS_BOTTOM, icon);
  g_object_unref (icon);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
#endif

#if 1
  box2 = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (box), box2, TRUE, TRUE, 0);

  frame = gtk_frame_new ("No marks");
  scale = gtk_vscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);

  frame = gtk_frame_new ("Simple marks");
  scale = gtk_vscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_LEFT);
  gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_LEFT);
  gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_LEFT);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
 
  frame = gtk_frame_new ("Labeled marks");
  scale = gtk_vscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[0], GTK_POS_LEFT, labels[0]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[1], GTK_POS_LEFT, labels[1]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[2], GTK_POS_LEFT, labels[2]);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
  
  frame = gtk_frame_new ("Some labels");
  scale = gtk_vscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[0], GTK_POS_LEFT, labels[0]);
  gtk_scale_add_mark      (GTK_SCALE (scale), marks[1], GTK_POS_LEFT);
  gtk_scale_add_mark_text (GTK_SCALE (scale), marks[2], GTK_POS_LEFT, labels[2]);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
  
  frame = gtk_frame_new ("Right and left");
  scale = gtk_vscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[0], GTK_POS_RIGHT, bath_labels[0]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[1], GTK_POS_LEFT, bath_labels[1]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[2], GTK_POS_LEFT, bath_labels[2]);
  gtk_scale_add_mark_text (GTK_SCALE (scale), bath_marks[3], GTK_POS_RIGHT, bath_labels[3]);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);

  frame = gtk_frame_new ("Icons");
  scale = gtk_vscale_new_with_range (0, 100, 1);
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
  icon = g_themed_icon_new (GTK_STOCK_ABOUT);
  gtk_scale_add_mark_icon (GTK_SCALE (scale), 20.0, GTK_POS_LEFT, icon);
  g_object_unref (icon);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
#endif

  gtk_container_add (GTK_CONTAINER (window), box);
  gtk_widget_show_all (window);


  gtk_main ();

  return 0;
}


