Module dlangui.core.types
This module declares basic data types for usage in dlangui
library.
Contains reference counting support, point and rect structures, character glyph structure, misc utility functions.
Synopsis
import dlangui .core .types;
// points
Point p(5, 10);
// rectangles
Rect r(5, 13, 120, 200);
writeln(r);
// reference counted objects, useful for RAII / resource management.
class Foo : RefCountedObject {
int[] resource;
~this() {
writeln("freeing Foo resources");
}
}
{
Ref!Foo ref1;
{
Ref!Foo fooRef = new RefCountedObject();
ref1 = fooRef;
}
// RAII: will destroy object when no more references
}
Functions
Name | Description |
---|---|
dcharToUpper
|
|
fromPercentSize
|
if size has SIZE_IN_PERCENTS_FLAG bit set, returns percent of baseSize , otherwise returns size unchanged
|
fromWStringz
|
conversion from wchar z-string |
isPercentSize
|
returns true if size has SIZE_IN_PERCENTS_FLAG bit set
|
isSpecialSize
|
returns true for WRAP_CONTENT , WRAP_CONTENT , SIZE_UNSPECIFIED
|
makePercentSize
|
make size value with SIZE_IN_PERCENTS_FLAG set
|
makePointSize
|
make size value with SIZE_IN_POINTS_FLAG set
|
parseHexDigit
|
decodes hex digit (0..9, a..f, A..F), returns uint.max if invalid |
pixelsToPoints
|
convert points (1/72in units) to pixels according to SCREEN_DPI
|
pointsToPixels
|
convert points (1/72in units) to pixels according to SCREEN_DPI
|
SCREEN_DPI
|
|
SCREEN_DPI
|
|
toPixels
|
convert custom size Point to pixels (sz can be either pixels, or points if SIZE_IN_POINTS_FLAG bit set)
|
toPixels
|
convert custom size to pixels (sz can be either pixels, or points if SIZE_IN_POINTS_FLAG bit set)
|
toPixels
|
convert custom size Rect to pixels (sz can be either pixels, or points if SIZE_IN_POINTS_FLAG bit set)
|
Classes
Name | Description |
---|---|
RefCountedObject
|
Base class for reference counted objects, maintains reference counter inplace. |
Structs
Name | Description |
---|---|
Glyph
|
Character glyph .
|
Point
|
2D point |
Rect
|
2D rectangle |
Ref
|
Reference counting support. |
Enums
Name | Description |
---|---|
State
|
widget state bit flags |
SubpixelRenderingMode
|
Subpixel rendering mode for fonts (aka ClearType) |
Enum values
Name | Type | Description |
---|---|---|
FILL_PARENT
|
layout option, to occupy all available place | |
POINTS_PER_INCH
|
one point is 1/72 of inch | |
SIZE_IN_PERCENTS_FLAG
|
(RESERVED) use in styles to specify size in percents * 100 (e.g. 0 == 0%, 10000 == 100%, 100 = 1%) | |
SIZE_IN_POINTS_FLAG
|
use in styles to specify size in points (1/72 inch) | |
SIZE_UNSPECIFIED
|
use as widget.layout() param to avoid applying of parent size | |
WRAP_CONTENT
|
layout option, for size based on content |
Authors
Vadim Lopatin, coolreader.org@gmail.com
Copyright
Vadim Lopatin, 2014
License
Boost License 1.0