mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Got rid of Action<T>/Func<T>
This commit is contained in:
parent
44bd9c698f
commit
b52db47d55
37 changed files with 94 additions and 88 deletions
|
@ -53,7 +53,7 @@ namespace Beefy.theme.dark
|
|||
public FontAlign mLabelAlign = FontAlign.Centered;
|
||||
public FrameKind mFrameKind = .OnWindow;
|
||||
|
||||
public Event<Action<Menu>> mPopulateMenuAction ~ _.Dispose();
|
||||
public Event<delegate void(Menu)> mPopulateMenuAction ~ _.Dispose();
|
||||
public CBMenuWidget mCurMenuWidget;
|
||||
bool mJustClosed;
|
||||
public uint32 mBkgColor;
|
||||
|
|
|
@ -842,8 +842,8 @@ namespace Beefy.theme.dark
|
|||
public SortType mSortType = SortType() ~ { mSortType.mColumn = -1; };
|
||||
public Insets mInsets ~ delete _;
|
||||
|
||||
public Event<Action<DragEvent>> mOnDragUpdate ~ _.Dispose();
|
||||
public Event<Action<DragEvent>> mOnDragEnd ~ _.Dispose();
|
||||
public Event<delegate void(DragEvent)> mOnDragUpdate ~ _.Dispose();
|
||||
public Event<delegate void(DragEvent)> mOnDragEnd ~ _.Dispose();
|
||||
|
||||
public this()
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Beefy.theme.dark
|
|||
public bool mAllowEdit = true;
|
||||
public Object mValue;
|
||||
public List<Widget> mMoveWidgets;
|
||||
public Action<DarkSmartEdit> mValueChangedAction;
|
||||
public delegate void(DarkSmartEdit) mValueChangedAction;
|
||||
|
||||
bool mCancelingEdit;
|
||||
float mMouseDownX;
|
||||
|
|
|
@ -397,7 +397,7 @@ namespace Beefy.theme.dark
|
|||
return tabCount;
|
||||
}
|
||||
|
||||
public override void WithTabs(Action<TabbedView.TabButton> func)
|
||||
public override void WithTabs(delegate void(TabbedView.TabButton) func)
|
||||
{
|
||||
for (var tab in mTabs)
|
||||
func(tab);
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace Beefy.utils
|
|||
Clear();
|
||||
}
|
||||
|
||||
public void WithActions(Action<UndoAction> func)
|
||||
public void WithActions(delegate void(UndoAction) func)
|
||||
{
|
||||
for (var action in mUndoList)
|
||||
func(action);
|
||||
|
|
|
@ -376,7 +376,7 @@ namespace Beefy.widgets
|
|||
}
|
||||
|
||||
protected void SerializeTimeline<T>(StructuredData data, TimelineData<T> timelineData, String name,
|
||||
String[] componentNames, Action<StructuredData, T>[] writeActions, T theDefault) where T : IEquatable<T>
|
||||
String[] componentNames, Delegate[] writeActions, T theDefault) where T : IEquatable<T>
|
||||
{
|
||||
/*if ((timelineData.mEntries != null) && (timelineData.mEntries.Count > 0))
|
||||
{
|
||||
|
@ -433,7 +433,7 @@ namespace Beefy.widgets
|
|||
data.Add("ResId", resIdStr);
|
||||
}
|
||||
|
||||
SerializeTimeline(data, mTimelineAnchor, "Anchor",
|
||||
/*SerializeTimeline(data, mTimelineAnchor, "Anchor",
|
||||
scope String[] { "X", "Y" },
|
||||
scope Action<StructuredData, CompositionPos>[] { scope => CompositionPos.WriteX, scope => CompositionPos.WriteY },
|
||||
CompositionPos(0, 0));
|
||||
|
@ -451,7 +451,7 @@ namespace Beefy.widgets
|
|||
SerializeTimeline(data, mTimelineRot, "Rotation",
|
||||
scope String[] { "Angle" },
|
||||
null,
|
||||
0.0f);
|
||||
0.0f);*/
|
||||
}
|
||||
|
||||
public void RebuildChildIndices()
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace Beefy.widgets
|
|||
return parentFrame;
|
||||
}
|
||||
|
||||
public void WithAllDockedWidgets(Action<DockedWidget> func)
|
||||
public void WithAllDockedWidgets(delegate void(DockedWidget) func)
|
||||
{
|
||||
for (var dockedWidget in mDockedWidgets)
|
||||
{
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace Beefy.widgets
|
|||
}
|
||||
}
|
||||
|
||||
public void WithItems(Action<ListViewItem> func)
|
||||
public void WithItems(delegate void(ListViewItem) func)
|
||||
{
|
||||
if (mChildItems != null)
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ namespace Beefy.widgets
|
|||
}
|
||||
}
|
||||
|
||||
public void WithSelectedItems(Action<ListViewItem> func, bool skipSelectedChildrenOnSelectedItems = false, bool skipClosed = false)
|
||||
public void WithSelectedItems(delegate void(ListViewItem) func, bool skipSelectedChildrenOnSelectedItems = false, bool skipClosed = false)
|
||||
{
|
||||
bool selfSelected = Selected;
|
||||
if (selfSelected)
|
||||
|
@ -684,7 +684,7 @@ namespace Beefy.widgets
|
|||
protected ListViewItem mRoot;
|
||||
public bool mListSizeDirty;
|
||||
public float mHeaderHeight;
|
||||
public Event<Action<ListViewItem>> mOnFocusChanged ~ _.Dispose();
|
||||
public Event<delegate void(ListViewItem)> mOnFocusChanged ~ _.Dispose();
|
||||
public float mBottomInset = 8;
|
||||
public bool mAllowMultiSelect = true;
|
||||
public Event<delegate void(ListViewItem item, float x, float y, int32 btnNum, int32 btnCount)> mOnItemMouseDown ~ _.Dispose();
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace Beefy.widgets
|
|||
public float mMaxContainerWidth = Int32.MaxValue;
|
||||
public Insets mPopupInsets = new Insets() ~ delete _;
|
||||
public bool mHasClosed;
|
||||
public Event<Action<int>> mOnSelectionChanged ~ _.Dispose();
|
||||
public Event<delegate void(int)> mOnSelectionChanged ~ _.Dispose();
|
||||
public bool mWasInitialized;
|
||||
|
||||
public this(Menu menu)
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Beefy.widgets
|
|||
{
|
||||
public Scrollbar mScrollbar;
|
||||
public DragHelper mDraggableHelper ~ delete _;
|
||||
public Event<Action<float, float>> mOnDrag ~ _.Dispose();
|
||||
public Event<delegate void(float, float)> mOnDrag ~ _.Dispose();
|
||||
|
||||
public this()
|
||||
{
|
||||
|
|
|
@ -346,7 +346,7 @@ namespace Beefy.widgets
|
|||
int32 mRefCount = 1;
|
||||
|
||||
public Event<OpenNewWindowDelegate> mOpenNewWindowDelegate ~ _.Dispose();
|
||||
public Event<Action<TabbedView>> mTabbedViewClosed ~ _.Dispose();
|
||||
public Event<delegate void(TabbedView)> mTabbedViewClosed ~ _.Dispose();
|
||||
|
||||
public SharedData Ref()
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ namespace Beefy.widgets
|
|||
|
||||
public delegate void OpenNewWindowDelegate(TabbedView tabbedView, WidgetWindow newWindow);
|
||||
|
||||
public Action<Menu> mPopulateMenuEvent;
|
||||
public delegate void(Menu) mPopulateMenuEvent;
|
||||
public float mTabHeight;
|
||||
public float mTabAreaWidth;
|
||||
public bool mNeedResizeTabs;
|
||||
|
@ -417,7 +417,7 @@ namespace Beefy.widgets
|
|||
return mTabs.Count;
|
||||
}
|
||||
|
||||
public virtual void WithTabs(Action<TabbedView.TabButton> func)
|
||||
public virtual void WithTabs(delegate void(TabbedView.TabButton) func)
|
||||
{
|
||||
for (var tab in mTabs)
|
||||
func(tab);
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace Beefy.widgets
|
|||
public Event<RemovedFromParentHandler> mOnRemovedFromParent ~ _.Dispose();
|
||||
public Event<AddedToParentHandler> mOnAddedToParent ~ _.Dispose();
|
||||
public Event<KeyDownHandler> mOnKeyDown ~ _.Dispose();
|
||||
public Event<Action<Widget>> mOnDeleted ~ _.Dispose();
|
||||
public Event<delegate void(Widget)> mOnDeleted ~ _.Dispose();
|
||||
|
||||
public Matrix Transform
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Beefy.widgets
|
|||
public Event<MouseWheelHandler> mOnMouseWheel ~ _.Dispose();
|
||||
public Event<MenuItemSelectedHandler> mOnMenuItemSelected ~ _.Dispose();
|
||||
public Event<KeyDownHandler> mOnWindowKeyDown ~ _.Dispose();
|
||||
public Event<Func<int32, int32, HitTestResult>> mOnHitTest ~ _.Dispose();
|
||||
public Event<delegate HitTestResult(int32, int32)> mOnHitTest ~ _.Dispose();
|
||||
|
||||
public static Event<MouseLeftWindowHandler> sOnMouseLeftWindow ~ _.Dispose();
|
||||
public static Event<WindowLostFocusHandler> sOnWindowLostFocus ~ _.Dispose();
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
namespace System
|
||||
{
|
||||
public delegate void Action();
|
||||
public delegate void Action<T>(T obj);
|
||||
public delegate void Action<T1, T2>(T1 p1, T2 p2);
|
||||
public delegate void Action<T1, T2, T3>(T1 p1, T2 p2, T3 p3);
|
||||
public delegate void Action<T1, T2, T3, T4>(T1 p1, T2 p2, T3 p3, T4 p4);
|
||||
|
||||
public delegate int Comparison<T>(T lhs, T rhs);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
namespace System.Collections
|
||||
{
|
||||
|
||||
}
|
|
@ -39,6 +39,8 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
delegate void Action();
|
||||
|
||||
struct Function : int
|
||||
{
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
namespace System
|
||||
{
|
||||
delegate TResult Func<TResult>();
|
||||
delegate TResult Func<T1, TResult>(T1 p1);
|
||||
delegate TResult Func<T1, T2, TResult>(T1 p1, T2 p2);
|
||||
delegate TResult Func<T1, T2, T3, TResult>(T1 p1, T2 p2, T3 p3);
|
||||
}
|
|
@ -72,4 +72,6 @@ namespace System
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public delegate int Comparison<T>(T lhs, T rhs);
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ namespace System.IO
|
|||
|
||||
public this(
|
||||
bool isRead,
|
||||
Func<Object, int> func, Object state,
|
||||
delegate int(Object) func, Object state,
|
||||
Stream stream, uint8[] buffer, int offset, int count, AsyncCallback callback) :
|
||||
base(func, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace System.Threading.Tasks
|
|||
|
||||
}
|
||||
|
||||
public this(Func<Object, TResult> func, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
public this(delegate TResult(Object) func, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
: this(func, state, Task.[Friend]InternalCurrentIfAttached(creationOptions), cancellationToken,
|
||||
creationOptions, InternalTaskOptions.None, null)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace System.Threading.Tasks
|
|||
//PossiblyCaptureContext(ref stackMark);
|
||||
}
|
||||
|
||||
this(Func<TResult> valueSelector, Task parent, CancellationToken cancellationToken,
|
||||
this(delegate TResult() valueSelector, Task parent, CancellationToken cancellationToken,
|
||||
TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler) :
|
||||
base(valueSelector, null, parent, cancellationToken, creationOptions, internalOptions, scheduler)
|
||||
{
|
||||
|
@ -103,9 +103,9 @@ namespace System.Threading.Tasks
|
|||
return m_result;
|
||||
}
|
||||
|
||||
List<Action<Task<TResult>>> mContinuations = new List<Action<Task<TResult>>>() ~ delete _;
|
||||
List<delegate void(Task<TResult>)> mContinuations = new .() ~ delete _;
|
||||
|
||||
public Task ContinueWith(Action<Task<TResult>> continuationAction)
|
||||
public Task ContinueWith(delegate void(Task<TResult>) continuationAction)
|
||||
{
|
||||
bool callDirectly = false;
|
||||
using (mMonitor.Enter())
|
||||
|
@ -130,7 +130,7 @@ namespace System.Threading.Tasks
|
|||
|
||||
public void Notify(bool allowDelete = true)
|
||||
{
|
||||
var continueList = scope List<Action<Task<TResult>>>(16);
|
||||
var continueList = scope List<delegate void(Task<TResult>)>(16);
|
||||
using (mMonitor.Enter())
|
||||
{
|
||||
mHasCompleted = true;
|
||||
|
|
|
@ -255,7 +255,7 @@ namespace System.Threading.Tasks
|
|||
|
||||
}
|
||||
|
||||
public this(Action<Object> action, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
public this(delegate void(Object) action, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
: this(action, state, Task.InternalCurrentIfAttached(creationOptions), cancellationToken, creationOptions, InternalTaskOptions.None, null)
|
||||
{
|
||||
//StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
|
||||
|
@ -1121,7 +1121,7 @@ namespace System.Threading.Tasks
|
|||
action();
|
||||
return;
|
||||
}
|
||||
var actionWithState = m_action as Action<Object>;
|
||||
var actionWithState = m_action as delegate void(Object);
|
||||
if (actionWithState != null)
|
||||
{
|
||||
actionWithState(m_stateObject);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue