Beispiel #1
0
 public void Init(GUIHost host, ButtonTemplate color_template)
 {
     SetToDefaultOptions(color_template);
     Init(host, ImageSrc, u0, v0, u1, v1, over_u0, over_v0, over_u1, over_v1, down_u0, down_v0, down_u1, down_v1, disabled_u0, disabled_v0, disabled_u1, disabled_v1);
     SetGrowableWidth(leftbordersize_pixels, rightbordersize_pixels, minimum_width_pixels);
     SetGrowableHeight(topbordersize_pixels, bottombordersize_pixels, minimum_height_pixels);
 }
Beispiel #2
0
        public async Task ReplyTemplateMessageAsync(string replyToken, ButtonTemplate template)
        {
            using (var httpClient = new HttpClient())
            {
                using (var request = new HttpRequestMessage(new HttpMethod("POST"), $"{lineMessageReplyApiBaseUrl}"))
                {
                    request.Headers.TryAddWithoutValidation("Authorization", $"Bearer {accessToken}");

                    LineMessageReq req = new LineMessageReq();
                    req.ReplyToken = replyToken;

                    req.Messages.Add(new TemplateMessageBase()
                    {
                        Template = template
                    });

                    var postJson = JsonConvert.SerializeObject(req, new JsonSerializerSettings
                    {
                        NullValueHandling = NullValueHandling.Ignore,
                        ContractResolver  = new DefaultContractResolver
                        {
                            NamingStrategy = new CamelCaseNamingStrategy()
                        },
                        Formatting = Formatting.Indented
                    });

                    request.Content = new StringContent(postJson);
                    request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
                    var response = await httpClient.SendAsync(request);

                    var result = await response.Content.ReadAsStringAsync();
                }
            }
        }
Beispiel #3
0
        public SparkleButton(ButtonTemplate template)
            : base(template)
        {
            bg = new Color(Rand.Int32(0, 0xffffff));
            AddSchedule(new Schedule(Animate, 50));

            mod = Rand.Float() * 50f;
        }
Beispiel #4
0
    private void AddButtons()
    {
        for (int i = 0; i < shopList.itemsList.Count; i++)
        {
            Item       item      = shopList.itemsList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);
            newButton.transform.localScale = new Vector3(1, 1, 1);

            ButtonTemplate buttonTemplate = newButton.GetComponent <ButtonTemplate>();
            buttonTemplate.SetupItem(item, this);
        }
    }
Beispiel #5
0
        private void CreateButton(ButtonTemplate template, ButtonIconProfile customIconProfile)
        {
            if (template.IsEmpty)
            {
                return;
            }

            switch (template.Type)
            {
            case ButtonTypeEnum.Custom:
                numDefaultButtons++;
                break;

            case ButtonTypeEnum.Adjust:
                numDefaultButtons++;
                break;

            case ButtonTypeEnum.Done:
                numManipulationButtons++;
                break;

            case ButtonTypeEnum.Remove:
                numManipulationButtons++;
                numDefaultButtons++;
                break;

            //AS
            case ButtonTypeEnum.Reset:
                numManipulationButtons++;
                numDefaultButtons++;
                break;
            //

            case ButtonTypeEnum.Hide:
                numDefaultButtons++;
                break;

            case ButtonTypeEnum.Show:
                numHiddenButtons++;
                break;
            }

            GameObject newButton = GameObject.Instantiate(SquareButtonPrefab, buttonParent);

            newButton.name = template.Name;
            newButton.transform.localPosition = Vector3.zero;
            newButton.transform.localRotation = Quaternion.identity;
            AppBarButton mtb = newButton.AddComponent <AppBarButton>();

            mtb.Initialize(this, template, customIconProfile);
        }
Beispiel #6
0
        public static void BuildDiagramView(Canvas canvas, int id)
        {
            Tree root     = GetTree(id);
            var  template = new ButtonTemplate {
                TextAligment = HorizontalAlignment.Left,
                Width        = 150
            };
            var depth = root.GetDepth();

            for (int i = depth; i >= 0; i--)
            {
                var row = root.GetRowAt(i);
            }
        }
        public async Task <IList <IRequestMessage> > GetReplyMessagesAsync()
        {
            var msg = new ButtonTemplate("Buttons", new List <IAction>()
            {
                new MessageAction("Buttion1"),
                new MessageAction("Buttion2")
            }, thumbnailImageUrl: "https://via.placeholder.com/200x150/333.png/fff");


            await Task.CompletedTask;

            return(new List <IRequestMessage>
            {
                msg
            });
        }
Beispiel #8
0
 public static void SetupUpgrades()
 {
     foreach (Multiplier mult in instance.multipliers)
     {
         ButtonTemplate thisButton = Instantiate(instance.upgradeTemplate, instance.upgradePanelTrans) as ButtonTemplate;
         instance.activeButtons.Add(thisButton);
         thisButton.icon.sprite           = mult.icon;
         thisButton.buttonName.text       = mult.name + GameState.GetStreamNumber();
         thisButton.currentLevel          = 0;
         thisButton.currentMultiplier     = mult.baseValue;
         thisButton.currentPrice          = mult.baseCost;
         thisButton.baseCost              = mult.baseCost;
         thisButton.baseValue             = mult.baseValue;
         thisButton.valueIncreasePerLevel = mult.addedValuePerLevel;
         thisButton.costIncreasePerLevel  = mult.costPerLevelMultiplier;
         thisButton.permanency            = mult.permanency;
     }
 }
Beispiel #9
0
        /// <summary>
        /// Every component gets a SettingUp message once when they are about to be added to the framework.  For Windows,
        /// this happens after it is set as the Application's window.
        /// </summary>
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            /// We are going to add a handy quit button to our Window, so we need to define the options for the button
            /// in a ButtonTemplate class.  We give it a Label, and we will also give it a nice Tooltip that will popup
            /// over the button when the mouse hovers over it.
            ///
            /// The UpperLeftPos property determines where the upper left corner of the control will be.  While most
            /// of the UI layout in OchreGui will have to be done by hand (there are no fancy layout grids in this
            /// library), there are some helper methods available, but we'll save those for our next example.
            ///
            /// One thing you may have noticed is that there is no way to specify the size of the button.  This is because
            /// all buttons (and many other controls) automatically size themselves according to the other options.  For
            /// a button, the height will always be 3 (to allow 1 space for the label and 2 spaces for the border), and
            /// the width will usually be Label.Length + 2 for width (again, allowing room for the border).  All
            /// of the *Info classes implement (or derive from) ISetupInfo, which provides the CalculateSize() method.
            /// This method returns the final size that the control will be, depending on its type and the specified options.
            ///
            /// If the combination of the specified position and the calculated size puts some or all of the control
            /// out of the screen area, the framework will automatcially slide the control so that none of it is clipped.
            ButtonTemplate quitButtonTemplate = new ButtonTemplate()
            {
                Label        = "QUIT",
                Tooltip      = "Quit the application",
                UpperLeftPos = new Point(35, 0)
            };

            /// Create the button with the specified options contained in quitButtonTemplate.
            Button quitButton = new Button(quitButtonTemplate);

            /// We are going to hook into the button clicked event, so we know when the user has clicked on the
            /// quit button.
            quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClicked);

            /// And, finally, add it to this Window.  Note that all controls added to a window must be unique objects, or
            /// an exception will be thrown by this method.  Also note that some of the properties of a contol (such as
            /// ScreenRect) are meaningless until they are added to a Window, which is why any setup code that depends
            /// on a fully initialized instance belongs in an overriden OnSettingUp() method, not in the constructor.
            AddControl(quitButton);
        }
Beispiel #10
0
        ButtonTemplate ButtonTest()
        {
            var buttons = new List <Button>();

            buttons.Add(new UrlButton()
            {
                Type  = ButtonType.web_url,
                Title = "Support document",
                URL   = "https://support.punnel.com/collection/40-bat-au"
                        //FallbackUrl = "https://support.punnel.com",
            });

            var t = new ButtonTemplate()
            {
                Buttons      = buttons,
                Text         = "bạn cần gì?",
                TemplateType = TemplateType.button
            };

            return(t);
        }
Beispiel #11
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            CheckBoxTemplate cb1 = new CheckBoxTemplate()
            {
                Label = " A Checkbox",
                UpperLeftPos = ViewRect.UpperLeft.Shift(1, 3),
            };
            AddControl(new CheckBox(cb1));

            CheckBoxTemplate cb2 = new CheckBoxTemplate()
            {
                Label = " Checkbox",
                MinimumWidth = cb1.CalculateSize().Width,
                CheckOnLeft = true
            };
            cb2.AlignTo(LayoutDirection.South, cb1, 1);
            AddControl(new CheckBox(cb2));

            CheckBoxTemplate cb3 = new CheckBoxTemplate()
            {
                Label = "Checkbox",
                MinimumWidth = cb1.CalculateSize().Width,
                CheckOnLeft = true,
                LabelAlignment = HorizontalAlignment.Right
            };
            cb3.AlignTo(LayoutDirection.South, cb2, 1);
            AddControl(new CheckBox(cb3));

            CheckBoxTemplate cb4 = new CheckBoxTemplate()
            {
                Label = "Checkbox",
                MinimumWidth = cb1.CalculateSize().Width,
                CheckOnLeft = true,
                LabelAlignment = HorizontalAlignment.Center,
            };
            cb4.AlignTo(LayoutDirection.South, cb3, 1);
            AddControl(new CheckBox(cb4));

            CheckBoxTemplate cb5 = new CheckBoxTemplate()
            {
                Label = "Checkbox",
                MinimumWidth = cb1.CalculateSize().Width,
                CheckOnLeft = false,
                LabelAlignment = HorizontalAlignment.Left,
                VerticalAlign = VerticalAlignment.Center,
                AutoSizeOverride = new Size(14,3),
                HasFrameBorder = false,
            };
            cb5.AlignTo(LayoutDirection.East, cb2, 1);
            AddControl(new CheckBox(cb5));

            CheckBoxTemplate cb6 = new CheckBoxTemplate()
            {
                Label = "Checkbox ",
                MinimumWidth = cb1.CalculateSize().Width,
                CheckOnLeft = false,
                LabelAlignment = HorizontalAlignment.Right,
                VerticalAlign = VerticalAlignment.Center,
                AutoSizeOverride = new Size(14, 3),
                HasFrameBorder = false,
            };
            cb6.AlignTo(LayoutDirection.South, cb5, 1);
            AddControl(new CheckBox(cb6));

            CheckBoxTemplate cb7 = new CheckBoxTemplate()
            {
                Label = Color.CYAN.DoForegroundCode() + "C" +
                    Color.RED.DoForegroundCode() + "o"+
                    Color.BLUE.DoForegroundCode() + "l"+
                    Color.BRASS.DoForegroundCode() + "o"+
                    Color.DARK_LIME.DoForegroundCode() + "r"+
                    Color.LIGHT_MAGENTA.DoForegroundCode() + "s" +
                    Color.StopColorCode + "!! ",
                CheckOnLeft = false,
                LabelAlignment = HorizontalAlignment.Center,
                HasFrameBorder = false,
            };
            cb7.AlignTo(LayoutDirection.South, cb6, 1);
            AddControl(new CheckBox(cb7));

            CheckBoxTemplate cb8 = new CheckBoxTemplate()
            {
                Label = "Custom",
                MinimumWidth = cb1.CalculateSize().Width,
                CheckOnLeft = false,
                LabelAlignment = HorizontalAlignment.Center,
            };
            cb8.AlignTo(LayoutDirection.North, cb5, 1);
            AddControl(new FancyCheck(cb8));

            ListBoxTemplate lb1 = new ListBoxTemplate()
            {
                Title = "A List Box",
                Items = new System.Collections.Generic.List<ListItemData>()
                {
                    new ListItemData("Item 1","Item 1 Tooltip"),
                    new ListItemData("Item 2","Item 2 Tooltip"),
                    new ListItemData("Item 3","Item 3 Tooltip"),
                    new ListItemData("Item 4","Item 4 Tooltip")
                },
            };
            lb1.AlignTo(LayoutDirection.South, cb4, 2);
            AddControl(new ListBox(lb1));

            ListBoxTemplate lb2 = new ListBoxTemplate()
            {
                Title = "A List Box",
                TitleAlignment = HorizontalAlignment.Right,
                LabelAlignment = HorizontalAlignment.Center,
                MinimumListBoxWidth = 20,
                Items = new System.Collections.Generic.List<ListItemData>()
                {
                    new ListItemData("Item 1","Item 1 Tooltip"),
                    new ListItemData("Item 2","Item 2 Tooltip"),
                    new ListItemData("Item 3","Item 3 Tooltip"),
                    new ListItemData("Item 4","Item 4 Tooltip")
                }
            };
            lb2.AlignTo(LayoutDirection.East, lb1, 2);
            AddControl(new ListBox(lb2));

            TextEntryTemplate t1 = new TextEntryTemplate()
            {
                Label = "Text Entry (Hit Enter to keep): ",
                MaximumCharacters = 6
            };
            t1.AlignTo(LayoutDirection.East, cb8, 2);
            AddControl(new TextEntry(t1));

            TextEntryTemplate t2 = new TextEntryTemplate()
            {
                Label = "Symbols Only: ",
                Validation = TextEntryValidations.Symbols,
                MaximumCharacters = 25
            };
            t2.AlignTo(LayoutDirection.South, t1, 2);
            AddControl(new TextEntry(t2));

            TextEntryTemplate t3 = new TextEntryTemplate()
            {
                Label = "Numbers & Symbols: ",
                Validation = TextEntryValidations.Numbers | TextEntryValidations.Symbols,
                MaximumCharacters = 20
            };
            t3.AlignTo(LayoutDirection.South, t2, 2);
            AddControl(new TextEntry(t3));

            TextEntryTemplate t4 = new TextEntryTemplate()
            {
                Label = "Don't need to hit Enter: ",
                MaximumCharacters = 4,
                CommitOnLostFocus = true,
            };
            t4.AlignTo(LayoutDirection.South, t3, 2);
            t4.UpperLeftPos = t4.UpperLeftPos.Shift(4, 0);
            AddControl(new TextEntry(t4));

            TextEntryTemplate t5 = new TextEntryTemplate()
            {
                Label = "Replace Text: ",
                MaximumCharacters = 11,
                CommitOnLostFocus = true,
                ReplaceOnFirstKey = true,
                StartingField = "Replace me",
                HasFrameBorder = false
            };
            t5.AlignTo(LayoutDirection.South, t4, 2);
            AddControl(new TextEntry(t5));

            ButtonTemplate mb1 = new ButtonTemplate()
            {
                Label = "Right Click for Menu"
            };
            mb1.AlignTo(LayoutDirection.South, lb2,3);
            AddControl(new MenuButton(mb1));

            RadioGroupTemplate rg1 = new RadioGroupTemplate()
            {
                Items = new System.Collections.Generic.List<RadioItemData>()
                {
                    new RadioItemData("Radio One","Tooltip for radio 1"),
                    new RadioItemData("Radio Two","Tooltip for radio 2"),
                    new RadioItemData("Radio Three","Tooltip for radio 3")
                },
            };
            rg1.AlignTo(LayoutDirection.South, t5, 2);
            AddControl(new RadioGroup(rg1));

            RadioGroupTemplate rg2 = new RadioGroupTemplate()
            {
                Items = new System.Collections.Generic.List<RadioItemData>()
                {
                    new RadioItemData("Radio One","Tooltip for radio 1"),
                    new RadioItemData("Radio Two","Tooltip for radio 2"),
                    new RadioItemData("Radio Three","Tooltip for radio 3")
                },
                HasFrameBorder = false,
                RadioOnLeft = false
            };
            rg2.AlignTo(LayoutDirection.South, rg1, 1);
            AddControl(new RadioGroup(rg2));

            PageInfo.AddText("This page shows a selection of Checkbox, TextEntry, ListBox, and RadioGroup controls." +
                "\n\nCheckbox controls are similar to buttons, except that there state (IsChecked) is persistant, and" +
                " this state is, by default, shown by a check box graphic." +
                "\n\nTextEntry controls allow user input.  Various behaviors of validation and committing the input are available." +
                "\n\nListBox controls are basically a list of clickable buttons with persistant state - one item is always the currently selected." +
                "\n\nMenu controls are similar to ListBox, except they automatically close if an item is selected or the mouse pointer leaves the area." +
                "\n\nRadioGroups are the same as ListBoxes, except the currently selected item is displayed differently.");
        }
Beispiel #12
0
        private void SetToDefaultOptions(ButtonTemplate type_template)
        {
            switch (type_template)
            {
            case ButtonTemplate.Gray:
                ImageSrc                = "extendedcontrols";
                u0                      = 0.0f;
                v0                      = 928f;
                u1                      = 63f;
                v1                      = 975f;
                down_u0                 = 64f;
                down_v0                 = 928f;
                down_u1                 = sbyte.MaxValue;
                down_v1                 = 975f;
                over_u0                 = 128f;
                over_v0                 = 928f;
                over_u1                 = 191f;
                over_v1                 = 975f;
                disabled_u0             = 0.0f;
                disabled_v0             = 928f;
                disabled_u1             = 63f;
                disabled_v1             = 975f;
                leftbordersize_pixels   = 9;
                rightbordersize_pixels  = 9;
                minimum_width_pixels    = 26;
                topbordersize_pixels    = 9;
                bottombordersize_pixels = 9;
                minimum_height_pixels   = 24;
                break;

            case ButtonTemplate.Blue:
                ImageSrc                = "extendedcontrols";
                u0                      = 0.0f;
                v0                      = 976f;
                u1                      = 63f;
                v1                      = 1023f;
                down_u0                 = 64f;
                down_v0                 = 976f;
                down_u1                 = sbyte.MaxValue;
                down_v1                 = 1023f;
                over_u0                 = 128f;
                over_v0                 = 976f;
                over_u1                 = 191f;
                over_v1                 = 1023f;
                disabled_u0             = 0.0f;
                disabled_v0             = 928f;
                disabled_u1             = 63f;
                disabled_v1             = 975f;
                leftbordersize_pixels   = 9;
                rightbordersize_pixels  = 9;
                minimum_width_pixels    = 26;
                topbordersize_pixels    = 9;
                bottombordersize_pixels = 9;
                minimum_height_pixels   = 24;
                break;

            case ButtonTemplate.CheckBox:
                ImageSrc    = "guicontrols";
                u0          = 640f;
                v0          = 448f;
                u1          = 671f;
                v1          = 479f;
                down_u0     = 640f;
                down_v0     = 480f;
                down_u1     = 671f;
                down_v1     = 511f;
                over_u0     = 672f;
                over_v0     = 448f;
                over_u1     = 703f;
                over_v1     = 479f;
                disabled_u0 = 672f;
                disabled_v0 = 480f;
                disabled_u1 = 703f;
                disabled_v1 = 511f;
                DontMove    = true;
                ClickType   = ButtonType.Checkable;
                if (!_can_click_off_set)
                {
                    CanClickOff = true;
                }

                SetGrowableWidth(9, 9, 26);
                SetGrowableHeight(9, 9, 24);
                break;

            case ButtonTemplate.MenuItem:
                ImageSrc                = "extendedcontrols";
                u0                      = 961f;
                v0                      = 65f;
                u1                      = 1022f;
                v1                      = sbyte.MaxValue;
                down_u0                 = 897f;
                down_v0                 = 65f;
                down_u1                 = 959f;
                down_v1                 = sbyte.MaxValue;
                over_u0                 = 897f;
                over_v0                 = 65f;
                over_u1                 = 959f;
                over_v1                 = sbyte.MaxValue;
                disabled_u0             = 672f;
                disabled_v0             = 480f;
                disabled_u1             = 703f;
                disabled_v1             = 511f;
                DontMove                = true;
                ClickType               = ButtonType.Clickable;
                CanClickOff             = false;
                leftbordersize_pixels   = 4;
                rightbordersize_pixels  = 4;
                minimum_width_pixels    = 16;
                topbordersize_pixels    = 4;
                bottombordersize_pixels = 4;
                minimum_height_pixels   = 16;
                VAlignment              = TextVerticalAlignment.Middle;
                Alignment               = QFontAlignment.Left;
                break;

            case ButtonTemplate.TextOnly:
            case ButtonTemplate.TextOnlyWhite:
            case ButtonTemplate.TextOnlyBlue:
                ImageSrc    = "guicontrols";
                u0          = 200f;
                v0          = 705f;
                u1          = 220f;
                v1          = 725f;
                down_u0     = 200f;
                down_v0     = 705f;
                down_u1     = 220f;
                down_v1     = 725f;
                over_u0     = 200f;
                over_v0     = 705f;
                over_u1     = 220f;
                over_v1     = 725f;
                disabled_u0 = 200f;
                disabled_v0 = 705f;
                disabled_u1 = 220f;
                disabled_v1 = 725f;
                if (type_template == ButtonTemplate.TextOnlyWhite)
                {
                    TextColor = new Color4(1f, 1f, 1f, 1f);
                    break;
                }
                if (type_template != ButtonTemplate.TextOnlyBlue)
                {
                    break;
                }

                TextColor     = new Color4(0.3529412f, 0.7450981f, 0.8627451f, 1f);
                TextOverColor = new Color4(0.4392157f, 0.8392157f, 0.9372549f, 1f);
                TextDownColor = new Color4(0.2f, 0.6078432f, 0.7098039f, 1f);
                break;

            case ButtonTemplate.GrayCheckable:
                ImageSrc                = "extendedcontrols";
                u0                      = 0.0f;
                v0                      = 928f;
                u1                      = 63f;
                v1                      = 975f;
                down_u0                 = 64f;
                down_v0                 = 928f;
                down_u1                 = sbyte.MaxValue;
                down_v1                 = 975f;
                over_u0                 = 128f;
                over_v0                 = 928f;
                over_u1                 = 191f;
                over_v1                 = 975f;
                disabled_u0             = 0.0f;
                disabled_v0             = 928f;
                disabled_u1             = 63f;
                disabled_v1             = 975f;
                leftbordersize_pixels   = 9;
                rightbordersize_pixels  = 9;
                minimum_width_pixels    = 26;
                topbordersize_pixels    = 9;
                bottombordersize_pixels = 9;
                minimum_height_pixels   = 24;
                DontMove                = true;
                ClickType               = ButtonType.Checkable;
                if (_can_click_off_set)
                {
                    break;
                }

                CanClickOff = true;
                break;
            }
        }
 public virtual ActionResult Template(ButtonTemplate? type)
 {
     return View(type == null ? null : "Template." + type.Value);
 }
Beispiel #14
0
        /// <summary>
        /// As mentioned, MyManager is responsible for initializing all of the buttons and 
        /// user interface logic, which we do in the OnSettingUp method.
        /// </summary>
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            /// First define the teleport button template.  Here we are going to use the MinimumWidth
            /// properties for all of these buttons so that they are all the same size, and thus
            /// line up nicely.
            ButtonTemplate telButtonTemplate = new ButtonTemplate()
            {
                Label = "Teleport",
                UpperLeftPos = new Point(3, 1),
                MinimumWidth = 12
            };

            /// Here we see a more intuitive way of positioning a control (or, more technically,
            /// a control template) relative to another one.  In this case, we are going to
            /// place our redButtonTemplate directly underneath the telButtonTemplate, with 1
            /// extra space in between.

            ButtonTemplate redButtonTemplate = new ButtonTemplate()
            {
                Label = "Turn Red",
                MinimumWidth = 12
            };
            redButtonTemplate.AlignTo(LayoutDirection.South, telButtonTemplate, 1);

            /// This one will go directly to the right of the red button template.

            ButtonTemplate blueButtonTemplate = new ButtonTemplate()
            {
                Label = "Turn Blue",
                MinimumWidth = 12
            };
            blueButtonTemplate.AlignTo(LayoutDirection.East, redButtonTemplate, 2);

            /// Create the buttons, add them to the window, and hook into their events.

            Button teleportButton = new Button(telButtonTemplate);
            Button turnRedButton = new Button(redButtonTemplate);
            Button turnBlueButton = new Button(blueButtonTemplate);

            Button quitButton = new Button(new ButtonTemplate()
            {
                Label = "QUIT",
                UpperLeftPos = new Point(74,0)
            });

            ParentWindow.AddControls(quitButton, turnBlueButton, turnRedButton, teleportButton);

            quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClicked);

            teleportButton.ButtonPushed += new EventHandler(teleportButton_ButtonClicked);

            turnBlueButton.ButtonPushed += new EventHandler(turnBlueButton_ButtonClicked);

            turnRedButton.ButtonPushed += new EventHandler(turnRedButton_ButtonClicked);

            /// Here we hilight the scheduling feature of the framework.  All descendents of Component, which
            /// includes our MyManager class, have access to the AddSchedule method.  This method takes as
            /// a parameter a Schedule instance, which in turn is constructed with 2 arguments:
            /// 1.  A delegate indiciating which method to call at the appropriate time
            /// 2.  A delay value in milliseconds.
            ///
            /// Here, we are telling the scheduler to call our Flicker method every 100 milliseconds.
            AddSchedule(new Schedule(Flicker, 100));
        }
Beispiel #15
0
        /// <summary>
        /// As mentioned, MyManager is responsible for initializing all of the buttons and
        /// user interface logic, which we do in the OnSettingUp method.
        /// </summary>
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            /// First define the teleport button template.  Here we are going to use the MinimumWidth
            /// properties for all of these buttons so that they are all the same size, and thus
            /// line up nicely.
            ButtonTemplate telButtonTemplate = new ButtonTemplate()
            {
                Label        = "Teleport",
                UpperLeftPos = new Point(3, 1),
                MinimumWidth = 12
            };

            /// Here we see a more intuitive way of positioning a control (or, more technically,
            /// a control template) relative to another one.  In this case, we are going to
            /// place our redButtonTemplate directly underneath the telButtonTemplate, with 1
            /// extra space in between.

            ButtonTemplate redButtonTemplate = new ButtonTemplate()
            {
                Label        = "Turn Red",
                MinimumWidth = 12
            };

            redButtonTemplate.AlignTo(LayoutDirection.South, telButtonTemplate, 1);

            /// This one will go directly to the right of the red button template.

            ButtonTemplate blueButtonTemplate = new ButtonTemplate()
            {
                Label        = "Turn Blue",
                MinimumWidth = 12
            };

            blueButtonTemplate.AlignTo(LayoutDirection.East, redButtonTemplate, 2);



            /// Create the buttons, add them to the window, and hook into their events.

            Button teleportButton = new Button(telButtonTemplate);
            Button turnRedButton  = new Button(redButtonTemplate);
            Button turnBlueButton = new Button(blueButtonTemplate);

            Button quitButton = new Button(new ButtonTemplate()
            {
                Label        = "QUIT",
                UpperLeftPos = new Point(74, 0)
            });

            ParentWindow.AddControls(quitButton, turnBlueButton, turnRedButton, teleportButton);

            quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClicked);

            teleportButton.ButtonPushed += new EventHandler(teleportButton_ButtonClicked);

            turnBlueButton.ButtonPushed += new EventHandler(turnBlueButton_ButtonClicked);

            turnRedButton.ButtonPushed += new EventHandler(turnRedButton_ButtonClicked);



            /// Here we hilight the scheduling feature of the framework.  All descendents of Component, which
            /// includes our MyManager class, have access to the AddSchedule method.  This method takes as
            /// a parameter a Schedule instance, which in turn is constructed with 2 arguments:
            /// 1.  A delegate indiciating which method to call at the appropriate time
            /// 2.  A delay value in milliseconds.
            ///
            /// Here, we are telling the scheduler to call our Flicker method every 100 milliseconds.
            AddSchedule(new Schedule(Flicker, 100));
        }
Beispiel #16
0
        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;
        }
Beispiel #17
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            // Start creating and adding the various sample controls.
            ButtonTemplate bt0 = new ButtonTemplate()
            {
                Label = "Autosize",
                UpperLeftPos = ViewRect.UpperLeft.Shift(1,3),
            };
            AddControl(new Button(bt0));

            ButtonTemplate bt1 = new ButtonTemplate()
            {
                Label = "Min. Size",
                MinimumWidth = 15
            };
            bt1.UpperLeftPos = bt0.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt1));

            ButtonTemplate bt2 = new ButtonTemplate()
            {
                Label = "No Border",
                HasFrameBorder = false,

            };
            bt2.UpperLeftPos = bt1.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt2));

            ButtonTemplate bt3 = new ButtonTemplate()
            {
                Label = "Centered",
                MinimumWidth = 15,
                LabelAlignment = HorizontalAlignment.Center
            };
            bt3.UpperLeftPos = bt2.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt3));

            ButtonTemplate bt4 = new ButtonTemplate()
            {
                Label = "Right",
                MinimumWidth = 15,
                LabelAlignment = HorizontalAlignment.Right
            };
            bt4.UpperLeftPos = bt3.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt4));

            ButtonTemplate bt5 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15,5),
                VAlignment = VerticalAlignment.Top,
                LabelAlignment = HorizontalAlignment.Left
            };
            bt5.AlignTo(LayoutDirection.East, bt0, 8);
            AddControl(new Button(bt5));

            ButtonTemplate bt6 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Center,
                LabelAlignment = HorizontalAlignment.Left
            };
            bt6.AlignTo(LayoutDirection.South, bt5, 2);
            AddControl(new Button(bt6));

            ButtonTemplate bt7 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Bottom,
                LabelAlignment = HorizontalAlignment.Left
            };
            bt7.AlignTo(LayoutDirection.South, bt6, 2);
            AddControl(new Button(bt7));

            ButtonTemplate bt8 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Top,
                LabelAlignment = HorizontalAlignment.Center,
                HasFrameBorder = false,
            };
            bt8.AlignTo(LayoutDirection.East, bt5, 2);
            AddControl(new Button(bt8));

            ButtonTemplate bt9 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Center,
                LabelAlignment = HorizontalAlignment.Center,
                HasFrameBorder = false,
            };
            bt9.AlignTo(LayoutDirection.South, bt8, 2);
            AddControl(new Button(bt9));

            ButtonTemplate bt10 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Bottom,
                LabelAlignment = HorizontalAlignment.Center,
                HasFrameBorder = false,
            };
            bt10.AlignTo(LayoutDirection.South, bt9, 2);
            AddControl(new Button(bt10));

            ButtonTemplate bt11 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Top,
                LabelAlignment = HorizontalAlignment.Right
            };
            bt11.AlignTo(LayoutDirection.East, bt8, 2);
            AddControl(new Button(bt11));

            ButtonTemplate bt12 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Center,
                LabelAlignment = HorizontalAlignment.Right
            };
            bt12.AlignTo(LayoutDirection.South, bt11, 2);
            AddControl(new Button(bt12));

            ButtonTemplate bt13 = new ButtonTemplate()
            {
                Label = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment = VerticalAlignment.Bottom,
                LabelAlignment = HorizontalAlignment.Right,
            };
            bt13.AlignTo(LayoutDirection.South, bt12, 2);
            AddControl(new Button(bt13));

            ButtonTemplate bt14 = new ButtonTemplate()
            {
                Label = "Animated",
                AutoSizeOverride = new Size(12,5),
                VAlignment = VerticalAlignment.Center,
                LabelAlignment = HorizontalAlignment.Center
            };
            bt14.AlignTo(LayoutDirection.South, bt4, 4);
            AddControl(new WaveButton(bt14));

            ButtonTemplate bt15 = new ButtonTemplate()
            {
                Label = "Normal Draw",
                LabelAlignment = HorizontalAlignment.Center
            };
            bt15.AlignTo(LayoutDirection.South, bt14, 4);
            AddControl(new OwnerButton(bt15));

            ButtonTemplate bt16 = new ButtonTemplate()
            {
                Label = "901 Animated Buttons!",
            };
            bt16.AlignTo(LayoutDirection.South, bt10, 2);
            AddControl(new Button(bt16));

            // Create the matrix of animated buttons.
            // Note there is actually a large amount of overhead here - this is
            // NOT the efficient way to do this.  However, this is meant to
            // "stress test" the library, so this is how we are doing it.
            for (int y = 30; y < 47; y++)
            {
                for (int x = 20; x < 73; x++)
                {
                    ButtonTemplate bt17 = new ButtonTemplate()
                    {
                        Label = " ",
                        AutoSizeOverride = new Size(1, 1),
                        HasFrameBorder = false,
                        UpperLeftPos = new Point(x, y)
                    };

                    AddControl(new SparkleButton(bt17));
                }
            }

            PageInfo.AddText("Here is a sample selection of buttons, in various styles." +
                "\n\nTry clicking on the Animated and Owner Draw buttons to see custom behavior." +
                "\n\nNote that the 901 animated button matrix is a stress test - each button is being " +
                "created individually, each with its own scheduler, message hooks, and memory console. This is an " +
                "enormous amount of overhead, and here we can see how much it slows down the framework by "+
                "comparing the text output of this TextBox to the other pages.");

            PageInfo.AddText("\n\nHere are a couple of general things to note about the demo project:");
            PageInfo.AddText("\n* Each page is a seperate Window with its own controls" +
                "\n* The popup tooltips are intelligently constrained to the window"+
                "\n* This text is being drawn by a TextBox control from extended library",
                PageInfo.Pigments[PigmentType.Window].ReplaceForeground(new Color(0x885599))
                );
        }
Beispiel #18
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            var nameTemplate = new TextEntryTemplate
            {
                Label             = "Name: ",
                MaximumCharacters = 20,
//                                  HasFrameBorder = false,
                TopLeftPos           = new Point(2, 2),
                Tooltip              = "Enter your character's name",
                StartingField        = "player",
                CanHaveKeyboardFocus = true,
                Pigments             = new PigmentAlternatives()
                {
                    { PigmentType.FrameNormal, new Pigment(ColorPresets.White, ColorPresets.Black) },
                    { PigmentType.ViewNormal, new Pigment(ColorPresets.White, ColorPresets.Black) },
                    { PigmentType.ViewSelected, new Pigment(ColorPresets.Green, ColorPresets.Black) }
                }
            };

            _nameEntry = new TextEntry(nameTemplate);

            AddControl(_nameEntry);

            var jobs = new List <ListItemData>();

            for (int i = 0; i < 2; i++)
            {
                jobs.Add(new ListItemData("jobs" + i));
            }

            var occupationTemplate = new ListBoxTemplate()
            {
                Title               = "Occupation",
                TitleAlignment      = HorizontalAlignment.Center,
                MinimumListBoxWidth = 15,
                FrameTitle          = true,
                AutoSizeOverride    = new Size(15, 10),
                Items               = jobs
            };

            occupationTemplate.AlignTo(LayoutDirection.South, nameTemplate);
            _occupationListBox = new ListBox(occupationTemplate);
            AddControl(_occupationListBox);
            jobs.Add(new ListItemData("test"));

            var sexTemplate = new MenuButtonTemplate()
            {
                Label = "Sex",
                //                                  MinimumWidth = 15,
                TopLeftPos = nameTemplate.CalculateRect().TopRight.Shift(2, 0),
                //                                  Tooltip = "Click to switch sex, right click to choose from a menu",
                Items = new List <string>()
                {
                    "Male",
                    "Female"
                },
            };

            _sexButton = new MenuButton(sexTemplate);
            AddControl(_sexButton);

            var nodes = new List <TreeNode>();
            int index = 0;

            for (int i = 0; i < 5; i++)
            {
                var treeNode = new TreeNode("category" + i);
                nodes.Add(treeNode);

                for (int j = 0; j < 10; j++)
                {
                    treeNode.AddChild(new TreeNode("jobs" + index));
                    index++;
                }
            }

            var treeTemplate = new TreeViewTemplate()
            {
                Title               = "Occupation",
                TitleAlignment      = HorizontalAlignment.Center,
                MinimumListBoxWidth = 15,
                FrameTitle          = true,
                AutoSizeOverride    = new Size(15, 10),
                Items               = nodes
            };

            treeTemplate.AlignTo(LayoutDirection.South, sexTemplate, 1);
            AddControl(new TreeView(treeTemplate));

            var treeTemplate1 = new TreeViewTemplate
            {
                Title               = "Occupation",
                TitleAlignment      = HorizontalAlignment.Center,
                MinimumListBoxWidth = 15,
                FrameTitle          = true,
                AutoSizeOverride    = new Size(15, 10),
                Items               = nodes.Where((n, i) => i % 10 == 0).ToList(),
            };

            treeTemplate1.AlignTo(LayoutDirection.South, treeTemplate, 1);
            AddControl(new TreeView(treeTemplate1));

            var sliderTestTemplate = new SliderTemplate()
            {
                Label          = "Slider",
                ShowLabel      = true,
                HasFrameBorder = false,
                MinimumWidth   = 22,
                MaximumValue   = 100,
                StartingValue  = 50,
            };

            sliderTestTemplate.AlignTo(LayoutDirection.South, occupationTemplate);
            var sliderTest = new Slider(sliderTestTemplate);

            AddControl(sliderTest);

            var doneTemplate = new ButtonTemplate()
            {
                Label = "Press [Enter] Finish",
            };

            doneTemplate.SetBottomRight(ScreenRect.BottomRight.Shift(-1, -1));
            var doneButton = new Button(doneTemplate);

            doneButton.ButtonPushed += StartNewGame;

            AddControl(doneButton);

            KeyPressed += CharGen_KeyPressed;
        }
Beispiel #19
0
 public WaveButton(ButtonTemplate template)
     : base(template)
 {
 }
Beispiel #20
0
        public SparkleButton(ButtonTemplate template)
            : base(template)
        {
            bg = new Color(Rand.Int32(0,0xffffff));
            AddSchedule(new Schedule(Animate, 50));

            mod = Rand.Float()*50f;
        }
Beispiel #21
0
 public OwnerButton(ButtonTemplate template)
     : base(template)
 {
     OwnerDraw = true;
 }
Beispiel #22
0
 public MenuButton(ButtonTemplate template)
     : base(template)
 {
 }
Beispiel #23
0
 public WaveButton(ButtonTemplate template)
     : base(template)
 {
 }
Beispiel #24
0
        /// <summary>
        /// Every component gets a SettingUp message once when they are about to be added to the framework.  For Windows,
        /// this happens after it is set as the Application's window.
        /// </summary>
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            /// We are going to add a handy quit button to our Window, so we need to define the options for the button
            /// in a ButtonTemplate class.  We give it a Label, and we will also give it a nice Tooltip that will popup
            /// over the button when the mouse hovers over it.
            ///
            /// The UpperLeftPos property determines where the upper left corner of the control will be.  While most
            /// of the UI layout in OchreGui will have to be done by hand (there are no fancy layout grids in this
            /// library), there are some helper methods available, but we'll save those for our next example.
            ///
            /// One thing you may have noticed is that there is no way to specify the size of the button.  This is because
            /// all buttons (and many other controls) automatically size themselves according to the other options.  For
            /// a button, the height will always be 3 (to allow 1 space for the label and 2 spaces for the border), and
            /// the width will usually be Label.Length + 2 for width (again, allowing room for the border).  All
            /// of the *Info classes implement (or derive from) ISetupInfo, which provides the CalculateSize() method.
            /// This method returns the final size that the control will be, depending on its type and the specified options.
            ///
            /// If the combination of the specified position and the calculated size puts some or all of the control
            /// out of the screen area, the framework will automatcially slide the control so that none of it is clipped.
            ButtonTemplate quitButtonTemplate = new ButtonTemplate()
            {
                Label = "QUIT",
                Tooltip = "Quit the application",
                UpperLeftPos = new Point(35,0)
            };

            /// Create the button with the specified options contained in quitButtonTemplate.
            Button quitButton = new Button(quitButtonTemplate);

            /// We are going to hook into the button clicked event, so we know when the user has clicked on the
            /// quit button.
            quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClicked);

            /// And, finally, add it to this Window.  Note that all controls added to a window must be unique objects, or
            /// an exception will be thrown by this method.  Also note that some of the properties of a contol (such as
            /// ScreenRect) are meaningless until they are added to a Window, which is why any setup code that depends
            /// on a fully initialized instance belongs in an overriden OnSettingUp() method, not in the constructor.
            AddControl(quitButton);
        }
Beispiel #25
0
 public OwnerButton(ButtonTemplate template)
     : base(template)
 {
     OwnerDraw = true;
 }
Beispiel #26
0
        /// Here we create all of the Gui elements and add them to this window.
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            /// Set the label strings for each of the directional buttons
            string upLabel    = ((char)libtcod.TCODSpecialCharacter.ArrowNorth).ToString();
            string downLabel  = ((char)libtcod.TCODSpecialCharacter.ArrowSouth).ToString();
            string rightLabel = ((char)libtcod.TCODSpecialCharacter.ArrowEast).ToString();
            string leftLabel  = ((char)libtcod.TCODSpecialCharacter.ArrowWest).ToString();



            /// We are going to create a series of 4 buttons, each representing a direction.
            /// To do this, I'll illustrate some of the helper methods for positioning controls.
            ///
            /// First we position the upButton normally...
            ButtonTemplate upButtonTemplate = new ButtonTemplate()
            {
                Label        = upLabel,
                UpperLeftPos = new Point(3, 0)
            };



            /// Now the RIGHT direction button, which I want to sit just off the lower right side
            /// of the previously defined UP button.  Notice the string of methods used to set this
            /// UpperLeftPos.  We can break it down as follows:
            ///     1.  upButtonInfo.CalculateRect() returns the Rect structure representing the previously
            ///         defined UP button
            ///     2.  Rect.LowerRight gives us the Point structure of the lower right corner of that rect
            ///     3.  Shift(int dx, int dy) shifts that point 1 space to the right and 1 space down.
            /// Basically this is a shorthand way (especially in todays world of
            /// intellisense IDE's) of specifying a position relative to another button.  In the next example,
            /// we will see a different (and more intuitive) way of doing this sort of relative layout.

            ButtonTemplate rightButtonTemplate = new ButtonTemplate()
            {
                Label        = rightLabel,
                UpperLeftPos = upButtonTemplate.CalculateRect().LowerRight.Shift(1, 1)
            };



            /// For the DOWN button we will need to do something a little different.  I want to set the upper right
            /// corner of the DOWN button off the lower left corner of the RIGHT button.  However, ButtonInfo
            /// does not expose a property to set the upper right position (since this would allow the user
            /// to specify two different positions in the same constructor).  But there is still a way to do this:
            /// just create the ButtonInfo normally, leaving out the position...
            ButtonTemplate downButtonTemplate = new ButtonTemplate()
            {
                Label = downLabel,
            };

            /// Then we use the SetUpperRight method to set the position, like so:

            downButtonTemplate.SetUpperRight(rightButtonTemplate.CalculateRect().LowerLeft.Shift(-1, 1));



            /// Finally, our LEFT button's upper right corner is just off the lower left corner
            /// of the UP button:

            ButtonTemplate leftButtonTemplate = new ButtonTemplate()
            {
                Label = leftLabel
            };

            leftButtonTemplate.SetUpperRight(upButtonTemplate.CalculateRect().LowerLeft.Shift(-1, 1));



            /// We just need to make sure we actually create the buttons, like so:

            Button upButton    = new Button(upButtonTemplate);
            Button rightButton = new Button(rightButtonTemplate);
            Button downButton  = new Button(downButtonTemplate);
            Button leftButton  = new Button(leftButtonTemplate);



            /// Our quit button, this time we will give it the upper left position explicitly.  Also, since
            /// we don't need to keep the ButtonTemplate around, we do the creation in one step.
            Button quitButton = new Button(new ButtonTemplate()
            {
                Label        = "QUIT",
                UpperLeftPos = new Point(74, 0)
            });



            /// This time we use AddControls to add multiple controls to the window.  The controls are added
            /// in order, from lowest to highest.
            AddControls(quitButton, upButton, downButton, leftButton, rightButton);

            /// Hook into each of the required button event handlers.
            quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClickedEventHandler);

            upButton.ButtonPushed    += new EventHandler(upButton_ButtonClicked);
            downButton.ButtonPushed  += new EventHandler(downButton_ButtonClicked);
            rightButton.ButtonPushed += new EventHandler(rightButton_ButtonClicked);
            leftButton.ButtonPushed  += new EventHandler(leftButton_ButtonClicked);
        }
Beispiel #27
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            // Start creating and adding the various sample controls.
            ButtonTemplate bt0 = new ButtonTemplate()
            {
                Label        = "Autosize",
                UpperLeftPos = ViewRect.UpperLeft.Shift(1, 3),
            };

            AddControl(new Button(bt0));

            ButtonTemplate bt1 = new ButtonTemplate()
            {
                Label        = "Min. Size",
                MinimumWidth = 15
            };

            bt1.UpperLeftPos = bt0.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt1));

            ButtonTemplate bt2 = new ButtonTemplate()
            {
                Label          = "No Border",
                HasFrameBorder = false,
            };

            bt2.UpperLeftPos = bt1.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt2));

            ButtonTemplate bt3 = new ButtonTemplate()
            {
                Label          = "Centered",
                MinimumWidth   = 15,
                LabelAlignment = HorizontalAlignment.Center
            };

            bt3.UpperLeftPos = bt2.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt3));

            ButtonTemplate bt4 = new ButtonTemplate()
            {
                Label          = "Right",
                MinimumWidth   = 15,
                LabelAlignment = HorizontalAlignment.Right
            };

            bt4.UpperLeftPos = bt3.CalculateRect().LowerLeft.Shift(0, 2);
            AddControl(new Button(bt4));

            ButtonTemplate bt5 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Top,
                LabelAlignment   = HorizontalAlignment.Left
            };

            bt5.AlignTo(LayoutDirection.East, bt0, 8);
            AddControl(new Button(bt5));

            ButtonTemplate bt6 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Center,
                LabelAlignment   = HorizontalAlignment.Left
            };

            bt6.AlignTo(LayoutDirection.South, bt5, 2);
            AddControl(new Button(bt6));

            ButtonTemplate bt7 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Bottom,
                LabelAlignment   = HorizontalAlignment.Left
            };

            bt7.AlignTo(LayoutDirection.South, bt6, 2);
            AddControl(new Button(bt7));

            ButtonTemplate bt8 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Top,
                LabelAlignment   = HorizontalAlignment.Center,
                HasFrameBorder   = false,
            };

            bt8.AlignTo(LayoutDirection.East, bt5, 2);
            AddControl(new Button(bt8));

            ButtonTemplate bt9 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Center,
                LabelAlignment   = HorizontalAlignment.Center,
                HasFrameBorder   = false,
            };

            bt9.AlignTo(LayoutDirection.South, bt8, 2);
            AddControl(new Button(bt9));

            ButtonTemplate bt10 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Bottom,
                LabelAlignment   = HorizontalAlignment.Center,
                HasFrameBorder   = false,
            };

            bt10.AlignTo(LayoutDirection.South, bt9, 2);
            AddControl(new Button(bt10));

            ButtonTemplate bt11 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Top,
                LabelAlignment   = HorizontalAlignment.Right
            };

            bt11.AlignTo(LayoutDirection.East, bt8, 2);
            AddControl(new Button(bt11));

            ButtonTemplate bt12 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Center,
                LabelAlignment   = HorizontalAlignment.Right
            };

            bt12.AlignTo(LayoutDirection.South, bt11, 2);
            AddControl(new Button(bt12));

            ButtonTemplate bt13 = new ButtonTemplate()
            {
                Label            = "Sized",
                AutoSizeOverride = new Size(15, 5),
                VAlignment       = VerticalAlignment.Bottom,
                LabelAlignment   = HorizontalAlignment.Right,
            };

            bt13.AlignTo(LayoutDirection.South, bt12, 2);
            AddControl(new Button(bt13));

            ButtonTemplate bt14 = new ButtonTemplate()
            {
                Label            = "Animated",
                AutoSizeOverride = new Size(12, 5),
                VAlignment       = VerticalAlignment.Center,
                LabelAlignment   = HorizontalAlignment.Center
            };

            bt14.AlignTo(LayoutDirection.South, bt4, 4);
            AddControl(new WaveButton(bt14));

            ButtonTemplate bt15 = new ButtonTemplate()
            {
                Label          = "Normal Draw",
                LabelAlignment = HorizontalAlignment.Center
            };

            bt15.AlignTo(LayoutDirection.South, bt14, 4);
            AddControl(new OwnerButton(bt15));

            ButtonTemplate bt16 = new ButtonTemplate()
            {
                Label = "901 Animated Buttons!",
            };

            bt16.AlignTo(LayoutDirection.South, bt10, 2);
            AddControl(new Button(bt16));

            // Create the matrix of animated buttons.
            // Note there is actually a large amount of overhead here - this is
            // NOT the efficient way to do this.  However, this is meant to
            // "stress test" the library, so this is how we are doing it.
            for (int y = 30; y < 47; y++)
            {
                for (int x = 20; x < 73; x++)
                {
                    ButtonTemplate bt17 = new ButtonTemplate()
                    {
                        Label            = " ",
                        AutoSizeOverride = new Size(1, 1),
                        HasFrameBorder   = false,
                        UpperLeftPos     = new Point(x, y)
                    };

                    AddControl(new SparkleButton(bt17));
                }
            }

            PageInfo.AddText("Here is a sample selection of buttons, in various styles." +
                             "\n\nTry clicking on the Animated and Owner Draw buttons to see custom behavior." +
                             "\n\nNote that the 901 animated button matrix is a stress test - each button is being " +
                             "created individually, each with its own scheduler, message hooks, and memory console. This is an " +
                             "enormous amount of overhead, and here we can see how much it slows down the framework by " +
                             "comparing the text output of this TextBox to the other pages.");

            PageInfo.AddText("\n\nHere are a couple of general things to note about the demo project:");
            PageInfo.AddText("\n* Each page is a seperate Window with its own controls" +
                             "\n* The popup tooltips are intelligently constrained to the window" +
                             "\n* This text is being drawn by a TextBox control from extended library",
                             PageInfo.Pigments[PigmentType.Window].ReplaceForeground(new Color(0x885599))
                             );
        }
Beispiel #28
0
        protected override void InputClicked(GameObject obj, InputClickedEventData eventData)
        {
            if (Time.time < lastTimeTapped + coolDownTime)
            {
                return;
            }

            lastTimeTapped = Time.time;

            base.InputClicked(obj, eventData);

            switch (obj.name)
            {
            case "Remove":
                // Destroy the target object, Bounding Box, Bounding Box Rig and App Bar
                boundingBox.Target.GetComponent <BoundingBoxRig>().Deactivate();
                Destroy(boundingBox.Target.GetComponent <BoundingBoxRig>());
                Destroy(boundingBox.Target);
                Destroy(gameObject);
                break;

            case "Adjust":
                // Make the bounding box active so users can manipulate it
                State = AppBarStateEnum.Manipulation;
                // Activate BoundingBoxRig
                boundingBox.Target.GetComponent <BoundingBoxRig>().Activate();
                break;

            case "Hide":
                // Make the bounding box inactive and invisible
                State = AppBarStateEnum.Hidden;
                break;

            case "Show":
                State = AppBarStateEnum.Default;
                // Deactivate BoundingBoxRig
                boundingBox.Target.GetComponent <BoundingBoxRig>().Deactivate();
                break;

            case "Done":
                State = AppBarStateEnum.Default;
                // Deactivate BoundingBoxRig
                boundingBox.Target.GetComponent <BoundingBoxRig>().Deactivate();
                break;

            case "TogglePlay":
                State = AppBarStateEnum.Default;
                // Play / Pause Animation of model
                BlendShapeAnimation blendShapeAnimation = boundingBox.Target.GetComponent <BlendShapeAnimation>();
                blendShapeAnimation.TogglePlay();

                // Switch icon to Play <=> Pause
                AppBarButton   toggleButton = buttonParent.GetComponentsInChildren <AppBarButton>().Single(b => b.name == "TogglePlay");
                ButtonTemplate buttonTmpl   = buttons.Single(b => b.Name == "TogglePlay");
                buttonTmpl.Icon = blendShapeAnimation.Playing ? "PauseIcon" : "PlayIcon";
                toggleButton.Initialize(this, buttonTmpl, null);
                break;

            default:
                break;
            }
        }
Beispiel #29
0
 public async Task ReplyTemplateMessageAsync(string replyToken, ButtonTemplate template)
 {
     await _messageService.ReplyTemplateMessageAsync(replyToken, template);
 }
Beispiel #30
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            CheckBoxTemplate cb1 = new CheckBoxTemplate()
            {
                Label        = " A Checkbox",
                UpperLeftPos = ViewRect.UpperLeft.Shift(1, 3),
            };

            AddControl(new CheckBox(cb1));

            CheckBoxTemplate cb2 = new CheckBoxTemplate()
            {
                Label        = " Checkbox",
                MinimumWidth = cb1.CalculateSize().Width,
                CheckOnLeft  = true
            };

            cb2.AlignTo(LayoutDirection.South, cb1, 1);
            AddControl(new CheckBox(cb2));

            CheckBoxTemplate cb3 = new CheckBoxTemplate()
            {
                Label          = "Checkbox",
                MinimumWidth   = cb1.CalculateSize().Width,
                CheckOnLeft    = true,
                LabelAlignment = HorizontalAlignment.Right
            };

            cb3.AlignTo(LayoutDirection.South, cb2, 1);
            AddControl(new CheckBox(cb3));

            CheckBoxTemplate cb4 = new CheckBoxTemplate()
            {
                Label          = "Checkbox",
                MinimumWidth   = cb1.CalculateSize().Width,
                CheckOnLeft    = true,
                LabelAlignment = HorizontalAlignment.Center,
            };

            cb4.AlignTo(LayoutDirection.South, cb3, 1);
            AddControl(new CheckBox(cb4));

            CheckBoxTemplate cb5 = new CheckBoxTemplate()
            {
                Label            = "Checkbox",
                MinimumWidth     = cb1.CalculateSize().Width,
                CheckOnLeft      = false,
                LabelAlignment   = HorizontalAlignment.Left,
                VerticalAlign    = VerticalAlignment.Center,
                AutoSizeOverride = new Size(14, 3),
                HasFrameBorder   = false,
            };

            cb5.AlignTo(LayoutDirection.East, cb2, 1);
            AddControl(new CheckBox(cb5));

            CheckBoxTemplate cb6 = new CheckBoxTemplate()
            {
                Label            = "Checkbox ",
                MinimumWidth     = cb1.CalculateSize().Width,
                CheckOnLeft      = false,
                LabelAlignment   = HorizontalAlignment.Right,
                VerticalAlign    = VerticalAlignment.Center,
                AutoSizeOverride = new Size(14, 3),
                HasFrameBorder   = false,
            };

            cb6.AlignTo(LayoutDirection.South, cb5, 1);
            AddControl(new CheckBox(cb6));

            CheckBoxTemplate cb7 = new CheckBoxTemplate()
            {
                Label = Color.CYAN.DoForegroundCode() + "C" +
                        Color.RED.DoForegroundCode() + "o" +
                        Color.BLUE.DoForegroundCode() + "l" +
                        Color.BRASS.DoForegroundCode() + "o" +
                        Color.DARK_LIME.DoForegroundCode() + "r" +
                        Color.LIGHT_MAGENTA.DoForegroundCode() + "s" +
                        Color.StopColorCode + "!! ",
                CheckOnLeft    = false,
                LabelAlignment = HorizontalAlignment.Center,
                HasFrameBorder = false,
            };

            cb7.AlignTo(LayoutDirection.South, cb6, 1);
            AddControl(new CheckBox(cb7));

            CheckBoxTemplate cb8 = new CheckBoxTemplate()
            {
                Label          = "Custom",
                MinimumWidth   = cb1.CalculateSize().Width,
                CheckOnLeft    = false,
                LabelAlignment = HorizontalAlignment.Center,
            };

            cb8.AlignTo(LayoutDirection.North, cb5, 1);
            AddControl(new FancyCheck(cb8));


            ListBoxTemplate lb1 = new ListBoxTemplate()
            {
                Title = "A List Box",
                Items = new System.Collections.Generic.List <ListItemData>()
                {
                    new ListItemData("Item 1", "Item 1 Tooltip"),
                    new ListItemData("Item 2", "Item 2 Tooltip"),
                    new ListItemData("Item 3", "Item 3 Tooltip"),
                    new ListItemData("Item 4", "Item 4 Tooltip")
                },
            };

            lb1.AlignTo(LayoutDirection.South, cb4, 2);
            AddControl(new ListBox(lb1));

            ListBoxTemplate lb2 = new ListBoxTemplate()
            {
                Title               = "A List Box",
                TitleAlignment      = HorizontalAlignment.Right,
                LabelAlignment      = HorizontalAlignment.Center,
                MinimumListBoxWidth = 20,
                Items               = new System.Collections.Generic.List <ListItemData>()
                {
                    new ListItemData("Item 1", "Item 1 Tooltip"),
                    new ListItemData("Item 2", "Item 2 Tooltip"),
                    new ListItemData("Item 3", "Item 3 Tooltip"),
                    new ListItemData("Item 4", "Item 4 Tooltip")
                }
            };

            lb2.AlignTo(LayoutDirection.East, lb1, 2);
            AddControl(new ListBox(lb2));


            TextEntryTemplate t1 = new TextEntryTemplate()
            {
                Label             = "Text Entry (Hit Enter to keep): ",
                MaximumCharacters = 6
            };

            t1.AlignTo(LayoutDirection.East, cb8, 2);
            AddControl(new TextEntry(t1));

            TextEntryTemplate t2 = new TextEntryTemplate()
            {
                Label             = "Symbols Only: ",
                Validation        = TextEntryValidations.Symbols,
                MaximumCharacters = 25
            };

            t2.AlignTo(LayoutDirection.South, t1, 2);
            AddControl(new TextEntry(t2));

            TextEntryTemplate t3 = new TextEntryTemplate()
            {
                Label             = "Numbers & Symbols: ",
                Validation        = TextEntryValidations.Numbers | TextEntryValidations.Symbols,
                MaximumCharacters = 20
            };

            t3.AlignTo(LayoutDirection.South, t2, 2);
            AddControl(new TextEntry(t3));

            TextEntryTemplate t4 = new TextEntryTemplate()
            {
                Label             = "Don't need to hit Enter: ",
                MaximumCharacters = 4,
                CommitOnLostFocus = true,
            };

            t4.AlignTo(LayoutDirection.South, t3, 2);
            t4.UpperLeftPos = t4.UpperLeftPos.Shift(4, 0);
            AddControl(new TextEntry(t4));

            TextEntryTemplate t5 = new TextEntryTemplate()
            {
                Label             = "Replace Text: ",
                MaximumCharacters = 11,
                CommitOnLostFocus = true,
                ReplaceOnFirstKey = true,
                StartingField     = "Replace me",
                HasFrameBorder    = false
            };

            t5.AlignTo(LayoutDirection.South, t4, 2);
            AddControl(new TextEntry(t5));


            ButtonTemplate mb1 = new ButtonTemplate()
            {
                Label = "Right Click for Menu"
            };

            mb1.AlignTo(LayoutDirection.South, lb2, 3);
            AddControl(new MenuButton(mb1));


            RadioGroupTemplate rg1 = new RadioGroupTemplate()
            {
                Items = new System.Collections.Generic.List <RadioItemData>()
                {
                    new RadioItemData("Radio One", "Tooltip for radio 1"),
                    new RadioItemData("Radio Two", "Tooltip for radio 2"),
                    new RadioItemData("Radio Three", "Tooltip for radio 3")
                },
            };

            rg1.AlignTo(LayoutDirection.South, t5, 2);
            AddControl(new RadioGroup(rg1));

            RadioGroupTemplate rg2 = new RadioGroupTemplate()
            {
                Items = new System.Collections.Generic.List <RadioItemData>()
                {
                    new RadioItemData("Radio One", "Tooltip for radio 1"),
                    new RadioItemData("Radio Two", "Tooltip for radio 2"),
                    new RadioItemData("Radio Three", "Tooltip for radio 3")
                },
                HasFrameBorder = false,
                RadioOnLeft    = false
            };

            rg2.AlignTo(LayoutDirection.South, rg1, 1);
            AddControl(new RadioGroup(rg2));


            PageInfo.AddText("This page shows a selection of Checkbox, TextEntry, ListBox, and RadioGroup controls." +
                             "\n\nCheckbox controls are similar to buttons, except that there state (IsChecked) is persistant, and" +
                             " this state is, by default, shown by a check box graphic." +
                             "\n\nTextEntry controls allow user input.  Various behaviors of validation and committing the input are available." +
                             "\n\nListBox controls are basically a list of clickable buttons with persistant state - one item is always the currently selected." +
                             "\n\nMenu controls are similar to ListBox, except they automatically close if an item is selected or the mouse pointer leaves the area." +
                             "\n\nRadioGroups are the same as ListBoxes, except the currently selected item is displayed differently.");
        }
Beispiel #31
0
 public MenuButton(ButtonTemplate template)
     : base(template)
 {
 }
Beispiel #32
0
        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;
        }
Beispiel #33
0
        /// Here we create all of the Gui elements and add them to this window.
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            /// Set the label strings for each of the directional buttons
            string upLabel = ((char)libtcod.TCODSpecialCharacter.ArrowNorth).ToString();
            string downLabel = ((char)libtcod.TCODSpecialCharacter.ArrowSouth).ToString();
            string rightLabel = ((char)libtcod.TCODSpecialCharacter.ArrowEast).ToString();
            string leftLabel = ((char)libtcod.TCODSpecialCharacter.ArrowWest).ToString();

            /// We are going to create a series of 4 buttons, each representing a direction.
            /// To do this, I'll illustrate some of the helper methods for positioning controls.
            ///
            /// First we position the upButton normally...
            ButtonTemplate upButtonTemplate = new ButtonTemplate()
            {
                Label = upLabel,
                UpperLeftPos = new Point(3, 0)
            };

            /// Now the RIGHT direction button, which I want to sit just off the lower right side
            /// of the previously defined UP button.  Notice the string of methods used to set this
            /// UpperLeftPos.  We can break it down as follows:
            ///     1.  upButtonInfo.CalculateRect() returns the Rect structure representing the previously
            ///         defined UP button
            ///     2.  Rect.LowerRight gives us the Point structure of the lower right corner of that rect
            ///     3.  Shift(int dx, int dy) shifts that point 1 space to the right and 1 space down.
            /// Basically this is a shorthand way (especially in todays world of
            /// intellisense IDE's) of specifying a position relative to another button.  In the next example,
            /// we will see a different (and more intuitive) way of doing this sort of relative layout.

            ButtonTemplate rightButtonTemplate = new ButtonTemplate()
            {
                Label = rightLabel,
                UpperLeftPos = upButtonTemplate.CalculateRect().LowerRight.Shift(1,1)
            };

            /// For the DOWN button we will need to do something a little different.  I want to set the upper right
            /// corner of the DOWN button off the lower left corner of the RIGHT button.  However, ButtonInfo
            /// does not expose a property to set the upper right position (since this would allow the user
            /// to specify two different positions in the same constructor).  But there is still a way to do this:
            /// just create the ButtonInfo normally, leaving out the position...
            ButtonTemplate downButtonTemplate = new ButtonTemplate()
            {
                Label = downLabel,
            };

            /// Then we use the SetUpperRight method to set the position, like so:

            downButtonTemplate.SetUpperRight(rightButtonTemplate.CalculateRect().LowerLeft.Shift(-1, 1));

            /// Finally, our LEFT button's upper right corner is just off the lower left corner
            /// of the UP button:

            ButtonTemplate leftButtonTemplate = new ButtonTemplate()
            {
                Label = leftLabel
            };
            leftButtonTemplate.SetUpperRight(upButtonTemplate.CalculateRect().LowerLeft.Shift(-1, 1));

            /// We just need to make sure we actually create the buttons, like so:

            Button upButton = new Button(upButtonTemplate);
            Button rightButton = new Button(rightButtonTemplate);
            Button downButton = new Button(downButtonTemplate);
            Button leftButton = new Button(leftButtonTemplate);

            /// Our quit button, this time we will give it the upper left position explicitly.  Also, since
            /// we don't need to keep the ButtonTemplate around, we do the creation in one step.
            Button quitButton = new Button(new ButtonTemplate()
            {
                Label = "QUIT",
                UpperLeftPos = new Point(74, 0)
            });

            /// This time we use AddControls to add multiple controls to the window.  The controls are added
            /// in order, from lowest to highest.
            AddControls(quitButton, upButton, downButton, leftButton, rightButton);

            /// Hook into each of the required button event handlers.
            quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClickedEventHandler);

            upButton.ButtonPushed += new EventHandler(upButton_ButtonClicked);
            downButton.ButtonPushed += new EventHandler(downButton_ButtonClicked);
            rightButton.ButtonPushed += new EventHandler(rightButton_ButtonClicked);
            leftButton.ButtonPushed += new EventHandler(leftButton_ButtonClicked);
        }