Пример #1
0
	// Constructor. It builds our application. It also calls its parent constructor through the base() keyword. 
	public GUI_Proof() : base("Example GTK# App"){
		// Sets a default size for our window. 
		this.SetDefaultSize(700, 500);
		// Centers the window on the screen. 
		this.SetPosition(WindowPosition.Center);
		// Sets an icon from the current directory
		//SetIconFromFile("web.png");
		// WIDGETS------------------------------------------
		// Containers
		Fixed fix = new Fixed();
		// Labels
		result.Text = "Pick a datatype";
		// ComboBox
		ComboBox cb = new ComboBox(dataTypes);
		// WIDGET's SETTINGS--------------------------------
		fix.Put(cb, 50, 30);
		fix.Put(result, 200, 30);
		// ADDS---------------------------------------------
		fix.Add(cb);
		fix.Add(result);
		this.Add(fix);
		// EVENT's ATTACH
		/* We plug a delegate to the DeleteEvent. This event is triggered, 
		 * when we click on the close button in the titlebar. Or press Alt+F4.
		 * Our delegate quits the application for good.  */
		//DeleteEvent += delegate { Application.Quit(); };
		/* This is another way, how we can plug an event handler to an event.
		 * It is just a bit more verbose. */
		this.DeleteEvent += new DeleteEventHandler(OnDelete);
		cb.Changed += OnChanged;
		// Now we show the window. The window is not visible, until we call the Show() method. 
		//Show();
		// This will work for all widgets and panels in the application
		this.ShowAll();
	}
Пример #2
0
        public void Init()
        {
            try{
                var fxd = new Fixed();
                _window.Add(fxd);
                _wbkt = new WebView();
                fxd.Add(_wbkt);

                //init window
                this.SetSizeRequest(_window_width, _window_height);
                _window.AllowShrink = false;
                _window.Resizable = false;
                _window.SetPosition(WindowPosition.CenterAlways);

                //subscribe on events
                _window.DeleteEvent += OnDelete;
                _wbkt.LoadFinished += OnWindowLoaded;

                //webkit init
                _wbkt.Open(string.Format (URL, this._app_id, _scope, _display, _api_veresion));
            }
            catch(Exception ex)
            {
                this.throwError(22, "Error while window initialization: " + ex.Message);
            }
        }
Пример #3
0
        private void AddGameToMenu()
        {
            //Initialize widgets
            _launchButton = new Button();
            _launchButton.Label = "Play";

            _updateButton = new Button ();
            _updateButton.Label = "Update";

            _titleLabel = new Label (_game.Title);
            _infoLabel = new Label (" ");
            _fix = new Fixed ();

            _fix.Add (_launchButton);
            _fix.Add (_updateButton);
            _fix.Add (_titleLabel);
            _fix.Add (_infoLabel);

            Add (_fix);
        }
Пример #4
0
 // constructor
 public TileWidget(string colorBg, string figure, string color, coord size)
 {
     string imgName;
       if (color != "" && figure != "" && figure.ToLower () != "empty") {
     if (figure.ToLower () != "knight") {
       imgName = color.ToLower () [0].ToString () + figure.ToUpper () [0].ToString ();
     } else {
       imgName = color.ToLower () [0].ToString () + "N";
     }
     Image img = loadSvg (imgName, size);
     Fixed f = new Fixed ();
     f.Add (img);
     f.ShowAll ();
     this.Add (f);
     this.Show ();
       }
       if (colorBg != "") {
     Gdk.Color col = new Gdk.Color ();
     Gdk.Color.Parse (colorBg, ref col);
     this.ModifyBg (StateType.Normal, col);
       }
       this.figure = figure;
       this.color = color;
 }
Пример #5
0
    /// <summary>
    ///     The set up buttons.
    /// </summary>
    private void SetUpButtons()
    {
        var x = 5; 
        var y = 5;

        this._fixedContainer = new Fixed();
        this._weatherButton = new CWeatherButton(0, 300);
        this._watchButton = new CWatchButton(0, 375);

        IRemoteDevice[] devs = CommLayerManager.Instance.GetAllDevices(DeviceAuthorizedEnum.Authorized).ToArray();

        foreach (IRemoteDevice dev in devs)
        {
            var p1 = new CThemperatureButton(x, y, dev);
            var e1 = new EventBox();
            e1.VisibleWindow = false;
            e1.Add(p1);

            e1.AddEvents((int)(
                EventMask.ButtonPressMask | 
                EventMask.ButtonReleaseMask | 
                EventMask.KeyPressMask | 
                EventMask.PointerMotionMask));

            e1.ButtonPressEvent += HandleButtonPressEvent;

            _fixedContainer.Put(e1, x, y);
            x += p1.WidthRequest + 5;
        }

        _fixedContainer.Add(this._weatherButton);
        _fixedContainer.Add(this._watchButton);

        //var chart = new CChart(0, 120);
        //chart.Show();
        //_fixedContainer.Add(chart);
        //test(_fixedContainer);

        this.Add(_fixedContainer);

    }