Пример #1
0
    protected void ReparentAspect(Fixed parent)
    {
        aspectLabel.Reparent(parent);
        aspectX.Reparent(parent);
        aspectY.Reparent(parent);
        aspectXLabel.Reparent(parent);
        aspectYLabel.Reparent(parent);

        parent.Move(aspectLabel, 365, 5);
        parent.Move(aspectX, 365, 25);
        parent.Move(aspectY, 365, 55);
        parent.Move(aspectXLabel, 350, 30);
        parent.Move(aspectYLabel, 350, 60);
    }
Пример #2
0
        public void Arrange(bool force = true)
        {
            if (height == shell.Allocation.Height && !force)
            {
                return;
            }

            height = shell.Allocation.Height - 10;             //A ScrolledWindow bevel counts into its width. As we don't have max_content_width in gtk+2, the 10pt buffer is used instead. Otherwise, horizontal overflow and a resulting horizontal scrollbar may pop up in certain caes.
            int y        = 0;
            int x        = 0;
            int rowWidth = 0;

            foreach (ObjectWidgetPair <T> pair in cache)
            {
                if (sample.Contains(pair.obj))
                {
                    Requisition size = pair.widget.SizeRequest();
                    if (y + size.Height > height)
                    {
                        y        = 0;
                        x       += rowWidth;
                        rowWidth = 0;
                    }
                    contents.Move(pair.widget, x, y);
                    y += size.Height;
                    if (size.Width > rowWidth)
                    {
                        rowWidth = size.Width;
                    }
                }
            }
        }
Пример #3
0
    protected void ReparentCameraControls(Fixed parent)
    {
        // Re-parent camera picture box and toggle buttons
        cameraImageEvent.Reparent(parent);
        grabButton.Reparent(parent);
        stopButton.Reparent(parent);
        restartButton.Reparent(parent);
        clearButton.Reparent(parent);
        saveButton.Reparent(parent);
        ellipseBoxToggle.Reparent(parent);

        // Move picture box and buttons to default locations
        parent.Move(cameraImageEvent, 20, 20);
        parent.Move(grabButton, 20, 520);
        parent.Move(stopButton, 80, 520);
        parent.Move(restartButton, 140, 520);
        parent.Move(clearButton, 220, 520);
        parent.Move(saveButton, 350, 520);
        parent.Move(ellipseBoxToggle, 410, 520);

        // Reparent and layout fix for edit region panel
        prevParent.Remove(editRegionLayout);
        parent.Put(editRegionLayout, 670, 20);
        prevParent = parent;
    }
    protected void ReparentLabel(Fixed parent, Label label, int x, int y)
    {
        label.Reparent(parent);

        parent.Move(label, x, y);
    }
Пример #5
0
    protected void OnButtonMovePressed(object sender, EventArgs e)
    {
        int mx, my;

        Gdk.Display.Default.GetPointer(out mx, out my);
        fixedLayout.Remove(this);
        fixedLayout.Add(this);

        x = Math.Max(0, x);
        y = Math.Max(0, y);
        w = this.WidthRequest;
        h = this.HeightRequest;
        fixedLayout.Move(this, curx, cury);

        ResetCursor();
        fixedLayout.Add(tmpwidget);
        fixedLayout.Move(tmpwidget, curx + w, cury + h);
        tmpwidget.Show();

        timer.Stop();
        timer          = new Timer(10);
        timer.Elapsed += delegate
        {
            try
            {
                Gtk.Application.Invoke(delegate {
                    int mx2, my2;
                    Gdk.Display.Default.GetPointer(out mx2, out my2);

                    if (mx2 != mx || my2 != my)
                    {
                        x = x - mx + mx2;
                        y = y - my + my2;

                        mx = mx2;
                        my = my2;

                        curx = Math.Max(0, x);
                        cury = Math.Max(0, y);
                        fixedLayout.Move(this, curx, cury);
                    }
                });
            }
            catch { }
        };
        timer.Start();
    }