Data types and structures for Simple CSS-like styles

unit CSSTypes;

interface

uses
  System.Types, System.UITypes;

type

  TControlState =
    (
      csDF,
      csDS,
      csSL,
      csHL,
      csSLHL,
      csOwnerHL,
      csOwnerHL_SL,
      csOwnerSL,
      csOwnerSL_SL
    );

  TStyleAttributeType =
    (
      saVisualColor,
      saVisualAlpha,
      saVisualMultAlpha,
      saBoxPaddingLeft,
      saBoxPaddingRight,
      saBoxPaddingTop,
      saBoxPaddingBottom,
      saBoxMarginLeft,
      saBoxMarginRight,
      saBoxMarginTop,
      saBoxMarginBottom,
      saBoxHAlign,
      saBoxVAlign,
      saBoxHAutoSize,
      saBoxVAutoSize,
      saBoxMinWidth,
      saBoxMinHeight,
      saBoxMaxWidth,
      saBoxMaxHeight,
      saLayoutType,
      saLayoutResizeChildren,
      saLayoutFitLastChild,
      saFontName,
      saFontStyle,
      saFontUnderline,
      saFontSize,
      saFontWhite,
      saFrameName,
      saFrameBorderColor,
      saFrameBorderAlpha
      //+etc
    );

  TStyleAttribute = record
    CS: TControlState;
    Typ: TStyleAttributeType;
    Value: Variant;
  end;

  TStyleDefinition = class
  public
    Name: string;
    ParentName: string;
    ParentStyle: TStyleDefinition;
    ContainerStyle: TStyleDefinition;
    Attributes: array of TStyleAttribute;
    ContainedStyles: array of TStyleDefinition;
  end;

  TControlStyle=class;

  TComputedStyle = class
  public
    Definition: TStyleDefinition;
    ParentStyle: TComputedStyle;
    ContainerStyle: TComputedStyle;
    StateStyles: array[TControlState] of TControlStyle;
    ContainedStyles: array of TComputedStyle;
  end;

  TControlVisual = class;
  TControlBox = class;
  TControlLayout = class;
  TControlFrame = class;

  TControlStyle = class
  public
    Visual: TControlVisual;
    Box: TControlBox;
    Layout: TControlLayout;
    Frame: TControlFrame;
  end;

  TControlVisual = class
  public
    Color: integer;
    Alpha: single;
    MultAlpha: single;
    Cursor: TCursor;
  end;

  direction = (horz, vert);

  TAlign =
    (
      alBeg,
      alCen,
      alEnd
    );

  TControlBox = class
  public
    Margins: TRect;
    Padding: TRect;
    Align: array[direction] of TAlign;
    AutoSize: array[direction] of boolean;
    MinSize: array[direction] of integer;
    MaxSize: array[direction] of integer;
  end;

  TLayoutType =
    (
      loNone,
      loHorz,
      loVert,
      loStack
    );

  TControlLayout = class
  public
    Typ: TLayoutType;
    ResizeChildren: boolean;
    FitLastChild: boolean;
  end;

  TControlFrame = class
  public
    Name: string;
    BorderColor: integer;
    BorderAlpha: single;
    BackColor: integer;
    BackAlpha: single;
  end;

  TControlFont = class
  public
    Name: string;
    Style: TFontStyles;
    IsWhite: boolean;
  end;

  TIconStyle = class(TControlStyle)
  public
    //
  end;

  TLabelStyle = class(TControlStyle)
  public
    Font: TControlFont;
    Underlined: boolean;
  end;

  TEditStyle = class(TLabelStyle)
  public
    //...
  end;

  TBezierSegment = array[0..3] of array[direction] of single;

  TEffectStyle=class
  public
    Name: string;
    Duration: single;
    Delay: single;
    EaseFunction: TBezierSegment;
  end;

  TPanelStyle = class(TControlStyle)
  public
    ShowEffect: TEffectStyle;
    HideEffect: TEffectStyle;
  end;

  TComboBoxStyle = class(TControlStyle)
  public
    //
  end;

  TScrollBoxStyle = class(TControlStyle)
  public
    //
  end;

  TListViewStyle = class(TScrollBoxStyle)
  public
    //
  end;

  TTableViewStyle = class(TScrollBoxStyle)
  public
    //
  end;

  TTreeViewStyle = class(TScrollBoxStyle)
  public
    //
  end;

implementation

end.

Advertisements
Data types and structures for Simple CSS-like styles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s