Advertisement
palmerstone

Gtk scale

Nov 25th, 2011
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <time.h>
  2. #include <cairo.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <windows.h>
  6. #include <gtk/gtk.h>
  7. #include <gdk/gdk.h>
  8. #include <gtk/gtkscale.h>
  9. #include <gtk/gtkvscale.h>
  10. #include <gtk/gtkvscale.h>
  11. #include <gdk/gdkkeysyms.h>
  12. #include <gdk-pixbuf/gdk-pixbuf.h>
  13.  
  14. int width, height;
  15. GtkWindow *window;
  16. GtkWidget *scale, *frame;
  17.  
  18. int main(int argc, char *argv[])
  19. {
  20. gtk_init(&argc, &argv);
  21. width = gdk_screen_width();
  22. height = gdk_screen_height();
  23.  
  24. window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  25. gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
  26. gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_NONE);
  27. gtk_widget_set_size_request(GTK_WIDGET(window), width, height);
  28. gtk_window_set_title(GTK_WINDOW(window), "Nanana");
  29. frame = gtk_fixed_new();
  30. scale = gtk_vscale_new_with_range(0, 100, 1);
  31. gtk_widget_set_size_request(scale, 100, 100);
  32. gtk_scale_set_draw_value (GTK_SCALE(scale), TRUE);
  33. gtk_scale_set_value_pos (GTK_SCALE(scale), GTK_POS_RIGHT);
  34. gtk_fixed_put(GTK_FIXED(frame), GTK_WIDGET(scale), 500, 300);
  35. gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(frame));
  36.  
  37. g_signal_connect(G_OBJECT(window), "delete-event",G_CALLBACK(gtk_main_quit), NULL);
  38. gtk_widget_show_all(GTK_WIDGET(window));
  39. gtk_main();
  40.  
  41. return 0x0;
  42. }
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement