Skip to content

Free open-source C11 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.

License

Notifications You must be signed in to change notification settings

gammasoft71/xtd_c

Repository files navigation

xtd_c

xtd_c (pronounced "extend for c") is a C11 framework to create console (CLI), forms (GUI like WinForms) and tunit (unit tests like Microsoft Unit Testing Framework) applications on Microsoft Windows, Apple macOS, Linux, iOS and android (*).

logo

(*) See portability for more information.

License Language web Reference Guide wiki discord

Warning

⚠️ xtd_c IS UNDER DEVELOPMENT AND IS NOT READY TO BE USED. ⚠️

Features

  • Free and open-source (MIT License);
  • a collection of native C11 libraries, to extend C11 standard;
  • API close to the xtd with a modern C11 approach and full integration with the ANSI/ISO standard;
  • xtd_c is designed to manage GUI controls and dialogs in pure native mode or with CSS styles.
  • written in efficient, C11;
  • and highly portable and available on many different platforms;

Dependency

xtd_c is a C11 wrapper on xtd framework. You need to install xtd before using xtd_c.

xtd libraries architecture

architecture_logo

xtd_c is composed of several libraries.

xtd_c.core

core The xtd_c.core library is C11 libraries of struct, enum, and value types that provide access to system functionality. It is the foundation on which C11 applications, components, and controls are built.

xtd_c.drawing

drawing The xtd_c.drawing library contains types that support basic GDI+ graphics functionality. Child namespaces support advanced two-dimensional and vector graphics functionality, advanced imaging functionality, and print-related and typographical services. A child namespace also contains types that extend design-time user-interface logic and drawing.

xtd_c.forms

forms The xtd_c.forms library contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows, Apple macOS and linux base operating system.

xtd_c.tunit

tunit The xtd_c.tunit library is a unit-testing framework for modern C11, inspired by Microsoft.VisualStudio.TestTools.Cpp.

Getting Started

  • Comming soon...

Development status

  • Comming soon...

Current release status

  • Comming soon...

This project is an open source project. The developers who participate do so on their own time. It is therefore difficult to fix realese dates.

But you can follow the evolution of the development. We keep the status up to date.

Continuous Integration build status

  • Comming soon...

Issues status

  • Comming soon...

Examples

The classic first application 'Hello World'.

Console (CLI)

hello_world_console.c

#include <xtd_c/xtd_c.h>

int main(void) {
  xtd_console_set_background_color(xtd_console_color_blue);
  xtd_console_set_foreground_color(xtd_console_color_white);
  xtd_console_write_line("Hello, World!");
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.3)

project(hello_world_console)
find_package(xtd_c REQUIRED)
add_sources(hello_world_console.c)
target_type(C_CONSOLE_APPLICATION)

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

Screenshot

Forms (GUI like WinForms)

hello_world_forms.c

#include <xtd_c/xtd_c.h>

void on_button1_click(xtd_object* sender, xtd_event_args e) {
  xtd_forms_message_box_show(NULL, "Hello, World!", "", xtd_forms_message_box_buttons_ok, xtd_forms_message_box_icon_none, xtd_forms_message_box_default_button_1, xtd_forms_message_box_options_none, false);
}

int main(void) {
  xtd_forms_control* form1 = xtd_forms_form_create();
  xtd_forms_control_set_text(form1, "Hello world (message_box)");
  
  xtd_forms_control* button1 = xtd_forms_button_create();
  xtd_forms_control_set_location(button1, (xtd_drawing_point){.x = 10, .y = 10});
  xtd_forms_control_set_parent(button1, form1);
  xtd_forms_control_set_text(button1, "&Click me");
  xtd_forms_control_set_click_event(button1, &on_button1_click, NULL);

  xtd_forms_application_run(XTD_FORMS_FORM(form1));
  
  xtd_forms_control_destroy(button1);
  xtd_forms_control_destroy(form1);
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.3)

project(hello_world_forms)
find_package(xtd_c REQUIRED)
add_sources(hello_world_forms.c)
target_type(C_GUI_APPLICATION)

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

Windows

Screenshot

Screenshot

macOS

Screenshot

Screenshot

Linux Gnome

Screenshot

Screenshot

tunit (Unit tests like Microsoft Unit Testing Framework)

hello_world_test.c

#include <xtd_c/xtd_c.h>
#include <string.h>

void XTD_TUNIT_TEST(hello_world_test, create_string_from_literal) {
 const char* s = "Hello, World!";
 XTD_TUNIT_ASSERT_ARE_EQUAL("Hello, World!", s);
}

void XTD_TUNIT_TEST(hello_world_test, create_string_from_chars) {
 const char s[14]  = {'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!', '\0'};
 XTD_TUNIT_VALID_ARE_EQUAL(13, s.size());
 XTD_TUNIT_STRING_ASSERT_STARTS_WIDTH("Hello,", s);
 XTD_TUNIT_STRING_ASSERT_ENDS_WIDTH(" World!", s);
}

int main(void) {
 return xtd_console_unit_test_run();
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.3)

project(hello_world_test)
find_package(xtd_c REQUIRED)
add_sources(hello_world_test.c)
target_type(C_TEST_APPLICATION)

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

  • Comming soon...

xtd

For more information about xtd framework see xtd website.

Contributing

The authors file lists contributors together with contact information. If you make a contribution, please add yourself to the list.

Your contributions are welcome.

  • First read Code of conduct and the design guidelines to make sure your contribution follows the rules.
  • Fork the project and use a pull request for adding your contribution.
  • If you face any problems feel free to open an issue at the issues tracker, If you feel like there is a missing feature, please raise a ticket on Github. Pull request are also welcome.

Your feedback is important for the evolution of the project.

Beginners

The following project aims to simplify and guide the way beginners make their first contribution. If you are looking to make your first contribution, check out the project below.

First Contributions

Now you are ready to make your first contribution to xtd.

See also

  • Comming soon...

© 2022 Gammasoft.

Releases

No releases published

Packages

No packages published