Home

Awesome

<p align="center"> <a href="https://lcui.org/"> <img src="https://lcui.lc-soft.io/static/images/lcui-logo-lg.png" alt="" width=72 height=72> </a> <h3 align="center">LCUI</h3> <p align="center"> A small C library for building user interfaces with C, XML and CSS. </p> <p align="center"> <a href="https://github.com/lc-soft/LCUI/actions"><img alt="GitHub Actions" src="https://github.com/lc-soft/LCUI/workflows/C%2FC%2B%2B%20CI/badge.svg"></a> <a href="https://codecov.io/gh/lc-soft/LCUI"><img src="https://codecov.io/gh/lc-soft/LCUI/branch/develop/graph/badge.svg" /></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/github/license/lc-soft/LCUI.svg" alt="License"></a> <a href="https://github.com/lc-soft/LCUI/releases"><img src="https://img.shields.io/github/release/lc-soft/LCUI/all.svg" alt="Github Release"></a> <a href="https://github.com/lc-soft/LCUI/releases"><img src="https://img.shields.io/github/downloads/lc-soft/LCUI/total.svg" alt="Github All Releases"></a> <img src="https://img.shields.io/github/repo-size/lc-soft/LCUI.svg" alt="Repo size"> <img src="https://img.shields.io/github/languages/code-size/lc-soft/LCUI.svg" alt="Code size"> </p> </p>

Table of contents

<!-- TOC --> <!-- /TOC -->

Introduction

LCUI (LC's UI Library) is a small C library for building user interfaces.

中文版说明文档

Features

Screenshots

<table> <tbody> <tr> <td> <a class="thumbnail" href="https://github.com/lc-soft/LCUI/blob/develop/test/helloworld.c"> <img src="https://lcui.org/static/images/showcase/screenshot-lcui-hello.png" alt="Hello App"/> </a> </td> <td> <a class="thumbnail" href="https://github.com/lc-soft/LC-Finder"> <img src="https://gitee.com/lc-soft/LC-Finder/raw/develop/screenshots/2.jpg" alt="LC Finder"/> </a> </td> </tr> <tr> <td> <a class="thumbnail" href="https://github.com/lc-ui/lcui-router-app"> <img src="https://gitee.com/lc-ui/lcui-router-app/raw/master/screenshot.gif" alt="LCUI Router App"/> </a> </td> <td> <a class="thumbnail" href="https://github.com/lc-ui/lc-design"> <img src="https://lcui.lc-soft.io/static/images/showcase/lc-design-example-preview.png" alt="LC Design"/> </a> </td> </tr> </tbody> </table>

Related projects

Want to know what LCUI can do? You can view the following projects:

Design references

Quick start

Use LCUI CLI

LCUI CLI is a command line tool, you need to install Node.js before using it, and then run the following command to quickly experience it:

# Install lcui-cli and lcpkg
npm install -g @lcui/cli lcpkg

# Create an LCUI project named myapp
lcui create myapp

# Go into project directory
cd myapp

# set up the development environment for this project
lcui setup

# Build project
lcui build

# run project
lcui run

Manual compilation and installation

Windows

  1. Open CMD window, and run following command in the LCUI source directory to install the dependency libraries:
    lcpkg install
    # If you want compile for x64 CPU architecture
    lcpkg install --arch x64
    # If you want compile for Universal Windows Platform (UWP)
    lcpkg install --platform uwp
    lcpkg install --arch x64 --platform uwp
    
  2. Rename config.win32.h.in in the include directory to config.h.
  3. Open the build/windows/LCUI.sln file with Visual Studio, and then build LCUI.

Ubuntu

# Install the dependencies
sudo apt-get install libpng-dev libjpeg-dev libxml2-dev libfreetype6-dev libx11-dev

# Clone this repository
git clone https://github.com/lc-soft/LCUI.git

# Go into the repository
cd LCUI

# Generate automake configure script
./autogen.sh

# Check the build environment and configure automake scripts
./configure

# Build
make

# If you wnat install LCUI
sudo make install

# Go into test directory
cd test

# Run helloworld application
./helloworld

Note: If you want to customize the compiler, compile flags, install location, and other configuration items, read the INSTALL file.

Contribution

Think LCUI is slow to update? there are many ways to contribute to LCUI.

LCUI has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates our values well. For more, see the Code of Conduct.

Documentation

The English version of the documentation is not available, because the author does not have time to write the English version, please read the files in the test directory and related projects to learn how to use LCUI.

FAQ

  1. Why develop it?

    • Explore and experiment new GUI development way
    • Let other developers share about how to write better code
    • Make it easier for me to find better jobs to make more money
    • Pass the time
  2. Is this a browser kernel? Or a development library like Electron that integrates the browser environment?

    No, you can think of it as a traditional GUI development library that applied some Web technologies.

  3. What do I need to pay attention to if I'm going to use it?

    We recommend that your project meet the following requirements:

    • The user interface is simple and does not require advanced features such as tables, animations, and transformations.
    • The code design is reasonable, and the core function code and UI logic code are independent of each other. Even if you find that the requirements are not met after using LCUI, you can easily migrate to other GUI libraries.
  4. Why do I choose the LCUI instead of Electron?

    In contrast to fully functional Electron, these features of LCUI, such as small binary file size and low memory usage, are not worth mentioning, except for technical research and share, you have no reason to use LCUI.

  5. Is it the same as writing a web page?

    Not exactly, there are the following differences need to be noted:

    • The interface description file format is XML, slightly different from HTML.
    • You need to implement all the features of your application in C code, which is much less development efficiency than JavaScript.
    • No <script> tag, you can't embed JavaScript or C code like HTML.
    • The widget is the basic layout element, not the text, and there is no inline display type.
    • The scrollbar is a widget, and the overflow: scroll; style doesn't show scrollbars automatically, you need to create it and specify the container and scroll layer.
    • All text is rendered by the TextView widget, which has a display type of block instead of inline.
    • The widget does not overflow the bounding box of the parent widget, and the effect is similar to the applied style: overflow: hidden;.
    • An absolutely positioned widget is always relative to its parent widget, not the first non-statically positioned widget of the parent.
    • There are no tools like Chrome Devtools to debug graphical interfaces, you need to rely on your own imagination and development experience to verify that the bug is from your code or LCUI.。
  6. How about CSS support?

    The following is a list of supported CSS features. Checked is supported (But does not mean full support). Unlisted properties are not supported by default.

    <details> <summary>CSS feature coverage</summary>
    • at rules
      • @font-face
      • @keyframes
      • @media
    • keywords
      • !important
    • selectors
      • *
      • type
      • #id
      • .class
      • :hover
      • :focus
      • :active
      • :first-child
      • :last-child
      • [attr="value"]
      • :not()
      • :nth-child()
      • parent > child
      • a ~ b
      • ::after
      • ::before
      • ...
    • units
      • px
      • dp
      • sp
      • pt
      • %
      • rem
      • vh
      • vw
    • properties
      • top, right, bottom, left
      • width, height
      • visibility
      • display
        • none
        • inline-block
        • block
        • flex
        • inline-flex
        • inline
        • grid
        • table
        • table-cell
        • table-row
        • table-column
        • ...
      • position
        • static
        • relative
        • absolute
        • fixed
      • box-sizing
        • border-box
        • content-box
      • border
      • border-radius
      • background-color
      • background-image
      • background-position
      • background-cover
      • background
      • pointer-events
      • font-face
      • font-family
      • font-size
      • font-style
      • flex
      • flex-shrink
      • flex-grow
      • flex-basis
      • flex-wrap
      • flex-direction
      • justify-content
        • flex-start
        • center
        • flex-end
      • align-items
        • flex-start
        • center
        • flex-end
        • stretch
      • float
      • transition
      • transform
      • ...
    </details>

License

The LCUI Project is released under the MIT License.