Ejemplo n.º 1
0
        public OverviewWidget()
        {
            this.Build();

            this.deviceComboboxWidget                  = new global::BlinkStickClient.DeviceComboboxWidget();
            this.deviceComboboxWidget.Events           = ((global::Gdk.EventMask)(256));
            this.deviceComboboxWidget.Name             = "deviceComboboxWidget";
            this.deviceComboboxWidget.AutoSelectDevice = true;
            this.hboxMiniMenu.Add(this.deviceComboboxWidget);
            global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hboxMiniMenu [this.deviceComboboxWidget]));
            w2.Position = 1;
            w2.Expand   = false;
            w2.Fill     = false;

            this.blinkstickemulatorwidget1 = new global::BlinkStickClient.BlinkStickEmulatorWidget();
            this.blinkstickemulatorwidget1.HeightRequest = 200;
            this.blinkstickemulatorwidget1.Events        = ((global::Gdk.EventMask)(256));
            this.blinkstickemulatorwidget1.Name          = "blinkstickemulatorwidget1";

            this.blinkstickemulatorwidget1 = new global::BlinkStickClient.BlinkStickEmulatorWidget();
            this.blinkstickemulatorwidget1.HeightRequest = 200;
            this.blinkstickemulatorwidget1.Events        = ((global::Gdk.EventMask)(256));
            this.blinkstickemulatorwidget1.Name          = "blinkstickemulatorwidget1";
            this.vbox4.Add(this.blinkstickemulatorwidget1);
            global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.blinkstickemulatorwidget1]));
            w10.Position = 1;

            this.blinkstickinfowidget2        = new global::BlinkStickClient.BlinkStickInfoWidget();
            this.blinkstickinfowidget2.Events = ((global::Gdk.EventMask)(256));
            this.blinkstickinfowidget2.Name   = "blinkstickinfowidget2";

            this.vbox4.Add(this.blinkstickinfowidget2);
            global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.blinkstickinfowidget2]));
            w15.Position = 4;
            w15.Expand   = false;
            w15.Fill     = false;

            hbox1.PackStart(colorPaletteWidget);

            colorPaletteWidget.ColorClicked += (object sender, ColorClickedEventArgs e) => {
                if (deviceComboboxWidget.SelectedBlinkStick != null && deviceComboboxWidget.SelectedBlinkStick.Led != null)
                {
                    RgbColor color = RgbColor.FromGdkColor(e.Color.Red, e.Color.Green, e.Color.Blue);
                    if (blinkstickemulatorwidget1.SelectedLed == -1)
                    {
                        deviceComboboxWidget.SelectedBlinkStick.SetColor(color.R, color.G, color.B);
                        //blinkstickemulatorwidget1.SetColor(e.Color);
                    }
                    else
                    {
                        deviceComboboxWidget.SelectedBlinkStick.SetColor(0,
                                                                         (byte)blinkstickemulatorwidget1.SelectedLed, color.R, color.G, color.B);
                        //blinkstickemulatorwidget1.SetColor((byte)blinkstickemulatorwidget1.SelectedLed, e.Color);
                    }
                }
            };

            colorPaletteWidget.AllOffClicked += (object sender, EventArgs e) => {
                if (deviceComboboxWidget.SelectedBlinkStick != null && deviceComboboxWidget.SelectedBlinkStick.Led != null)
                {
                    deviceComboboxWidget.SelectedBlinkStick.TurnOff();
                }
            };

            deviceComboboxWidget.DeviceChanged += (object sender, EventArgs e) => {
                if (PreviousDeviceSettings != null && PreviousDeviceSettings.Led != null)
                {
                    PreviousDeviceSettings.SendColor -= BlinkStickSendColor;
                }

                PreviousDeviceSettings = deviceComboboxWidget.SelectedBlinkStick;

                if (PreviousDeviceSettings != null && PreviousDeviceSettings.Led != null)
                {
                    PreviousDeviceSettings.SendColor += BlinkStickSendColor;
                }

                UpdateUI();
            };

            UpdateUI();
        }
Ejemplo n.º 2
0
 protected virtual void Build()
 {
     global::Stetic.Gui.Initialize(this);
     // Widget BlinkStickClient.PatternEditorWidget
     global::Stetic.BinContainer.Attach(this);
     this.Name = "BlinkStickClient.PatternEditorWidget";
     // Container child BlinkStickClient.PatternEditorWidget.Gtk.Container+ContainerChild
     this.hboxHorizontalSplit         = new global::Gtk.HBox();
     this.hboxHorizontalSplit.Name    = "hboxHorizontalSplit";
     this.hboxHorizontalSplit.Spacing = 6;
     // Container child hboxHorizontalSplit.Gtk.Box+BoxChild
     this.vboxLeft             = new global::Gtk.VBox();
     this.vboxLeft.Name        = "vboxLeft";
     this.vboxLeft.Spacing     = 6;
     this.vboxLeft.BorderWidth = ((uint)(6));
     // Container child vboxLeft.Gtk.Box+BoxChild
     this.blinkstickemulatorwidget1        = new global::BlinkStickClient.BlinkStickEmulatorWidget();
     this.blinkstickemulatorwidget1.Events = ((global::Gdk.EventMask)(256));
     this.blinkstickemulatorwidget1.Name   = "blinkstickemulatorwidget1";
     this.vboxLeft.Add(this.blinkstickemulatorwidget1);
     global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vboxLeft [this.blinkstickemulatorwidget1]));
     w1.Position = 0;
     // Container child vboxLeft.Gtk.Box+BoxChild
     this.hboxNewPatternButtons         = new global::Gtk.HBox();
     this.hboxNewPatternButtons.Name    = "hboxNewPatternButtons";
     this.hboxNewPatternButtons.Spacing = 6;
     // Container child hboxNewPatternButtons.Gtk.Box+BoxChild
     this.buttonAddPattern              = new global::Gtk.Button();
     this.buttonAddPattern.CanFocus     = true;
     this.buttonAddPattern.Name         = "buttonAddPattern";
     this.buttonAddPattern.UseUnderline = true;
     global::Gtk.Image w2 = new global::Gtk.Image();
     w2.Pixbuf = global::Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.icons.icon-dark-plus.png");
     this.buttonAddPattern.Image = w2;
     this.hboxNewPatternButtons.Add(this.buttonAddPattern);
     global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hboxNewPatternButtons [this.buttonAddPattern]));
     w3.Position = 0;
     w3.Expand   = false;
     w3.Fill     = false;
     // Container child hboxNewPatternButtons.Gtk.Box+BoxChild
     this.alignment2      = new global::Gtk.Alignment(0.5F, 0.5F, 1F, 1F);
     this.alignment2.Name = "alignment2";
     this.hboxNewPatternButtons.Add(this.alignment2);
     global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hboxNewPatternButtons [this.alignment2]));
     w4.Position = 1;
     this.vboxLeft.Add(this.hboxNewPatternButtons);
     global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vboxLeft [this.hboxNewPatternButtons]));
     w5.Position = 1;
     w5.Expand   = false;
     w5.Fill     = false;
     // Container child vboxLeft.Gtk.Box+BoxChild
     this.GtkScrolledWindow            = new global::Gtk.ScrolledWindow();
     this.GtkScrolledWindow.Name       = "GtkScrolledWindow";
     this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
     // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
     this.treeviewPatterns                = new global::Gtk.TreeView();
     this.treeviewPatterns.CanFocus       = true;
     this.treeviewPatterns.Name           = "treeviewPatterns";
     this.treeviewPatterns.HeadersVisible = false;
     this.GtkScrolledWindow.Add(this.treeviewPatterns);
     this.vboxLeft.Add(this.GtkScrolledWindow);
     global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vboxLeft [this.GtkScrolledWindow]));
     w7.Position = 2;
     this.hboxHorizontalSplit.Add(this.vboxLeft);
     global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hboxHorizontalSplit [this.vboxLeft]));
     w8.Position = 0;
     // Container child hboxHorizontalSplit.Gtk.Box+BoxChild
     this.vboxRight             = new global::Gtk.VBox();
     this.vboxRight.Name        = "vboxRight";
     this.vboxRight.Spacing     = 6;
     this.vboxRight.BorderWidth = ((uint)(6));
     // Container child vboxRight.Gtk.Box+BoxChild
     this.hboxAnimationsTitle         = new global::Gtk.HBox();
     this.hboxAnimationsTitle.Name    = "hboxAnimationsTitle";
     this.hboxAnimationsTitle.Spacing = 6;
     // Container child hboxAnimationsTitle.Gtk.Box+BoxChild
     this.buttonAddAnimation              = new global::Gtk.Button();
     this.buttonAddAnimation.CanFocus     = true;
     this.buttonAddAnimation.Name         = "buttonAddAnimation";
     this.buttonAddAnimation.UseUnderline = true;
     global::Gtk.Image w9 = new global::Gtk.Image();
     w9.Pixbuf = global::Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.icons.icon-dark-plus.png");
     this.buttonAddAnimation.Image = w9;
     this.hboxAnimationsTitle.Add(this.buttonAddAnimation);
     global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hboxAnimationsTitle [this.buttonAddAnimation]));
     w10.Position = 0;
     w10.Expand   = false;
     w10.Fill     = false;
     // Container child hboxAnimationsTitle.Gtk.Box+BoxChild
     this.labelPattern           = new global::Gtk.Label();
     this.labelPattern.Name      = "labelPattern";
     this.labelPattern.LabelProp = global::Mono.Unix.Catalog.GetString("Pattern Animations");
     this.hboxAnimationsTitle.Add(this.labelPattern);
     global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hboxAnimationsTitle [this.labelPattern]));
     w11.Position = 1;
     this.vboxRight.Add(this.hboxAnimationsTitle);
     global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vboxRight [this.hboxAnimationsTitle]));
     w12.Position = 0;
     w12.Expand   = false;
     w12.Fill     = false;
     // Container child vboxRight.Gtk.Box+BoxChild
     this.scrolledwindowAnimations = new global::Gtk.ScrolledWindow();
     this.scrolledwindowAnimations.WidthRequest     = 310;
     this.scrolledwindowAnimations.CanFocus         = true;
     this.scrolledwindowAnimations.Name             = "scrolledwindowAnimations";
     this.scrolledwindowAnimations.HscrollbarPolicy = ((global::Gtk.PolicyType)(2));
     this.scrolledwindowAnimations.ShadowType       = ((global::Gtk.ShadowType)(1));
     // Container child scrolledwindowAnimations.Gtk.Container+ContainerChild
     global::Gtk.Viewport w13 = new global::Gtk.Viewport();
     w13.ShadowType = ((global::Gtk.ShadowType)(0));
     // Container child GtkViewport.Gtk.Container+ContainerChild
     this.vboxAnimations             = new global::Gtk.VBox();
     this.vboxAnimations.Name        = "vboxAnimations";
     this.vboxAnimations.BorderWidth = ((uint)(6));
     w13.Add(this.vboxAnimations);
     this.scrolledwindowAnimations.Add(w13);
     this.vboxRight.Add(this.scrolledwindowAnimations);
     global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vboxRight [this.scrolledwindowAnimations]));
     w16.Position = 1;
     this.hboxHorizontalSplit.Add(this.vboxRight);
     global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.hboxHorizontalSplit [this.vboxRight]));
     w17.Position = 1;
     w17.Expand   = false;
     w17.Fill     = false;
     this.Add(this.hboxHorizontalSplit);
     if ((this.Child != null))
     {
         this.Child.ShowAll();
     }
     this.Hide();
     this.buttonAddPattern.Clicked   += new global::System.EventHandler(this.OnButtonAddPatternClicked);
     this.buttonAddAnimation.Clicked += new global::System.EventHandler(this.OnButtonAddAnimationClicked);
 }