Add icons for launchpad

This commit is contained in:
daleclack 2022-02-06 13:41:31 +08:00
parent ef9fd5bde5
commit 60043e19aa
13 changed files with 492 additions and 203 deletions

View File

@ -1,3 +1,79 @@
{
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"files.associations": {
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cfenv": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"source_location": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
}
}

View File

@ -51,18 +51,18 @@ set(RESOURCE_LIST
icons/16x16/actions/list-add.svg
icons/16x16/actions/list-remove.svg
icons/48x48/actions/dialog-error.png
icons/48x48/actions/file-app.png
icons/48x48/actions/file-app-running.png
icons/48x48/actions/game.png
icons/48x48/actions/game_running.png
icons/48x48/actions/gedit.png
icons/48x48/actions/gedit_running.png
icons/48x48/actions/gedit_running.png
icons/48x48/actions/btnabout.png
icons/48x48/actions/My_GtkUI.png
icons/scalable/status/my_prefs.svg
icons/scalable/status/drawing_app.svg
icons/scalable/status/drawing_app_running.svg
icons/scalable/status/finder-find.svg
icons/scalable/status/display_prefs.svg)
icons/scalable/status/display_prefs.svg
icons/scalable/status/file-app.svg)
compile_gresources(RESOURCE_FILE
XML_OUT

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -2,6 +2,21 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkWindow">
<property name="can-focus">False</property>
<child>
<object class="GtkButton" id="btnnote">
<property name="label" translatable="yes">Notepad</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image15</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
</child>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -9,6 +24,44 @@
<property name="icon-name">My_GtkUI</property>
<property name="icon_size">6</property>
</object>
<object class="GtkImage" id="image10">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">audacious</property>
<property name="icon_size">6</property>
</object>
<object class="GtkImage" id="image11">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">file-app</property>
</object>
<object class="GtkImage" id="image12">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">gedit</property>
</object>
<object class="GtkImage" id="image13">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">game</property>
</object>
<object class="GtkImage" id="image14">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">eog</property>
<property name="icon_size">6</property>
</object>
<object class="GtkImage" id="image15">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">gedit</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -45,6 +98,21 @@
<property name="pixel-size">48</property>
<property name="icon-name">my_prefs</property>
</object>
<object class="GtkImage" id="image8">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">btnabout</property>
<property name="icon_size">6</property>
</object>
<object class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">48</property>
<property name="icon-name">drawing_app</property>
</object>
<object class="GtkBox" id="main_box">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -238,185 +306,286 @@
</packing>
</child>
<child>
<!-- n-columns=8 n-rows=8 -->
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="launchpad_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="row-homogeneous">True</property>
<property name="column-homogeneous">True</property>
<child>
<placeholder/>
<!-- n-columns=8 n-rows=6 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="row-homogeneous">True</property>
<property name="column-homogeneous">True</property>
<child>
<object class="GtkButton" id="btnabout">
<property name="label" translatable="yes">about</property>
<property name="width-request">64</property>
<property name="height-request">64</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="action-name">win.about</property>
<property name="image">image8</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnaud">
<property name="label" translatable="yes">audacious</property>
<property name="width-request">64</property>
<property name="height-request">64</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image10</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btndra">
<property name="label" translatable="yes">Drawing</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image9</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnfile">
<property name="label" translatable="yes">MyFinder</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image11</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btngedit">
<property name="label" translatable="yes">Gedit</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image12</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">4</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btngam">
<property name="label" translatable="yes">Guess game</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image13</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">5</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnimag">
<property name="label" translatable="yes">Image Viewer</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image14</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="left-attach">6</property>
<property name="top-attach">0</property>
</packing>
</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>
<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>
<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>
<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>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</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>
<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>
<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>
<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>
<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>
<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>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>

View File

@ -2,26 +2,31 @@
#include "winpe.xpm"
MyWin::MyWin()
: menubox(Gtk::ORIENTATION_HORIZONTAL, 0)
: menubox(Gtk::ORIENTATION_HORIZONTAL, 0),
width(1024),
height(576)
{
// Initalize window
set_default_size(1024, 576);
set_icon_name("My_GtkUI");
set_title("My GtkUI macOS Version");
get_size_config(width, height);
// Add background
auto pixbuf = Gdk::Pixbuf::create_from_xpm_data(winpe);
auto sized = pixbuf->scale_simple(1024, 576, Gdk::INTERP_BILINEAR);
auto sized = pixbuf->scale_simple(width, height, Gdk::INTERP_BILINEAR);
gtk_image_set_from_pixbuf(m_background.gobj(), sized->gobj());
m_overlay.add(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_actiavted));
add_action("about", sigc::mem_fun(*this, &MyWin::about_activated));
add_action("back", sigc::mem_fun(*this, &MyWin::back_actiavted));
// Add Stack
m_overlay.set_size_request(width, height);
m_overlay.add_overlay(*(main_stack.stack));
// Add context menu
@ -37,7 +42,7 @@ MyWin::MyWin()
gesture->signal_pressed().connect(sigc::mem_fun(*this, &MyWin::press));
// Initalize Stack
main_stack.mystack_init(this,&m_background);
main_stack.mystack_init(this, &m_background);
add(m_overlay);
show_all_children();
@ -55,7 +60,8 @@ void MyWin::logout_activated()
main_stack.logout();
}
void MyWin::back_actiavted(){
void MyWin::back_actiavted()
{
main_stack.show_prefs();
}
@ -67,7 +73,7 @@ void MyWin::about_activated()
"GCR_CMake on github https://github.com/Makman2/GCR_CMake",
NULL};
//Version information
// Version information
char *version;
version = g_strdup_printf("5.0\nRunning Against: Gtkmm %d.%d.%d",
GTKMM_MAJOR_VERSION,
@ -76,15 +82,15 @@ void MyWin::about_activated()
// Get Year information
time_t t;
t=time(NULL);
struct tm * local;
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);
// Copyright
char *copyright;
copyright = g_strdup_printf("©2019—%04d The Xe Project", local->tm_year + 1900);
//Show the about dialog
// Show the about dialog
gtk_show_about_dialog(GTK_WINDOW(gobj()),
"program-name", "My_GtkUI",
"version", version,
@ -95,8 +101,8 @@ void MyWin::about_activated()
"logo-icon-name", "My_GtkUI",
"title", "About My GtkUI Mac Version",
NULL);
//Free Memory
// Free Memory
g_free(version);
g_free(copyright);
}

View File

@ -19,6 +19,7 @@ private:
//Main Stack
MyStack main_stack;
int width, height;
//Signal Handlers
void logout_activated();

View File

@ -1,4 +1,5 @@
#include "MyDock.hh"
#include <thread>
MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Glade)
: Gtk::Box(cobject),
@ -18,6 +19,16 @@ MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Gl
ref_builder->get_widget("launchpad_stack",launchpad_stack);
ref_builder->get_widget("default_page",default_page);
ref_builder->get_widget("launchpad_page",launchpad_page);
ref_builder->get_widget("btnabout",btnabout);
ref_builder->get_widget("btnaud",btnaud);
// Add Buttons for launchpad
// launchpad_page->attach(*btnabout,0,0);
// launchpad_page->attach(*btnaud,1,0);
// label1.set_label(" ");
// label1.set_hexpand();
// label1.set_vexpand();
// launchpad_page->attach(label1,2,1);
//Link signals
btnset->signal_clicked().connect(sigc::mem_fun(*this,&MyDock::btnset_clicked));
@ -37,11 +48,9 @@ MyDock::MyDock(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Gl
void MyDock::btnlaunch_clicked(){
if(launchpad_shown){
finder_box->set_visible();
launchpad_stack->set_visible_child(*default_page);
launchpad_shown = false;
}else{
finder_box->set_visible(false);
launchpad_stack->set_visible_child(*launchpad_page);
launchpad_shown = true;
}

View File

@ -25,6 +25,8 @@ private:
bool launchpad_shown;
Gtk::Stack *launchpad_stack;
Gtk::Grid *default_page, *launchpad_page;
Gtk::Button *btnabout, *btnaud;
Gtk::Label label1;
//Window Preferences
MyPrefs prefs_win;

View File

@ -2,7 +2,6 @@
#include "winpe.xpm"
#include "img7.xpm"
#include "image_types.hh"
#include "cfgfile/cfgfile.hh"
#include <iostream>
#include <fstream>
@ -446,10 +445,3 @@ void MyPrefs::load_winsize_config(){
width = atoi(width_str.c_str());
}
}
void MyPrefs::get_winsize_config(int &width1, int &height1)
{
// Apply Config
width1 = width;
height1 = height;
}

View File

@ -2,6 +2,7 @@
#include <gtkmm.h>
#include <string>
#include "cfgfile/cfgfile.hh"
class MyPrefs : public Gtk::Window
{
@ -9,7 +10,6 @@ public:
MyPrefs();
void set_background(Gtk::Image *back);
void load_winsize_config();
void get_winsize_config(int &width1,int &height1);
void update_background_size();
protected:
@ -78,3 +78,15 @@ private:
void btnapply_clicked();
void btnGet_clicked();
};
//Read Config from file without use the MyPrefs class
static inline void get_size_config(int &width, int &height){
std::string height_str, width_str;
// Read values from a file
if (readCfgFile("config", "width", width_str) && readCfgFile("config", "height", height_str))
{
height = atoi(height_str.c_str());
width = atoi(width_str.c_str());
}
}