diff --git a/XeRelease_Gtkmm3/res/menubar.xml b/XeRelease_Gtkmm3/res/menubar.xml index 92f8b52..0c4778d 100644 --- a/XeRelease_Gtkmm3/res/menubar.xml +++ b/XeRelease_Gtkmm3/res/menubar.xml @@ -6,24 +6,35 @@ Config Change Xe-lts config - app.config1 + win.config1 Change Xe-stable config - app.config2 + win.config2 Change Xe-devel config - app.config3 + win.config3 + + + + Backgrounds + + XeRelease8-9 + win.back1 + + + XeRelease10-12 + win.back2 About - app.about + win.about Exit - app.quit + win.quit diff --git a/XeRelease_Gtkmm3/src/MyWin.cc b/XeRelease_Gtkmm3/src/MyWin.cc index 67a71c6..dfa99b8 100644 --- a/XeRelease_Gtkmm3/src/MyWin.cc +++ b/XeRelease_Gtkmm3/src/MyWin.cc @@ -1,5 +1,6 @@ #include "MyWin.hh" #include "img7.xpm" +#include "winpe.xpm" MyWin::MyWin() :btn_box(Gtk::ORIENTATION_VERTICAL,5), @@ -8,23 +9,7 @@ btn_ver("Xe-Ver") //Initalize window set_icon_name("Xe-Release"); set_default_size(640,360); - - //Add HeaderBar - header.set_title("Xe Release 12"); - header.set_show_close_button(); - header.set_decoration_layout("close,minimize:menu"); - set_titlebar(header); - - //Initalize Menu - menu_builder=Gtk::Builder::create_from_resource("/XeRelease/menubar.xml"); - auto object=menu_builder->get_object("app-menu"); - auto gmenu=Glib::RefPtr::cast_dynamic(object); - popover.bind_model(gmenu); - - //Initalize MenuButton - menubtn.set_image_from_icon_name("open-menu"); - menubtn.set_popover(popover); - header.pack_end(menubtn); + titlebar_init(); //Set Background Image auto pixbuf=Gdk::Pixbuf::create_from_xpm_data(img7); @@ -53,3 +38,49 @@ btn_ver("Xe-Ver") pixbuf.reset(); sized.reset(); } + +void MyWin::titlebar_init(){ + //Add HeaderBar + header.set_title("Xe Release 12"); + header.set_show_close_button(); + header.set_decoration_layout("close,minimize:menu"); + set_titlebar(header); + + //Initalize Menu + menu_builder=Gtk::Builder::create_from_resource("/XeRelease/menubar.xml"); + auto object=menu_builder->get_object("app-menu"); + auto gmenu=Glib::RefPtr::cast_dynamic(object); + popover.bind_model(gmenu); + + //Add Menu Actions + add_action("back1",sigc::mem_fun(*this,&MyWin::background1)); + add_action("back2",sigc::mem_fun(*this,&MyWin::background2)); + add_action("quit",sigc::mem_fun(*this,&MyWin::hide)); + + //Initalize MenuButton + menubtn.set_image_from_icon_name("open-menu"); + menubtn.set_popover(popover); + header.pack_end(menubtn); +} + +void MyWin::background1(){ + //Set Background Image + auto pixbuf=Gdk::Pixbuf::create_from_xpm_data(winpe); + auto sized=pixbuf->scale_simple(640,360,Gdk::INTERP_BILINEAR); + gtk_image_set_from_pixbuf(background.gobj(),sized->gobj()); + //overlay.add(background); + //Free Memory + pixbuf.reset(); + sized.reset(); +} + +void MyWin::background2(){ + //Set Background Image + auto pixbuf=Gdk::Pixbuf::create_from_xpm_data(img7); + auto sized=pixbuf->scale_simple(640,360,Gdk::INTERP_BILINEAR); + gtk_image_set_from_pixbuf(background.gobj(),sized->gobj()); + //overlay.add(background); + //Free Memory + pixbuf.reset(); + sized.reset(); +} diff --git a/XeRelease_Gtkmm3/src/MyWin.hh b/XeRelease_Gtkmm3/src/MyWin.hh index 77355cd..54b0246 100644 --- a/XeRelease_Gtkmm3/src/MyWin.hh +++ b/XeRelease_Gtkmm3/src/MyWin.hh @@ -8,14 +8,21 @@ public: private: //Child Widgets Glib::RefPtr menu_builder; + //Main window Gtk::Image background; Gtk::Overlay overlay; Gtk::Box btn_box; Gtk::ComboBoxText combo; Gtk::Button btn_ver; + //TitleBar and menu Gtk::HeaderBar header; Gtk::MenuButton menubtn; Gtk::PopoverMenu popover; + void titlebar_init(); + + //Backgrounds + void background1(); + void background2(); }; \ No newline at end of file