This repository has been archived by the owner on Jul 19, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Issue #13
- Loading branch information
gossi
committed
Sep 5, 2010
1 parent
5a7a4e0
commit 00f1efa
Showing
17 changed files
with
762 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>control listener (dev)</title> | ||
<link rel="stylesheet" href="../../css/themes/sand/sand.css" type="text/css"/> | ||
<script type="text/javascript" src="../../src/gara.js"></script> | ||
<script type="text/javascript"> | ||
var list, text, tree, | ||
controlListener = { | ||
mouseEnter : function(e) { | ||
console.log("Mouse Entered on " + e.widget); | ||
}, | ||
|
||
mouseExit : function(e) { | ||
console.log("Mouse Exited on " + e.widget); | ||
}, | ||
|
||
mouseHover : function(e) { | ||
//console.log("Mouse Hovered on " + e.widget); | ||
}, | ||
|
||
mouseMove : function(e) { | ||
console.log("Mouse Moved"); | ||
}, | ||
|
||
mouseScrolled : function(e) { | ||
console.log("Mouse Scrolled " + e.detail); | ||
}, | ||
|
||
controlResized : function(e) { | ||
console.log("Control Resized"); | ||
}, | ||
|
||
controlMoved : function(e) { | ||
console.log("Control Moved"); | ||
} | ||
}, | ||
modifyListener = { | ||
modifyText : function (e) { | ||
console.log("Text modified"); | ||
} | ||
}, | ||
treeListener = { | ||
treeExpanded : function (e) { | ||
console.log("Tree expanded on item: " + e.item.getText()); | ||
}, | ||
|
||
treeCollapsed : function (e) { | ||
console.log("Tree collapsed on item: " + e.item.getText()); | ||
} | ||
}; | ||
|
||
function main() { | ||
// text | ||
text = new gara.jswt.widgets.Text(document.getElementById("text")); | ||
text.addModifyListener(modifyListener); | ||
|
||
// list | ||
list = new gara.jswt.widgets.List(document.getElementById("list"), gara.jswt.JSWT.MULTI); | ||
for (var i = 1; i <= 20; i++) { | ||
new gara.jswt.widgets.ListItem(list).setText("Item " + i); | ||
} | ||
|
||
list.addControlListener(controlListener); | ||
list.addMouseTrackListener(controlListener); | ||
//list.addMouseMovecontrolListener(controlListener); | ||
list.addMouseWheelListener(controlListener); | ||
|
||
list.setHeight(200); | ||
|
||
//tree | ||
tree = new gara.jswt.widgets.Tree(document.getElementById("tree")); | ||
tree.addTreeListener(treeListener); | ||
tree.setHeight(200); | ||
|
||
var movies = new gara.jswt.widgets.TreeItem(tree).setText("Movies"); | ||
new gara.jswt.widgets.TreeItem(movies).setText("300!"); | ||
new gara.jswt.widgets.TreeItem(movies).setText("Bud Spencer and Terrance Hill"); | ||
new gara.jswt.widgets.TreeItem(movies).setText("Last Samurai"); | ||
|
||
var series = new gara.jswt.widgets.TreeItem(tree).setText("Series"); | ||
new gara.jswt.widgets.TreeItem(series).setText("Two and a half man"); | ||
new gara.jswt.widgets.TreeItem(series).setText("Big Bang"); | ||
new gara.jswt.widgets.TreeItem(series).setText("Monk"); | ||
} | ||
</script> | ||
</head> | ||
<body style="padding: 10px;"> | ||
<h1 style="font-size: 24px; margin-bottom: 10px;">Text + Modify Listener</h1> | ||
<div id="text" class="sand"></div> | ||
|
||
<div style="width: 300px; float: left;"> | ||
<h1 style="font-size: 24px; margin-bottom: 10px;">List + Control Listener</h1> | ||
<div id="list" class="sand" style="border: 1px solid #888;"></div> | ||
</div> | ||
|
||
<div style="margin-left: 320px; width: 300px;"> | ||
<h1 style="font-size: 24px; margin-bottom: 10px;">Tree + Tree Listener</h1> | ||
<div id="tree" class="sand" style="border: 1px solid #888;"></div> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
gara.require(["gara.jswt.widgets.List", "gara.jswt.widgets.Text", "gara.jswt.widgets.Tree"], main); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* $Id: FocusListener.interface.js 91 2007-12-09 18:58:43Z tgossmann $ | ||
gara - Javascript Toolkit | ||
=========================================================================== | ||
Copyright (c) 2007 Thomas Gossmann | ||
Homepage: | ||
http://gara.creative2.net | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
=========================================================================== | ||
*/ | ||
|
||
gara.provide("gara.jswt.events.ControlListener"); | ||
|
||
/** | ||
* @interface ControlListener | ||
* @summary | ||
* Classes which implement this interface provide methods that deal with the events | ||
* that are generated by moving and resizing controls. | ||
* | ||
* @description | ||
* After creating an instance of a class that implements this interface it can be | ||
* added to a control using the <code>addControlListener</code> method and removed using | ||
* the <code>removeControlListener</code> method. When a control is moved or resized, | ||
* the appropriate method will be invoked. | ||
* | ||
* @namespace gara.jswt.events | ||
*/ | ||
|
||
gara.Class("gara.jswt.events.ControlListener", { | ||
|
||
/** | ||
* @method | ||
* Sent when the location (x, y) of a control changes | ||
* relative to its parent (or relative to the display, for Shells). | ||
* | ||
* @param {Event} e an event containing information about the mouse move | ||
* @return {void} | ||
*/ | ||
controlMoved : function() {}, | ||
|
||
/** | ||
* @method | ||
* Sent when the size (width, height) of a control changes. | ||
* | ||
* @param {Event} e an event containing information about the mouse move | ||
* @return {void} | ||
*/ | ||
controlResized : function() {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* $Id: FocusListener.interface.js 91 2007-12-09 18:58:43Z tgossmann $ | ||
gara - Javascript Toolkit | ||
=========================================================================== | ||
Copyright (c) 2007 Thomas Gossmann | ||
Homepage: | ||
http://gara.creative2.net | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
=========================================================================== | ||
*/ | ||
|
||
gara.provide("gara.jswt.events.MouseMoveListener"); | ||
|
||
/** | ||
* @interface MouseListener | ||
* | ||
* @summary | ||
* Classes which implement this interface provide a method that deals with the events that are | ||
* generated as the mouse pointer moves. | ||
* | ||
* @description | ||
* After creating an instance of a class that implements this interface it can be added to a | ||
* control using the <code>addMouseMoveListener</code> method and removed using the | ||
* <code>removeMouseMoveListener</code> method. As the mouse moves, the mouseMove method will | ||
* be invoked. | ||
* | ||
* @namespace gara.jswt.events | ||
*/ | ||
gara.Class("gara.jswt.events.MouseMoveListener", { | ||
|
||
/** | ||
* @method | ||
* Sent when the mouse moves. | ||
* | ||
* @param {Event} e an event containing information about the mouse move | ||
* @return {void} | ||
*/ | ||
mouseMove : function(e) {} | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* $Id: FocusListener.interface.js 91 2007-12-09 18:58:43Z tgossmann $ | ||
gara - Javascript Toolkit | ||
=========================================================================== | ||
Copyright (c) 2007 Thomas Gossmann | ||
Homepage: | ||
http://gara.creative2.net | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
=========================================================================== | ||
*/ | ||
|
||
gara.provide("gara.jswt.events.MouseWheelListener"); | ||
|
||
/** | ||
* @interface MouseListener | ||
* | ||
* @summary | ||
* Classes which implement this interface provide a method that deals with the event that is | ||
* generated as the mouse wheel is scrolled. | ||
* | ||
* @description | ||
* After creating an instance of a class that implements this interface it can be added to a | ||
* control using the <code>addMouseWheelListener</code> method and removed using the | ||
* <code>removeMouseWheelListener</code> method. When the mouse wheel is scrolled the | ||
* mouseScrolled method will be invoked. | ||
* | ||
* @namespace gara.jswt.events | ||
*/ | ||
gara.Class("gara.jswt.events.MouseWheelListener", { | ||
|
||
/** | ||
* @method | ||
* Sent when the mouse wheel is scrolled. | ||
* | ||
* @author Thomas Gossmann | ||
* @param {Event} e an event containing information about the mouse wheel action | ||
* @return {void} | ||
*/ | ||
mouseScrolled : function(e) {} | ||
}); |
Oops, something went wrong.