36 lines
1022 B
C
36 lines
1022 B
C
#include <gtk/gtk.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
GtkWidget *window;
|
|
GtkWidget *button;
|
|
GtkWidget *halign;
|
|
|
|
gtk_init(&argc, &argv);
|
|
|
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
gtk_window_set_title(GTK_WINDOW(window), "Tooltip");
|
|
gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);
|
|
|
|
/*set border space around the edges of the window*/
|
|
gtk_container_set_border_width(GTK_CONTAINER(window), 15);
|
|
|
|
button = gtk_button_new_with_label("Button");
|
|
|
|
/*set tooltop for widget*/
|
|
gtk_widget_set_tooltip_text(button, "Button widget");
|
|
|
|
/*source:https://stackoverflow.com/questions/58746046/alternative-to-deprecated-gtk-alignment-new*/
|
|
gtk_widget_set_halign (button, GTK_ALIGN_START);
|
|
gtk_widget_set_valign (button, GTK_ALIGN_START);
|
|
|
|
gtk_container_add(GTK_CONTAINER(window), button);
|
|
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
|
|
|
/*flat the container to show all widgets at once*/
|
|
gtk_widget_show_all(window);
|
|
gtk_main();
|
|
|
|
return 0;
|
|
}
|