{"id":13894266,"url":"https://github.com/lsp-plugins/lsp-tk-lib","last_synced_at":"2026-03-11T23:39:40.745Z","repository":{"id":48997282,"uuid":"261513623","full_name":"lsp-plugins/lsp-tk-lib","owner":"lsp-plugins","description":"Graphical toolkit library used by LSP Plugins","archived":false,"fork":false,"pushed_at":"2026-02-19T17:03:22.000Z","size":5601,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-02-19T20:41:13.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsp-plugins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"liberapay":"sadko4u","patreon":"sadko4u","custom":["https://www.blockchain.com/btc/address/15X3AfDRF3EshSLBoK8UfHAsFr2TQsH8pk","https://etherscan.io/address/0x079b24da78d78302cd3cfbb80c728cd554606cc6","https://www.bountysource.com/teams/lsp-plugins","https://paypal.me/sadko4u"]}},"created_at":"2020-05-05T15:41:54.000Z","updated_at":"2025-12-20T11:25:45.000Z","dependencies_parsed_at":"2025-12-30T09:00:57.932Z","dependency_job_id":null,"html_url":"https://github.com/lsp-plugins/lsp-tk-lib","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/lsp-plugins/lsp-tk-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-tk-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-tk-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-tk-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-tk-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsp-plugins","download_url":"https://codeload.github.com/lsp-plugins/lsp-tk-lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-tk-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30407285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T22:36:59.286Z","status":"ssl_error","status_checked_at":"2026-03-11T22:36:57.544Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T18:01:28.034Z","updated_at":"2026-03-11T23:39:40.709Z","avatar_url":"https://github.com/lsp-plugins.png","language":"C++","funding_links":["https://liberapay.com/sadko4u","https://patreon.com/sadko4u","https://www.blockchain.com/btc/address/15X3AfDRF3EshSLBoK8UfHAsFr2TQsH8pk","https://etherscan.io/address/0x079b24da78d78302cd3cfbb80c728cd554606cc6","https://www.bountysource.com/teams/lsp-plugins","https://paypal.me/sadko4u"],"categories":["C++"],"sub_categories":[],"readme":"# lsp-tk-lib\n\nGraphical toolkit library used by Linux Studio Plugins Project.\n\n![Indicator widget](res/doc/indicator.png)\n\n## Key features\n\n* Supported platforms:\n  * FreeBSD (X11/OpenGL, X11/Cairo);\n  * GNU/Linux (X11/OpenGL, X11/Cairo);\n  * Windows (WinAPI/Direct2D).\n* Pretty leightweight, only about 2 MB of compiled code.\n* Almost minimum global state (used only in case when underlying API requires global variables),\n  all operations are performed on `tk::Display` main object and objects derived from `tk::Widget`.\n  This makes possible to have multiple versions of library for instances in the same runtime under\n  certain circumstances.\n* Basic styling support. Style schema can be loaded from the XML file and updated in runtime.\n* Automatic space and widget layout allocation.\n* Dynamic widget scaling is supported for High DPI displays.\n* Multilingual support, languages may be switched in runtime without need of application reload.\n  There is also a flexible way to manage access to the dicionary data.\n* All widgets provide set of object properties which change the appearance and\n  behaviour of the widget in runtime.\n* Slots (one publisher - multiple subscribers) for handling UI events.\n\n## Overall list of widgets\n\nThis library provides set of widgets useful for creating user interfaces of plugins.\n\nThe full list of provided widgets:\n* 3D rendering:\n  * Area3D - the 3D scene rendering widget which supports different rendering backends\n    which implement [R3D interfaces](https://github.com/sadko4u/lsp-r3d-iface.git).\n* Compound widgets:\n  * ComboBox - widget with drop-down list.\n  * ComboGroup - widget group with drop-down list for selection of currently visible widget.\n  * ListBox - list of selectable items.\n  * Menu - popup menu.\n* Widget containers:\n  * Align - widget alignment among the surrounding container.\n  * Box - container for packaging widgets into a single horizontal row or vertical column.\n  * Grid - container for packaging widgets into table.\n  * Group - container for surrounding widgets into a distinguishable group.\n  * MultiLabel - widget that allows to implement overlay of multiple labels on the same area.\n  * Overlay - special container for displaying overlayed widgets on the window.\n  * ScrollArea - container that allows to package widget into limited rectangular space.\n  * TabControl - container that allows to organize widgets as a set of tabs.\n  * TabGroup - container that behaves similar to ComboGroup but uses tabs insetad of combo box.\n  * Window - window widget.\n* Dialogs:\n  * FileDialog - widget for selecting files for load/save operations.\n  * MessageBox - widget for displaying popup messages.\n* 2D graph widgets for rendering graphs and plots:\n  * Graph - widget for rendering 2D graphical data (graphs and plots).\n  * GraphAxis - axis on a graph widget.\n  * GraphDot - dot on a graph widget.\n  * GraphFrameBuffer - frame buffer for drawing on the graph widget.\n  * GraphLineSegment - grap line segment defined by two points.\n  * GraphMarker - marker on the graph widget.\n  * GraphMesh - widget for drawing meshes on the graph widget.\n  * GraphOrigin - widget for defining origins within the graph widget.\n* Simple widgets:\n  * Bevel - simple widget that allows to draw bevels/facets in the UI.\n  * Button - simple button which can operate in different modes.\n  * CheckBox - squared single on/off toggle.\n  * Edit - single line text edit widget.\n  * Fader - fader widget.\n  * Hyperlink - hyperlink widget.\n  * Indicator - 7-segment LED indicator.\n  * Knob - single rotating knob.\n  * Label - single/multiline text.\n  * Led - led widget.\n  * ListBoxItem - single item of the ListBox widget.\n  * MenuItem - menu item widget used by Menu widget.\n  * ProgressBar - widget for displaying progress of some long lasting process.\n  * RadioButton - rounded single on/off toggle.\n  * ScrollBar - single scroll bar.\n  * Separator - separator widget to visually separate space allocated in widget containers.\n  * Void - void widget which can be used for filling empty area.\n* Specifific widgets\n  * AudioChannel - single audio channel oscillogram.\n  * AudioSample - oscillogram of audio sample with multiple audio channels.\n  * FileButton - button of 1.44\" disk form for loading/saving files.\n  * Fraction - music fraction with numerator and denominator.\n  * LedMeter - led level/peak meter with multiple channels.\n  * LedMeterChannel - single-channel level/peak meter.\n\n## Styling system\n\nStyling system allows to apply different styles to the same widgets:\n\nStandard theme:\n\n![Indicator widget](res/doc/filedialog-standard.png)\n\nLSP theme:\n\n![Indicator widget](res/doc/filedialog-lsp.png)\n\nDrak flat theme:\n\n![Indicator widget](res/doc/filedialog-dark.png)\n\n## Multilingual support\n\nEach string is associated with a dot-separated text key which defines the corresponding\npath in the dictionary to access the localized string nb. All dictionaries for the same language\nare stored as JSON files in a directory with the symbolic name of the language (for example, `en`).\nAll possible languages are stored in a single localization directory which is passed to the\ntoolkit. Additional fallback `default` directory is also considered for searching keys which\nare not present in the current language.\n\nExample of a dictionary `actions.json`:\n```\n{\n\t\"cancel\": \"Cancel\",\n\t\"nav\": {\n\t\t\"go\": \"Go\",\n\t\t\"up\": \"Up\"\n\t},\n\t\"to_bookmarks\": \"+Bookmarks\",\n\t\"dlg\": {\n\t\t\"open\": \"Open dialog\",\n\t\t\"save\": \"Save dialog\"\n\t},\n\t\"open\": \"Open\",\n\t\"save\": \"Save\",\n\t\"link\": {\n\t\t\"follow\": \"Follow link\",\n\t\t\"copy\": \"Copy link\"\n\t},\n\t\"edit\": {\n\t\t\"delete\": \"Delete\",\n\t\t\"move_first\": \"Move first\",\n\t\t\"move_last\": \"Move last\",\n\t\t\"move_up\": \"Move up\",\n\t\t\"move_down\": \"Move down\",\n\t\t\"cut\": \"Cut\",\n\t\t\"copy\": \"Copy\",\n\t\t\"paste\": \"Paste\"\n\t},\n\t\"confirm\": {\n\t\t\"yes\": \"Yes\",\n\t\t\"no\": \"No\"\n\t},\n\t\"ok\": \"OK\"\n}\n```\n\nThe string `Open dialog` from the localization data can be accessed in the toolkit by specifying\npath `actions.dlg.open`. Additionally, there is a way to manage access to the localization data\nin case when bundles are organized in some other way or stored as built-in into application resources.\n\n\n## Example\n\n```C++\n\n#include \u003cstdio.h\u003e\n#include \u003clsp-plug.in/tk/tk.h\u003e\n\n// Handle the window close request event\nstatic lsp::status_t slot_close(lsp::tk::Widget *sender, void *ptr, void *data)\n{\n    // Obtain the display and leave the main loop\n    sender-\u003edisplay()-\u003equit_main();\n    return lsp::STATUS_OK;\n}\n\n// Handle the key release event\nstatic lsp::status_t slot_key_up(lsp::tk::Widget *sender, void *ptr, void *data)\n{\n    // Obtain the toplevel widget (window)\n    lsp::tk::Window *wnd = lsp::tk::widget_cast\u003clsp::tk::Window\u003e(sender-\u003etoplevel());\n    lsp::ws::event_t *ev = static_cast\u003clsp::ws::event_t *\u003e(data);\n\n    if ((wnd != NULL) \u0026\u0026 (ev != NULL) \u0026\u0026 (ev-\u003enType == lsp::ws::UIE_KEY_UP))\n    {\n        printf(\"Key up: %c (0x%x)\\n\", (char)ev-\u003enCode, int(ev-\u003enCode));\n\n        // Get current scaling\n        float scaling = wnd-\u003estyle()-\u003eschema()-\u003escaling()-\u003eget();\n\n        // Change the scaling\n        switch (ev-\u003enCode)\n        {\n            case '+':\n            case lsp::ws::WSK_KEYPAD_ADD:\n                scaling     = lsp::lsp_max(0.25f, scaling + 0.25f);\n                break;\n            case '-':\n            case lsp::ws::WSK_KEYPAD_SUBTRACT:\n                scaling     = lsp::lsp_max(0.25f, scaling - 0.25f);\n                break;\n            default:\n                break;\n        }\n\n        // Update scaling of the window\n        wnd-\u003estyle()-\u003eschema()-\u003escaling()-\u003eset(scaling);\n    }\n    return lsp::STATUS_OK;\n}\n\nstatic lsp::status_t slot_ok_submitted(lsp::tk::Widget *sender, void *ptr, void *data)\n{\n    // Avoid widget destroy in event handlers,\n    // query widget for removal at the end of main loop iteration\n    lsp::tk::MessageBox *mbox = lsp::tk::widget_ptrcast\u003clsp::tk::MessageBox\u003e(ptr);\n    mbox-\u003edisplay()-\u003equeue_destroy(mbox);\n    return lsp::STATUS_OK;\n}\n\nstatic lsp::status_t slot_btn_submit(lsp::tk::Widget *sender, void *ptr, void *data)\n{\n    // Create message box\n    lsp::tk::MessageBox *mbox = new lsp::tk::MessageBox(sender-\u003edisplay());\n    mbox-\u003einit();\n    mbox-\u003etitle()-\u003eset(\"Message\");\n    mbox-\u003eheading()-\u003eset_raw(\"Information\");\n    mbox-\u003emessage()-\u003eset(\"Button has been clicked\");\n    mbox-\u003eadd(\"OK\", slot_ok_submitted, mbox);\n    mbox-\u003ebutton_layout()-\u003eset_halign(1.0f);\n\n    mbox-\u003ebutton_constraints()-\u003eset_fixed(64, 16);\n\n    mbox-\u003eshow(sender);\n    return lsp::STATUS_OK;\n}\n\nint main(int argc, const char *argv[])\n{\n    // Initialize the tookit\n    lsp::tk::init(0, NULL);\n\n    // Create the display\n    lsp::tk::Display *dpy = new lsp::tk::Display();\n\n    // Initialize the display\n    if (dpy-\u003einit(0, NULL) != lsp::STATUS_OK)\n        return -1;\n\n    // Create widgets\n    lsp::tk::Window *wnd     = new lsp::tk::Window(dpy);\n    lsp::tk::Box *box        = new lsp::tk::Box(dpy);\n    lsp::tk::Label *label    = new lsp::tk::Label(dpy);\n    lsp::tk::Button *btn     = new lsp::tk::Button(dpy);\n\n    // Initialize widgets\n    wnd-\u003einit();\n    box-\u003einit();\n    label-\u003einit();\n    btn-\u003einit();\n\n    // Initialize widgets\n    wnd-\u003etitle()-\u003eset_raw(\"Example window\");\n    wnd-\u003erole()-\u003eset_raw(\"example-window\");\n    wnd-\u003ebg_color()-\u003eset_rgb(0.75f, 1.0f, 1.0f);\n    wnd-\u003eactions()-\u003eset_actions(lsp::ws::WA_MOVE | lsp::ws::WA_RESIZE | lsp::ws::WA_CLOSE);\n    wnd-\u003eborder_style()-\u003eset(lsp::ws::BS_DIALOG);\n    wnd-\u003econstraints()-\u003eset(160, 100, 640, 400);\n    wnd-\u003esize()-\u003eset(320, 200);\n    wnd-\u003epointer()-\u003eset(lsp::ws::MP_TABLE_CELL);\n    wnd-\u003elayout()-\u003eset(0.0f, 0.0f, 1.0f, 1.0f);\n    wnd-\u003epadding()-\u003eset(16);\n\n    box-\u003eorientation()-\u003eset(lsp::tk::O_VERTICAL);\n    box-\u003espacing()-\u003eset(4);\n\n    label-\u003efont()-\u003eset_size(16.0f);\n    label-\u003efont()-\u003eset_bold(true);\n    label-\u003etext()-\u003eset_raw(\"Example\\nLabel\");\n    label-\u003eallocation()-\u003eset_vexpand(true);\n\n    btn-\u003etext()-\u003eset(\"Button\");\n    btn-\u003ecolor()-\u003eset(\"#008800\");\n    btn-\u003etext_color()-\u003eset(\"#ffff00\");\n    btn-\u003econstraints()-\u003eset(96, 24, 96, -1);\n\n    // Initialize widget structure\n    wnd-\u003eadd(box);\n    box-\u003eadd(label);\n    box-\u003eadd(btn);\n\n    // Initialize event handlers\n    wnd-\u003eslot(lsp::tk::SLOT_CLOSE)-\u003ebind(slot_close, NULL);\n    wnd-\u003eslot(lsp::tk::SLOT_KEY_UP)-\u003ebind(slot_key_up, NULL);\n    btn-\u003eslot(lsp::tk::SLOT_KEY_UP)-\u003ebind(slot_key_up, NULL);\n    label-\u003eslot(lsp::tk::SLOT_KEY_UP)-\u003ebind(slot_key_up, NULL);\n    box-\u003eslot(lsp::tk::SLOT_KEY_UP)-\u003ebind(slot_key_up, NULL);\n    btn-\u003eslot(lsp::tk::SLOT_SUBMIT)-\u003ebind(slot_btn_submit, NULL);\n\n    // Show window at the center of screen\n    ssize_t sw = 0, sh = 0;\n    lsp::ws::rectangle_t wsz;\n    dpy-\u003escreen_size(0, \u0026sw, \u0026sh);\n    wnd-\u003esize()-\u003ecompute(\u0026wsz, wnd-\u003escaling()-\u003eget());\n    wnd-\u003eposition()-\u003eset((sw - wsz.nWidth)/2, (sh - wsz.nHeight)/2);\n    wnd-\u003evisibility()-\u003eset(true);\n\n    // Enter the main event loop\n    dpy-\u003emain();\n\n    // Destroy widgets\n    btn-\u003edestroy();\n    label-\u003edestroy();\n    box-\u003edestroy();\n    wnd-\u003edestroy();\n\n    // Delete widget objects\n    delete btn;\n    delete label;\n    delete box;\n    delete wnd;\n\n    // Destroy display\n    dpy-\u003edestroy();\n    delete dpy;\n\n    return 0;\n}\n\n```\n\nThe result of this example:\n\n![Indicator widget](res/doc/example.png)\n\n![Indicator widget](res/doc/example-msg.png)\n\n## SAST Tools\n\n* [PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=website\u0026utm_medium=github\u0026utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsp-plugins%2Flsp-tk-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsp-plugins%2Flsp-tk-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsp-plugins%2Flsp-tk-lib/lists"}