Beispiel #1
0
        /// <summary>Add a button to the button bar</summary>
        /// <param name="text">Text for button</param>
        /// <param name="image">Image for button</param>
        /// <param name="handler">Handler to call when user clicks on button</param>
        public void AddButton(string text, Image image, EventHandler handler)
        {
            Button button = new Button(text);

            button.Image       = image;
            button.Clicked    += handler;
            button.BorderWidth = 5;
            if (image != null)
            {
                button.ImagePosition = PositionType.Top;
            }

            buttonPanel.PackStart(button, false, false, 0);
            buttonPanel.ShowAll();
        }
            public PlayerPage(ICSGameObserverWidget widget,
					   MoveDetails details)
                : base(widget,
								      details)
            {
                HButtonBox box = new HButtonBox ();

                  drawButton =
                    new Button (Catalog.
                            GetString ("Draw"));
                  resignButton =
                    new Button (Catalog.
                            GetString ("Resign"));
                  abortButton =
                    new Button (Catalog.
                            GetString ("Abort"));
                  adjournButton =
                    new Button (Catalog.
                            GetString ("Adjourn"));
                  takebackButton =
                    new Button (Catalog.
                            GetString ("Takeback"));

                  drawButton.Clicked += OnClicked;
                  resignButton.Clicked += OnClicked;
                  abortButton.Clicked += OnClicked;
                  adjournButton.Clicked += OnClicked;
                  takebackButton.Clicked += OnClicked;

                  box.LayoutStyle = ButtonBoxStyle.Start;
                  box.PackStart (drawButton, false, false, 2);
                  box.PackStart (resignButton, false, false,
                         2);
                  box.PackStart (abortButton, false, false,
                         2);
                  box.PackStart (adjournButton, false, false,
                         2);
                  box.PackStart (takebackButton, false, false,
                         2);
                  box.ShowAll ();
                  PackStart (box, false, true, 2);
            }