+ - dlangui.core
+
+ - dlangui.graphics
+
+ - dlangui.widgets
+
+ - dlangui.dialogs
+
+ - dlangui.platforms.common
+
+ - dlangui
+
+
diff --git a/src/api.d b/src/api.d
new file mode 100644
index 00000000..d860ab6b
--- /dev/null
+++ b/src/api.d
@@ -0,0 +1,10 @@
+Ddoc
+
+
+Dlang UI API reference
+
+
+
+By Modules
+ $(MODULE_TREE)
+
diff --git a/src/dlangui/all.d b/src/dlangui/all.d
index f1add033..4da25f03 100644
--- a/src/dlangui/all.d
+++ b/src/dlangui/all.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module is just to simplify import of most useful DLANGUI modules.
Synopsis:
@@ -23,12 +21,11 @@ extern (C) int UIAppMain(string[] args) {
];
// setup resource directories - will use only existing directories
- drawableCache.setResourcePaths(resourceDirs);
-
- // setup i18n - look for i18n directory inside one of passed directories
- i18n.findTranslationsDir(resourceDirs);
+ Platform.instance.resourceDirs = resourceDirs;
// select translation file - for english language
- i18n.load("en.ini"); //"ru.ini", "en.ini"
+ 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);
diff --git a/src/dlangui/core/collections.d b/src/dlangui/core/collections.d
index e919f3fb..ee0cc485 100644
--- a/src/dlangui/core/collections.d
+++ b/src/dlangui/core/collections.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module implements array based collection.
Synopsis:
diff --git a/src/dlangui/core/events.d b/src/dlangui/core/events.d
index 1fd5a990..5e9f9eea 100644
--- a/src/dlangui/core/events.d
+++ b/src/dlangui/core/events.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains dlangui event types declarations.
diff --git a/src/dlangui/core/i18n.d b/src/dlangui/core/i18n.d
index 25330003..3da8bef0 100644
--- a/src/dlangui/core/i18n.d
+++ b/src/dlangui/core/i18n.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains internationalization support implementation.
Translation files contain of simple key=value pair lines.
diff --git a/src/dlangui/core/linestream.d b/src/dlangui/core/linestream.d
index a7c7f32a..1e7e0d63 100644
--- a/src/dlangui/core/linestream.d
+++ b/src/dlangui/core/linestream.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains text file reader implementation.
Support utf8, utf16, utf32 be and le encodings, and line endings - according to D language source file specification.
diff --git a/src/dlangui/core/logger.d b/src/dlangui/core/logger.d
index 5d728320..9cd91ea1 100644
--- a/src/dlangui/core/logger.d
+++ b/src/dlangui/core/logger.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains logger implementation.
diff --git a/src/dlangui/core/signals.d b/src/dlangui/core/signals.d
index 5783d9d1..5dca939b 100644
--- a/src/dlangui/core/signals.d
+++ b/src/dlangui/core/signals.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains definition of signals / listeners.
Similar to std.signals.
diff --git a/src/dlangui/core/stdaction.d b/src/dlangui/core/stdaction.d
index 2be04078..0cc005a7 100644
--- a/src/dlangui/core/stdaction.d
+++ b/src/dlangui/core/stdaction.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
Definition of standard actions commonly used in dialogs and controls.
Synopsis:
diff --git a/src/dlangui/core/types.d b/src/dlangui/core/types.d
index f7a167da..7a90cd6c 100644
--- a/src/dlangui/core/types.d
+++ b/src/dlangui/core/types.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module declares basic data types for usage in dlangui library.
Synopsis:
diff --git a/src/dlangui/dialogs/dialog.d b/src/dlangui/dialogs/dialog.d
index 2a6fead8..4908ce86 100644
--- a/src/dlangui/dialogs/dialog.d
+++ b/src/dlangui/dialogs/dialog.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains common Dialog implementation.
diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d
index 1c1e36fb..813b93e6 100644
--- a/src/dlangui/dialogs/filedlg.d
+++ b/src/dlangui/dialogs/filedlg.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains FileDialog implementation.
Can show dialog for open / save.
diff --git a/src/dlangui/graphics/drawbuf.d b/src/dlangui/graphics/drawbuf.d
index 0bd84e5f..cc58b6a6 100644
--- a/src/dlangui/graphics/drawbuf.d
+++ b/src/dlangui/graphics/drawbuf.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains drawing buffer implementation.
diff --git a/src/dlangui/graphics/fonts.d b/src/dlangui/graphics/fonts.d
index c2b43c79..c1ed472d 100644
--- a/src/dlangui/graphics/fonts.d
+++ b/src/dlangui/graphics/fonts.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains base fonts access interface and common implementation.
Font - base class for fonts.
diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d
index fb7878b6..313fe4fd 100644
--- a/src/dlangui/graphics/ftfonts.d
+++ b/src/dlangui/graphics/ftfonts.d
@@ -1,13 +1,8 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This file contains FontManager implementation based on FreeType library.
-
-
-
Copyright: Vadim Lopatin, 2014
License: Boost License 1.0
Authors: Vadim Lopatin, coolreader.org@gmail.com
diff --git a/src/dlangui/graphics/gldrawbuf.d b/src/dlangui/graphics/gldrawbuf.d
index aa2457a6..8ee96b30 100644
--- a/src/dlangui/graphics/gldrawbuf.d
+++ b/src/dlangui/graphics/gldrawbuf.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains opengl based drawing buffer implementation.
To enable OpenGL support, build with version(USE_OPENGL);
diff --git a/src/dlangui/graphics/glsupport.d b/src/dlangui/graphics/glsupport.d
index 27f6864a..1ddc1961 100644
--- a/src/dlangui/graphics/glsupport.d
+++ b/src/dlangui/graphics/glsupport.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains OpenGL access layer.
To enable OpenGL support, build with version(USE_OPENGL);
diff --git a/src/dlangui/graphics/images.d b/src/dlangui/graphics/images.d
index 2ce3ead1..cdb0c3c2 100644
--- a/src/dlangui/graphics/images.d
+++ b/src/dlangui/graphics/images.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains image loading functions.
Currently uses FreeImage.
diff --git a/src/dlangui/graphics/resources.d b/src/dlangui/graphics/resources.d
index b030c289..132cd97d 100644
--- a/src/dlangui/graphics/resources.d
+++ b/src/dlangui/graphics/resources.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains resource management and drawables implementation.
imageCache is RAM cache of decoded images (as DrawBuf).
diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d
index 6fd3fb42..c82874ae 100644
--- a/src/dlangui/platforms/common/platform.d
+++ b/src/dlangui/platforms/common/platform.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains common Plaform definitions.
Platform is abstraction layer for application.
diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d
index 76608312..970ae110 100644
--- a/src/dlangui/platforms/sdl/sdlapp.d
+++ b/src/dlangui/platforms/sdl/sdlapp.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains implementation of SDL2 based backend for dlang library.
diff --git a/src/dlangui/widgets/controls.d b/src/dlangui/widgets/controls.d
index ac3199bb..93380383 100644
--- a/src/dlangui/widgets/controls.d
+++ b/src/dlangui/widgets/controls.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains simple controls widgets implementation.
TextWidget
diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d
index 5578f480..3e1bb993 100644
--- a/src/dlangui/widgets/editors.d
+++ b/src/dlangui/widgets/editors.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains implementation of editors.
diff --git a/src/dlangui/widgets/layouts.d b/src/dlangui/widgets/layouts.d
index 9447a9f7..9e288347 100644
--- a/src/dlangui/widgets/layouts.d
+++ b/src/dlangui/widgets/layouts.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains common layouts implementations.
Layouts are similar to the same in Android.
diff --git a/src/dlangui/widgets/lists.d b/src/dlangui/widgets/lists.d
index a5250aa9..401b557d 100644
--- a/src/dlangui/widgets/lists.d
+++ b/src/dlangui/widgets/lists.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains list widgets implementation.
Similar to lists implementation in Android UI API.
diff --git a/src/dlangui/widgets/menu.d b/src/dlangui/widgets/menu.d
index cfc8d334..02526269 100644
--- a/src/dlangui/widgets/menu.d
+++ b/src/dlangui/widgets/menu.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains menu widgets implementation.
MenuItem - menu item properties container - to hold hierarchy of menu.
diff --git a/src/dlangui/widgets/popup.d b/src/dlangui/widgets/popup.d
index 46d44b0d..6d874652 100644
--- a/src/dlangui/widgets/popup.d
+++ b/src/dlangui/widgets/popup.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains popup widgets implementation.
Popups appear above other widgets inside window.
diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d
index 027be2d4..44cab43a 100644
--- a/src/dlangui/widgets/styles.d
+++ b/src/dlangui/widgets/styles.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains declaration of themes and styles implementation.
Style - style container
diff --git a/src/dlangui/widgets/tabs.d b/src/dlangui/widgets/tabs.d
index 6fa62bdd..5af2e68e 100644
--- a/src/dlangui/widgets/tabs.d
+++ b/src/dlangui/widgets/tabs.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains declaration of tabbed view controls.
TabItemWidget - single tab header in tab control
diff --git a/src/dlangui/widgets/widget.d b/src/dlangui/widgets/widget.d
index 05028209..60d8847f 100644
--- a/src/dlangui/widgets/widget.d
+++ b/src/dlangui/widgets/widget.d
@@ -1,8 +1,6 @@
// Written in the D programming language.
/**
-DLANGUI library.
-
This module contains declaration of Widget class - base class for all widgets.
Widgets are styleable. Use styleId property to set style to use from current Theme.
diff --git a/src/index.d b/src/index.d
new file mode 100644
index 00000000..5da60150
--- /dev/null
+++ b/src/index.d
@@ -0,0 +1,232 @@
+Ddoc
+
+
+Dlang UI
+
+GUI for D programming language, written in D.
+
+ Alpha stage of development.
+
+
+- Crossplatform (Win32 and Linux are supported in current version); can use SDL2 as a backend.
+- Mostly inspired by Android UI API (layouts, styles, two phase layout, ...)
+- Supports highly customizable UI themes and styles
+- Supports internationalization
+- Hardware acceleration using OpenGL (when built with version USE_OPENGL)
+- Fallback to Win32 API / XCB when OpenGL is not available
+- Actually it's a port (with major refactoring) of GUI library for cross platform OpenGL based implementation of Cool Reader app project from C++.
+- Almost ready for 2D games development
+- Goal: provide set of widgets suitable for building of IDE.
+- Non thread safe
+
+
+Widgets
+
+
+- Widget - base class for all widgets and widget containers, similar to Android's View
+
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
+
+Lists are implemented similar to 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
+
TODOs:
+
+
+- Multicolumn lists
+- Tree view
+
+Resources
+
+Resources like fonts and images use reference counting. For proper resource freeing, always destroy widgets implicitly.
+
+
+- FontManager: provides access to fonts
+- Images: .png or .jpg images; if filename ends with .9.png, it's autodetected as nine-patch image (see Android drawables description)
+- StateDrawables: .xml file can describe list of other drawables to choose based on widget's State (.xml files from android themes can be used directly)
+- imageCache allows to cache unpacked images
+- drawableCache provides access by resource id (string, usually filename w/o extension) to drawables located in specified list of resource directories.
+
+Styles and Themes
+
+Styles and themes are a bit similar to ones in Android API.
+
+
+- Theme is a container for styles. Can be load from XML theme resource file.
+- Styles are accessible in theme by string ID.
+- Styles can be nested to form hiararchy - when some attribute is missing in style, value from base style will be used.
+- State substyles are supported: allow to change widget appearance dynamically based on its state.
+- Widgets use style attributes directly from assigned style. When some attribute is being changed in widget, it creates its own copy of base style,
+which allows to modify some of attributes, while getting base style attributes if they are not changed in widget. This trick can minimize memory usage for widget attributes when
+standard values are used.
+
+Win32 builds
+
+
+- Under windows, uses SDL2 or Win32 API as backend.
+- Optionally, may use OpenGL acceleration via DerelictGL3/WGL.
+- Uses Win32 API for font rendering.
+- Optinally can use FreeType for font rendering.
+
Build and run using DUB:
+
+-----------------------
+ git clone https://github.com/buggins/dlangui.git
+ cd dlangui
+ dub run dlangui:example1
+-----------------------
+
+To develop using Visual-D, download sources for dlabgui and dependencies into some directory:
+
+-----------------------
+ git clone https://github.com/buggins/dlangui.git
+ git clone https://github.com/DerelictOrg/DerelictUtil.git
+ git clone https://github.com/DerelictOrg/DerelictGL3.git
+ git clone https://github.com/DerelictOrg/DerelictFI.git
+ git clone https://github.com/DerelictOrg/DerelictFT.git
+ git clone https://github.com/DerelictOrg/DerelictSDL2.git
+-----------------------
+
+Then open .sln using Visual D.
+
+
+Linux builds
+
+
+- Uses SDL2 or XCB as a backend (SDL2 is recommended, since has better support now).
+- Uses shared memory images for faster drawing.
+- Uses FreeType for font rendering.
+- TODO: Use FontConfig to get font list.
+- OpenGL is now working under SDL2 only.
+- Entering of unicode characters is now working under SDL2 only.
+
For linux build with SDL2 backend, following libraries are required:
+
+-----------------------
+ libsdl2
+-----------------------
+
+To build dlangui apps with XCB backend, development packages for following libraries required for XCB backend build:
+
+-----------------------
+ xcb, xcb-util, xcb-shm, xcb-image, xcb-keysyms, X11-xcb, X11
+-----------------------
+
+E.g. in Ubuntu, you can use following command to enable SDL2 backend builds:
+
+-----------------------
+ sudo apt-get install libsdl2-dev
+-----------------------
+
+or (for XCB backend)
+
+-----------------------
+ sudo apt-get install libxcb-image0-dev libxcb-shm0-dev libxcb-keysyms1-dev libfreeimage-dev
+-----------------------
+
+
+In runtime, .so for following libraries are being loaded (binary packages required):
+
+-----------------------
+ freetype, opengl, freeimage
+-----------------------
+
+Build and run on Linux using DUB:
+
+-----------------------
+ dub run dlangui:example1
+-----------------------
+
+Development using Mono-D:
+
+
+- open solution dlangui/dlanguimonod.sln
+- build and run project example1
+
You need fresh version of MonoDevelop to use Mono-D. It can be installed from PPA repository.
+
+-----------------------
+ sudo add-apt-repository ppa:ermshiperete/monodevelop
+ sudo apt-get update
+ sudo apt-get install monodevelop-current
+-----------------------
+
+
+Other platforms
+
+
+- Other platforms support may be added easy
+
+Third party components used
+
+
+- DerelictGL3 - for OpenGL support
+- DerelictFT + FreeType library support under linux and optionally under Windows.
+- DerelictFI + FreeImage library support for decoding of images
+- DerelictSDL2 + SDL2 for cross platform support
+- WindowsAPI bindings from http://www.dsource.org/projects/bindings/wiki/WindowsApi (patched)
+- XCB and X11 bindings (patched) when SDL2 is not used; TODO: provide links
+
+Hello World
+
+------------------------------------------
+// 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();
+}
+--------------------------------
+