<!-- Copyright 2002 NeuronForge Pty Ltd, see COPYING file for licensing [LGPL] -->
-<xwt>
+<ibex>
A single-line or multi-line edit widget. Only handles text with one font and one color, and is capable of line or word wrapping.
TRAPS:
- keep length value up to date so limit checking works.
- insert key
- <preapply name="org.xwt.builtin.edit_lib"/>
+ <preapply name="org.ibex.builtin.edit_lib"/>
<template multiline="false" disabled="false" editable="true" wrap="none" font="sansserif"
selectcolor="blue" selecttextcolor="#FFFFFF" color="#FFFFFF" orient="vertical">
var key = k.substring(k.lastIndexOf('-')+1).toLowerCase();
if (key.length == 1) {
- if (xwt.control) {
+ if (ibex.control) {
if (key == 'a') {
selectText(0, 0, content.numchildren -1, content[content.numchildren -1].fulltext.length);
arguments.cascade(null);
} else if (key == 'x') {
- xwt.clipboard = selection; deleteSelection();
+ ibex.clipboard = selection; deleteSelection();
arguments.cascade(null);
} else if (key == 'c') {
- xwt.clipboard = selection;
+ ibex.clipboard = selection;
arguments.cascade(null);
} else if (key == 'v') {
- deleteSelection(); insertText(curs.cl, curs.cx, xwt.clipboard);
+ deleteSelection(); insertText(curs.cl, curs.cx, ibex.clipboard);
textChangd = true;
arguments.cascade(null);
} else {
} else if (key == "left") {
var cl, cx;
- if (xwt.control) {
+ if (ibex.control) {
// Skip word algorithm. Ugly to look at.
cl = curs.cl; cx = curs.cx;
else { cl = curs.cl; cx = curs.cx -1; }
}
- if (xwt.shift) { updateSelectionCx(cl, cx); }
+ if (ibex.shift) { updateSelectionCx(cl, cx); }
else { clearSelection(); moveCursor(cl, cx); }
arguments.cascade(null);
} else if (key == "right") {
var cl, cx;
- if (xwt.control) {
+ if (ibex.control) {
// Skip word algorithm. Ugly to look at.
cl = curs.cl; cx = curs.cx;
else { cl = curs.cl; cx = curs.cx +1; }
}
- if (xwt.shift) { updateSelectionCx(cl, cx); }
+ if (ibex.shift) { updateSelectionCx(cl, cx); }
else { clearSelection(); moveCursor(cl, cx); }
arguments.cascade(null);
} else if (key == "down") {
var cl, cy;
- if (xwt.control) { cl = content.numchildren -1; cy = content[cl].numchildren -1; }
+ if (ibex.control) { cl = content.numchildren -1; cy = content[cl].numchildren -1; }
else { if (curs.cy == content[curs.cl].numchildren -1) { cl = curs.cl +1; cy = 0; } else { cl = curs.cl; cy = curs.cy + 1; } }
- if (xwt.shift) { updateSelection(cl, cy, curs.px); }
+ if (ibex.shift) { updateSelection(cl, cy, curs.px); }
else { var px = curs.px; clearSelection(); moveCursorToCy(cl, cy, px); }
arguments.cascade(null);
} else if (key == "up") {
var cl, cy;
- if (xwt.control) { cl = 0; cy = content[0].numchildren -1; }
+ if (ibex.control) { cl = 0; cy = content[0].numchildren -1; }
else {
if (curs.cy == 0) { if (curs.cl == 0) { cl=0; cy=0; } else { cl = curs.cl -1; cy = content[cl].numchildren -1; } }
else { cl = curs.cl; cy = curs.cy -1; }
}
- if (xwt.shift) { updateSelection(cl, cy, curs.px); }
+ if (ibex.shift) { updateSelection(cl, cy, curs.px); }
else { var px = curs.px; clearSelection(); moveCursorToCy(cl, cy, px); }
arguments.cascade(null);
} else if (key == "home") {
var cy;
- if (xwt.control) { cy = 0; }
+ if (ibex.control) { cy = 0; }
else { cy = curs.cy; }
- if (xwt.shift) { updateSelection(curs.cl, cy, 0); }
+ if (ibex.shift) { updateSelection(curs.cl, cy, 0); }
else { var cl = curs.cl; clearSelection(); moveCursorToCy(cl, cy, 0); }
arguments.cascade(null);
} else if (key == "end") {
var cy;
- if (xwt.control) { cy = content[curs.cl].numchildren -1; }
+ if (ibex.control) { cy = content[curs.cl].numchildren -1; }
else { cy = curs.cy; }
- if (xwt.shift) { updateSelection(curs.cl, cy, content[curs.cl][cy].text.length); }
+ if (ibex.shift) { updateSelection(curs.cl, cy, content[curs.cl][cy].text.length); }
else { var cl = curs.cl; clearSelection(); moveCursorToCy(cl, cy, content[cl][cy].text.length); }
arguments.cascade(null);
} else if (key == "insert") {
- xwt.println("NOT YET IMPLEMENTED: insert key"); // TODO
+ ibex.println("NOT YET IMPLEMENTED: insert key"); // TODO
arguments.cascade(null);
}
}
_blink = function(v) { invisible = (focused and !disabled) ? v : true; }
</box>
</template>
-</xwt>
+</ibex>