Beispiel #1
0
 /// <summary>
 /// Assert that this object isn't disposed; throws an ObjectDisposedException if Disposed == true
 /// </summary>
 /// <param name="self"></param>
 /// <exception cref="ObjectDisposedException"></exception>
 public static void Assert(this IGLObject self)
 {
     if (self.Disposed)
     {
         throw new ObjectDisposedException(self.Name);
     }
 }
Beispiel #2
0
 public void AddGLObject(IGLObject ob)
 {
     if (TreeUpdated != null)
     {
         TreeUpdated(this, null);
     }
     ob.Updated += OnExposed;
     // init here?
     ob.Init();
     GLObjectList.Add(ob);
 }
Beispiel #3
0
        public void Add(IGLObject item)
        {
#if Android
            lock (items) {
                foreach (var i in items)
                {
                    if (!i.IsAlive)
                    {
                        i.Target = item;
                        return;
                    }
                }
                items.Add(new WeakReference(item));
            }
#endif
        }
Beispiel #4
0
 public void AddGLObject(IGLObject ob)
 {
     if (TreeUpdated != null)
         TreeUpdated (this, null);
     ob.Updated += OnExposed;
     // init here?
     ob.Init ();
     GLObjectList.Add (ob);
 }
Beispiel #5
0
        public void AddGLObject(IGLObject ob)
        {
            ob.Updated += OnExposed;

            GLObjectList.Add(ob);
        }
        // The constructor.  Takes as its argument the glObject that it will control (and track)
        // the rotation of
        public GLObjectRotationController(IGLObject glObject)
        {
            // Set our member variable to the passed glObject
            glOb = glObject;

            // Grab the controlWindow widget from the glade xml
            controlXML = new Glade.XML (null, "rotation-controller.glade", "controlWindow", null);
            controlWindow = (Gtk.Window)controlXML["controlWindow"];

            // Make a map to these widgets
            entryMap = new System.Collections.Hashtable(3);

            foreach (char c in new char [] {'x', 'y', 'z'}) {
                string widgetName = c+"RotEntry";

                Gtk.Entry e = (Gtk.Entry) controlXML[widgetName];

                // Align left
                e.Alignment = 0.0f;

                // When the user presses enter or tab, update the object's rotation
                e.Activated += UpdateObjectRotation;
                e.FocusOutEvent += UpdateObjectRotation;

                entryMap.Add(c, e);
            }

            // The controlWindow is hidden by default.  Make it visible
            controlWindow.Visible = true;

            // Attach the reset button click event to our ResetRotationHandler method
            Gtk.Button resetButton = (Gtk.Button)controlXML["rotationResetButton"];
            resetButton.Clicked += this.ResetRotationHandler;

            // Get the table from the glade xml
            Gtk.Table t = (Gtk.Table)controlXML["table1"];

            // Create a counter-clockwise rotation (on the X axis) button and place it in the table
            ObjectRotationButton btnXMinus =
                new ObjectRotationButton(new Image(Stock.Remove, IconSize.Button),
                                         glOb,
                                         new GtkGL.EulerRotation(-1.0, 0.0, 0.0)
                                        );

            t.Attach(btnXMinus, 2, 3, 0, 1);
            btnXMinus.Rotated += UpdateRotationValues;

            // Create a clockwise rotation (on the X axis) button and place it in the table
            ObjectRotationButton btnXPlus =
                new ObjectRotationButton(new Image(Stock.Add, IconSize.Button),
                                         glOb,
                                         new GtkGL.EulerRotation(1.0, 0.0, 0.0)
                                        );

            t.Attach(btnXPlus, 3, 4, 0, 1);
            btnXPlus.Rotated += UpdateRotationValues;

            // Create a counter-clockwise rotation (on the Y axis) button and place it in the table
            ObjectRotationButton btnYMinus =
                new ObjectRotationButton(new Image(Stock.Remove, IconSize.Button),
                                         glOb,
                                         new GtkGL.EulerRotation(0.0, -1.0, 0.0)
                                        );

            t.Attach(btnYMinus, 2, 3, 1, 2);
            btnYMinus.Rotated += UpdateRotationValues;

            // Create a clockwise rotation (on the Y axis) button and place it in the table
            ObjectRotationButton btnYPlus =
                new ObjectRotationButton(new Image(Stock.Add, IconSize.Button),
                                         glOb,
                                         new GtkGL.EulerRotation(0.0, 1.0, 0.0)
                                         );

            t.Attach(btnYPlus, 3, 4, 1, 2);
            btnYPlus.Rotated += UpdateRotationValues;

            // Create a counter-clockwise rotation (on the Z axis) button and place it in the table
            ObjectRotationButton btnZMinus =
                new ObjectRotationButton(new Image(Stock.Remove, IconSize.Button),
                                         glOb,
                                         new GtkGL.EulerRotation(0.0, 0.0, -1.0)
                                        );

            t.Attach(btnZMinus, 2, 3, 2, 3);
            btnZMinus.Rotated += UpdateRotationValues;

            // Create a clockwise rotation (on the Z axis) button and place it in the table
            ObjectRotationButton btnZPlus =
                new ObjectRotationButton(new Image(Stock.Add, IconSize.Button),
                                         glOb,
                                         new GtkGL.EulerRotation(0.0, 0.0, 1.0)
                                         );

            t.Attach(btnZPlus, 3, 4, 2, 3);
            btnZPlus.Rotated += UpdateRotationValues;

            // Show the controlWindow and all of its children
            controlWindow.ShowAll();
        }
 public static uint SafeGetHandle(this IGLObject o)
 {
     return(o != null ? o.Handle : 0);
 }