Example #1
0
 // Case 1) User created structure:
 // allocate native on creation, free native on dispose.
 internal CfxStructure(CfxApi.cfx_ctor_delegate cfx_ctor, CfxApi.cfx_dtor_delegate cfx_dtor)
 {
     this.m_cfx_dtor = cfx_dtor;
     //this might happen if the application tries to instanciate a platform specific struct
     //on the wrong platform.
     if(cfx_ctor == null)
         return;
     CreateNative(cfx_ctor);
 }
Example #2
0
 internal CfxTime(IntPtr nativePtr, CfxApi.cfx_dtor_delegate cfx_dtor)
     : base(nativePtr, cfx_dtor)
 {
 }
Example #3
0
 internal void CreateNative(CfxApi.cfx_ctor_delegate cfx_ctor)
 {
     m_nativePtr = cfx_ctor();
     if(m_nativePtr == IntPtr.Zero)
         throw new OutOfMemoryException();
 }
Example #4
0
 internal void CreateNative(CfxApi.cfx_ctor_with_gc_handle_delegate cfx_ctor)
 {
     // must be a weak handle
     // otherwise transient callback structs never go out of scope if
     // they are not explicitly disposed
     System.Runtime.InteropServices.GCHandle handle =
         System.Runtime.InteropServices.GCHandle.Alloc(this, System.Runtime.InteropServices.GCHandleType.Weak);
     m_nativePtr = cfx_ctor(System.Runtime.InteropServices.GCHandle.ToIntPtr(handle));
     if(m_nativePtr == IntPtr.Zero)
         throw new OutOfMemoryException();
 }
Example #5
0
 internal CfxBrowserSettings(IntPtr nativePtr, CfxApi.cfx_dtor_delegate cfx_dtor)
     : base(nativePtr, cfx_dtor)
 {
 }
Example #6
0
 /// <summary>
 /// Sets the value at the specified index as type int. Returns true (1) if the
 /// value was set successfully.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetInt(int index, int value)
 {
     return(0 != CfxApi.cfx_list_value_set_int(NativePtr, index, value));
 }
Example #7
0
 /// <summary>
 /// Sets the value at the specified index as type bool. Returns true (1) if the
 /// value was set successfully.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetBool(int index, bool value)
 {
     return(0 != CfxApi.cfx_list_value_set_bool(NativePtr, index, value ? 1 : 0));
 }
Example #8
0
 /// <summary>
 /// Sets the value at the specified index as type null. Returns true (1) if the
 /// value was set successfully.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public bool SetNull(int index)
 {
     return(0 != CfxApi.cfx_list_value_set_null(NativePtr, index));
 }
Example #9
0
 /// <summary>
 /// Returns the value at the specified index as type list. The returned value
 /// will reference existing data and modifications to the value will modify
 /// this object.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>.
 /// </remarks>
 public CfxListValue GetList(int index)
 {
     return(CfxListValue.Wrap(CfxApi.cfx_list_value_get_list(NativePtr, index)));
 }
Example #10
0
 internal CfxScreenInfo(IntPtr nativePtr, CfxApi.cfx_dtor_delegate cfx_dtor)
     : base(nativePtr, cfx_dtor)
 {
 }
Example #11
0
 internal CfxWindowInfoWindows(IntPtr nativePtr, CfxApi.cfx_dtor_delegate cfx_dtor)
     : base(nativePtr, cfx_dtor)
 {
 }
Example #12
0
 internal CfxBase(CfxApi.cfx_ctor_with_gc_handle_delegate cfx_ctor)
 {
     CreateNative(cfx_ctor);
 }
Example #13
0
 // Case 3) struct passed in from framework as a return value
 // native layer makes a copy -> free native pointer on dispose
 internal CfxStructure(IntPtr nativePtr, CfxApi.cfx_dtor_delegate cfx_dtor)
 {
     this.m_cfx_dtor = cfx_dtor;
     SetNative(nativePtr);
 }
Example #14
0
 internal CfxDraggableRegion(IntPtr nativePtr, CfxApi.cfx_dtor_delegate cfx_dtor)
     : base(nativePtr, cfx_dtor)
 {
 }