/// <summary> /// Constructor. /// </summary> /// <param name="game">The currently running Game object.</param> /// <param name="guiManager">GUIManager that this control is part of.</param> public MenuItem(Game game, GUIManager guiManager) : base(game, guiManager) { this.numMenuItems = 0; this.numClicks = 0; this.isPopUpShown = false; this.isHighlightShown = false; this.isEnabled = true; this.canClose = true; #region Create Child Controls this.label = new Label(game, guiManager); this.highlightBox = new Box(game, guiManager); this.popUpMenu = new PopUpMenu(game, guiManager); this.arrow = new Icon(game, guiManager); #endregion #region Add Child Controls base.Add(this.label); #endregion #region Set Default Properties HMargin = defaultHMargin; VMargin = defaultVMargin; HighlightSkin = defaultHighlightSkin; ArrowSkin = defaultArrowSkin; #endregion #region Event Handlers this.popUpMenu.Close += new CloseHandler(OnPopUpClosed); #endregion }
/// <summary> /// Constructor. /// </summary> /// <param name="game">The currently running Game object.</param> /// <param name="guiManager">GUIManager that this control is part of.</param> public ListBox(Game game, GUIManager guiManager) : base(game, guiManager) { this.entries = new List<Label>(); this.selectedIndex = -1; this.resizeToFit = false; #region Create Child Controls this.box = new Box(game, guiManager); this.surface = new UIComponent(game, guiManager); this.viewPort = new UIComponent(game, guiManager); this.scrollBar = new ScrollBar(game, guiManager); #endregion #region Add Child Controls Add(this.box); this.viewPort.Add(this.surface); Add(this.viewPort); #endregion #region Set Properties this.surface.CanHaveFocus = false; this.viewPort.CanHaveFocus = false; //this.scrollBar.Y = 1; #endregion #region Set Default Properties Width = defaultWidth; Height = defaultHeight; HMargin = defaultHMargin; VMargin = defaultVMargin; Skin = defaultSkin; Font = defaultFont; #endregion #region Event Handlers this.scrollBar.Scroll += new ScrollHandler(OnScroll); // Scrollbar doesn't need keyboard, so hand control over to this this.scrollBar.KeyDown += new KeyDownHandler(OnKeyDown); #endregion }
/// <summary> /// Constructor. /// </summary> /// <param name="game">The currently running Game object.</param> /// <param name="guiManager">GUIManager that this control is part of. /// </param> public TextBox(Game game, GUIManager guiManager) : base(game, guiManager) { this.seconds = 0.0; #region Create Child Controls this.box = new Box(game, guiManager); this.label = new Label(game, guiManager); #endregion #region Add Child Controls Add(this.box); Add(this.label); #endregion #region Set Default Properties Width = defaultWidth; Height = defaultHeight; HMargin = defaultHMargin; VMargin = defaultVMargin; Skin = defaultSkin; #endregion }
/// <summary> /// Constructor. /// </summary> /// <param name="game">The currently running Game object.</param> /// <param name="guiManager">GUIManager that this control is part of.</param> public Window(Game game, GUIManager guiManager) : base(game, guiManager) { this.isResizable = true; this.transparency = -1; #region Create Child Controls this.box = new Box(game, guiManager); this.viewPort = new UIComponent(game, guiManager); this.titleBar = new Bar(game, guiManager); this.movableArea = new MovableArea(game, guiManager); this.backgroundMovableArea = new MovableArea(game, guiManager); this.label = new Label(game, guiManager); this.closeButton = new ImageButton(game, guiManager); #endregion #region Add Child Controls base.Add(this.box); base.Add(this.viewPort); base.Add(this.titleBar); base.Add(this.label); base.Add(this.movableArea); #endregion #region Add Resizable Areas this.resizableAreas = new ResizableArea[8]; for (int i = 0; i < 8; i++) { this.resizableAreas[i] = new ResizableArea(game, guiManager); this.resizableAreas[i].ZOrder = 0.3f; this.resizableAreas[i].StartResizing += new StartResizingHandler(OnStartAnimating); this.resizableAreas[i].EndResizing += new EndResizingHandler(OnEndAnimating); base.Add(this.resizableAreas[i]); } this.resizableAreas[0].ResizeArea = ResizeAreas.TopLeft; this.resizableAreas[1].ResizeArea = ResizeAreas.Top; this.resizableAreas[2].ResizeArea = ResizeAreas.TopRight; this.resizableAreas[3].ResizeArea = ResizeAreas.Left; this.resizableAreas[4].ResizeArea = ResizeAreas.Right; this.resizableAreas[5].ResizeArea = ResizeAreas.BottomLeft; this.resizableAreas[6].ResizeArea = ResizeAreas.Bottom; this.resizableAreas[7].ResizeArea = ResizeAreas.BottomRight; #endregion #region Set Non-Default Properties this.movableArea.ZOrder = 0.1f; this.closeButton.ZOrder = 0.4f; this.viewPort.ZOrder = 0.2f; this.viewPort.CanHaveFocus = true; MinWidth = 150; #endregion #region Set Default Properties Margin = defaultMargin; HasCloseButton = defaultHasCloseButton; HasFullWindowMovableArea = defaultFullWindowMovableArea; TitleBarHeight = defaultTitleBarHeight; Width = MinWidth; Height = MinHeight; ButtonSize = defaultButtonSize; Skin = defaultSkin; TitleBarSkin = defaultTitleBarSkin; CloseButtonSkin = defaultCloseButtonSkin; CloseButtonHoverSkin = defaultCloseButtonHoverSkin; CloseButtonPressedSkin = defaultCloseButtonPressedSkin; #endregion #region Event Handlers this.closeButton.Click += new ClickHandler(OnClose); this.movableArea.StartMoving += new StartMovingHandler(OnStartAnimating); this.movableArea.EndMoving += new EndMovingHandler(OnEndAnimating); this.backgroundMovableArea.StartMoving += new StartMovingHandler(OnStartAnimating); this.backgroundMovableArea.EndMoving += new EndMovingHandler(OnEndAnimating); #endregion Refresh(); }