diff --git a/GCR_CMake b/GCR_CMake index c39fdec..b5a7fe5 160000 --- a/GCR_CMake +++ b/GCR_CMake @@ -1 +1 @@ -Subproject commit c39fdece33041c8028acc6cb90455019c35dae17 +Subproject commit b5a7fe5719ed0df8998b2ba961e09d967a385ec6 diff --git a/Gtk4/gtk114_UI4_test/.vscode/settings.json b/Gtk4/gtk114_UI4_test/.vscode/settings.json new file mode 100644 index 0000000..b4d8c35 --- /dev/null +++ b/Gtk4/gtk114_UI4_test/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" +} \ No newline at end of file diff --git a/Gtk4/gtk114_UI4_test/CMakeLists.txt b/Gtk4/gtk114_UI4_test/CMakeLists.txt new file mode 100644 index 0000000..9167335 --- /dev/null +++ b/Gtk4/gtk114_UI4_test/CMakeLists.txt @@ -0,0 +1,39 @@ +set(CMAKE_CXX_STANDARD 17) +cmake_minimum_required(VERSION 3.0.0) +project(gtk114 VERSION 1.0.0) + +include(CTest) +enable_testing() + +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) + +include(CPack) +include_directories(.) +include_directories(..) + +find_package (PkgConfig REQUIRED) +pkg_check_modules (GTK4 REQUIRED gtk4) +include_directories (${GTK4_INCLUDE_DIRS}) +link_directories (${GTK4_LIBRARY_DIRS}) + +set(SOURCES src/main.cpp) + +# Step 4:Add the resource to compile list and compile +if(WIN32) + set(app_WINRC icon.rc) + set_property(SOURCE icon.rc APPEND PROPERTY + OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/icon.ico + ) + add_executable(${PROJECT_NAME} WIN32 ${app_WINRC} ${SOURCES} ${RESOURCE_FILE}) +else() + add_executable(${PROJECT_NAME} ${SOURCES} ${RESOURCE_FILE}) +endif(WIN32) + +#Add command to generate .gitignore +add_custom_command(TARGET ${PROJECT_NAME} + COMMAND echo \"*\" > ${CMAKE_BINARY_DIR}/.gitignore + COMMAND echo \"**/*\" > ${CMAKE_BINARY_DIR}/.hgignore) + +SET (CMAKE_EXTRA_CXX_FLAGS ${GTK4_CFLAGS_OTHER}) +target_link_libraries (${PROJECT_NAME} ${GTK4_LIBRARIES} -lpthread -lm) diff --git a/Gtk4/gtk114_UI4_test/src/main.cpp b/Gtk4/gtk114_UI4_test/src/main.cpp new file mode 100644 index 0000000..3c0d49a --- /dev/null +++ b/Gtk4/gtk114_UI4_test/src/main.cpp @@ -0,0 +1,38 @@ +#include + +static void btnstate_clicked(GtkWidget * widget,gpointer data){ + GdkSurface * surface = gtk_native_get_surface(GTK_NATIVE(data)); + GdkToplevelState state = gdk_toplevel_get_state(GDK_TOPLEVEL(surface)); + g_print("%d",state); +} + +static void gtkmain(GtkApplication * app,gpointer user_data){ + GtkWidget * window, * vbox, * label_state, * btn_state; + //Initalize Window + window = gtk_application_window_new(app); + gtk_window_set_icon_name(GTK_WINDOW(window),"org.gtk.daleclack"); + gtk_window_set_default_size(GTK_WINDOW(window),300,200); + + GtkWidget * win = gtk_window_new(); + + //Add Widgets + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,5); + gtk_widget_set_halign(vbox,GTK_ALIGN_CENTER); + gtk_widget_set_valign(vbox,GTK_ALIGN_CENTER); + label_state = gtk_label_new(""); + gtk_box_append(GTK_BOX(vbox),label_state); + btn_state = gtk_button_new_with_label("Get Window State"); + g_signal_connect(btn_state,"clicked",G_CALLBACK(btnstate_clicked),win); + gtk_box_append(GTK_BOX(vbox),btn_state); + + gtk_window_set_child(GTK_WINDOW(window),vbox); + gtk_widget_show(window); + gtk_widget_show(win); +} + +int main(int argc,char **argv){ + GtkApplication * app; + app = gtk_application_new("org.gtk.daleclack",G_APPLICATION_NON_UNIQUE); + g_signal_connect(app,"activate",G_CALLBACK(gtkmain),NULL); + return g_application_run(G_APPLICATION(app),argc,argv); +} \ No newline at end of file diff --git a/cpp/algorithms/problem1.cpp b/cpp/algorithms/problem1.cpp new file mode 100644 index 0000000..e69de29