Make Toppanel in a Box widget

This commit is contained in:
daleclack 2022-02-10 20:01:13 +08:00
parent d75f376e11
commit a30ed0a4ef
8 changed files with 25 additions and 13 deletions

4
.gitignore vendored
View File

@ -23,8 +23,12 @@ Makefile
#backup files
*.*~
.DS_Store\
.DS_Store
#music files
*.mp3
#Gresource prebuild file
*/src/resources.cpp
resources.cc

View File

@ -1,6 +1,6 @@
set(CMAKE_CXX_STANDARD 17)
cmake_minimum_required(VERSION 3.0.0)
project(My_GtkUI VERSION 3.5.0)
project(My_GtkUI VERSION 3.6.0)
include(CTest)
enable_testing()

View File

@ -374,7 +374,16 @@
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child type="center">
<placeholder/>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkLabel">

View File

@ -1,8 +1,6 @@
#include "MyStack.hh"
MyStack::MyStack(Gtk::Window *parent1)
:labelbox(Gtk::ORIENTATION_HORIZONTAL,5),
toplabel("My GtkUI Desktop")
{
//Create a builder
ref_builder=Gtk::Builder::create_from_resource("/GtkUI/main_stack.ui");
@ -22,12 +20,7 @@ toplabel("My GtkUI Desktop")
home_btn->signal_clicked().connect(sigc::mem_fun(*this,&MyStack::btnhome_clicked));
login_overlay->add_overlay(*user_box);
//Add Toppanel
labelbox.pack_start(toplabel);
labelbox.set_valign(Gtk::ALIGN_START);
labelbox.set_halign(Gtk::ALIGN_START);
main_overlay->add_overlay(labelbox);
panel1.set_halign(Gtk::ALIGN_END);
panel1.set_halign(Gtk::ALIGN_FILL);
panel1.set_valign(Gtk::ALIGN_START);
main_overlay->add_overlay(panel1);

View File

@ -21,8 +21,6 @@ private:
Gtk::Image *user_image;
Gtk::Button *login_btn,*home_btn;
//TopPanel and LeftPanel
Gtk::Box labelbox;
Gtk::Label toplabel;
TopPanel panel1;
LeftPanel panel2;
//Signal Handlers

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.5\nRunning against Gtkmm %d.%d.%d",
version=g_strdup_printf("3.6\nRunning against Gtkmm %d.%d.%d",
GTKMM_MAJOR_VERSION,
GTKMM_MINOR_VERSION,
GTKMM_MICRO_VERSION);

View File

@ -4,8 +4,14 @@
TopPanel::TopPanel():
Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,5),
toplabel("My GtkUI Desktop"),
midlabel(" "),
timer_value(1000)
{
//Add Header
pack_start(toplabel,Gtk::PACK_SHRINK);
pack_start(midlabel);
//Initalize Timer
mytimer=Glib::signal_timeout().connect(sigc::mem_fun(*this,&TopPanel::on_timeout),timer_value);
time_btn.set_relief(Gtk::RELIEF_NONE);

View File

@ -14,6 +14,8 @@ private:
Gtk::Popover popover;
Gtk::MenuButton menubtn;
Glib::RefPtr<Gtk::Builder> menu_builder;
//Header
Gtk::Label toplabel,midlabel;
//Timer
sigc::connection mytimer;
Gtk::MenuButton time_btn;