This commit is contained in:
daleclack 2021-06-21 23:05:49 +08:00
parent ec7c1acc0b
commit 3a93419a39
6 changed files with 51 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id='app-menu'>
<section>
<submenu>
<attribute name='label'>Config</attribute>
<item>
<attribute name='label'>Change Xe-lts config</attribute>
<attribute name='action'>app.config1</attribute>
</item>
<item>
<attribute name='label'>Change Xe-stable config</attribute>
<attribute name='action'>app.config2</attribute>
</item>
<item>
<attribute name='label'>Change Xe-devel config</attribute>
<attribute name='action'>app.config3</attribute>
</item>
</submenu>
<item>
<attribute name='label'>About</attribute>
<attribute name='action'>app.about</attribute>
</item>
<item>
<attribute name='label'>Exit</attribute>
<attribute name='action'>app.quit</attribute>
</item>
</section>
</menu>
</interface>

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="org/gtk/daleclack">
<file>icons/16x16/actions/open-menu.png</file>
<file>icons/48x48/actions/Xe-Release.png</file>
</gresource>
<gresource prefix="XeRelease">
<file preprocess="xml-stripblanks">menubar.xml</file>
</gresource>
</gresources>

View File

@ -15,6 +15,17 @@ btn_ver("Xe-Ver")
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<Gio::Menu>::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);
//Set Background Image
auto pixbuf=Gdk::Pixbuf::create_from_xpm_data(img7);
auto sized=pixbuf->scale_simple(640,360,Gdk::INTERP_BILINEAR);

View File

@ -2,15 +2,20 @@
#include <gtkmm.h>
class MyWin : public Gtk::Window{
class MyWin : public Gtk::ApplicationWindow{
public:
MyWin();
private:
//Child Widgets
Glib::RefPtr<Gtk::Builder> 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;
};