1.1 KiB
1.1 KiB
GTK Fixed
Same as box, with difference ie in box size of widget depends on window but here in fixed size is fixed.
#include <gtk/gtk.h>
#include <stdio.h>
int main(int argc, char **argv) {
gtk_init(&argc, &argv);
int b = 13;
int a = 10;
printf("hey");
GtkWidget *window;
GtkWidget *fixed;
GtkWidget *button1;
GtkWidget *button2;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);
fixed = gtk_fixed_new();
button1 = gtk_button_new_with_label("button1");
button2 = gtk_button_new_with_label("button2");
// para: fixed widget,widget inside it, xCor,yCor
gtk_fixed_put(GTK_FIXED(fixed), button1, 100, 50);
gtk_fixed_put(GTK_FIXED(fixed), button2, 200, 100);
// para: same with gtk_fixed_put but instead of adding widget it changes
// coordinates
gtk_fixed_move(GTK_FIXED(fixed), button1, 200, 100);
gtk_fixed_move(GTK_FIXED(fixed), button2, 100, 50);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_container_add(GTK_CONTAINER(window), fixed);
gtk_widget_show_all(window);
gtk_main();
return 0;
}