/// <summary> /// Construct a Panel instance from the given template. /// </summary> /// <param name="template"></param> public Panel(PanelTemplate template) : base(template) { this.HasFrame = template.HasFrame; this.CanHaveKeyboardFocus = template.CanHaveKeyboardFocus; this.HilightWhenMouseOver = template.HilightedWhenMouseOver; }
protected override void OnSettingUp() { base.OnSettingUp(); // Create and add interior panel that will "hold" all of the example controls Size panelSize = new Size(this.Size.Width-2,this.Size.Height-24); PanelTemplate panelTemplate = new PanelTemplate() { HasFrame = true, UpperLeftPos = this.LocalRect.UpperLeft.Shift(1,3), Size = panelSize }; //panelTemplate.SetLowerRight(this.ScreenRect.LowerRight.Shift(-1, -17)); AddControl(new Panel(panelTemplate)); ViewRect = Rect.Inflate(panelTemplate.CalculateRect(),-1,-1); // Create the page info TextBox control. Each page will have one. Rect textBoxRect = new Rect(panelTemplate.CalculateRect().LowerLeft.Shift(0, 1), this.LocalRect.LowerRight.Shift(-1, -1)); TextBoxTemplate tbt = new TextBoxTemplate() { Size = textBoxRect.Size, UpperLeftPos = textBoxRect.UpperLeft, TextSpeed = 5, Pigments = new PigmentAlternatives() { {PigmentType.Window,new Pigment(0xaaaaaa,0x111511)} } }; PageInfo = new TextBox(tbt); AddControl(PageInfo); // Create the next, previous and quit buttons. Each page will have these // buttons ButtonTemplate nextButtonTemplate = new ButtonTemplate() { Label = "Next->", Tooltip = "Click to go to the next page", HilightWhenMouseOver = true, LabelAlignment = HorizontalAlignment.Center, MinimumWidth = 12 }; nextButtonTemplate.SetUpperRight(Application.ScreenRect.UpperRight); ButtonTemplate previousButtonTemplate = new ButtonTemplate() { Label = "<-Previous", Tooltip = "Click to go to the previous page", HilightWhenMouseOver = true, UpperLeftPos = new Point(0, 0), LabelAlignment = HorizontalAlignment.Center, MinimumWidth = 12 }; ButtonTemplate quitButtonTemplate = new ButtonTemplate() { Label = "QUIT", Tooltip = "Quit the demo", HilightWhenMouseOver = true, LabelAlignment = HorizontalAlignment.Center, MinimumWidth = 38 }; quitButtonTemplate.SetTopCenter(Application.ScreenRect.TopCenter); Button quitButton = new Button(quitButtonTemplate); nextButton = new Button(nextButtonTemplate); prevButton = new Button(previousButtonTemplate); AddControls(nextButton, prevButton, quitButton); quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClicked); prevButton.ButtonPushed += new EventHandler(prevButton_ButtonClicked); nextButton.ButtonPushed += new EventHandler(nextButton_ButtonClicked); prevButton.IsActive = hasPrev; nextButton.IsActive = hasNext; }
/// Again we force that a Player object be passed to our constructor, and we save it in /// a field for later use. public MapView(PanelTemplate template,Player player) : base(template) { this.player = player; }