Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created September 6, 2016 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/9c9d66946c63d4f78e34de0509cb61a0 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/9c9d66946c63d4f78e34de0509cb61a0 to your computer and use it in GitHub Desktop.
using System;
using System.Runtime.InteropServices;
namespace CSSLayoutApp
{
public static class Native
{
private const string DllName = "CSSLayout.dll";
[DllImport(DllName)]
public static extern IntPtr CSSNodeNew();
[DllImport(DllName)]
public static extern void CSSNodeInit(IntPtr cssNode);
[DllImport(DllName)]
public static extern void CSSNodeFree(IntPtr cssNode);
[DllImport(DllName)]
public static extern void CSSNodeInsertChild(IntPtr node, IntPtr child, uint index);
[DllImport(DllName)]
public static extern void CSSNodeRemoveChild(IntPtr node, IntPtr child);
[DllImport(DllName)]
public static extern IntPtr CSSNodeGetChild(IntPtr node, uint index);
[DllImport(DllName)]
public static extern uint CSSNodeChildCount(IntPtr node);
[DllImport(DllName)]
public static extern void CSSNodeCalculateLayout(IntPtr node,
float availableWidth,
float availableHeight,
CSSDirection parentDirection);
[DllImport(DllName)]
public static extern void CSSNodeMarkDirty(IntPtr node);
[DllImport(DllName)]
public static extern bool CSSNodeIsDirty(IntPtr node);
[DllImport(DllName)]
public static extern void CSSNodePrint(IntPtr node, CSSPrintOptions options);
[DllImport(DllName)]
public static extern bool CSSValueIsUndefined(float value);
#region CSSNode Properties
[DllImport(DllName)]
public static extern void CSSNodeSetContext(IntPtr node, IntPtr context);
[DllImport(DllName)]
public static extern IntPtr CSSNodeGetContext(IntPtr node);
[DllImport(DllName)]
public static extern void CSSNodeSetMeasureFunc(IntPtr node, CSSMeasureFunc measureFunc);
[DllImport(DllName)]
public static extern CSSMeasureFunc CSSNodeGetMeasureFunc(IntPtr node);
[DllImport(DllName)]
public static extern void CSSNodeSetPrintFunc(IntPtr node, CSSPrintFunc printFunc);
[DllImport(DllName)]
public static extern CSSPrintFunc CSSNodeGePrintFunc(IntPtr node);
#endregion
/*
CSS_NODE_PROPERTY(void *, Context, context);
CSS_NODE_PROPERTY(CSSMeasureFunc, MeasureFunc, measureFunc);
CSS_NODE_PROPERTY(CSSPrintFunc, PrintFunc, printFunc);
CSS_NODE_PROPERTY(bool, IsTextnode, isTextNode);
CSS_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment