CE103 Algorithms and Programming I¶
Week-12 (C/Cpp GUI Programming)¶
Fall Semester, 2021-2022¶
C/Cpp GUI Programming¶
The Microsoft Foundation Class
Visual C++ / MFC Calculator 3 - YouTube
MFC C++ : My videos source code download available now to members - YouTube
GTK 4
Build and run GTK 4 applications with Visual Studio
The GTK Project - A free and open-source cross-platform widget toolkit
// Include gtk
#include <gtk/gtk.h>
static void on_activate (GtkApplication *app) {
// Create a new window
GtkWidget *window = gtk_application_window_new (app);
// Create a new button
GtkWidget *button = gtk_button_new_with_label ("Hello, World!");
// When the button is clicked, close the window passed as an argument
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_close), window);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char *argv[]) {
// Create a new application
GtkApplication *app = gtk_application_new ("com.example.GtkApplication",
G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL);
return g_application_run (G_APPLICATION (app), argc, argv);
}
Last update:
March 25, 2022