*Addition of text field paths. 4.x-dev

Sat, 12 Dec 2020 01:20:49 +0100

author
Luca Tonini
date
Sat, 12 Dec 2020 01:20:49 +0100
branch
4.x-dev
changeset 1514
3f3708af2d91
parent 1513
1197deea44f0
child 1515
1d8909ed4d1f

*Addition of text field paths.

README.md file | annotate | diff | comparison | revisions
Tools/ResourceManagementUI/Source/UI/App.cpp file | annotate | diff | comparison | revisions
Tools/ResourceManagementUI/Source/UI/App.h file | annotate | diff | comparison | revisions
--- a/README.md	Thu Dec 10 02:14:06 2020 +0200
+++ b/README.md	Sat Dec 12 01:20:49 2020 +0100
@@ -14,7 +14,7 @@
 
 
 ----
-### Fedora 32 on 64bit system dependencies
+### Fedora 32/33 on 64bit system dependencies
 Run the command below to install all the dependencies on Fedora distros after Fedora 26.
 
 ```$ sudo dnf install gcc cmake cmake-gui libX11 libXinerama-devel.x86_64 libXrandr-devel.x86_64 libXext doxygen freetype fifechan-opengl-devel.x86_64 mingw64-winpthreads.noarch freetype-devel.x86_64 pulseaudio-libs-devel.x86_64```
--- a/Tools/ResourceManagementUI/Source/UI/App.cpp	Thu Dec 10 02:14:06 2020 +0200
+++ b/Tools/ResourceManagementUI/Source/UI/App.cpp	Sat Dec 12 01:20:49 2020 +0100
@@ -1,10 +1,11 @@
 #include "App.h"
 #include <Gorgon/UI/Organizers/Flow.h>
 
+
 namespace UI{
 
     //Initialization of constructor class 
-    UI::App::App ( Gorgon::Geometry::Size size, int fontSize, std::string title ):window(size,title), btnImport("Import"),btnFileFrom("Path From"), btnFileTo("Path To"), pnlSettings(Gorgon::Widgets::Registry::Panel_Left){
+    UI::App::App (Gorgon::Geometry::Size size, int fontSize, std::string title ):window(size,title),initstyl("Goldman-Regular.ttf",14), btnImport("IMPORT"),btnFileFrom("Path From"), btnFileTo("Path To"), btnExit("EXIT"){
         
         
         //Import application icon and apply to window
@@ -23,28 +24,63 @@
         
         
         //Initialization of settings  panel
-        pnlSettings.SetWidth(510);
-        pnlSettings.Move(20, 20);
-        pnlSettings.SetHeight(310);
+        pnlSettings.SetWidth(550);
+        pnlSettings.Move(0, 0);
+        pnlSettings.SetHeight(350);
         pnlSettings.EnableScroll(false, false);
         window.Add(pnlSettings);
         
-        
         //Organizers to display elements to the panel.
         auto &org = pnlSettings.CreateOrganizer<Gorgon::UI::Organizers::Flow>();
         
-        org << std::endl << 2 << "Label" << btnFileFrom << btnFileTo
-         << org.Break << std::endl << 2 << "Label" << btnImport ;
+        org 
+        << org.Break 
+        << 1 << "" << 4 << "Import From:" << 9 << pathFrom << btnFileFrom
+        << org.Break << org.Break
+        << 1 << "" << 4 << "Import To:" << 9 << pathTo << btnFileTo 
+        << org.Break 
+        << org.Break << org.Break << org.Break << org.Break << org.Break
+        << org.Break 
+        << btnExit << 12 << "" << btnImport ;
+        
+        btnImport.PressEvent.Register([&]{
+            Import();
+        });
         
         //Allows the program to be terminated if the window is closed.
         window.DestroyedEvent.Register([&]() {
             exit(0);
         });
+        
+        //Program terminates if Exit button is clicked.
+        btnExit.PressEvent.Register([&]{
+            exit(0);
+        });
             
     }
+    
+    void App::Import(){
+        std::string fromPath = pathFrom.GetText();
+        std::string toPath = pathTo.GetText();
+        std::cout << "Importing Resources From \"" << fromPath << "\" to \"" << toPath << "\"" << std::endl;
+    }
 
     
-    
+    App::initStyle::initStyle(std::string fontname, int fh) {
+        Gorgon::Graphics::Initialize();
+
+        uiStyle.Init ( fh, fontname );
+        uiStyle.Background.Regular = { Gorgon::Graphics::Color::White, 0.2f };
+        uiStyle.Background.Edit = { Gorgon::Graphics::Color::LightYellow, 0.2f };
+        uiStyle.Forecolor.Regular = Gorgon::Graphics::Color::White;
+        uiStyle.Forecolor.Hover = Gorgon::Graphics::Color::Black;
+        uiStyle.Forecolor.Down = { Gorgon::Graphics::Color::Black, 0.3f };
+        //uiStyle.Border.Color = Gorgon::Graphics::Color::Grey;
+        uiStyle.Background.Panel = {Gorgon::Graphics::RGBA(54,54,54,1),1};
+        uiStyle.Focus.Color = Gorgon::Graphics::Color::Yellow;
+        uiStyle.Activate();
+        
+    }
     
 
 }
--- a/Tools/ResourceManagementUI/Source/UI/App.h	Thu Dec 10 02:14:06 2020 +0200
+++ b/Tools/ResourceManagementUI/Source/UI/App.h	Sat Dec 12 01:20:49 2020 +0100
@@ -15,7 +15,7 @@
 #include <Gorgon/Widgets/Button.h>
 #include <Gorgon/Widgets/Checkbox.h>
 #include <Gorgon/Widgets/RadioButtons.h>
-#include <Gorgon/Widgets/Label.h>
+//#include <Gorgon/Widgets/Label.h>
 
 #include <Gorgon/UI/RadioControl.h>
 #include <Gorgon/WindowManager.h>
@@ -30,6 +30,10 @@
 #include <Gorgon/Graphics/Color.h>
 #include <Gorgon/Graphics/FreeType.h>
 
+#include <Gorgon/Graphics/Color.h>
+
+
+//#include "Cli.h"
 
 namespace UI{
     
@@ -37,7 +41,7 @@
     public:
         InitUI() {
             Gorgon::Graphics::Initialize();
-            Gorgon::UI::Initialize("Goldman-Regular.ttf",7,12);            
+            Gorgon::UI::Initialize();            
         };
     };
     
@@ -48,12 +52,26 @@
         
         
     private:
+        
+        void Import();
         //Gorgon Main UI Window
         Gorgon::UI::Window window;
         
         //This will initialize UI after the window is created.
         InitUI uninit;
         
+        //Structure to handle styling of UI
+        struct initStyle {
+            initStyle(std::string fontname, int fh);
+            
+            Gorgon::Widgets::SimpleGenerator uiStyle;
+        };
+        
+        //Initialize styling
+        initStyle initstyl;
+        
+        //UI::Cli cli;
+        
         //Gorgon Icon objects for app window
         Gorgon::Graphics::Bitmap ico;
         Gorgon::WindowManager::Icon icon;
@@ -65,11 +83,13 @@
         Gorgon::Graphics::BlankImage applicationBG;
         
         //Gorgon Button Objects
-        Gorgon::Widgets::Button btnImport, btnFileFrom, btnFileTo;
+        Gorgon::Widgets::Button btnImport, btnFileFrom, btnFileTo, btnExit;
         
         //Gorgon Checkbox opjects
         //Gorgon::Widgets::Checkbox metadata;
         
+        Gorgon::Widgets::Textbox pathTo, pathFrom;
+        
         //Gorgon panel objects
         Gorgon::Widgets::Panel pnlSettings;
         

mercurial