Add Stack

This commit is contained in:
daleclack 2022-01-23 21:41:47 +08:00
parent bf9370f7cb
commit 23fdb549d4
7 changed files with 155 additions and 2 deletions

View File

@ -22,7 +22,7 @@ pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0)
include_directories (${GTKMM3_INCLUDE_DIRS})
link_directories (${GTKMM3_LIBRARY_DIRS})
set(SOURCES src/core/main.cc src/core/MyWin.cc) #src/core/winconf.cc src/core/MyStack.cc
set(SOURCES src/core/main.cc src/core/MyWin.cc src/core/MyStack.cc) #src/core/winconf.cc
# src/panels/LeftPanel.cc src/panels/TopPanel.cc
# src/draw_app/drawing.cc src/file_app/FileWindow.cc src/game_app/Game.cc
# src/image_app/ImageApp.cc src/image_app/MyImage.cc

View File

@ -3,7 +3,7 @@
<menu id="main_menu">
<section>
<item>
<attribute name="label">About My GtkUI mac version</attribute>
<attribute name="label">About My GtkUI Mac version</attribute>
</item>
<item>
<attribute name="label">Software Update...</attribute>

111
Gtkmm3_Mac/res/stack.ui Normal file
View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox" id="login_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">My_GtkUI</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Login</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="main_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
<child>
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="launchpad_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page2</property>
<property name="title" translatable="yes">page2</property>
<property name="position">2</property>
</packing>
</child>
</object>
</interface>

View File

@ -0,0 +1,9 @@
#include "MyStack.hh"
MyStack::MyStack(){
}
void MyStack::add_stack(Gtk::Overlay &overlay){
}

View File

@ -0,0 +1,12 @@
#pragma once
#include <gtkmm.h>
class MyStack{
public:
MyStack();
void add_stack(Gtk::Overlay &overlay);
private:
Gtk::Stack * main_stack;
};

View File

@ -1,4 +1,5 @@
#include "MyWin.hh"
#include "MyStack.hh"
#include "winpe.xpm"
MyWin::MyWin()
@ -72,6 +73,20 @@ MyWin::MyWin()
menubox.set_valign(Gtk::ALIGN_START);
m_overlay.add_overlay(menubox);
//Add a timer
time_popover.add(calender);
calender.show();
calender.set_margin_bottom(5);
calender.set_margin_end(5);
calender.set_margin_start(5);
calender.set_margin_end(5);
//Timer
timer_button.set_label("2022/1/23 18:32");
timer_button.set_relief(Gtk::RELIEF_NONE);
timer_button.set_popover(time_popover);
menubox.pack_end(timer_button,Gtk::PACK_SHRINK);
add(m_overlay);
show_all_children();
}

View File

@ -12,7 +12,13 @@ private:
Gtk::Box menubox;
Gtk::MenuButton btnlogo, btntitle, btnfile, btnedit, btnshow,
btngoto, btnwin, btnhelp;
Gtk::MenuButton timer_button;
Gtk::Popover time_popover;
Gtk::Calendar calender;
//Get Menu
Glib::RefPtr<Gio::Menu> get_menu(Glib::RefPtr<Gtk::Builder> &builder, const Glib::ustring &id);
//Timer auto update
sigc::connection mytimer;
};