From babc2fd301f28828b5caab19dc6cded8279e7c90 Mon Sep 17 00:00:00 2001 From: daleclack Date: Mon, 21 Jun 2021 22:26:47 +0800 Subject: [PATCH] Add HeaderBar and background --- XeRelease_Gtkmm3/src/MyWin.cc | 29 +++++++++++++++++++++++++++-- XeRelease_Gtkmm3/src/MyWin.hh | 5 +++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/XeRelease_Gtkmm3/src/MyWin.cc b/XeRelease_Gtkmm3/src/MyWin.cc index 5d6b9e4..94c98aa 100644 --- a/XeRelease_Gtkmm3/src/MyWin.cc +++ b/XeRelease_Gtkmm3/src/MyWin.cc @@ -1,18 +1,43 @@ #include "MyWin.hh" #include "img7.xpm" -MyWin::MyWin(){ +MyWin::MyWin() +:btn_box(Gtk::ORIENTATION_VERTICAL,5), +btn_ver("Xe-Ver") +{ //Initalize window set_icon_name("org.gtk.daleclack"); - set_default_size(640,360); + 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); + //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); + + //Initalize combobox + combo.append("Longterm"); + combo.append("Stable"); + combo.append("Development"); + combo.set_active(1); + + //Add Main Controls + btn_box.set_halign(Gtk::ALIGN_CENTER); + btn_box.set_valign(Gtk::ALIGN_CENTER); + btn_box.pack_start(combo,Gtk::PACK_SHRINK); + btn_box.pack_start(btn_ver,Gtk::PACK_SHRINK); + overlay.add_overlay(btn_box); + //Show everything add(overlay); show_all_children(); + //Free Memory pixbuf.reset(); sized.reset(); diff --git a/XeRelease_Gtkmm3/src/MyWin.hh b/XeRelease_Gtkmm3/src/MyWin.hh index f4ef257..a16a61e 100644 --- a/XeRelease_Gtkmm3/src/MyWin.hh +++ b/XeRelease_Gtkmm3/src/MyWin.hh @@ -6,6 +6,11 @@ class MyWin : public Gtk::Window{ public: MyWin(); private: + //Child Widgets Gtk::Image background; Gtk::Overlay overlay; + Gtk::Box btn_box; + Gtk::ComboBoxText combo; + Gtk::Button btn_ver; + Gtk::HeaderBar header; }; \ No newline at end of file