Module dlangui.widgets.styles

This module contains declaration of themes and styles implementation.

Style - style container Theme - parent for all styles

Synopsis

import dlangui.widgets.styles;

Recent changes: Dimensions like fontSize, padding, margins, min/max width and height can be specified in points, e.g. minWidth = "3pt" margins="1pt,2pt,1pt,2pt" % for font size, based on parent font size, e.g. fontSize="120.5%" means parentStyle.fontSize * 120.5 / 100.0;

Functions

Name Description
createDefaultTheme
currentTheme current theme accessor
currentTheme set new current theme
decodeAlignment parses string like "Left|VCenter" to bit set of Align flags
decodeFocusRectColors Decode color list attribute, e.g.: "#84A, #99FFFF" -> [0x8844aa, 0x99ffff]
decodeFontFamily decode FontFamily item name to value
decodeFontWeight decode FontWeight item name to value
decodeLayoutDimension decode layout dimension (FILL_PARENT, WRAP_CONTENT, or just size)
decodeRect decode comma delimited dimension list or single value - and put to Rect
decodeTextFlags parses string like "HotKeys|UnderlineHotKeysWhenAltPressed" to bit set of TextFlag flags
loadStyleAttributes load style attributes from XML element
loadTheme load theme from file
loadTheme load theme from XML document
loadTheme load theme from XML file (null if failed)
overrideCustomDrawableId returns custom drawable replacement id for specified id from current theme, or returns passed value if not found or no current theme

Classes

Name Description
DrawableAttribute custom drawable attribute container for styles
Style style properties
Theme Theme - root for style hierarhy.

Enums

Name Description
Align Align option bit constants
TextFlag text drawing flag bits

Enum values

Name Type Description
ALIGN_UNSPECIFIED unspecified align - to take parent's value instead
FONT_SIZE_UNSPECIFIED unspecified font size constant - to take parent style property value
FONT_STYLE_ITALIC italic font style constant
FONT_STYLE_NORMAL normal font style constant
FONT_STYLE_UNSPECIFIED unspecified font style constant - to take parent style property value
FONT_WEIGHT_UNSPECIFIED unspecified font weight constant - to take parent style property value
TEXT_FLAGS_UNSPECIFIED use text flags from parent style
TEXT_FLAGS_USE_PARENT use text flags from parent widget
WEIGHT_UNSPECIFIED to take layout weight from parent

Global variables

Name Type Description
ATTR_SCROLLBAR_BUTTON_DOWN immutable(char[])
ATTR_SCROLLBAR_BUTTON_LEFT immutable(char[])
ATTR_SCROLLBAR_BUTTON_RIGHT immutable(char[])
ATTR_SCROLLBAR_BUTTON_UP immutable(char[])
ATTR_SCROLLBAR_INDICATOR_HORIZONTAL immutable(char[])
ATTR_SCROLLBAR_INDICATOR_VERTICAL immutable(char[])
STYLE_BUTTON immutable(char[]) standard style id for Button
STYLE_BUTTON_IMAGE immutable(char[]) standard style id for Button image
STYLE_BUTTON_LABEL immutable(char[]) standard style id for Button label
STYLE_BUTTON_NOMARGINS immutable(char[]) style id for Button w/o margins
STYLE_BUTTON_TRANSPARENT immutable(char[]) style id for transparent Button
STYLE_CHECKBOX immutable(char[]) standard style id for CheckBox
STYLE_CHECKBOX_IMAGE immutable(char[]) standard style id for CheckBox image
STYLE_CHECKBOX_LABEL immutable(char[]) standard style id for CheckBox label
STYLE_COLOR_DIALOG_BACKGROUND immutable(char[]) dialog background color resource id
STYLE_COLOR_WINDOW_BACKGROUND immutable(char[]) window background color resource id
STYLE_COMBO_BOX immutable(char[]) standard style id for combo box
STYLE_COMBO_BOX_BODY immutable(char[]) standard style id for combo box body (current item)
STYLE_COMBO_BOX_BUTTON immutable(char[]) standard style id for combo box button
STYLE_DOCK_HOST immutable(char[]) standard style id for dock host
STYLE_DOCK_HOST_BODY immutable(char[]) standard style id for dock host body
STYLE_DOCK_WINDOW immutable(char[]) standard style id for dock window
STYLE_DOCK_WINDOW_BODY immutable(char[]) standard style id for dock window body
STYLE_DOCK_WINDOW_CAPTION immutable(char[]) standard style id for dock window caption
STYLE_DOCK_WINDOW_CAPTION_LABEL immutable(char[]) standard style id for dock window caption label
STYLE_EDIT_BOX immutable(char[]) standard style id for EditBox
STYLE_EDIT_LINE immutable(char[]) standard style id for EditLine
STYLE_FLOATING_WINDOW immutable(char[]) standard style id for toolbar separator
STYLE_HSPACER immutable(char[]) standard style id for HSpacer
STYLE_LIST_ITEM immutable(char[]) standard style id for list items
STYLE_MAIN_MENU immutable(char[]) standard style id for main menu
STYLE_MAIN_MENU_ITEM immutable(char[]) standard style id for main menu item
STYLE_MAIN_MENU_LABEL immutable(char[]) standard style id for main menu item label
STYLE_MENU_ACCEL immutable(char[]) standard style id for menu item accelerators label
STYLE_MENU_ICON immutable(char[]) standard style id for menu item icon
STYLE_MENU_ITEM immutable(char[]) standard style id for menu item
STYLE_MENU_LABEL immutable(char[]) standard style id for menu item label
STYLE_MULTILINE_TEXT immutable(char[]) standard style id for MultilineTextWidget
STYLE_PAGE_SCROLL immutable(char[]) standard style id for ScrollBar page control
STYLE_POPUP_MENU immutable(char[]) standard style id for PopupMenu
STYLE_RADIOBUTTON immutable(char[]) standard style id for RadioButton
STYLE_RADIOBUTTON_IMAGE immutable(char[]) standard style id for RadioButton image
STYLE_RADIOBUTTON_LABEL immutable(char[]) standard style id for RadioButton label
STYLE_SCROLLBAR immutable(char[]) standard style id for ScrollBar
STYLE_SCROLLBAR_BUTTON immutable(char[]) standard style id for ScrollBar button
STYLE_SCROLLBAR_BUTTON_TRANSPARENT immutable(char[]) standard style id for ScrollBar button
STYLE_SETTINGS_PAGES immutable(char[]) standard style id for settings dialog content pages frame
STYLE_SETTINGS_PAGE_TITLE immutable(char[]) standard style id for settings dialog page title
STYLE_SETTINGS_TREE immutable(char[]) standard style id for settings dialog tree
STYLE_SLIDER immutable(char[]) standard style id for Slider
STYLE_STATUS_LINE immutable(char[]) standard style id for app frame status line
STYLE_STRING_GRID immutable(char[]) standard style id for StringGrid
STYLE_SWITCH immutable(char[]) standard style id for Switch
STYLE_TAB_DOWN_BUTTON_DARK immutable(char[]) standard style id for tab control tab button in dock frame
STYLE_TAB_DOWN_BUTTON_DARK_TEXT immutable(char[]) standard style id for tab control tab button text in dock frame
STYLE_TAB_DOWN_DARK immutable(char[]) standard style id for tab control in dock frame
STYLE_TAB_HOST immutable(char[]) standard style id for TabHost
STYLE_TAB_UP immutable(char[]) standard style id for Tab with Up alignment
STYLE_TAB_UP_BUTTON immutable(char[]) standard style id for button of Tab with Up alignment
STYLE_TAB_UP_BUTTON_DARK immutable(char[]) standard style id for tab control tab button in dock frame
STYLE_TAB_UP_BUTTON_DARK_TEXT immutable(char[]) standard style id for tab control tab button text in dock frame
STYLE_TAB_UP_BUTTON_TEXT immutable(char[]) standard style id for button of Tab with Up alignment
STYLE_TAB_UP_DARK immutable(char[]) standard style id for tab control in dock frame
STYLE_TAB_WIDGET immutable(char[]) standard style id for TabWidget
STYLE_TEXT immutable(char[]) standard style id for TextWidget
STYLE_TOOLBAR immutable(char[]) standard style id for toolbars
STYLE_TOOLBAR_BUTTON immutable(char[]) standard style id for toolbar button
STYLE_TOOLBAR_CONTROL immutable(char[]) standard style id for toolbar control, e.g. combobox
STYLE_TOOLBAR_HOST immutable(char[]) standard style id for toolbars layout
STYLE_TOOLBAR_SEPARATOR immutable(char[]) standard style id for toolbar separator
STYLE_TOOLTIP immutable(char[]) standard style id for tooltip popup
STYLE_TRANSPARENT_BUTTON_BACKGROUND immutable(char[]) standard style id for background similar to transparent button
STYLE_TREE_ITEM immutable(char[]) standard style id for tree item
STYLE_TREE_ITEM_BODY immutable(char[]) standard style id for tree item body (icon + label)
STYLE_TREE_ITEM_EXPAND_ICON immutable(char[]) standard style id for tree item expand icon
STYLE_TREE_ITEM_ICON immutable(char[]) standard style id for tree item icon
STYLE_TREE_ITEM_LABEL immutable(char[]) standard style id for tree item label
STYLE_VSPACER immutable(char[]) standard style id for VSpacer

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0