mirror of https://github.com/daleclack/My_GtkUi
Remove non-used source files
This commit is contained in:
parent
92e663df5e
commit
61ab991813
|
@ -4,7 +4,7 @@
|
|||
<ui>
|
||||
(1,None,"test.ui","test.ui",None,None,None,None,None,None),
|
||||
(2,None,None,"test2.ui",None,None,None,None,None,None),
|
||||
(3,None,None,"test3",None,None,None,None,None,None)
|
||||
(3,None,None,"test3.ui",None,None,None,None,None,None)
|
||||
</ui>
|
||||
<object>
|
||||
(1,1,"GtkWindow",None,None,None,None,None,None),
|
||||
|
@ -13,16 +13,12 @@
|
|||
(2,1,"GtkWindow",None,None,None,None,None,None),
|
||||
(2,2,"GtkDropDown",None,1,None,None,None,None),
|
||||
(3,1,"GtkWindow",None,None,None,None,None,None),
|
||||
(3,2,"GtkStack","main_stack",1,None,None,None,-1),
|
||||
(3,3,"GtkBox",None,2,None,None,None,-1),
|
||||
(3,4,"GtkBox",None,2,None,None,None,-1)
|
||||
(3,2,"GtkOverlay",None,1,None,None,None,-1)
|
||||
</object>
|
||||
<object_property>
|
||||
(1,2,"GtkButton","child","3",None,None,None,None,None),
|
||||
(1,3,"GtkImage","icon-name","org.gtk.Demo4",None,None,None,None,None),
|
||||
(1,3,"GtkImage","pixel-size","48",None,None,None,None,None),
|
||||
(2,2,"GtkDropDown","selected","4294967292",None,None,None,None,None),
|
||||
(3,2,"GtkWidget","name","page2",None,None,None,None,None),
|
||||
(3,3,"GtkWidget","name","test1",None,None,None,None,None)
|
||||
(2,2,"GtkDropDown","selected","4294967292",None,None,None,None,None)
|
||||
</object_property>
|
||||
</cambalache-project>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Created with Cambalache 0.10.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.6"/>
|
||||
<object class="GtkWindow">
|
||||
<child>
|
||||
<object class="GtkOverlay"/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -1,6 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkBox" id="login_page">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="user_image">
|
||||
<property name="pixel-size">48</property>
|
||||
<property name="icon-name">My_GtkUI</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="user_label">
|
||||
<property name="label" translatable="1">dale</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btnlogin">
|
||||
<property name="label" translatable="1">Login</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="has-frame">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkStack" id="main_stack">
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
|
@ -8,29 +32,8 @@
|
|||
<property name="title" translatable="1">page0</property>
|
||||
<property name="name">login_page1</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="login_page">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="user_image">
|
||||
<property name="pixel-size">48</property>
|
||||
<property name="icon-name">My_GtkUI</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="user_label">
|
||||
<property name="label" translatable="1">dale</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btnlogin">
|
||||
<property name="label" translatable="1">Login</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="has-frame">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkOverlay" id="login_overlay">
|
||||
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
#include "MyStack.hh"
|
||||
#include <iostream>
|
||||
|
||||
MyStack::MyStack()
|
||||
{
|
||||
// Get Widgets
|
||||
stackbuilder = Gtk::Builder::create_from_resource("/org/gtk/daleclack/stack.ui");
|
||||
stack = stackbuilder->get_widget<Gtk::Stack>("main_stack");
|
||||
login_page = stackbuilder->get_widget<Gtk::Box>("login_page");
|
||||
main_page = stackbuilder->get_widget<Gtk::Box>("main_page");
|
||||
btnlogin = stackbuilder->get_widget<Gtk::Button>("btnlogin");
|
||||
|
||||
// Link Signals
|
||||
btnlogin->signal_clicked().connect(sigc::mem_fun(*this, &MyStack::btnlogin_clicked));
|
||||
}
|
||||
|
||||
void MyStack::mystack_init(Gtk::Window *window, Gtk::Picture *m_back)
|
||||
{
|
||||
main_dock->mydock_init(window, m_back);
|
||||
}
|
||||
|
||||
void MyStack::show_prefs()
|
||||
{
|
||||
main_dock->btnset_clicked();
|
||||
}
|
||||
|
||||
void MyStack::logout()
|
||||
{
|
||||
stack->set_visible_child(*login_page);
|
||||
}
|
||||
|
||||
void MyStack::btnlogin_clicked()
|
||||
{
|
||||
stack->set_visible_child(*main_page);
|
||||
}
|
||||
|
||||
void MyStack::set_mydock_mode(DockMode mode)
|
||||
{
|
||||
// main_dock->set_dock_mode(mode);
|
||||
// switch (mode)
|
||||
// {
|
||||
// case DockMode::MODE_DOCK:
|
||||
// std::cout << "dock mode" << std::endl;
|
||||
// break;
|
||||
// case DockMode::MODE_PANEL:
|
||||
// std::cout << "panel mode" << std::endl;
|
||||
// break;
|
||||
// default:
|
||||
// std::cout << "undefined" << std::endl;
|
||||
// break;
|
||||
// }
|
||||
// Add Widget
|
||||
main_dock = MyDock::create(mode);
|
||||
main_dock->set_hexpand();
|
||||
main_dock->set_vexpand();
|
||||
main_page->append(*main_dock);
|
||||
}
|
|
@ -1,19 +1,49 @@
|
|||
#include "MyStack.h"
|
||||
#include "winpe.xpm"
|
||||
|
||||
static void btnlogin_clicked(GtkWidget *widget, GtkStack *stack){
|
||||
static void btnlogin_clicked(GtkWidget *widget, GtkStack *stack)
|
||||
{
|
||||
gtk_stack_set_visible_child_name(stack, "main_page1");
|
||||
}
|
||||
|
||||
void create_main_stack(GtkWindow *win){
|
||||
static void logout_activated(GSimpleAction *action,
|
||||
GVariant *parmeter,
|
||||
gpointer win)
|
||||
{
|
||||
GtkWidget *stack = gtk_window_get_child(GTK_WINDOW(win));
|
||||
gtk_stack_set_visible_child_name(GTK_STACK(stack), "login_page1");
|
||||
}
|
||||
|
||||
void create_main_stack(GtkWindow *win)
|
||||
{
|
||||
static GActionEntry entries[] = {
|
||||
{"logout", logout_activated, NULL, NULL, NULL}};
|
||||
|
||||
// Create a builder
|
||||
GtkBuilder *builder = gtk_builder_new_from_resource("/org/gtk/daleclack/stack.ui");
|
||||
|
||||
// Get Widgets
|
||||
GtkWidget *stack = GTK_WIDGET(gtk_builder_get_object(builder, "main_stack"));
|
||||
GtkWidget *login_page = GTK_WIDGET(gtk_builder_get_object(builder, "login_page"));
|
||||
GtkWidget *login_overlay = GTK_WIDGET(gtk_builder_get_object(builder, "login_overlay"));
|
||||
GtkWidget *main_page = GTK_WIDGET(gtk_builder_get_object(builder, "main_page"));
|
||||
GtkWidget *btnlogin = GTK_WIDGET(gtk_builder_get_object(builder, "btnlogin"));
|
||||
|
||||
// Add background for login page
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data(winpe);
|
||||
GdkPixbuf *sized = gdk_pixbuf_scale_simple(pixbuf, 1024, 576, GDK_INTERP_BILINEAR);
|
||||
GtkWidget *login_pic = gtk_picture_new_for_pixbuf(sized);
|
||||
g_object_unref(pixbuf);
|
||||
g_object_unref(sized);
|
||||
gtk_overlay_set_child(GTK_OVERLAY(login_overlay), login_pic);
|
||||
|
||||
// Add login buttons
|
||||
gtk_overlay_add_overlay(GTK_OVERLAY(login_overlay), login_page);
|
||||
|
||||
// Add actions
|
||||
g_action_map_add_action_entries(G_ACTION_MAP(win), entries,
|
||||
G_N_ELEMENTS(entries), win);
|
||||
|
||||
// Link Signals
|
||||
g_signal_connect(btnlogin, "clicked", G_CALLBACK(btnlogin_clicked), stack);
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include "MyDock.hh"
|
||||
|
||||
class MyStack
|
||||
{
|
||||
public:
|
||||
MyStack();
|
||||
void logout();
|
||||
void mystack_init(Gtk::Window *window, Gtk::Picture *m_back);
|
||||
void show_prefs();
|
||||
void set_mydock_mode(DockMode mode);
|
||||
|
||||
// Main Widget
|
||||
Gtk::Stack *stack;
|
||||
private:
|
||||
Glib::RefPtr<Gtk::Builder> stackbuilder;
|
||||
|
||||
// Child widgets
|
||||
Gtk::Box *login_page, *main_page;
|
||||
Gtk::Button *btnlogin;
|
||||
|
||||
// Dock Widget
|
||||
MyDock *main_dock;
|
||||
|
||||
// Signal Handlers
|
||||
void btnlogin_clicked();
|
||||
};
|
|
@ -1,126 +0,0 @@
|
|||
#include "MyWin.hh"
|
||||
#include "winpe.xpm"
|
||||
|
||||
MyWin::MyWin()
|
||||
: menubox(Gtk::Orientation::HORIZONTAL, 0),
|
||||
width(1024),
|
||||
height(576)
|
||||
{
|
||||
// Initalize window
|
||||
set_icon_name("My_GtkUI");
|
||||
set_title("My GtkUI macOS Version");
|
||||
// get_size_config(width, height, panel_mode);
|
||||
panel_mode = true;
|
||||
|
||||
// Set the display mode of dock
|
||||
if(panel_mode){
|
||||
main_stack.set_mydock_mode(DockMode::MODE_PANEL);
|
||||
}else{
|
||||
main_stack.set_mydock_mode(DockMode::MODE_DOCK);
|
||||
}
|
||||
|
||||
// Add background
|
||||
// auto pixbuf = Gdk::Pixbuf::create_from_xpm_data(winpe);
|
||||
// auto sized = pixbuf->scale_simple(width, height, Gdk::InterpType::BILINEAR);
|
||||
// gtk_image_set_from_pixbuf(m_background.gobj(), sized->gobj());
|
||||
m_overlay.set_child(m_background);
|
||||
// pixbuf.reset();
|
||||
// sized.reset();
|
||||
|
||||
// Add Action for menus
|
||||
add_action("logout", sigc::mem_fun(*this, &MyWin::logout_activated));
|
||||
add_action("quit", sigc::mem_fun(*this, &MyWin::quit_activated));
|
||||
add_action("about", sigc::mem_fun(*this, &MyWin::about_activated));
|
||||
add_action("back", sigc::mem_fun(*this, &MyWin::back_activated));
|
||||
add_action("expand",sigc::mem_fun(*this,&MyWin::expand_activated));
|
||||
|
||||
// Add Stack
|
||||
m_overlay.set_size_request(width, height);
|
||||
m_overlay.add_overlay(*(main_stack.stack));
|
||||
|
||||
// Add context menu
|
||||
auto menubuilder = Gtk::Builder::create_from_resource("/org/gtk/daleclack/mainmenu.xml");
|
||||
auto object = menubuilder->get_object<Gio::MenuModel>("model");
|
||||
context_menu.set_menu_model(object);
|
||||
context_menu.set_has_arrow(false);
|
||||
context_menu.set_parent(m_overlay);
|
||||
|
||||
// Add Gesture for control
|
||||
gesture = Gtk::GestureClick::create();
|
||||
m_overlay.add_controller(gesture);
|
||||
gesture->set_button(GDK_BUTTON_SECONDARY);
|
||||
gesture->signal_pressed().connect(sigc::mem_fun(*this, &MyWin::press));
|
||||
|
||||
// Initalize Stack
|
||||
main_stack.mystack_init(this, &m_background);
|
||||
|
||||
set_child(m_overlay);
|
||||
}
|
||||
|
||||
void MyWin::press(int n_press, double x, double y)
|
||||
{
|
||||
// Show Menu
|
||||
context_menu.set_pointing_to(Gdk::Rectangle((int)x, (int)y, 1, 1));
|
||||
context_menu.popup();
|
||||
}
|
||||
|
||||
void MyWin::logout_activated()
|
||||
{
|
||||
main_stack.logout();
|
||||
}
|
||||
|
||||
void MyWin::back_activated()
|
||||
{
|
||||
main_stack.show_prefs();
|
||||
}
|
||||
|
||||
void MyWin::expand_activated(){
|
||||
// main_stack.set_mydock_mode(DockMode::MODE_PANEL);
|
||||
}
|
||||
|
||||
void MyWin::about_activated()
|
||||
{
|
||||
// Authors information
|
||||
const char *authors[] = {
|
||||
"Dale Clack",
|
||||
"GCR_CMake on github https://github.com/Makman2/GCR_CMake",
|
||||
NULL};
|
||||
|
||||
// Version information
|
||||
char *version;
|
||||
version = g_strdup_printf("6.0\nRunning Against: Gtkmm %d.%d.%d",
|
||||
GTKMM_MAJOR_VERSION,
|
||||
GTKMM_MINOR_VERSION,
|
||||
GTKMM_MICRO_VERSION);
|
||||
|
||||
// Get Year information
|
||||
time_t t;
|
||||
t = time(NULL);
|
||||
struct tm *local;
|
||||
local = localtime(&t);
|
||||
|
||||
// Copyright
|
||||
char *copyright;
|
||||
copyright = g_strdup_printf("© 2019—%04d The Xe Project", local->tm_year + 1900);
|
||||
|
||||
// Show the about dialog
|
||||
gtk_show_about_dialog(GTK_WINDOW(gobj()),
|
||||
"program-name", "My_GtkUI",
|
||||
"version", version,
|
||||
"copyright", copyright,
|
||||
"comments", "A program that simulates desktop (Mac Version)",
|
||||
"authors", authors,
|
||||
"license-type", GTK_LICENSE_GPL_3_0,
|
||||
"logo-icon-name", "My_GtkUI",
|
||||
"title", "About My GtkUI Mac Version",
|
||||
NULL);
|
||||
|
||||
// Free Memory
|
||||
g_free(version);
|
||||
g_free(copyright);
|
||||
}
|
||||
|
||||
void MyWin::quit_activated()
|
||||
{
|
||||
hide();
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include "MyStack.hh"
|
||||
|
||||
class MyWin : public Gtk::ApplicationWindow{
|
||||
public:
|
||||
MyWin();
|
||||
private:
|
||||
//Child widgets
|
||||
Gtk::Overlay m_overlay;
|
||||
Gtk::Picture m_background;
|
||||
Gtk::Box menubox;
|
||||
Gtk::PopoverMenu context_menu;
|
||||
|
||||
//Gesture Control
|
||||
Glib::RefPtr<Gtk::GestureClick> gesture;
|
||||
void press(int n_press,double x,double y);
|
||||
|
||||
//Main Stack
|
||||
MyStack main_stack;
|
||||
int width, height;
|
||||
bool panel_mode;
|
||||
|
||||
//Signal Handlers
|
||||
void logout_activated();
|
||||
void quit_activated();
|
||||
void about_activated();
|
||||
void back_activated();
|
||||
void expand_activated();
|
||||
|
||||
};
|
Loading…
Reference in New Issue