Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gtk-3.0\gtk\gtk.h>
- static void destroy(GtkWidget *widget, gpointer data)
- {
- gtk_main_quit();
- }
- static void button_clicked(GtkWidget *button, gpointer data)
- {
- g_print("Button clicked\n");
- }
- int main(int argc, char *argv[])
- {
- GtkWidget *window;
- GtkWidget *area;
- GtkWidget *button;
- GtkWidget *label;
- GtkWidget *textview;
- GtkTextBuffer *textbuffer;
- GtkWidget *icon;
- gtk_init(&argc, &argv);
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_icon_from_file(GTK_WINDOW(window), "bu.ICO", NULL);
- gtk_widget_set_size_request(window, 528, 184);
- gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ALWAYS);
- gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
- g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL);
- area = gtk_fixed_new ();
- gtk_container_add(GTK_CONTAINER (window), area);
- label = gtk_label_new("Dossier source : ");
- //myPangoF = "sans bold 12";
- GtkStyle *style = gtk_widget_get_style(label);
- pango_font_description_set_weight(style->font_desc, PANGO_WEIGHT_BOLD);
- pango_font_description_set_size(style->font_desc, 20);
- gtk_widget_modify_font(label, style->font_desc);
- //gtk_widget_modify_font(label, pango_font_description_from_string("Monospace 12"));
- gtk_fixed_put(GTK_FIXED(area), label, 8, 5);
- gtk_widget_set_size_request(label, 150, 30);
- textbuffer = gtk_text_buffer_new(NULL);
- gtk_text_buffer_set_text(textbuffer, "C:\\Users\\mjolly", -1);
- textview = gtk_text_view_new_with_buffer(textbuffer);
- gtk_fixed_put(GTK_FIXED(area), textview, 170, 12);
- gtk_widget_set_size_request(textview, 180, 18);
- button = gtk_button_new();
- icon = gtk_image_new_from_file("folder.ICO");
- g_signal_connect(GTK_BUTTON(button), "clicked", G_CALLBACK(button_clicked), NULL);
- gtk_fixed_put(GTK_FIXED(area), button, 380, 8);
- gtk_button_set_image(GTK_BUTTON(button), icon);
- gtk_widget_set_size_request(textview, 30, 30);
- gtk_widget_show_all(window);
- gtk_main();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement