diff --git a/Gtk4/gtk120_music_res/CMakeLists.txt b/Gtk4/gtk120_music_res/CMakeLists.txt index 16e6b96..25bfee4 100644 --- a/Gtk4/gtk120_music_res/CMakeLists.txt +++ b/Gtk4/gtk120_music_res/CMakeLists.txt @@ -1,6 +1,6 @@ set(CMAKE_CXX_STANDARD 17) cmake_minimum_required(VERSION 3.0.0) -project(gtk118 VERSION 1.0.0) +project(gtk120 VERSION 1.0.0) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../GCR_CMake/macros) include(GlibCompileResourcesSupport) diff --git a/Gtkmm3/gtk121_launchpad/.vscode/settings.json b/Gtkmm3/gtk121_launchpad/.vscode/settings.json new file mode 100644 index 0000000..b4d8c35 --- /dev/null +++ b/Gtkmm3/gtk121_launchpad/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" +} \ No newline at end of file diff --git a/Gtkmm3/gtk121_launchpad/CMakeLists.txt b/Gtkmm3/gtk121_launchpad/CMakeLists.txt new file mode 100644 index 0000000..94130d3 --- /dev/null +++ b/Gtkmm3/gtk121_launchpad/CMakeLists.txt @@ -0,0 +1,58 @@ +set(CMAKE_CXX_STANDARD 17) +cmake_minimum_required(VERSION 3.0.0) +project(gtk119 VERSION 1.0.0) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../GCR_CMake/macros) +include(GlibCompileResourcesSupport) + +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 (GTKMM3 REQUIRED gtkmm-3.0) +include_directories (${GTKMM3_INCLUDE_DIRS}) +link_directories (${GTKMM3_LIBRARY_DIRS}) + +#Compile Resource + +set(RESOURCE_LIST + stack.ui) + +compile_gresources(RESOURCE_FILE + XML_OUT + TYPE EMBED_C + RESOURCES ${RESOURCE_LIST} + PREFIX "/org/gtk/daleclack" + SOURCE_DIR ${PROJECT_SOURCE_DIR}/res) + +# Add a custom target to the makefile. Now make builds our resource file. +# It depends on the output RESOURCE_FILE. +add_custom_target(resource ALL DEPENDS ${RESOURCE_FILE}) + +#For win32 platform,use rc resource and .ico icon +if(WIN32) + SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) + 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} src/main.cc src/MyWin.cc ${RESOURCE_FILE}) +else() + add_executable(${PROJECT_NAME} src/main.cc src/MyWin.cc ${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 ${GTKMM3_CFLAGS_OTHER}) +target_link_libraries (${PROJECT_NAME} ${GTKMM3_LIBRARIES} -lpthread) diff --git a/Gtkmm3/gtk121_launchpad/res/stack.ui b/Gtkmm3/gtk121_launchpad/res/stack.ui new file mode 100644 index 0000000..8b19fc9 --- /dev/null +++ b/Gtkmm3/gtk121_launchpad/res/stack.ui @@ -0,0 +1,112 @@ + + + + + + False + 440 + 250 + + + True + False + crossfade + + + + True + False + + + Go + True + True + True + + + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + page0 + page0 + + + + + + True + False + + + back + True + True + True + + + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + page1 + page1 + 1 + + + + + + diff --git a/Gtkmm3/gtk121_launchpad/src/MyWin.cc b/Gtkmm3/gtk121_launchpad/src/MyWin.cc new file mode 100644 index 0000000..342479e --- /dev/null +++ b/Gtkmm3/gtk121_launchpad/src/MyWin.cc @@ -0,0 +1,36 @@ +#include "MyWin.hh" + +MyWin *MyWin::create() +{ + MyWin *win = nullptr; + + auto builder1 = Gtk::Builder::create_from_resource("/org/gtk/daleclack/stack.ui"); + builder1->get_widget_derived("window", win); + win->set_icon_name("org.gtk.daleclack"); + + return win; +} + +MyWin::MyWin(BaseObjectType *cobject, const Glib::RefPtr &builder) + : Gtk::Window(cobject), + ref_builder(builder) +{ + //Get Widgets + ref_builder->get_widget("btn_go",btn_go); + ref_builder->get_widget("btn_back",btn_back); + ref_builder->get_widget("start_grid",start_grid); + ref_builder->get_widget("test_grid",test_grid); + ref_builder->get_widget("main_stack",main_stack); + + //Link Signals + btn_go->signal_clicked().connect(sigc::mem_fun(*this,&MyWin::btngo_clicked)); + btn_back->signal_clicked().connect(sigc::mem_fun(*this,&MyWin::btnback_clicked)); +} + +void MyWin::btngo_clicked(){ + main_stack->set_visible_child(*test_grid); +} + +void MyWin::btnback_clicked(){ + main_stack->set_visible_child(*start_grid); +} diff --git a/Gtkmm3/gtk121_launchpad/src/MyWin.hh b/Gtkmm3/gtk121_launchpad/src/MyWin.hh new file mode 100644 index 0000000..02424eb --- /dev/null +++ b/Gtkmm3/gtk121_launchpad/src/MyWin.hh @@ -0,0 +1,23 @@ +#pragma once + +#include + +class MyWin : public Gtk::Window +{ +public: + static MyWin *create(); + MyWin(BaseObjectType *cobject, const Glib::RefPtr &builder); + +private: + Glib::RefPtr ref_builder; + + // Child Widgets + Gtk::Button *btn_go, *btn_back; + Gtk::Grid *start_grid, *test_grid; + Gtk::Stack *main_stack; + + //Signal Handlers + void btngo_clicked(); + void btnback_clicked(); + +}; diff --git a/Gtkmm3/gtk121_launchpad/src/main.cc b/Gtkmm3/gtk121_launchpad/src/main.cc new file mode 100644 index 0000000..90e67ee --- /dev/null +++ b/Gtkmm3/gtk121_launchpad/src/main.cc @@ -0,0 +1,8 @@ +#include "MyWin.hh" + +int main(int argc,char ** argv){ + //Create a application and run + auto app = Gtk::Application::create(argc,argv,"org.gtk.daleclack"); + auto win = MyWin::create(); + return app->run(*win); +}