/[dotgnu-pnet]/pnetlib/Xsharp/Widget.cs
ViewVC logotype

Diff of /pnetlib/Xsharp/Widget.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by tum, Thu Jun 3 00:41:25 2004 UTC revision 1.19 by Rich333, Thu Dec 30 07:31:17 2004 UTC
# Line 590  public abstract class Widget : Drawable, Line 590  public abstract class Widget : Drawable,
590                                                          {                                                          {
591                                                                  child = child.nextBelow;                                                                  child = child.nextBelow;
592                                                          }                                                          }
                                                         MoveToBelow(child);  
593                                                          RepositionBelow(child);                                                          RepositionBelow(child);
594                                                  }                                                  }
595                                                  else if(origLayer > value)                                                  else if(origLayer > value)
# Line 607  public abstract class Widget : Drawable, Line 606  public abstract class Widget : Drawable,
606                                                          {                                                          {
607                                                                  child = child.nextAbove;                                                                  child = child.nextAbove;
608                                                          }                                                          }
                                                         MoveToAbove(child);  
609                                                          RepositionAbove(child);                                                          RepositionAbove(child);
610                                                  }                                                  }
611                                          }                                          }
612                                  }                                  }
613                          }                          }
614    
615          // Move this widget to below one of its siblings.  
616          private void MoveToBelow(Widget sibling)          // Reposition this widget below one of its siblings.
617            private void RepositionBelow(Widget child)
618                          {                          {
619                                  // Detach ourselves from the widget tree.                                  // Detach ourselves from the widget tree.
620                                  if(nextAbove != null)                                  if(nextAbove != null)
# Line 632  public abstract class Widget : Drawable, Line 631  public abstract class Widget : Drawable,
631                                  }                                  }
632    
633                                  // Re-insert at the new position.                                  // Re-insert at the new position.
634                                  nextAbove = sibling;                                  nextAbove = child;
635                                  nextBelow = sibling.nextBelow;                                  nextBelow = child.nextBelow;
636                                  if(nextBelow != null)                                  if(nextBelow != null)
637                                  {                                  {
638                                          nextBelow.nextAbove = this;                                          nextBelow.nextAbove = this;
639                                  }                                  }
640                                  sibling.nextBelow = this;                                  child.nextBelow = this;
                         }  
   
         // Move this widget to above one of its siblings.  
         private void MoveToAbove(Widget sibling)  
                         {  
                                 // Detach ourselves from the widget tree.  
                                 if(nextAbove != null)  
                                 {  
                                         nextAbove.nextBelow = nextBelow;  
                                 }  
                                 else  
                                 {  
                                         parent.topChild = nextBelow;  
                                 }  
                                 if(nextBelow != null)  
                                 {  
                                         nextBelow.nextAbove = nextAbove;  
                                 }  
   
                                 // Re-insert at the new position.  
                                 nextAbove = sibling.nextAbove;  
                                 nextBelow = sibling;  
                                 if(nextAbove != null)  
                                 {  
                                         nextAbove.nextBelow = this;  
                                 }  
                                 else  
                                 {  
                                         parent.topChild = this;  
                                 }  
                                 sibling.nextAbove = this;  
                         }  
641    
         // Reposition this widget below one of its siblings.  
         private void RepositionBelow(Widget child)  
                         {  
642                                  try                                  try
643                                  {                                  {
644                                          IntPtr display = dpy.Lock();                                          IntPtr display = dpy.Lock();
# Line 706  public abstract class Widget : Drawable, Line 670  public abstract class Widget : Drawable,
670          // Reposition this widget above one of its siblings.          // Reposition this widget above one of its siblings.
671          private void RepositionAbove(Widget child)          private void RepositionAbove(Widget child)
672                          {                          {
673                                    // Detach ourselves from the widget tree.
674                                    if(nextAbove != null)
675                                    {
676                                            nextAbove.nextBelow = nextBelow;
677                                    }
678                                    else
679                                    {
680                                            parent.topChild = nextBelow;
681                                    }
682                                    if(nextBelow != null)
683                                    {
684                                            nextBelow.nextAbove = nextAbove;
685                                    }
686    
687                                    // Re-insert at the new position.
688                                    nextAbove = child.nextAbove;
689                                    nextBelow = child;
690                                    if(nextAbove != null)
691                                    {
692                                            nextAbove.nextBelow = this;
693                                    }
694                                    else
695                                    {
696                                            parent.topChild = this;
697                                    }
698                                    child.nextAbove = this;
699    
700                                  try                                  try
701                                  {                                  {
702                                          IntPtr display = dpy.Lock();                                          IntPtr display = dpy.Lock();
# Line 799  public abstract class Widget : Drawable, Line 790  public abstract class Widget : Drawable,
790                                  }                                  }
791                                  if(sibling != null)                                  if(sibling != null)
792                                  {                                  {
                                         MoveToBelow(sibling);  
793                                          RepositionBelow(sibling);                                          RepositionBelow(sibling);
794                                  }                                  }
795                                  else if(last != this)                                  else if(last != this)
796                                  {                                  {
                                         MoveToAbove(last);  
797                                          RepositionAbove(last);                                          RepositionAbove(last);
798                                  }                                  }
799                          }                          }
# Line 823  public abstract class Widget : Drawable, Line 812  public abstract class Widget : Drawable,
812                                  }                                  }
813                                  if(sibling != null)                                  if(sibling != null)
814                                  {                                  {
                                         MoveToAbove(sibling);  
815                                          RepositionAbove(sibling);                                          RepositionAbove(sibling);
816                                  }                                  }
817                                  else if(last != this)                                  else if(last != this)
818                                  {                                  {
                                         MoveToBelow(last);  
819                                          RepositionBelow(last);                                          RepositionBelow(last);
820                                  }                                  }
821                          }                          }
822    
823          /// <summary>          /// <summary>
824            /// <para>Move this widget to above one of its siblings.</para>
825            /// </summary>
826            ///
827            /// <param name="sibling">
828            /// <para>The sibling to move this widget above.</para>
829            /// </param>
830            public virtual void MoveToAbove(Widget sibling)
831                            {
832                                    if(sibling != null && sibling.layer == layer)
833                                    {
834                                            RepositionAbove(sibling);
835                                    }
836                            }
837    
838            /// <summary>
839            /// <para>Move this widget to above one of its siblings.</para>
840            /// </summary>
841            ///
842            /// <param name="sibling">
843            /// <para>The sibling to move this widget below.</para>
844            /// </param>
845            public virtual void MoveToBelow(Widget sibling)
846                            {
847                                    if(sibling != null && sibling.layer == layer)
848                                    {
849                                            RepositionBelow(sibling);
850                                    }
851                            }
852    
853            /// <summary>
854          /// <para>Move this widget to a new location relative to its parent.</para>          /// <para>Move this widget to a new location relative to its parent.</para>
855          /// </summary>          /// </summary>
856          ///          ///
# Line 1562  public abstract class Widget : Drawable, Line 1579  public abstract class Widget : Drawable,
1579                          }                          }
1580    
1581          protected void SendBeginInvoke(IntPtr i_gch)          protected void SendBeginInvoke(IntPtr i_gch)
                 {  
                         XEvent xevent = new XEvent();  
                         xevent.xany.type = (int)(EventType.ClientMessage);  
                         xevent.xany.window = GetWidgetHandle();  
                         xevent.xclient.format = 32;  
                         xevent.xclient.setl(0,(int)i_gch);  
   
                         try  
                         {  
                                 IntPtr display = dpy.Lock();  
                                 xevent.xclient.message_type = Xlib.XInternAtom  
                                                 (display, "INTERNAL_BEGIN_INVOKE", XBool.False);  
                                 Xlib.XSendEvent (display, GetWidgetHandle(),  
                                                 XBool.False, (int)(EventMask.NoEventMask), ref xevent);  
                                 Xlib.XFlush(display);  
                         }  
                         finally  
1582                          {                          {
1583                                  dpy.Unlock();                                  XEvent xevent = new XEvent();
1584                                    xevent.xany.type = (int)(EventType.ClientMessage);
1585                                    xevent.xany.window = GetWidgetHandle();
1586                                    xevent.xclient.format = 32;
1587                                    xevent.xclient.setl(0,(int)i_gch);
1588    
1589                                    try
1590                                    {
1591                                            IntPtr display = dpy.Lock();
1592                                            xevent.xclient.message_type = Xlib.XInternAtom
1593                                                            (display, "INTERNAL_BEGIN_INVOKE", XBool.False);
1594                                            Xlib.XSendEvent (display, GetWidgetHandle(),
1595                                                            XBool.False, (int)(EventMask.NoEventMask), ref xevent);
1596                                            Xlib.XFlush(display);
1597                                    }
1598                                    finally
1599                                    {
1600                                            dpy.Unlock();
1601                                    }
1602                          }                          }
         }  
1603    
1604  } // class Widget  } // class Widget
1605    

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26