Exemplo n.º 1
0
 bool UpdateAllocation(Widget w)
 {
     if (w.IsRealized)
     {
         IShadedWidget   sw = w as IShadedWidget;
         Gdk.Rectangle[] newAllocations;
         if (sw != null)
         {
             List <Gdk.Rectangle> rects = new List <Gdk.Rectangle> ();
             foreach (Gdk.Rectangle ar in sw.GetShadedAreas())
             {
                 rects.Add(ar);
             }
             newAllocations = rects.ToArray();
         }
         else
         {
             newAllocations = new Gdk.Rectangle [] { w.Allocation };
         }
         Gdk.Rectangle[] oldAllocations;
         if (allocations.TryGetValue(w, out oldAllocations))
         {
             if (oldAllocations.Length == newAllocations.Length)
             {
                 bool changed = false;
                 for (int n = 0; n < oldAllocations.Length; n++)
                 {
                     if (newAllocations[n] != oldAllocations[n])
                     {
                         changed = true;
                         break;
                     }
                 }
                 if (!changed)
                 {
                     return(false);
                 }
             }
         }
         allocations [w] = newAllocations;
         return(true);
     }
     else
     {
         if (!allocations.ContainsKey(w))
         {
             return(false);
         }
         allocations.Remove(w);
         return(true);
     }
 }
Exemplo n.º 2
0
        public void Remove(Widget w)
        {
            widgets.Remove(w);
            allocations.Remove(w);
            w.Destroyed -= HandleWDestroyed;
            w.Shown     -= HandleWShown;
            w.Hidden    -= HandleWHidden;
            w.Realized  -= HandleWRealized;
            IShadedWidget sw = w as IShadedWidget;

            if (sw != null)
            {
                sw.AreasChanged -= HandleSwAreasChanged;
            }
            RedrawAll();
        }
Exemplo n.º 3
0
        public void Add(Gtk.Widget w)
        {
            widgets.Add(w);
            UpdateAllocation(w);
            w.Destroyed     += HandleWDestroyed;
            w.Shown         += HandleWShown;
            w.Hidden        += HandleWHidden;
            w.SizeAllocated += HandleWSizeAllocated;
            w.Realized      += HandleWRealized;
            IShadedWidget sw = w as IShadedWidget;

            if (sw != null)
            {
                sw.AreasChanged += HandleSwAreasChanged;
            }
            RedrawAll();
        }
Exemplo n.º 4
0
 void RedrawAll()
 {
     foreach (Widget w in widgets)
     {
         if (!w.Visible)
         {
             continue;
         }
         IShadedWidget sw = w as IShadedWidget;
         if (sw != null)
         {
             foreach (Gdk.Rectangle rect in sw.GetShadedAreas())
             {
                 w.QueueDrawArea(rect.X, rect.Y, rect.Width, rect.Height);
             }
         }
         else
         {
             w.QueueDraw();
         }
     }
 }