DlangUI

Cross Platform GUI for D programming language

Home API Docs Screenshots Download .zip View on GitHub

dlangui.widgets.layouts

This module contains common layouts implementations.

Layouts are similar to the same in Android.

LinearLayout - either VerticalLayout or HorizontalLayout. VerticalLayout - just LinearLayout with orientation=Orientation.Vertical HorizontalLayout - just LinearLayout with orientation=Orientation.Vertical FrameLayout - children occupy the same place, usually one one is visible at a time TableLayout - children aligned into rows and columns



Synopsis:
import dlangui.widgets.layouts;



License:
Boost License 1.0

Authors:
Vadim Lopatin, coolreader.org@gmail.com

struct LayoutItem;
helper for layouts

void set(Widget widget, Orientation orientation);
sets item for widget

void measure(int parentWidth, int parentHeight);
set item and measure it

class LayoutItems;
helper class for layouts

Point measure(int parentWidth, int parentHeight);
fill widget layout list with Visible or Invisible items, measure them

void setWidgets(ref WidgetList widgets);
fill widget layout list with Visible or Invisible items, measure them

class ResizerWidget: dlangui.widgets.widget.Widget;
Resizer control. Put it between other items in LinearLayout to allow resizing its siblings. While dragging, it will resize previous and next children in layout.

uint getCursorType(int x, int y);
returns mouse cursor type for widget

void measure(int parentWidth, int parentHeight);
Measure widget according to desired width and height constraints. (Step 1 of two phase layout).

void layout(Rect rc);
Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).

bool onMouseEvent(MouseEvent event);
process mouse event; return true if event is processed by widget.

class FrameLayout: dlangui.widgets.widget.WidgetGroup;
place all children into same place (usually, only one child should be visible at a time)

void measure(int parentWidth, int parentHeight);
Measure widget according to desired width and height constraints. (Step 1 of two phase layout).

void layout(Rect rc);
Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).

void onDraw(DrawBuf buf);
Draw widget at its position to buffer

bool showChild(string ID, Visibility otherChildrenVisibility = Visibility.Invisible, bool updateFocus = false);
make one of children (with specified ID) visible, for the rest, set visibility to otherChildrenVisibility

class TableLayout: dlangui.widgets.widget.WidgetGroup;
layout children as table with rows and columns

@property int colCount();
number of columns

void measure(int parentWidth, int parentHeight);
Measure widget according to desired width and height constraints. (Step 1 of two phase layout).

void layout(Rect rc);
Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).

void onDraw(DrawBuf buf);
Draw widget at its position to buffer