- Window 7, 8.1, 10 or Linux distribution
- GTK+ 3.22 or later
- gcc on Linux or MSVC on Window
- Git
For further more experience use the C++ standard 17 or later.
- Windows 10 with Visual Studio 2019
- Ubuntu 18.02 LTS, and Ubuntu 20.04 LTS
Install gtk on windows with vcpkg
Clone this repository
git clone https://github.com/Developmentprogramming/CGui.git
- Open the visual studio and create a new cpp empty console project(CGui).
- Copy the cloned repository to the cpp empty console project(CGui) except Makefile, Main.cc, Examples/, Image/ Readme.md.
- Right click cpp empty console project(CGui)->Properties->Configuration Properties->General->Configuration Type and select Static library.
- Create a new cpp empty console project2(your_project_name).
- Add a reference of cpp empty console project(CGui) to cpp empty console project2(your_project_name).
- Right click cpp empty console project2(your_project_name)->Properties->Configuration Properties->C/C++->General->Additional include directories and add the path of cpp empty console project(CGui).
Install dependencies for CGui
sudo apt-get install g++-8 libgtk-3-dev git make
Clone this repository
git clone https://github.com/Developmentprogramming/CGui.git
Start the installtion process
cd CGui/Installer/bin
chmod +x ./Installer
./Installer
Now choose the path where you want to install, and check the Universal Access to get access of this library from any where on your system.
And at last click on install and wait until it finsihes.
Note: This installer itself is made using this library(CGui).
If you want to install in Preferred Path location then you must run this installer with root access, and if you want to install it in the Current Path location or any other user's location then no need for root access.
git clone https://github.com/Developmentprogramming/CGui.git
cd CGui
make -i PrecompiledHeaders
For compile any file, use the following command line:
g++-8 -std=c++17 file.cc `pkg-config gtk+-3.0 --cflags --libs`
- Change the file.cc with your cpp file.
g++-8
for g++ 8th generation compiler-std=c++17
for c++ standard version 17`pkg-config gtk+-3.0 --cflags --libs`
for invoking all the GTK+ files
Compile the test file and run it(Only for testing the CGui is working):
g++-8 -std=c++17 Main.cc -o Main `pkg-config gtk+-3.0 --cflags --libs`
./Main
If you see this message Welcome to CGui.
Congratulations!!!, it's working... .
// Label example
#include <CGUI.hh>
using namespace CGui;
int main(int argc, char *argv[])
{
Init init(argc, argv); // Initialize CGui
// Some code
Window window(WindowType::TOPLEVEL, "CGUI WINDOW", WindowPos::CENTER); // Create a new Window
Label label("Text");
label.Align(Alignments::CENTER, Alignments::CENTER); // align the label to center horizontally and vertically
window.Add(label); // add label to window
window.DefaultSize(640, 480); // window default size
window.InternalWidth(10); // Internal window width
window.ShowAll(); // Show all widgets
init.Render(); // Start the main loop
return 0;
}
//Image Example
#include <CGUI.hh>
using namespace CGui;
int main(int argc, char *argv[])
{
Init init(argc, argv); // Initialize CGui
// Some Code
Window window(WindowType::TOPLEVEL, "CGUI WINDOW", WindowPos::CEN); // Create a new Window
Pixbuf pixbuf("./Image/yaktocat.png", 400, 400);
Image image(pixbuf); // create a new image of size of 400X400
image.Align(Alignments::CENTER, Alignments::CENTER); // align the image to center horizontally and vertically
window.Add(image); // add image to window
window.DefaultSize(640, 480); // window default size
window.InternalWidth(10); // Internal window width
window.ShowAll(); // Show all widgets
init.Render(); // Start the main loop
return 0;
}
// Button example
#include <CGUI.hh>
#include <iostream>
using namespace CGui;
static void Button_Clicked()
{
std::cout << "Hello World" << std::endl;
}
int main(int argc, char *argv[])
{
Init init(argc, argv); // Initialize CGui
// Some Code
Window window(WindowType::TOPLEVEL, "CGUI WINDOW", WindowPos::CENTER); // Create a new Window
Button button("Button"); // Create a new button
button.Align(Alignments::CENTER, Alignments::CENTER); // align button to center horizontally and vertically
button.Clicked(Button_Clicked);
window.Add(button); // add button to window
window.DefaultSize(640, 480); // window default size
window.InternalWidth(10); // Internal window width
window.ShowAll(); // Show all widgets
init.Render(); // Start the main loop
return 0;
}
Email: developmentprogramming154@gmail.com
Name: Parth Lodhia
Age: 17
Email: parthlodhia154@gmail.com