internal static void OnKeySetFocus(Widget widget, FocusEventArg arg) { Instance root_inst = arg.focus_widget_root; Instance widget_inst = arg.focus_widget; Layout layout = null; if (GUI.SearchLayout(root_inst, out layout)) { Widget widget2 = null; if (layout.TryGetWidget(widget_inst, out widget2)) { widget.mHandleKeySetFocus(widget.Name, layout.Name, widget2.Name); return; } else if (widget_inst.IsValid) { String name = Widget.GetName(widget_inst.Ptr); if (name.Length > 0)//[2012/6/17 zhongdaohuan]暂不支持编辑匿名的ui控件 { widget2 = Widget.CreateWidget(widget_inst, name, layout); widget.mHandleKeySetFocus(widget.Name, layout.Name, widget2.Name); return; } } } widget.mHandleKeySetFocus(widget.Name, null, null); }
internal ExecuteResult Load() { //throw new Exception("mWinPtr not null"); Instance inst = GUI.LoadLayout(mParent, mFileName); if (inst.IsValid) { mWidget = Widget.CreateWidget(inst, null, this); mWidget.Visible = mVisible; return(ExecuteResult.Success); } return(ExecuteResult.False); }
internal ExecuteResult Load() { if (null != mParent && (!mParent.IsValid)) { return(ExecuteResult.ParentNotExist); } Instance inst = GUI.LoadLayout(mParent, mFileName); if (inst.IsValid) { mWidget = Widget.CreateWidget(inst, null, this); mWidget.Visible = mVisible; return(ExecuteResult.Success); } return(ExecuteResult.False); }
protected ItemInfo findItem(Instance inst) { ItemInfo info = null; mItems.TryGetValue(inst.Ptr, out info); if (null == info) { int temp = mInstance.Ptr.ToInt32() + inst.Ptr.ToInt32(); string name = mName.Name + "_item_" + temp.ToString(); Widget widget = Widget.CreateWidget(inst, name, mParentLayout);// info = new ItemInfo(this, widget); mItems.Add(inst.Ptr, info); mParentLayout.AddWidget(info.Item); } return(info); }
internal bool FindWidget(FString widget_name, out Widget widget) { if (!IsLoaded) { widget = null; return(false); } if (mWidget.Name == widget_name) { widget = mWidget; return(true); } //先从子layout找,因为,如果widget_name,在子layout里, //widget_name的脚本对象必须由子layout管理,要不然会悲剧。 // foreach (Layout ly in mChildLayouts) { if (ly.FindWidget(widget_name, out widget)) { return(true); } } if (mChilds.GetWidget(widget_name, out widget)) { return(true); } else { Instance inst = GUI.FindWidget(mWidget.Instance.Ptr, widget_name.Name); if (inst.IsValid) { widget = Widget.CreateWidget(inst, widget_name.Name, this); mChilds.Add(widget); return(true); } else { widget = null; return(false); } } }
internal bool FindWidget(FString widget_name, out Widget widget) { if (mChilds.GetWidget(widget_name, out widget)) { return(true); } else { Instance inst = GUI.FindWidget(mWidget.Instance.Ptr, widget_name.Name); if (inst.IsValid) { widget = Widget.CreateWidget(inst, widget_name.Name, this); mChilds.Add(widget); return(true); } else { widget = null; return(false); } } }