public ButtonDecorator(ViewHostComponent child, ButtonCollection buttonDefinitions, ButtonFactory buttonFactory = null) : base("Medical.GUI.AnomalousMvc.Decorators.ButtonDecorator.layout") { this.child = child; widget.setSize(child.Widget.Width, child.Widget.Height + BUTTON_AREA_HEIGHT); child.Widget.attachToWidget(widget); child.Widget.setPosition(0, BUTTON_AREA_HEIGHT); child.Widget.Align = Align.Stretch; widgetHeight = widget.Height; int buttonWidth = (widget.Width - BUTTON_PADDING) / buttonDefinitions.Count; currentX = BUTTON_PADDING; if (buttonFactory == null) { buttonFactory = this; } foreach (ButtonDefinitionBase buttonDef in buttonDefinitions) { buttonDef.createButton(buttonFactory, currentX, BUTTON_Y, buttonWidth - BUTTON_PADDING, BUTTON_HEIGHT); } }
public void setTopComponent(ViewHostComponent component) { this.component = component; layoutContainer = new VariableSizeMyGUILayoutContainer(component.Widget, getDesiredSize); layoutContainer.LayoutChanged += layoutContainer_LayoutChanged; layoutContainer.AnimatedResizeStarted += layoutContainer_AnimatedResizeStarted; layoutContainer.AnimatedResizeCompleted += layoutContainer_AnimatedResizeCompleted; }
public ViewHostComponent createViewHostComponent(MyGUIView view, AnomalousMvcContext context, MyGUIViewHost viewHost) { WizardView wizardView = view as WizardView; if (wizardView != null) { wizardView.TeethToolController = teethToolController; ViewHostComponent component = wizardView.createViewHost(context, viewHost); return(component); } return(null); }
public MDIDialogDecorator(MDILayoutManager targetLayoutManager, ViewHostComponent child, MyGUIView view) : base(view.Buttons.hasItem("Close") ? "Medical.GUI.AnomalousMvc.Decorators.MDIDialogDecoratorCSX.layout" : "Medical.GUI.AnomalousMvc.Decorators.MDIDialogDecoratorCS.layout") { this.MDIManager = targetLayoutManager; MDILayoutElementName mdiElementName = view.ElementName as MDILayoutElementName; if (mdiElementName != null) { this.AllowedDockLocations = mdiElementName.AllowedDockLocations; } ButtonCollection buttons = view.Buttons; if (buttons.Count > 0) { //Keep button decorator from being made if there is only one button and it is close if (buttons.Count == 1 && buttons.hasItem("Close")) { buttons["Close"].createButton(this, 0, 0, 0, 0); } else { child = new ButtonDecorator(child, buttons, this); } } fireCloseEvent = closeAction != null; window.Visible = true; window.Caption = view.DisplayTitle; IntCoord clientCoord = window.ClientCoord; int widthDifference = window.Width - clientCoord.width; int heightDifference = window.Height - clientCoord.height; Position = new IntVector2(child.Widget.Left, child.Widget.Top); Size = new IntSize2(child.Widget.Width + widthDifference, child.Widget.Height + heightDifference); dockedSize = Size; clientCoord = window.ClientCoord; this.child = child; child.Widget.attachToWidget(window); child.Widget.setCoord(0, 0, clientCoord.width, clientCoord.height); child.Widget.Align = Align.Stretch; Resized += MDIDialogDecorator_Resized; Closing += MDIDialogDecorator_Closing; child.topLevelResized(); window.Visible = false; }
public FloatingPanelDecorator(ViewHostComponent child, ButtonCollection buttons, View view) : base(view.Transparent ? "Medical.GUI.AnomalousMvc.Decorators.SidePanelDecoratorTransparent.layout" : "Medical.GUI.AnomalousMvc.Decorators.SidePanelDecorator.layout") { if (buttons.Count > 0) { child = new ButtonDecorator(child, buttons); } this.child = child; widget.setSize(child.Widget.Right + int.Parse(widget.getUserString("ChildWidthOffset")), child.Widget.Bottom + int.Parse(widget.getUserString("ChildHeightOffset"))); child.Widget.attachToWidget(widget); child.Widget.setPosition(int.Parse(widget.getUserString("ChildX")), int.Parse(widget.getUserString("ChildY"))); child.Widget.Align = Align.HStretch | Align.VStretch; }
public TopBottomPanelDecorator(ViewHostComponent child, ButtonCollection buttons, bool transparent) : base(transparent ? "Medical.GUI.AnomalousMvc.Decorators.TopBottomPanelDecoratorTransparent.layout" : "Medical.GUI.AnomalousMvc.Decorators.TopBottomPanelDecorator.layout") { if (buttons.Count > 0) { child = new ButtonDecorator(child, buttons); } this.child = child; child.Widget.attachToWidget(widget); childPosition = new IntVector2(int.Parse(widget.getUserString("ChildX")), int.Parse(widget.getUserString("ChildY"))); child.Widget.setPosition(childPosition.x, childPosition.y); childSizeOffset = new IntSize2(int.Parse(widget.getUserString("ChildWidthOffset")), int.Parse(widget.getUserString("ChildHeightOffset"))); widget.setSize(child.Widget.Right - childSizeOffset.Width, child.Widget.Bottom - childSizeOffset.Height); child.Widget.Align = Align.HStretch | Align.VStretch; }
public ScrollViewDecorator(ViewHostComponent child) { this.child = child; IntCoord childCoord = child.Widget.Coord; scrollView = Gui.Instance.createWidgetT("ScrollView", "ScrollViewEmpty", childCoord.left, childCoord.top, childCoord.width, childCoord.height, Align.HStretch | Align.VStretch, "Main", "") as ScrollView; child.Widget.attachToWidget(scrollView); child.Widget.setPosition(0, 0); scrollView.CanvasAlign = Align.Left | Align.Top; scrollView.VisibleHScroll = false; var viewCoord = scrollView.ViewCoord; scrollView.CanvasSize = new IntSize2(viewCoord.width, child.Widget.Height); }
public WindowDecorator(ViewHostComponent child, ButtonCollection buttons, MyGUIView view) { if (buttons.Count > 0) { //Keep button decorator from being made if there is only one button and it is close if (buttons.Count == 1 && buttons.hasItem("Close")) { buttons["Close"].createButton(this, 0, 0, 0, 0); } else { child = new ButtonDecorator(child, buttons, this); } } if (closeAction != null) { window = (Window)Gui.Instance.createWidgetT("Window", "WindowCSX", 300, 150, 260, 440, Align.Default, "Overlapped", ""); window.WindowButtonPressed += new MyGUIEvent(window_WindowButtonPressed); } else { window = (Window)Gui.Instance.createWidgetT("Window", "WindowCS", 300, 150, 260, 440, Align.Default, "Overlapped", ""); } int widthDiffernce = window.ClientCoord.width - window.Width; int heightDifference = window.ClientCoord.height - window.Height; window.setCoord(child.Widget.Left, child.Widget.Top, child.Widget.Width + widthDiffernce, child.Widget.Height + heightDifference); this.child = child; child.Widget.attachToWidget(window); IntCoord clientCoord = window.ClientCoord; child.Widget.setCoord(0, 0, clientCoord.width, clientCoord.height); child.Widget.Align = Align.Stretch; window.WindowChangedCoord += new MyGUIEvent(window_WindowChangedCoord); child.topLevelResized(); window.Caption = view.DisplayTitle; }
public ViewHostComponent createViewHostComponent(MyGUIView view, AnomalousMvcContext context, MyGUIViewHost viewHost) { ViewHostComponent component = null; foreach (ViewHostComponentFactory factory in concreteComponentFactories) { component = factory.createViewHostComponent(view, context, viewHost); if (component != null) { break; } } if (component == null) { return(component); } switch (view.ElementName.ViewType) { case ViewType.Window: MDIDialogDecorator dialogDecorator = new MDIDialogDecorator(mdiManager, component, view); switch (view.ElementName.LocationHint) { case ViewLocations.Left: dialogDecorator.CurrentDockLocation = DockLocation.Left; break; case ViewLocations.Right: dialogDecorator.CurrentDockLocation = DockLocation.Right; break; case ViewLocations.Top: dialogDecorator.CurrentDockLocation = DockLocation.Top; break; case ViewLocations.Bottom: dialogDecorator.CurrentDockLocation = DockLocation.Bottom; break; case ViewLocations.Floating: dialogDecorator.CurrentDockLocation = DockLocation.Floating; break; } component = dialogDecorator; break; case ViewType.Panel: switch (view.ElementName.LocationHint) { case ViewLocations.Left: component = new SidePanelDecorator(component, view.Buttons, view.Transparent); break; case ViewLocations.Right: component = new SidePanelDecorator(component, view.Buttons, view.Transparent); break; case ViewLocations.Top: component = new TopBottomPanelDecorator(component, view.Buttons, view.Transparent); break; case ViewLocations.Bottom: component = new TopBottomPanelDecorator(component, view.Buttons, view.Transparent); break; case ViewLocations.Floating: component = new FloatingPanelDecorator(component, view.Buttons, view); break; } break; } return(component); }