On Tuesday, 20 May 2014 at 18:13:36 UTC, Vadim Lopatin wrote:
Hello!
I would like to announce my project, DlangUI library -
cross-platform GUI for D.
https://github.com/buggins/dlangui
License: Boost License 1.0
Native library written in D (not a wrapper to other GUI
library) - easy to extend.
As a backend, uses SDL2 on any platform, Win32 API on Windows,
XCB on Linux. Other backends can be added easy.
Tested on Windows and Linux.
Supports hardware acceleration - drawing using OpenGL when
built with version=USE_OPENGL.
Unicode support.
Internationalization support.
Uses Win32 API fonts on Windows, and FreeType on other
platforms.
Same look and feel can be achieved on all platforms.
Flexible look and feel - themes and styles.
API is a bit similar to Android UI.
Flexible layout, support of different screen DPI, scaling.
Uses two phase layout like in Android.
Supports drawable resources in .png and .jpeg, nine-patch pngs
and state drawables like in Android.
Single threaded. Use other threads for performing slow tasks.
Mouse oriented.
Actually, it's a port (with major redesign) of my library used
for cross-platform version of my application CoolReader from
C++.
State of project: alpha. But, already can be used for simple 2D
games and simple GUI apps.
I'm keeping in mind a goal to write D language IDE based on
dlangui. :)
Adding support of 3D graphics is planned.
Currently implemented widgets:
TextWidget - simple static text (TODO: implement multiline
formatting)
ImageWidget - static image
Button - simple button with text label
ImageButton - image only button
TextImageButton - button with icon and label
CheckBox - check button with label
RadioButton - radio button with label
EditLine - single line edit
EditBox - multiline editor
VSpacer - vertical spacer - just an empty widget with
layoutHeight == FILL_PARENT, to fill vertical space in layouts
HSpacer - horizontal spacer - just an empty widget with
layoutWidth == FILL_PARENT, to fill horizontal space in layouts
ScrollBar - scroll bar
TabControl - tabs widget, allows to select one of tabs
TabHost - container for pages controlled by TabControl
TabWidget - combination of TabControl and TabHost
Layouts - Similar to layouts in Android
LinearLayout - layout children horizontally or vertically
depending on orientation
VerticalLayout - just a LinearLayout with vertical orientation
HorizontalLayout - just a LinearLayout with vertical orientation
FrameLayout - all children occupy the same place; usually onle
one of them is visible
TableLayout - children are aligned into rows and columns of
table
List Views - similar to lists in Android UI API.
ListWidget - layout dynamic items horizontally or vertically
(one in row/column) with automatic scrollbar; can reuse widgets
for similar items
ListAdapter - interface to provide data and widgets for
ListWidget
WidgetListAdapter - simple implementation of ListAdapter
interface - just a list of widgets (one per list item) to show
Sample project, example1 contains demo code for most of dlangui
API.
Try it using DUB:
git clone https://github.com/buggins/dlangui.git
cd dlangui
dub run dlangui:example1
Fonts note: on Linux, several .TTFs are loaded from hardcoded
paths (suitable for Ubuntu).
TODO: add fontconfig support to access all available system
fonts.
Helloworld:
// main.d
import dlangui.all;
mixin DLANGUI_ENTRY_POINT;
/// entry point for dlangui based application
extern (C) int UIAppMain(string[] args) {
// resource directory search paths
string[] resourceDirs = [
appendPath(exePath, "../res/"), // for Visual D and
DUB builds
appendPath(exePath, "../../res/") // for Mono-D builds
];
// setup resource directories - will use only existing
directories
Platform.instance.resourceDirs = resourceDirs;
// select translation file - for english language
Platform.instance.uiLanguage = "en";
// load theme from file "theme_default.xml"
Platform.instance.uiTheme = "theme_default";
// create window
Window window = Platform.instance.createWindow("My Window",
null);
// create some widget to show in window
window.mainWidget = (new Button()).text("Hello
world"d).textColor(0xFF0000); // red text
// show window
window.show();
// run message loop
return Platform.instance.enterMessageLoop();
}
DDOC generated documentation can be found there:
https://github.com/buggins/dlangui/tree/master/docs
For more info see readme and example1 code.
I would be glad to see any feedback.
Can this project be useful for someone? What features/widgets
are must have for you?
Best regards,
Vadim <coolreader....@gmail.com>
Thanks a million! Please keep it up. Finally we get our own GUI.
I've been dreaming of this for years. As has been mentioned
before, bindings are only as good as the UI they bind to. With a
native UI you can use the full power of the language itself.
Talking about templates and stuff ...
Are you planning to make it C(++) compatible so that non-D-people
could use it too?