]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Add mousewheel on tab bar and alt+left/right.
authorChris Porter <redacted>
Wed, 22 Oct 2008 19:55:54 +0000 (20:55 +0100)
committerChris Porter <redacted>
Wed, 22 Oct 2008 19:55:54 +0000 (20:55 +0100)
js/ui/baseui.js
js/ui/qui.js

index 4ba7c7a874afea0802209c86da6da0ea490e9126..b8b515abf7b5857e94dceead41e1380d5b466a6a 100644 (file)
@@ -61,6 +61,29 @@ qwebirc.ui.BaseUI = new Class({
     window.select();  /* calls setActiveWindow */
     document.title = window.name + " - " + this.options.appTitle;
   },
+  nextWindow: function(direction) {
+    if(this.windowArray.length == 0 || !this.active)
+      return;
+      
+    if(!direction)
+      direction = 1;
+      
+    var index = this.windowArray.indexOf(this.active);
+    if(index == -1)
+      return;
+      
+    index = index + direction;
+    if(index < 0) {
+      index = this.windowArray.length - 1;
+    } else if(index >= this.windowArray.length) {
+      index = 0;
+    }
+    
+    this.selectWindow(this.windowArray[index]);
+  },
+  prevWindow: function() {
+    this.nextWindow(-1);
+  },
   __closed: function(window) {
     if(window.active) {
       this.active = undefined;
@@ -127,6 +150,10 @@ qwebirc.ui.StandardUI = new Class({
           return;
           
         this.selectWindow(this.windowArray[number]);
+      } else if(x.key == "left") {
+        this.prevWindow();
+      } else if(x.key == "right") {
+        this.nextWindow();
       }
     }.bind(this));
   },
index 2c1a95506a70bb6fc7e872c3adae0d54e646aa34..495f6b7b05393fd6b74ea91e805343c6d45fbd7b 100644 (file)
@@ -23,6 +23,19 @@ qwebirc.ui.QUI = new Class({
     this.input = this.qjsui.bottom;
     this.reflow = this.qjsui.reflow.bind(this.qjsui);
     
+    this.tabs.addEvent("mousewheel", function(x) {
+      var event = new Event(x);
+      
+      /* up */
+      if(event.wheel > 0) {
+        this.nextWindow();
+      } else if(event.wheel < 0) {
+        /* down */
+        this.prevWindow();        
+      }
+      event.stop();
+    }.bind(this));
+    
     this.createInput();
     this.reflow();
   },