diff --git a/XeRelease_Gtkmm3/.vscode/c_cpp_properties.json b/XeRelease_Gtkmm3/.vscode/c_cpp_properties.json index 1e4207f..13056cf 100644 --- a/XeRelease_Gtkmm3/.vscode/c_cpp_properties.json +++ b/XeRelease_Gtkmm3/.vscode/c_cpp_properties.json @@ -91,6 +91,7 @@ "name": "win32", "includePath": [ "${workspaceFolder}/**", + "{$workspaceFolder}/../**", "${workspaceFolder}/src/**", //I assume the msys2 installed in D:/msys64 "D:/msys64/mingw64/include/gtkmm-3.0/**", diff --git a/XeRelease_Gtkmm3/CMakeLists.txt b/XeRelease_Gtkmm3/CMakeLists.txt index 44d58a8..b4c176e 100644 --- a/XeRelease_Gtkmm3/CMakeLists.txt +++ b/XeRelease_Gtkmm3/CMakeLists.txt @@ -16,7 +16,7 @@ pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0) include_directories (${GTKMM3_INCLUDE_DIRS}) link_directories (${GTKMM3_LIBRARY_DIRS}) -add_executable(XeRelease src/main.cc src/MyWin.cc src/resources.cpp) +add_executable(XeRelease src/main.cc src/MyWin.cc src/MyDialog.cc src/resources.cpp) IF(WIN32) SET(CMAKE_EXE_LINKER_FLAGS -mwindows) diff --git a/XeRelease_Gtkmm3/src/MyDialog.cc b/XeRelease_Gtkmm3/src/MyDialog.cc new file mode 100644 index 0000000..073df9f --- /dev/null +++ b/XeRelease_Gtkmm3/src/MyDialog.cc @@ -0,0 +1,25 @@ +#include "MyDialog.hh" + +MsgBox::MsgBox(Gtk::Window &parent) +:hbox(Gtk::ORIENTATION_HORIZONTAL,5) +{ + //Initalize MsgBox + set_icon_name("Xe-Release"); + set_default_size(300,150); + add_button("OK",Gtk::RESPONSE_OK); + set_transient_for(parent); + //Add Message + image.set_from_icon_name("Xe-Release",Gtk::ICON_SIZE_DIALOG); + vbox=get_content_area(); + hbox.pack_start(image,Gtk::PACK_SHRINK); + hbox.pack_start(msg_label,Gtk::PACK_SHRINK); + vbox->pack_start(hbox); +} + +void MsgBox::Init(Glib::ustring msg){ + msg_label.set_label(msg); +} + +void MsgBox::on_response(int response_id){ + hide(); +} diff --git a/XeRelease_Gtkmm3/src/MyDialog.hh b/XeRelease_Gtkmm3/src/MyDialog.hh new file mode 100644 index 0000000..bcae41f --- /dev/null +++ b/XeRelease_Gtkmm3/src/MyDialog.hh @@ -0,0 +1,21 @@ +#pragma once + +#include + +class MyDialog : public Gtk::Dialog{ + +}; + +class MsgBox : public Gtk::Dialog{ +public: + MsgBox(Gtk::Window &parent); + void Init(Glib::ustring msg); +protected: + //Signal Handler + void on_response(int response_id) override; +private: + //Child Widgets + Gtk::Image image; + Gtk::Label msg_label; + Gtk::Box *vbox,hbox; +}; diff --git a/XeRelease_Gtkmm3/src/MyWin.cc b/XeRelease_Gtkmm3/src/MyWin.cc index bc52c9d..7a21fa9 100644 --- a/XeRelease_Gtkmm3/src/MyWin.cc +++ b/XeRelease_Gtkmm3/src/MyWin.cc @@ -2,9 +2,16 @@ #include "img7.xpm" #include "winpe.xpm" +enum Releases{ + LongTerm, + Stable, + Develop, +}; + MyWin::MyWin() :btn_box(Gtk::ORIENTATION_VERTICAL,5), -btn_ver("Xe-Ver") +btn_ver("Xe-Ver"), +msg_dialog(*this) { //Initalize window set_icon_name("Xe-Release"); @@ -29,6 +36,7 @@ btn_ver("Xe-Ver") btn_box.pack_start(combo,Gtk::PACK_SHRINK); btn_box.pack_start(btn_ver,Gtk::PACK_SHRINK); overlay.add_overlay(btn_box); + btn_ver.signal_clicked().connect(sigc::mem_fun(*this,&MyWin::main_releases)); //Show everything add(overlay); @@ -86,6 +94,23 @@ void MyWin::background2(){ sized.reset(); } +void MyWin::main_releases(){ + int version=combo.get_active_row_number(); + switch (version) + { + case Releases::LongTerm: + msg_dialog.Init("Xe LongTerm"); + break; + case Releases::Stable: + msg_dialog.Init("Xe Stable"); + break; + case Releases::Develop: + msg_dialog.Init("Xe Develop"); + break; + } + msg_dialog.show_all(); +} + void MyWin::about_dialog(){ char *version; version=g_strdup_printf("12.0\nRunning Against Gtkmm %d.%d.%d", diff --git a/XeRelease_Gtkmm3/src/MyWin.hh b/XeRelease_Gtkmm3/src/MyWin.hh index 75c1bb9..e9484b8 100644 --- a/XeRelease_Gtkmm3/src/MyWin.hh +++ b/XeRelease_Gtkmm3/src/MyWin.hh @@ -1,6 +1,7 @@ #pragma once #include +#include "MyDialog.hh" class MyWin : public Gtk::ApplicationWindow{ public: @@ -22,10 +23,14 @@ private: Gtk::PopoverMenu popover; void titlebar_init(); + //Dialogs + MsgBox msg_dialog; + //Backgrounds void background1(); void background2(); //Signal Handlers void about_dialog(); + void main_releases(); }; \ No newline at end of file