Add Calander

This commit is contained in:
daleclack 2021-11-07 18:16:30 +08:00
parent cdffab95ef
commit d635c39cc3
5 changed files with 22 additions and 7 deletions

@ -1 +1 @@
Subproject commit c39fdece33041c8028acc6cb90455019c35dae17
Subproject commit 6ea69eca6817aead20a2cb87cdd08ab8e9a173cd

View File

@ -1,6 +1,6 @@
set(CMAKE_CXX_STANDARD 17)
cmake_minimum_required(VERSION 3.0.0)
project(My_GtkUI VERSION 3.3.0)
project(My_GtkUI VERSION 3.4.0)
include(CTest)
enable_testing()
@ -34,6 +34,13 @@ add_custom_command(
${GRESOURCE_XML}
--target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
--generate-source
DEPENDS
${CMAKE_SOURCE_DIR}/res/appmenu.xml
${CMAKE_SOURCE_DIR}/res/game1.ui
${CMAKE_SOURCE_DIR}/res/leftpanel.ui
${CMAKE_SOURCE_DIR}/res/main_stack.ui
${CMAKE_SOURCE_DIR}/res/toppanel.ui
${CMAKE_SOURCE_DIR}/res/win_size.ui
)
# Step 3:

View File

@ -144,7 +144,7 @@ void MyWin::about_dialog(){
std::vector<Glib::ustring> authors;
authors.push_back("Dale Clack");
//Create Comments
version=g_strdup_printf("3.3\nRunning against Gtkmm %d.%d.%d",
version=g_strdup_printf("3.4\nRunning against Gtkmm %d.%d.%d",
GTKMM_MAJOR_VERSION,
GTKMM_MINOR_VERSION,
GTKMM_MICRO_VERSION);

View File

@ -4,12 +4,17 @@
TopPanel::TopPanel():
Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,5),
time_label("21:00:00 2021/6/13"),
timer_value(1000)
{
//Initalize Timer
mytimer=Glib::signal_timeout().connect(sigc::mem_fun(*this,&TopPanel::on_timeout),timer_value);
pack_start(time_label,Gtk::PACK_SHRINK);
time_btn.set_relief(Gtk::RELIEF_NONE);
time_btn.set_label("18:13:00 2021/11/17");
time_btn.set_popover(time_popover);
time_popover.add(calender);
calender.set_size_request(300,250);
calender.show();
pack_start(time_btn,Gtk::PACK_SHRINK);
//Initalize menu
menu_builder=Gtk::Builder::create_from_resource("/GtkUI/appmenu.xml");
@ -44,6 +49,6 @@ bool TopPanel::on_timeout(){
//Show time
sprintf(time_string,"%02d:%02d:%02d %04d/%02d/%02d",
local->tm_hour,local->tm_min,local->tm_sec,local->tm_year+1900,local->tm_mon+1,local->tm_mday);
time_label.set_label(time_string);
time_btn.set_label(time_string);
return true;
}

View File

@ -16,10 +16,13 @@ private:
Glib::RefPtr<Gtk::Builder> menu_builder;
//Timer
sigc::connection mytimer;
Gtk::Label time_label;
Gtk::MenuButton time_btn;
const int timer_value;
bool on_timeout();
char time_string[57];
//Calander
Gtk::Popover time_popover;
Gtk::Calendar calender;
//Other Things
Glib::RefPtr<Gtk::Builder> panel_builder;
Gtk::VolumeButton *volume1;