Beispiel #1
0
 void OnSizeButtonPress(object ob, Gtk.ButtonPressEventArgs args)
 {
     if (!animating && args.Event.Button == 1 && !args.Event.TriggersContextMenu())
     {
         int n;
         if (horiz)
         {
             Toplevel.GetPointer(out resizePos, out n);
             origSize = WidthRequest;
             if (!startPos)
             {
                 origPos = X + origSize;
             }
         }
         else
         {
             Toplevel.GetPointer(out n, out resizePos);
             origSize = HeightRequest;
             if (!startPos)
             {
                 origPos = Y + origSize;
             }
         }
         resizing = true;
     }
 }
Beispiel #2
0
 void OnSizeMotion(object ob, Gtk.MotionNotifyEventArgs args)
 {
     if (resizing)
     {
         int newPos, n;
         if (horiz)
         {
             Toplevel.GetPointer(out newPos, out n);
             int diff    = startPos ? (newPos - resizePos) : (resizePos - newPos);
             int newSize = origSize + diff;
             if (newSize < Child.SizeRequest().Width)
             {
                 newSize = Child.SizeRequest().Width;
             }
             if (!startPos)
             {
                 X = origPos - newSize;
             }
             WidthRequest = newSize;
         }
         else
         {
             Toplevel.GetPointer(out n, out newPos);
             int diff    = startPos ? (newPos - resizePos) : (resizePos - newPos);
             int newSize = origSize + diff;
             if (newSize < Child.SizeRequest().Height)
             {
                 newSize = Child.SizeRequest().Height;
             }
             if (!startPos)
             {
                 Y = origPos - newSize;
             }
             HeightRequest = newSize;
         }
         frame.QueueResize();
     }
 }