PlexyDesk : GPU accelerated Display Server for GNU/Linux and BSD
Search
PlexyDesk
Not logged in
Talk
Contributions
Create account
Log in
Open Desktop Systems Journal
Main page
Documentation
Architecture
Development
Components
News
Gallery
Community
Page
Discussion
Read
Edit
Edit source
View history
Editing
Examples
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Examples = The repository includes a small collection of examples that are useful both as smoke tests and as reference code for application authors. == Minimal PlexyUI example == The following example is based on <code>examples/hello_uikit.c</code>: <pre> #include <plexy_ui.h> #include <stdio.h> static void on_click(uint32_t widget_id, void* userdata) { printf("Button clicked! (widget %u)\n", widget_id); } int main(void) { PlexyApp* app = plexy_app_create("Hello UIKit"); PlexyWindow* win = plexy_window_create(app, 400, 300, "Hello PlexyDesk"); uint32_t root = plexy_window_root(win); plexy_padding(win, root, 24, 24, 24, 24); plexy_gap(win, root, 16); plexy_justify(win, root, PLEXY_JUSTIFY_CENTER); plexy_align(win, root, PLEXY_ALIGN_CENTER); uint32_t title = plexy_label(win, root, "Welcome to PlexyDesk UIKit"); plexy_set_text_color_hex(win, title, "#1f2937"); uint32_t btn = plexy_button(win, root, "Click Me"); plexy_set_fill_color_hex(win, btn, "#3b82f6"); plexy_set_text_color_hex(win, btn, "#ffffff"); plexy_on_click(win, btn, on_click, NULL); plexy_app_run(app); plexy_app_destroy(app); return 0; } </pre> Build and run: <pre> gcc -o hello_uikit hello_uikit.c -L../lib -lplexyui ./hello_uikit </pre> == Useful example files == {| class="wikitable" |- ! File ! Why it is useful |- | <code>examples/hello_uikit.c</code> | Smallest usable PlexyUI program |- | <code>examples/hello_client.c</code> | Lightweight client-side entry point |- | <code>examples/canvas_demo.c</code> | Canvas and rendering-oriented example |- | <code>examples/drawer_demo.c</code> | Drawer and interaction example |- | <code>examples/plexy_dock.c</code> | Dock-related shell UI ideas |- | <code>examples/settings_panel.c</code> | Structured settings-style interface |- | <code>examples/showcase_demo.c</code> | Broader demonstration page for the toolkit |- | <code>examples/widget_demo.c</code> | Widget coverage and visual output |} == What to learn from the examples == * how to create an application and a root window * how layout is controlled with padding, gap, justify, align, and rows or columns * how to style widgets with color, radius, elevation, and glass-related helpers * how to bind click and value callbacks * how client programs fit into the compositor model == Next step == After reading the examples, continue with [[Developer Guide]] and [[Architecture]].
Summary:
Please note that all contributions to PlexyDesk - Display Server for GNU/Linux may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)