Ejemplo n.º 1
0
        private void OnColorChange(object sender, EventArgs args)
        {
            ColorButton btn = (ColorButton)sender;

            parent.Color = btn.Style.Background(Gtk.StateType.Normal);
            Close();
        }
Ejemplo n.º 2
0
        public ColorPickerDialog(int x, int y, HColorPicker parent) :
            base(Gtk.WindowType.Toplevel)
        {
            this.parent       = parent;
            this.AppPaintable = true;
            Move(x - 180, y);
            Resize(120, 120);
            this.Build();
            addColors();
            //add buttons

            int  cols = 8;
            uint left = 0;
            uint top  = 0;

            foreach (Color c in colors)
            {
                if (left == cols)
                {
                    left = 0;
                    top++;
                }
                //color button
                ColorButton btn = new ColorButton(c);
                btn.BorderWidth   = 1;
                btn.HeightRequest = 20;
                btn.WidthRequest  = 20;
                //
                btn.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnColorChange);
                TblColors.Attach(btn, left, left + 1, top, top + 1);
                left++;
            }
            ShowAll();
            GrabUtil.GrabWindow(this);
        }
        public ColorPickerDialog( int x, int y, HColorPicker parent )
            : base(Gtk.WindowType.Toplevel)
        {
            this.parent       = parent;
            this.AppPaintable = true;
            Move  ( x - 180 , y   );
            Resize( 120     , 120 );
            this.Build();
            addColors();
            //add buttons

            int cols  = 8;
            uint left = 0;
            uint top  = 0;

            foreach( Color c in colors )
            {

                if( left == cols )
                {
                    left = 0;
                    top++;
                }
                //color button
                ColorButton btn   = new ColorButton( c );
                btn.BorderWidth   = 1;
                btn.HeightRequest = 20;
                btn.WidthRequest  = 20;
                //
                btn.ButtonPressEvent += new Gtk.ButtonPressEventHandler( OnColorChange );
                TblColors.Attach( btn, left, left + 1, top, top + 1 );
                left++;
            }
            ShowAll();
            GrabUtil.GrabWindow(this);
        }