]> O.S.I.I.S - jp/crow.git/commitdiff
add virtual onSelectedItemChanged in TemplatedGroup
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 22 Sep 2021 06:22:39 +0000 (06:22 +0000)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 22 Sep 2021 06:22:39 +0000 (06:22 +0000)
Crow/src/Widgets/ScrollingStack.cs
Crow/src/Widgets/TemplatedGroup.cs
Directory.Build.props
Samples/ShowCase/ShowCase.cs

index 6bda175c934e99c406b40ab7f485582bd4b04d45..07f968a0148a0e21c39e8520ccf20a840421dac1 100644 (file)
@@ -47,7 +47,7 @@ namespace Crow {
                                NotifyValueChangedAuto (maxScroll);
                                //RegisterForGraphicUpdate ();
                        }
-               }               
+               }
 
 
 
@@ -84,11 +84,11 @@ namespace Crow {
                        Widget go = sender as Widget;
 
                        if (Orientation == Orientation.Horizontal) {
-                               if (arg.LayoutType == LayoutingType.Width && itemSize < go.Slot.Width) 
+                               if (arg.LayoutType == LayoutingType.Width && itemSize < go.Slot.Width)
                                        itemSize = go.Slot.Width;
                        } else if (arg.LayoutType == LayoutingType.Height && itemSize < go.Slot.Height)
                                itemSize = go.Slot.Height;
-                       
+
                        base.OnChildLayoutChanges (sender, arg);
                        DbgLogger.EndEvent(DbgEvtType.GOOnChildLayoutChange);
                }
@@ -105,7 +105,7 @@ namespace Crow {
                {
                        DbgLogger.StartEvent (DbgEvtType.GODraw, this);
 
-                       base.onDraw (gr);                       
+                       base.onDraw (gr);
 
                        if (ClipToClientRect) {
                                gr.Save ();
@@ -115,7 +115,7 @@ namespace Crow {
                        }
 
                        childrenRWLock.EnterReadLock ();
-                       try     {                               
+                       try     {
                                for (int i = Scroll; i < Children.Count && i < Scroll + visibleItems; i++) {
                                        if (!Children[i].IsVisible)
                                                continue;
@@ -177,10 +177,10 @@ namespace Crow {
                        }/*else
                                Console.WriteLine("GROUP REPAINT WITH EMPTY CLIPPING");*/
                        paintCache (ctx, Slot + Parent.ClientRectangle.Position);
-                       DbgLogger.EndEvent(DbgEvtType.GOUpdateCache);                           
-               }               
+                       DbgLogger.EndEvent(DbgEvtType.GOUpdateCache);
+               }
+
 
-               
                public override void checkHoverWidget (MouseMoveEventArgs e) {
                        base.checkHoverWidget (e);//TODO:check if not possible to put it at beginning of meth to avoid doubled check to DropTarget.
                        if (!childrenRWLock.TryEnterReadLock (10))
@@ -197,9 +197,9 @@ namespace Crow {
                        }
                }
                /// <summary> Process scrolling vertically, or if shift is down, vertically </summary>
-               public override void onMouseWheel (object sender, MouseWheelEventArgs e) {                      
+               public override void onMouseWheel (object sender, MouseWheelEventArgs e) {
                        e.Handled = true;
-                       Scroll += e.Delta * itemSize;                   
+                       Scroll += e.Delta * itemSize;
                        base.onMouseWheel (sender, e);
                }
        }
index e67625fec41f8e41f8905aa3b4f330f6e3b82d75..bc00a0f394b6965c5f1c829ab14b23d3e8665135 100644 (file)
@@ -203,9 +203,12 @@ namespace Crow {
 
                                NotifyValueChanged ("SelectedItem", SelectedItem);
                                NotifyValueChanged ("SelectedIndex", SelectedIndex);
-                               SelectedItemChanged.Raise (this, new SelectionChangeEventArgs (SelectedItem));
+                               onSelectedItemChanged (this, new SelectionChangeEventArgs (SelectedItem));
                        }
                }
+               public virtual void onSelectedItemChanged (object sender, SelectionChangeEventArgs e) {
+                       SelectedItemChanged.Raise (sender, e);
+               }
                [XmlIgnore]public virtual int SelectedIndex{
                        get => selectedItemContainer == null ? -1 : itemsContainer.Children.IndexOf (selectedItemContainer);
                        set {
index ba354726e2e1eae99a24a1c5e77d884ab8edd8ca..a0ea5fb5d3b83658d81f7fe41b16c1e93a79cc92 100644 (file)
@@ -15,7 +15,7 @@
 
                <!-- Compile with logging enabled, this will slow down apps, use this only
                         for debugging purpose-->
-               <CrowDebugLogEnabled>true</CrowDebugLogEnabled>
+               <CrowDebugLogEnabled>false</CrowDebugLogEnabled>
 
                <!-- Collect several statistics on widgets-->
                <CrowDebugStatsEnabled>false</CrowDebugStatsEnabled>
index 37582cfe2063d78d5516d224dd906949927638a9..71556f019f859964b3b68cfb0e8e579f17091f60 100644 (file)
@@ -79,6 +79,7 @@ namespace ShowCase
                }
 
                void showError (Exception ex) {
+                       Console.WriteLine (ex);
                        NotifyValueChanged ("ErrorMessage", ex);
                        NotifyValueChanged ("ShowError", true);
                }