ecere/gui/controls/Stacker, ide: implement hover scroll for Stacker. make use of...
authorRejean Loyer <redj@ecere.com>
Thu, 2 Jun 2016 09:07:35 +0000 (05:07 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 22:23:26 +0000 (18:23 -0400)
ecere/src/gui/controls/SelectorBar.ec
ecere/src/gui/controls/Stacker.ec
ide/src/ProjectSettings.ec
ide/src/dialogs/GlobalSettingsDialog.ec

index 4c3ad08..ded05d8 100644 (file)
@@ -140,6 +140,7 @@ public:
 public class SelectorButton : Button
 {
    bevelOver = true, isRadio = true, bitmap = null, minClientSize = { 44, 22 }; isRemote = true;
+   clickThrough = true;
 
 public:
    Window focusHolder;
index 900e412..e4137fc 100644 (file)
@@ -16,7 +16,7 @@ static define stackerScrolling = 16;
 
 class StackerBits
 {
-   bool reverse:1, scrollable:1, flipSpring:1, autoSize:1, endButtons:1;
+   bool reverse:1, scrollable:1, flipSpring:1, autoSize:1, endButtons:1, hoverScroll:1;
 
    // internals
    bool holdChildMonitoring:1;
@@ -83,6 +83,11 @@ public:
       }
       get { return bits.endButtons; }
    };
+   property bool hoverScroll
+   {
+      set { bits.hoverScroll = value; }
+      get { return bits.hoverScroll; }
+   };
 
 private:
    StackerBits bits;
@@ -117,6 +122,7 @@ private:
    RepButton left
    {
       nonClient = true, parent = this, visible = false, bevelOver = true, keyRepeat = true, opacity = 0; delay0 = 0.1;
+      clickThrough = true;
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
@@ -138,6 +144,7 @@ private:
    RepButton right
    {
       nonClient = true, parent = this, visible = false, bevelOver = true, keyRepeat = true, opacity = 0; delay0 = 0.1;
+      clickThrough = true;
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
@@ -256,6 +263,29 @@ private:
    direction = vertical;
    endButtons = true;
 
+   bool OnMouseMove(int x, int y, Modifiers mods)
+   {
+      int limit = direction == vertical ? size.h : size.w;
+      int length = direction == vertical ? scrollArea.h : scrollArea.w;
+      if(bits.hoverScroll/* && needScrollers*/ && length > limit)
+      {
+         int pos = direction == vertical ? y : x;
+         if(pos > 0)
+         {
+            int endZoneSize = (bits.endButtons ? left.size.w : 0) + 16;
+            //float ratio = (float)pos / (float)limit;
+            float ratio = (float)(Min(Max(endZoneSize, pos), limit - endZoneSize) - endZoneSize) / (float)(limit - endZoneSize * 2);
+            int offset = (int)(ratio * (length - limit));
+            if(direction == vertical)
+               scroll.y = offset;
+            else
+               scroll.x = offset;
+            size = size;   // TRIGGER SCROLLING UPDATE (Currently required since we aren't using Window scrollbars)
+         }
+      }
+      return true;
+   }
+
    void OnChildAddedOrRemoved(Window child, bool removed)
    {
       if(!child.nonClient)
index f47b3ab..c83f7d7 100644 (file)
@@ -1322,7 +1322,10 @@ class BuildTab : Tab
    {
       this, text = $"Configurations: ", anchor = { left = 98, top = 8, right = 54 }; size = { 0, 26 };
       opacity = 0;
-      direction = horizontal, scrollable = true;
+      direction = horizontal;
+      scrollable = true;
+      endButtons = false;
+      hoverScroll = true;
 
       bool OnKeyDown(Key key, unichar ch)
       {
@@ -1468,7 +1471,10 @@ class BuildTab : Tab
    {
       this, text = $"Platforms: ", anchor = { left = 64, top = 38, right = 54 }; size = { 0, 26 };
       opacity = 0;
-      direction = horizontal, scrollable = true;
+      direction = horizontal;
+      scrollable = true;
+      endButtons = false;
+      hoverScroll = true;
 
       bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
       {
index 01782aa..cc389a5 100644 (file)
@@ -278,7 +278,10 @@ class CompilersTab : GlobalSettingsSubTab
    {
       this, text = $"Compiler Configurations:", anchor = { left = 148, top = 38, right = 99 }; size = { 0, 26 };
       opacity = 0;
-      direction = horizontal, scrollable = true;
+      direction = horizontal;
+      scrollable = true;
+      endButtons = false;
+      hoverScroll = true;
 
       bool OnKeyDown(Key key, unichar ch)
       {