Revision: 1937
http://svn.sourceforge.net/vexi/?rev=1937&view=rev
Author: clrg
Date: 2007-07-07 08:32:19 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Rather large update to text widgets
- fixes up textareas apart from a core issue
- textfield/labels have been worked on
- textfield/labels still don't quite work
Modified Paths:
--------------
widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/default.t
widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/edit.t
widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/field.t
widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/textarea.t
widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/label.t
widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t
widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.t
widgets/trunk/org.vexi.widgets/src/vexi/widget/textarea.t
widgets/trunk/org.vexi.widgets/src/vexi/widget/textfield.t
Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/default.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/default.t
2007-07-07 12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/default.t
2007-07-07 15:32:19 UTC (rev 1937)
@@ -7,7 +7,8 @@
</meta:doc>
<ui:box layout="absolute">
- <role.repeatable id="cursor" align="topleft" display="false"
interval="300" width="1">
+ <text.edit id="edit" highlightcolor="white" highlightfill="darkblue" />
+ <role.repeatable id="cursor" display="false" fill="black"
interval="300" width="1">
var counter = 0; // counter used to implement blinking
thisbox.moved = false; // used to track recent cursor movement
@@ -36,18 +37,14 @@
</role.repeatable>
thisbox.th_cursor = $cursor;
+ thisbox.th_edit = $edit;
- // implemented by lib.text.edit
- thisbox.getCBlock = null;
- thisbox.getCWord = null;
- thisbox.getCPos = null;
-
/** syncCursor function called by edit.t */
- thisbox.syncCursor = function(v)
+ $edit.syncCursor = function(v)
{
- var cBlock = getCBlock();
- var cWord = getCWord();
- var cPos = getCPos();
+ var cBlock = $edit.getCBlock();
+ var cWord = $edit.getCWord();
+ var cPos = $edit.getCPos();
// calculate cursor pos according to cWord
if (cWord)
{
@@ -85,16 +82,15 @@
}
/** activate cursor when focused */
- thisbox.focused ++= function(v) { cascade = v; $cursor.repeat =
focused; }
+ $edit.focused ++= function(v)
+ {
+ cascade = v;
+ $cursor.repeat = v;
+ }
thisbox.cursorcolor ++= function(v) { $cursor.fill = v; }
- // set sane defaults
- thisbox.cursorcolor = "black";
- thisbox.highlightcolor = "white";
- thisbox.highlightfill = "darkblue";
- // other text properties default to Vexi defaults
+ vexi..vexi.util.redirect..addRedirect(thisbox, $edit, "multiline");
</ui:box>
- <text.edit />
</vexi>
Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/edit.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/edit.t 2007-07-07
12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/edit.t 2007-07-07
15:32:19 UTC (rev 1937)
@@ -86,7 +86,7 @@
</details>
</meta:doc>
- <ui:box>
+ <ui:box layout="absolute">
<ui:box id="text" align="topleft" orient="vertical" vshrink="true" />
// use vars for encapsulation and efficiency
Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/field.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/field.t
2007-07-07 12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/org/vexi/lib/text/field.t
2007-07-07 15:32:19 UTC (rev 1937)
@@ -23,7 +23,7 @@
// assign named trap functions
caretposition ++= static.caretPosReadFunc;
caretposition ++= static.caretPosWriteFunc;
- th_edit ++= static.themeEditFunc;
+ focused ++= static.focusFunc;
th_cursor ++= static.themeCursorFunc;
th_viewport ++= static.themeViewportFunc;
@@ -89,24 +89,15 @@
/** on focus, focus content edit */
static.focusFunc = function(v)
{
- trapee.th_edit.focused = v;
+ cascade = v;
+ trapee.th_edit.focused = trapee.focused;
if (trapee.selectonfocus)
{
- if (v) trapee.selectAll();
- else trapee.unselectAll();
+ if (trapee.focused) trapee.th_edit.selectAll();
+ else trapee.th_edit.unselectAll();
}
- cascade = v;
}
- /** add redirects for th_edit */
- static.themeEditFunc = function(v)
- {
- vexi..vexi.util.redirect..addRedirect(trapee, v,
- "font", "fontsize", "insert", "text", "textcolor", "selectAll",
"unselectAll" );
- trapee.focused ++= static.focusFunc;
- cascade = v;
- }
-
/** update view according to cursor position */
static.themeCursorFunc = function(v)
{
Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/textarea.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/textarea.t
2007-07-07 12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/textarea.t
2007-07-07 15:32:19 UTC (rev 1937)
@@ -8,12 +8,15 @@
<ui:box>
thisbox.enabled = true;
- thisbox.th_edit = null;
thisbox.th_scroll = null;
+ thisbox.th_edit ++= function(v) { cascade = v; v.multiline = true; }
+ thisbox.focused ++= function(v) { cascade = v; th_edit.focused =
focused; }
+
/** syncs the view to be make sure the cursor is visible */
var syncViewWithCursor = function(v)
{
+ cascade = v;
if (!th_scroll) return;
if (-th_scroll.getYOffset() > v)
th_scroll.setYOffset(-v);
@@ -21,12 +24,7 @@
th_scroll.setYOffset(-(v + 6 + trapee.height -
th_scroll.getViewportHeight()));
}
- /** initiate edit */
- th_edit ++= function(v)
- {
- rdrt..addRedirect(thisbox, v, "fontsize", "insert", "text",
"textcolor", "selectAll", "unselectAll", "KeyPressed", "KeyReleased");
- v.th_cursor.y ++= syncViewWithCursor;
- }
+ thisbox.th_cursor ++= function(v) { cascade = v; v.y ++=
syncViewWithCursor; }
</ui:box>
</vexi>
Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/label.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/label.t
2007-07-07 12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/label.t
2007-07-07 15:32:19 UTC (rev 1937)
@@ -5,11 +5,13 @@
<author>Charles Goodwin</author>
</meta:doc>
- <default enabled="false" multiline="true">
+ <default />
+ <ui:box enabled="false">
- thisbox.syncCursor = static.syncCursor;
+ th_edit.multiline = true;
+ th_edit.syncCursor = static.syncCursor;
- </default>
+ </ui:box>
static.syncCursor = function() { return true; }
Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t
2007-07-07 12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t
2007-07-07 15:32:19 UTC (rev 1937)
@@ -10,17 +10,15 @@
<bevel form="down" margin="3">
<scrollpane id="scroll" redirect="null" autohidehorizontal="true"
autohidevertical="true">
<pad id="pad" fill="white" padding="3">
- <lib:text.default id="content" minheight="30" multiline="true"
/>
+ <lib:text.default id="edit" minheight="30" multiline="true" />
</pad>
</scrollpane>
- thisbox.th_edit = $content;
+ thisbox.th_edit = $edit.th_edit;
thisbox.th_scroll = $scroll;
thisbox.enabled ++= function(v) { cascade = v; $pad.fill = enabled ?
"white" : "#d4d0c8"; }
- thisbox.focused ++= function(v) { cascade = v; $content.focused =
focused; }
-
vexi..vexi.util.redirect..addRedirect(thisbox, $pad,
"padding", "paddingtop", "paddingbottom", "paddingleft",
"paddingright");
vexi..vexi.util.redirect..addRedirect(thisbox, $scroll,
Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.t
2007-07-07 12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.t
2007-07-07 15:32:19 UTC (rev 1937)
@@ -7,15 +7,15 @@
<lib:widget.textfield />
<bevel redirect="null" fill="white" form="down" margin="3">
- <pad padding="3">
- <ui:box id="inset" layout="absolute">
+ <ui:box id="inset" layout="absolute">
+ <pad id="pad" padding="3">
<lib:text.default id="edit" align="left" vshrink="true" />
- </ui:box>
- </pad>
+ </pad>
+ </ui:box>
thisbox.th_cursor = $edit.th_cursor;
- thisbox.th_edit = $edit;
- thisbox.th_view = $edit;
+ thisbox.th_edit = $edit.th_edit;
+ thisbox.th_view = $pad;
thisbox.th_viewport = $inset;
thisbox.prevfill = "white";
Modified: widgets/trunk/org.vexi.widgets/src/vexi/widget/textarea.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/vexi/widget/textarea.t 2007-07-07
12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/vexi/widget/textarea.t 2007-07-07
15:32:19 UTC (rev 1937)
@@ -16,10 +16,10 @@
// glue code
rdrt..addRedirect(thisbox, $margin, "margin", "marginleft",
"marginright", "margintop", "marginbottom");
- rdrt..addRedirect(thisbox, $widget, "action", "enabled", "fill",
"focusable", "focused", "font", "fontsize", "insert",
- "selectAll", "unselectAll", "text",
"textcolor", "KeyPressed", "KeyReleased",
+ rdrt..addRedirect(thisbox, $widget, "action", "enabled", "fill",
"focusable", "focused", "KeyPressed", "KeyReleased",
"padding", "paddingleft",
"paddingright", "paddingtop", "paddingbottom",
"autohidevertical",
"autohidehorizontal", "scrollvertical", "scrollhorizontal");
+ rdrt..addRedirect(thisbox, $widget.th_edit, "font", "fontsize",
"insert", "text", "textcolor", "selectAll", "unselectAll" );
if ($widget.margin) $margin.margin = $widget.margin;
Modified: widgets/trunk/org.vexi.widgets/src/vexi/widget/textfield.t
===================================================================
--- widgets/trunk/org.vexi.widgets/src/vexi/widget/textfield.t 2007-07-07
12:02:56 UTC (rev 1936)
+++ widgets/trunk/org.vexi.widgets/src/vexi/widget/textfield.t 2007-07-07
15:32:19 UTC (rev 1937)
@@ -26,9 +26,10 @@
// glue code
rdrt..addRedirect(thisbox, $margin, "margin", "marginleft",
"marginright", "margintop", "marginbottom");
- rdrt..addRedirect(thisbox, $widget, "action", "enabled",
"caretposition", "focused", "focusable", "font", "fontsize", "fill", "insert",
- "maxlength", "password", "padding",
"paddingleft", "paddingright", "paddingtop", "paddingbottom",
- "selectonfocus", "selectAll",
"unselectAll", "text", "textcolor", "value", "KeyPressed", "KeyReleased");
+ rdrt..addRedirect(thisbox, $widget, "action", "enabled",
"caretposition", "focused", "focusable", "fill",
+ "padding", "paddingleft",
"paddingright", "paddingtop", "paddingbottom",
+ "maxlength", "password",
"selectonfocus", "value", "KeyPressed", "KeyReleased");
+ rdrt..addRedirect(thisbox, $widget.th_edit, "font", "fontsize",
"insert", "text", "textcolor", "selectAll", "unselectAll" );
if ($widget.margin) $margin.margin = $widget.margin;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn