News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

LCUI - A small C library for building user interfaces with C, XML and CSS

Started by LiaoMi, April 03, 2021, 12:19:58 AM

Previous topic - Next topic

LiaoMi

Hi,

our time is popular for various frameworks, especially for building GUI interfaces. I would like to present for discussion one of them, similar to the one already published here UASM and UltraLight - http://masm32.com/board/index.php?topic=9223.0

LCUI - A small C library for building user interfaces with C, XML and CSS

Features
Written in C: Suitable for small applications written primarily in C.language designed for LCUI, it makes it easier to create interactive UIs.
Cross platform: Support for Windows and Linux, you can write Windows Desktop apps and Universal Windows Platform apps, as well as Linux Desktop apps.
XML + CSS: Includes XML and CSS parsers, you can use XML and CSS to describe interface structure and style.
Web-like development experience: Since the design and implementation of LCUI's functions, including layout, CSS, and renderer, are mostly referenced from MDN documents and some popular web front-end development libraries, its development experience and interface effects will have some similarities to web pages. If you already have experience writing web pages with HTML and CSS, it will be easier to get started.
Flexible: Support for adapting the interface to screens of different pixel densities by setting global scaling. Support for using screen density related sp and dp units to describe position and size of the elements.

URL - https://github.com/lc-soft/LCUI and https://github.com/lc-ui/lc-design

Everything that's needed:
https://github.com/lc-soft/LCUI/releases/tag/v2.1.0
https://github.com/lc-ui/lc-design/releases/tag/v1.1.0

The minimum set for Windows:
https://github.com/lc-ui/lc-design/releases/download/v1.1.0/lc-design-1.1.0_x64-windows.lcpkg.zip
https://github.com/lc-ui/lc-design/releases/download/v1.1.0/lc-design-1.1.0_x86-windows.lcpkg.zip
https://github.com/lc-ui/lc-design/releases/download/v1.1.0/lc-design-demo.zip

https://github.com/lc-soft/LCUI/releases/download/v2.1.0/LCUI-2.1.0_x64-windows.lcpkg.zip
https://github.com/lc-soft/LCUI/releases/download/v2.1.0/LCUI-2.1.0_x86-windows.lcpkg.zip

The archives contain header files that need to be converted (LCUI-2.1.0_x64-windows.lcpkg and LCUI-2.1.0_x86-windows.lcpkg.zip)



helloworld.c
#include <LCUI_Build.h>
#include <LCUI/LCUI.h>
#include <LCUI/gui/widget.h>
#include <LCUI/gui/builder.h>
#include <LCUI/gui/widget/textview.h>
#include <LCUI/gui/widget/textedit.h>

static void OnBtnClick(LCUI_Widget self, LCUI_WidgetEvent e, void *arg)
{
wchar_t str[256];
LCUI_Widget edit = LCUIWidget_GetById("edit");
LCUI_Widget txt = LCUIWidget_GetById("text-hello");

TextEdit_GetTextW(edit, 0, 255, str);
TextView_SetTextW(txt, str);
}

int main(int argc, char **argv)
{
LCUI_Widget root, pack, btn;

LCUI_Init();
root = LCUIWidget_GetRoot();
pack = LCUIBuilder_LoadFile("helloworld.xml");
if (!pack) {
return -1;
}
Widget_Append(root, pack);
Widget_Unwrap(pack);
btn = LCUIWidget_GetById("btn");
Widget_BindEvent(btn, "click", OnBtnClick, NULL, NULL);
return LCUI_Main();
}


Interesting projects that are implemented using this library
LC-Finder - An image annotation and object detection tool written in C - https://github.com/lc-soft/LC-Finder/releases and https://github.com/lc-soft/LC-Finder



The development of LCFinder is inseparable from the support of these projects:

LCUI — UI engine, provide graphical user interface support
LCUI.css — UI component library, provides basic styles and components for the graphical user interface
darknetlibC bindings for darknet, provide image recognition support