Revision: 4796 http://sourceforge.net/p/vexi/code/4796 Author: clrg Date: 2015-05-23 11:30:20 +0000 (Sat, 23 May 2015) Log Message: ----------- Port scroll widgets
Added Paths: ----------- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollbar.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollpane.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollbar.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollpane.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/Button.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollbar.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollpane.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/gui/Scroll.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/image/pacman_origin.jpg Removed Paths: ------------- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/button.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollbar.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollpane.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollbar.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollpane.t branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/pacman_origin.jpg branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/scroll.t Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollbar.t (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollbar.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollbar.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,378 @@ +<!-- Copyright 2015 - see COPYING for details [LGPL] --> + +<vexi xmlns:ui="vexi://ui" + xmlns:meta="vexi://meta" + xmlns="org.vexi.lib.role"> + + <meta:doc> + <author>Charles Goodwin</author> + <usage> + * th_thumb should be a role.Draggable + * viewport should have the structure: + <Box layout="place"><Box /></Box> + </usage> + </meta:doc> + + <Polarized /> + <ui:Box> + + // public variables + thisbox.lineheight = vexi.ui.font.height(font, fontsize, "dp"); + thisbox.mwheelshift = 4; + thisbox.pageshift; + thisbox.autohide; + thisbox.enabled = true; + thisbox.hide; + thisbox.minthumbsize; + thisbox.shift; + thisbox.uiport; + thisbox.viewport; + + // theme box variables + thisbox.th_back; + thisbox.th_next; + thisbox.th_thumb; + thisbox.th_track; + + // private variables + var listeners = {}; + var percent; + var percentset; + var trackpos; + + // for efficient lookups + var max = vexi.math.max; + var min = vexi.math.min; + var thumb, track; + var vport, varea; + + //////// + // sync functions + + /** sync viewport with thumb position */ + const syncViewport = function() { + if (vport and varea) + varea[pos] = percent * (vport[dim] - varea[dim]); + } + + /** sync specific listener with viewport position */ + const syncListener = function(v) { + if (v and v[0]) v[0][pos] = percent * (v[dim] - v[0][dim]); + } + + /** syncs all listeners with viewport position */ + const syncAllListeners = function(v) { + // BROKEN - disabling this, it prevents button from working (until thumb has been moved) + // Once motion is set it doesn't seem to get unset in normal use, so it seems like + // a useless check. +// if (motion) { + for (var key in listeners) { + if (v == key) continue; + syncListener(key); + } +// } + } + + /** sync thumb with viewport size and position */ + const syncThumb = function() { + // don't do much if we're hidden + if (hide) display = false; + // conditions where thumb placement is not [yet] desirable + else if (!surface || vport == null || varea == null || vport[dim] >= varea[dim]) { + if (enabled) enabled = false; + if (autohide) display = false; + else { + thumb[dim] = track[dim]; + thumb[pos] = 0; + } + // display, size, and place thumb + } else { + if (!enabled) enabled = true; + if (!display) display = true; + thumb[dim] = + max(minthumbsize, + min(track[dim], + (vport[dim] / varea[dim]) * track[dim])); + thumb[pos] = max(0, (track[dim] - thumb[dim]) * percent); + } + } + + //////// + // trap functions to invoke sync + + /** invokes sync funcs on all but listener trapee */ + const listenerMove = function(v) { + if (trapee[trapname] == v) return; + cascade = v; + if (percentset or !trapee.constrain) return; + percentset = true; + percent = trapee[0][pos] / (trapee[0][dim] - trapee[dim]); + syncAllListeners(trapee); + syncViewport(); + percentset = false; + } + + /** listener resized - sync with viewport */ + const listenerResize = function(v) { cascade = v; syncListener(trapee); } + + const syncThumbTrap = function(v) { cascade = v; syncThumb(); } + + const viewportMove = function(v) { + cascade = min(0, max(v, vport[dim] - varea[dim])); + if (percentset) return; + percentset = true; + percent = varea[pos] / (vport[dim] - varea[dim]); + syncThumb(); + syncAllListeners(); + percentset = false; + } + + /** viewport or varea resized */ + const viewportResize = function(v) { + var v0 = trapee[trapname]; + if(v==v0) return; + + cascade = v; + if (percentset) return; + // avoid resetting percent + percentset = true; + // viewport bigger than view subject + if (vport[dim] >= varea[dim]) varea[pos] = 0; + // constrain viewport position + else varea[pos] = -percent * (varea[dim] - vport[dim]); + // sync thumbsize to viewport + syncThumb(); + percentset = false; + } + + /** vertical mousewheel movement */ + const mwheelWrite = function(v) { + if (display and (track[dim] > thumb[dim])) { + shift = lineheight * v * mwheelshift; + return; + } + cascade = v; + } + + //////// + // public functions + + /** add listener (weak viewport) to the scrollbar */ + thisbox.addListener = function(v) { + listeners[v] = true; + v[dim] ++= listenerResize; + v[0][dim] ++= listenerResize; + v[0][pos] ++= listenerMove; + syncListener(v); + } + + /** remove listener (weak viewport) to the scrollbar */ + thisbox.removeListener = function(v) { + if (listeners[v] != null) { + listeners[v][dim] --= listenerResize; + listeners[v][0][dim] --= listenerResize; + listeners[v][0][pos] --= listenerMove; + (keysof(listeners)).remove(v); + } + } + + //////// + // public property traps + + autohide ++= syncThumbTrap; + minthumbsize ++= static.minthumbsizeWrite; + pageshift ++= static.pageshiftRead; + v_container ++= static.containerWrite; + + /** adjust scrollbar orient - "horizontal" or "vertical" */ + orient ++= function(v) { + if (v == orient) return; + cascade = v; + // reassign track traps + if (track) { + track[flip(dim)] --= syncThumbTrap; + track[dim] ++= syncThumbTrap; + track[flip(mindim)] = 0; + track[mindim] = minthumbsize; + } + // reassign viewport traps + if (vport) { + if (!varea) throw "viewport must have a child"; + // react to viewport resize + vport[flip(dim)] --= viewportResize; + vport[dim] ++= viewportResize; + // react to viewarea resize + varea[flip(dim)] --= viewportResize; + varea[dim] ++= viewportResize; + // react to viewarea movement + varea[flip(pos)] --= viewportMove; + varea[pos] ++= viewportMove; + } + // reassign uiport traps + if (uiport) { + uiport[flip(mousewheel)] --= mwheelWrite; + uiport[mousewheel] ++= mwheelWrite; + } + // reassign listener traps + const olddim = flip(dim); + const oldpos = flip(pos); + const newdim = dim; + const newpos = pos; + for (var key in listeners) { + dim = olddim; + pos = oldpos; + removeListener(key); + dim = newdim; + pos = newpos; + addListener(key); + } + } + + /** attempt to shift viewport by given amount */ + shift ++= function(v) { + varea[pos] = + min(0, + max(vport[dim] - varea[dim], + varea[pos] - v)); + return; + } + + /** set up viewport */ + viewport ++= function(v) { + // clean up old viewport + if (vport) { + if (!varea) throw "viewport must have a child"; + vport[dim] --= viewportResize; + varea[dim] --= viewportResize; + varea[pos] --= viewportMove; + } + // set up new viewport + if (v) { + if (!v[0]) throw "viewport must have a child"; + v[dim] ++= viewportResize; + v[0][dim] ++= viewportResize; + v[0][pos] ++= viewportMove; + } + cascade = v; + vport = v; + varea = v ? v[0] : null; + syncThumb(); + } + + /** set up ui port (see scrollpane uiport) in case viewport is virtual */ + uiport ++= function(v) { + if (uiport) { + uiport[mousewheel] --= mwheelWrite; + } + if (v) { + v[mousewheel] ++= mwheelWrite; + } + cascade = v; + } + + //////// + // theme trap assignments + + /** move up a line */ + const backAction = function(a) { shift = -(mwheelshift * lineheight); cascade = a; } + + /** set up back button */ + th_back ++= function(v) { + v.action ++= backAction; + v.focusable = false; + cascade = v; + } + + /** move down a line */ + const nextAction = function(a) { shift = mwheelshift * lineheight; cascade = a; } + + /** set up next button */ + th_next ++= function(v) { + v.action ++= nextAction; + v.focusable = false; + cascade = v; + } + + /** invokes a pageshift in appropriate direction */ + const trackAction = function(a) { + const trackpos = track.mouse[pos]; + if (thumb[pos] > trackpos) shift = -pageshift; + else if (trackpos > thumb[pos] + thumb[dim]) shift = pageshift; + cascade = a; + } + + /** set up track */ + th_track ++= function(v) { + v[dim] ++= syncThumbTrap; + v.action ++= trackAction; + v[mindim] = minthumbsize; + cascade = v; + track = v; + } + + /** thumb is moved by user */ + var lastpos; + var limitpos; + var startpos; + const thumbStart = function(v) { + motion = true; + startpos = v==1 ? thumb[pos] : varea[pos]; + limitpos = v==1 ? track[dim] - thumb[dim] : vport[dim] - varea[dim]; + return; + } + const thumbStop = function(v) { motion = false; lastpos = null; return; } + const thumbMove = function(d) { + // avoid duplicates (when flip(pos) changes) + if (d[pos] == lastpos) return; + lastpos = d[pos]; + // RMB drags relative to the content + if (d.button == 2) { + varea[pos] = min(0, max(limitpos, startpos - d[pos])); + return; + } + // LMB drags relative to the scrollbar + thumb[pos] = max(0, min(limitpos, startpos + d[pos])); + if (percentset) return; + // set percent according to thumb + percentset = true; + percent = thumb[pos] / (track[dim] - thumb[dim]); + syncViewport(); + syncAllListeners(); + percentset = false; + return; + } + + /** set up scrollbar thumb */ + th_thumb ++= function(v) { + v.dragUpdate ++= thumbMove; + v.dragStart ++= thumbStart; + v.dragStop ++= thumbStop; + v.dragButton = 2; + cascade = v; + thumb = v; + } + + </ui:Box> + + /** scrollbars can not have content */ + static.containerWrite = function(v) { cascade = v; trapee.v_content = null; } + + /** updates the lineheight as used by mousewheel scrolling */ + static.fontWrite = function(v) { + cascade = v; + trapee.lineheight = vexi.ui.font.height(trapee.font, trapee.fontsize, "dp"); + } + + /** constrain track to minimum size of thumb */ + static.minthumbsizeWrite = function(v) { + cascade = v; + if (trapee.th_track) trapee.th_track[trapee.mindim] = v; + } + + /** return amount by which to shift a full page */ + static.pageshiftRead = function() { + if (trapee.viewport) return 0.9 * (trapee.viewport[trapee.dim]); + else return 0; + } + +</vexi> Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollpane.t (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollpane.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/gui/Scrollpane.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,222 @@ +<!-- Copyright 2015 - see COPYING for details [LGPL] --> + +<vexi xmlns:ui="vexi://ui" + xmlns:meta="vexi://meta" + xmlns="org.vexi.lib.gui"> + + <meta:doc> + <author>Charles Goodwin</author> + <fixme> + - toggling autohidehorizontal/vertical does not toggle autohide + - setting scrollhorizontal/vertical is not guarranteed as autohide + also sets the display properties on scrollbars + </fixme> + </meta:doc> + + <ui:Box> + + // public variables + thisbox.autohide; + thisbox.autohidehorizontal = false; + thisbox.autohidevertical = false; + thisbox.scrollhorizontal = true; + thisbox.scrollvertical = true; + + // theme variables + thisbox.th_hscroll; + thisbox.th_vscroll; + thisbox.th_viewport; + thisbox.th_uiport; + + /** reusable function for write traps that constrain the viewport to the contents */ + var constrainPaneH = function(v) { cascade = v; th_viewport.minwidth = th_viewport[0].contentwidth; } + + /** reusable function for write traps that constrain the viewport to the contents */ + var constrainPaneV = function(v) { cascade = v; th_viewport.minheight = th_viewport[0].contentheight; } + + // apply constrain traps + hshrink ++= constrainPaneH; + vshrink ++= constrainPaneV; + + /** set up horizontal scrollbar */ + th_hscroll ++= function(v) { + cascade = v; + + /** autohide th_hscroll */ + autohidehorizontal ++= function(a) { + if (v == autohidehorizontal) { + return; + } + v.autohide = a; + cascade = a; + } + + /** toggle horizontal scrollbar */ + scrollhorizontal ++= function(s) { + if (v.display != s) { + v.display = s; + } + if (s and v.viewport != th_viewport) { + v.viewport = th_viewport; + } + if (!s and v.viewport == th_viewport) { + v.viewport = null; + } + if (!th_viewport) { + return; + } + if (!s) { + if (scrollhorizontal) { + th_viewport[0].contentwidth ++= constrainPaneH; + } + } else { + th_viewport[0].contentwidth --= constrainPaneH; + } + cascade = s; + } + } + + /** set up vertical scrollbar */ + th_vscroll ++= function(v) { + cascade = v; + + /** autohide th_vscroll */ + autohidevertical ++= function(a) { + if (a == autohidevertical) { + return; + } + v.autohide = a; + cascade = a; + } + + /** toggle vertical scrollbar */ + scrollvertical ++= function(s) { + if (v.display != s) { + v.display = s; + } + if (s and v.viewport != th_viewport) { + v.viewport = th_viewport; + } + if (!s and v.viewport == th_viewport) { + v.viewport = null; + } + if (!th_viewport) { + return; + } + if (!s) { + if (scrollvertical) { + th_viewport[0].contentheight ++= constrainPaneV; + } + } else { + th_viewport[0].contentheight --= constrainPaneV; + } + cascade = s; + } + } + + /** set up viewport */ + th_viewport ++= function(v) { + // clean up existing viewport + if (th_viewport) { + if (!scrollhorizontal) { + th_viewport[0].width --= constrainPaneH; + } + if (!scrollvertical) { + th_viewport[0].height --= constrainPaneV; + } + } + // set up new viewport + cascade = v; + if (scrollhorizontal) { + th_hscroll.viewport = v; + } else { + v[0].width ++= constrainPaneH; + } + if (scrollvertical) { + th_vscroll.viewport = v; + } else { + v[0].height ++= constrainPaneV; + } + // usually these are the same + if (th_uiport==null) { + th_uiport = v; + } + } + + /** th_uiport is used in case the viewport is virtual + * in which case uiport represents the ui area that + * would otherwise be the viewport + */ + thisbox.th_uiport ++= function(v) { + cascade = v; + th_hscroll.uiport = v; + th_vscroll.uiport = v; + } + + // assign static traps + + thisbox.autohide ++= static.autohideWrite; + thisbox.autohide ++= static.autohideRead; + thisbox.scroll ++= static.scrollWrite; + thisbox.scroll ++= static.scrollRead; + thisbox.hinset ++= static.hinsetRead; + thisbox.vinset ++= static.vinsetRead; + thisbox.viewheight ++= static.viewheightRead; + thisbox.viewwidth ++= static.viewwidthRead; + thisbox.viewx ++= static.viewxRead; + thisbox.viewx ++= static.viewxWrite; + thisbox.viewy ++= static.viewyRead; + thisbox.viewy ++= static.viewyWrite; + + </ui:Box> + + /** write trap to set autohide on scrollbars */ + static.autohideWrite = function(v) { trapee.autohidehorizontal = v; trapee.autohidevertical = v; return; } + + /** read trap to return current autohide state */ + static.autohideRead = function() { return trapee.autohidehorizontal and trapee.autohidevertical; } + + /** write trap to enable or disable scrollbars */ + static.scrollWrite = function(v) { trapee.scrollhorizontal = v; trapee.scrollvertical = v; return; } + + /** read trap to return current scroll state */ + static.scrollRead = function() { return trapee.scrollhorizontal and trapee.scrollvertical; } + + var max = vexi.math.max; + var min = vexi.math.min; + + /** return horizontal inset caused by vertical scrollbar */ + static.hinsetRead = function() { return trapee.th_vscroll.display ? trapee.th_vscroll.width : 0; } + + /** return vertical inset caused by horizontal scrollbar */ + static.vinsetRead = function() { return trapee.th_hscroll.display ? trapee.th_hscroll.height : 0; } + + /** return the height of the viewport */ + static.viewheightRead = function() { return trapee.th_viewport.height; } + + /** return the width of the viewport */ + static.viewwidthRead = function() { return trapee.th_viewport.width; } + + /** set the view x offset */ + static.viewxWrite = function(v) { + var vp = trapee.th_viewport; + var ox = max(0, min(v, vp[0].width - vp.width)); + vp[0].x = -ox; + return; + } + + /** fetch the view x offset */ + static.viewxRead = function() { return -trapee.th_viewport[0].x; } + + /** set the view y offset */ + static.viewyWrite = function(v) { + var vp = trapee.th_viewport; + var oy = max(0, min(v, vp[0].height - vp.height)); + vp[0].y = -oy; + return; + } + + /** fetch the view y offset */ + static.viewyRead = function() { return -trapee.th_viewport[0].y; } + +</vexi> Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,375 +0,0 @@ -<!-- Copyright 2009 - see COPYING for details [LGPL] --> - -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="org.vexi.lib.role"> - <meta:doc> - <author>Charles Goodwin</author> - <usage> - * th_thumb should be a role.draggable - * viewport should have the structure: - <box layout="place"><box /></box> - </usage> - </meta:doc> - - <polarizable /> - <ui:box> - - // public variables - thisbox.lineheight = vexi.ui.font.height(font, fontsize, "dp"); - thisbox.mwheelshift = 4; - thisbox.pageshift; - thisbox.autohide; - thisbox.enabled = true; - thisbox.hide; - thisbox.minthumbsize; - thisbox.shift; - thisbox.uiport; - thisbox.viewport; - - // theme box variables - thisbox.th_back; - thisbox.th_next; - thisbox.th_thumb; - thisbox.th_track; - - // private variables - var listeners = {}; - var percent; - var percentset; - var trackpos; - - // for efficient lookups - var max = vexi.math.max; - var min = vexi.math.min; - var thumb, track; - var vport, varea; - - //////// - // sync functions - - /** sync viewport with thumb position */ - const syncViewport = function() { - if (vport and varea) - varea[pos] = percent * (vport[dim] - varea[dim]); - } - - /** sync specific listener with viewport position */ - const syncListener = function(v) { - if (v and v[0]) v[0][pos] = percent * (v[dim] - v[0][dim]); - } - - /** syncs all listeners with viewport position */ - const syncAllListeners = function(v) { - // BROKEN - disabling this, it prevents button from working (until thumb has been moved) - // Once motion is set it doesn't seem to get unset in normal use, so it seems like - // a useless check. -// if (motion) { - for (var key in listeners) { - if (v == key) continue; - syncListener(key); - } -// } - } - - /** sync thumb with viewport size and position */ - const syncThumb = function() { - // don't do much if we're hidden - if (hide) display = false; - // conditions where thumb placement is not [yet] desirable - else if (!surface || vport == null || varea == null || vport[dim] >= varea[dim]) { - if (enabled) enabled = false; - if (autohide) display = false; - else { - thumb[dim] = track[dim]; - thumb[pos] = 0; - } - // display, size, and place thumb - } else { - if (!enabled) enabled = true; - if (!display) display = true; - thumb[dim] = - max(minthumbsize, - min(track[dim], - (vport[dim] / varea[dim]) * track[dim])); - thumb[pos] = max(0, (track[dim] - thumb[dim]) * percent); - } - } - - //////// - // trap functions to invoke sync - - /** invokes sync funcs on all but listener trapee */ - const listenerMove = function(v) { - if (trapee[trapname] == v) return; - cascade = v; - if (percentset or !trapee.constrain) return; - percentset = true; - percent = trapee[0][pos] / (trapee[0][dim] - trapee[dim]); - syncAllListeners(trapee); - syncViewport(); - percentset = false; - } - - /** listener resized - sync with viewport */ - const listenerResize = function(v) { cascade = v; syncListener(trapee); } - - const syncThumbTrap = function(v) { cascade = v; syncThumb(); } - - const viewportMove = function(v) { - cascade = min(0, max(v, vport[dim] - varea[dim])); - if (percentset) return; - percentset = true; - percent = varea[pos] / (vport[dim] - varea[dim]); - syncThumb(); - syncAllListeners(); - percentset = false; - } - - /** viewport or varea resized */ - const viewportResize = function(v) { - var v0 = trapee[trapname]; - if(v==v0) return; - - cascade = v; - if (percentset) return; - // avoid resetting percent - percentset = true; - // viewport bigger than view subject - if (vport[dim] >= varea[dim]) varea[pos] = 0; - // constrain viewport position - else varea[pos] = -percent * (varea[dim] - vport[dim]); - // sync thumbsize to viewport - syncThumb(); - percentset = false; - } - - /** vertical mousewheel movement */ - const mwheelWrite = function(v) { - if (display and (track[dim] > thumb[dim])) { - shift = lineheight * v * mwheelshift; - return; - } - cascade = v; - } - - //////// - // public functions - - /** add listener (weak viewport) to the scrollbar */ - thisbox.addListener = function(v) { - listeners[v] = true; - v[dim] ++= listenerResize; - v[0][dim] ++= listenerResize; - v[0][pos] ++= listenerMove; - syncListener(v); - } - - /** remove listener (weak viewport) to the scrollbar */ - thisbox.removeListener = function(v) { - if (listeners[v] != null) { - listeners[v][dim] --= listenerResize; - listeners[v][0][dim] --= listenerResize; - listeners[v][0][pos] --= listenerMove; - (keysof(listeners)).remove(v); - } - } - - //////// - // public property traps - - autohide ++= syncThumbTrap; - minthumbsize ++= static.minthumbsizeWrite; - pageshift ++= static.pageshiftRead; - v_container ++= static.containerWrite; - - /** adjust scrollbar orient - "horizontal" or "vertical" */ - orient ++= function(v) { - if (v == orient) return; - cascade = v; - // reassign track traps - if (track) { - track[flip(dim)] --= syncThumbTrap; - track[dim] ++= syncThumbTrap; - track[flip(mindim)] = 0; - track[mindim] = minthumbsize; - } - // reassign viewport traps - if (vport) { - if (!varea) throw "viewport must have a child"; - // react to viewport resize - vport[flip(dim)] --= viewportResize; - vport[dim] ++= viewportResize; - // react to viewarea resize - varea[flip(dim)] --= viewportResize; - varea[dim] ++= viewportResize; - // react to viewarea movement - varea[flip(pos)] --= viewportMove; - varea[pos] ++= viewportMove; - } - // reassign uiport traps - if (uiport) { - uiport[flip(mousewheel)] --= mwheelWrite; - uiport[mousewheel] ++= mwheelWrite; - } - // reassign listener traps - const olddim = flip(dim); - const oldpos = flip(pos); - const newdim = dim; - const newpos = pos; - for (var key in listeners) { - dim = olddim; - pos = oldpos; - removeListener(key); - dim = newdim; - pos = newpos; - addListener(key); - } - } - - /** attempt to shift viewport by given amount */ - shift ++= function(v) { - varea[pos] = - min(0, - max(vport[dim] - varea[dim], - varea[pos] - v)); - return; - } - - /** set up viewport */ - viewport ++= function(v) { - // clean up old viewport - if (vport) { - if (!varea) throw "viewport must have a child"; - vport[dim] --= viewportResize; - varea[dim] --= viewportResize; - varea[pos] --= viewportMove; - } - // set up new viewport - if (v) { - if (!v[0]) throw "viewport must have a child"; - v[dim] ++= viewportResize; - v[0][dim] ++= viewportResize; - v[0][pos] ++= viewportMove; - } - cascade = v; - vport = v; - varea = v ? v[0] : null; - syncThumb(); - } - - /** set up ui port (see scrollpane uiport) in case viewport is virtual */ - uiport ++= function(v) { - if (uiport) { - uiport[mousewheel] --= mwheelWrite; - } - if (v) { - v[mousewheel] ++= mwheelWrite; - } - cascade = v; - } - - //////// - // theme trap assignments - - /** move up a line */ - const backAction = function(a) { shift = -(mwheelshift * lineheight); cascade = a; } - - /** set up back button */ - th_back ++= function(v) { - v.action ++= backAction; - v.focusable = false; - cascade = v; - } - - /** move down a line */ - const nextAction = function(a) { shift = mwheelshift * lineheight; cascade = a; } - - /** set up next button */ - th_next ++= function(v) { - v.action ++= nextAction; - v.focusable = false; - cascade = v; - } - - /** invokes a pageshift in appropriate direction */ - const trackAction = function(a) { - const trackpos = track.mouse[pos]; - if (thumb[pos] > trackpos) shift = -pageshift; - else if (trackpos > thumb[pos] + thumb[dim]) shift = pageshift; - cascade = a; - } - - /** set up track */ - th_track ++= function(v) { - v[dim] ++= syncThumbTrap; - v.action ++= trackAction; - v[mindim] = minthumbsize; - cascade = v; - track = v; - } - - /** thumb is moved by user */ - var lastpos; - var limitpos; - var startpos; - const thumbStart = function(v) { - motion = true; - startpos = v==1 ? thumb[pos] : varea[pos]; - limitpos = v==1 ? track[dim] - thumb[dim] : vport[dim] - varea[dim]; - return; - } - const thumbStop = function(v) { motion = false; lastpos = null; return; } - const thumbMove = function(d) { - // avoid duplicates (when flip(pos) changes) - if (d[pos] == lastpos) return; - lastpos = d[pos]; - // RMB drags relative to the content - if (d.button == 2) { - varea[pos] = min(0, max(limitpos, startpos - d[pos])); - return; - } - // LMB drags relative to the scrollbar - thumb[pos] = max(0, min(limitpos, startpos + d[pos])); - if (percentset) return; - // set percent according to thumb - percentset = true; - percent = thumb[pos] / (track[dim] - thumb[dim]); - syncViewport(); - syncAllListeners(); - percentset = false; - return; - } - - /** set up scrollbar thumb */ - th_thumb ++= function(v) { - v.dragUpdate ++= thumbMove; - v.dragStart ++= thumbStart; - v.dragStop ++= thumbStop; - v.dragButton = 2; - cascade = v; - thumb = v; - } - - </ui:box> - - /** scrollbars can not have content */ - static.containerWrite = function(v) { cascade = v; trapee.v_content = null; } - - /** updates the lineheight as used by mousewheel scrolling */ - static.fontWrite = function(v) { - cascade = v; - trapee.lineheight = vexi.ui.font.height(trapee.font, trapee.fontsize, "dp"); - } - - /** constrain track to minimum size of thumb */ - static.minthumbsizeWrite = function(v) { - cascade = v; - if (trapee.th_track) trapee.th_track[trapee.mindim] = v; - } - - /** return amount by which to shift a full page */ - static.pageshiftRead = function() { - if (trapee.viewport) return 0.9 * (trapee.viewport[trapee.dim]); - else return 0; - } - -</vexi> Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,233 +0,0 @@ -<!-- Copyright 2009 - see COPYING for details [LGPL] --> - -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="org.vexi.lib.widget" - xmlns:common="vexi.util.common"> - <meta:doc> - <author>Charles Goodwin</author> - <fixme> - - toggling autohidehorizontal/vertical does not toggle autohide - - setting scrollhorizontal/vertical is not guarranteed as autohide - also sets the display properties on scrollbars - </fixme> - </meta:doc> - - <ui:box> - - // public variables - thisbox.autohide; - thisbox.autohidehorizontal = false; - thisbox.autohidevertical = false; - thisbox.scrollhorizontal = true; - thisbox.scrollvertical = true; - - // theme variables - thisbox.th_hscroll; - thisbox.th_vscroll; - thisbox.th_viewport; - thisbox.th_uiport; - - /** reusable function for write traps that constrain the viewport to the contents */ - var constrainPaneH = function(v) { cascade = v; th_viewport.minwidth = th_viewport[0].contentwidth; } - - /** reusable function for write traps that constrain the viewport to the contents */ - var constrainPaneV = function(v) { cascade = v; th_viewport.minheight = th_viewport[0].contentheight; } - - // apply constrain traps - hshrink ++= constrainPaneH; - vshrink ++= constrainPaneV; - - /** set up horizontal scrollbar */ - th_hscroll ++= function(v) { - cascade = v; - - /** autohide th_hscroll */ - autohidehorizontal ++= function(a) { - if (v == autohidehorizontal) { - return; - } - v.autohide = a; - cascade = a; - } - - /** toggle horizontal scrollbar */ - scrollhorizontal ++= function(s) { - if (v.display != s) { - v.display = s; - } - if (s and v.viewport != th_viewport) { - v.viewport = th_viewport; - } - if (!s and v.viewport == th_viewport) { - v.viewport = null; - } - if (!th_viewport) { - return; - } - if (!s) { - if (scrollhorizontal) { - th_viewport[0].contentwidth ++= constrainPaneH; - } - } else { - th_viewport[0].contentwidth --= constrainPaneH; - } - cascade = s; - } - } - - /** set up vertical scrollbar */ - th_vscroll ++= function(v) { - cascade = v; - - /** autohide th_vscroll */ - autohidevertical ++= function(a) { - if (a == autohidevertical) { - return; - } - v.autohide = a; - cascade = a; - } - - /** toggle vertical scrollbar */ - scrollvertical ++= function(s) { - if (v.display != s) { - v.display = s; - } - if (s and v.viewport != th_viewport) { - v.viewport = th_viewport; - } - if (!s and v.viewport == th_viewport) { - v.viewport = null; - } - if (!th_viewport) { - return; - } - if (!s) { - if (scrollvertical) { - th_viewport[0].contentheight ++= constrainPaneV; - } - } else { - th_viewport[0].contentheight --= constrainPaneV; - } - cascade = s; - } - } - - /** set up viewport */ - th_viewport ++= function(v) { - // clean up existing viewport - if (th_viewport) { - if (!scrollhorizontal) { - th_viewport[0].width --= constrainPaneH; - } - if (!scrollvertical) { - th_viewport[0].height --= constrainPaneV; - } - } - // set up new viewport - cascade = v; - if (scrollhorizontal) { - th_hscroll.viewport = v; - } else { - v[0].width ++= constrainPaneH; - } - if (scrollvertical) { - th_vscroll.viewport = v; - } else { - v[0].height ++= constrainPaneV; - } - // usually these are the same - if (th_uiport==null) { - th_uiport = v; - } - } - - /** th_uiport is used in case the viewport is virtual - * in which case uiport represents the ui area that - * would otherwise be the viewport - */ - thisbox.th_uiport ++= function(v) { - cascade = v; - th_hscroll.uiport = v; - th_vscroll.uiport = v; - } - - // assign static traps - - thisbox.autohide ++= static.autohideWrite; - thisbox.autohide ++= static.autohideRead; - thisbox.scroll ++= static.scrollWrite; - thisbox.scroll ++= static.scrollRead; - thisbox.hinset ++= static.hinsetRead; - thisbox.vinset ++= static.vinsetRead; - thisbox.viewheight ++= static.viewheightRead; - thisbox.viewwidth ++= static.viewwidthRead; - thisbox.viewx ++= static.viewxRead; - thisbox.viewx ++= static.viewxWrite; - thisbox.viewy ++= static.viewyRead; - thisbox.viewy ++= static.viewyWrite; - - // TODO - remove these - - thisbox.getViewportHeight ++= common..noFunction; - thisbox.getViewportWidth ++= common..noFunction; - thisbox.getHorizontalInset ++= common..noFunction; - thisbox.getVerticalInset ++= common..noFunction; - thisbox.getOffset ++= common..noFunction; - thisbox.getXOffset ++= common..noFunction; - thisbox.getYOffset ++= common..noFunction; - thisbox.setOffset ++= common..noFunction; - thisbox.setXOffset ++= common..noFunction; - thisbox.setYOffset ++= common..noFunction; - - </ui:box> - - /** write trap to set autohide on scrollbars */ - static.autohideWrite = function(v) { trapee.autohidehorizontal = v; trapee.autohidevertical = v; return; } - - /** read trap to return current autohide state */ - static.autohideRead = function() { return trapee.autohidehorizontal and trapee.autohidevertical; } - - /** write trap to enable or disable scrollbars */ - static.scrollWrite = function(v) { trapee.scrollhorizontal = v; trapee.scrollvertical = v; return; } - - /** read trap to return current scroll state */ - static.scrollRead = function() { return trapee.scrollhorizontal and trapee.scrollvertical; } - - var max = vexi.math.max; - var min = vexi.math.min; - - /** return horizontal inset caused by vertical scrollbar */ - static.hinsetRead = function() { return trapee.th_vscroll.display ? trapee.th_vscroll.width : 0; } - - /** return vertical inset caused by horizontal scrollbar */ - static.vinsetRead = function() { return trapee.th_hscroll.display ? trapee.th_hscroll.height : 0; } - - /** return the height of the viewport */ - static.viewheightRead = function() { return trapee.th_viewport.height; } - - /** return the width of the viewport */ - static.viewwidthRead = function() { return trapee.th_viewport.width; } - - /** set the view x offset */ - static.viewxWrite = function(v) { - var vp = trapee.th_viewport; - var ox = max(0, min(v, vp[0].width - vp.width)); - vp[0].x = -ox; - return; - } - - /** fetch the view x offset */ - static.viewxRead = function() { return -trapee.th_viewport[0].x; } - - /** set the view y offset */ - static.viewyWrite = function(v) { - var vp = trapee.th_viewport; - var oy = max(0, min(v, vp[0].height - vp.height)); - vp[0].y = -oy; - return; - } - - /** fetch the view y offset */ - static.viewyRead = function() { return -trapee.th_viewport[0].y; } - -</vexi> Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollbar.t (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollbar.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollbar.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollbar.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,72 @@ +<!-- Copyright 2015 - see COPYING for details [LGPL] --> + +<vexi xmlns:ui="vexi://ui" + xmlns:lib="org.vexi.lib.gui" + xmlns:role="org.vexi.lib.role" + xmlns="vexi.theme"> + + <lib:Scrollbar /> + <ui:Box minthumbsize="8"> + <lib.Button id="back" width="16" height="16" repeats="true" shrink="true"> + <ui:Box layout="place"><ui:Box id="backimg" debug="true" shrink="true" /></ui:Box> + </lib.Button> + <role:Clickable id="track" align="topleft" enabled="true" fill=":.image.scrollbg" layout="place" repeats="true"> + <ui:Box id="shadow" fill="#c4c0b8" display="false" /> + <role:Draggable id="thumb"> + <Bevel fill=":.Settings..widgetfill" form="up" /> + </role:Draggable> + </role:Clickable> + <lib.Button id="next" width="16" height="16" repeats="true" shrink="true"> + <ui:Box layout="place"><ui:Box id="nextimg" debug="true" shrink="true" /></ui:Box> + </lib.Button> + + thisbox.th_back = $back; + thisbox.th_next = $next; + thisbox.th_thumb = $thumb; + thisbox.th_track = $track; + + /** set orient specific visual elements */ + thisbox.orient ++= function(v) { + cascade = v; + thisbox[shr] = false; + thisbox[flip(shr)] = true; + if (horizontal) { + $backimg.fill = .image.arrowleft; + $nextimg.fill = .image.arrowright; + } else { + $backimg.fill = .image.arrowup; + $nextimg.fill = .image.arrowdown; + } + } + + /** prevent thumb presses from activating track action */ + $track.Press1 ++= function(v) { if ($thumb.mouse.inside) return; cascade = v; } + + /** set shadow to cover track to one side of the thumb */ + var setShadow = function() { + var thumbpos = $thumb[pos]; + var thumbdim = $thumb[dim]; + var trackpos = $track.mouse[pos]; + if (thumbpos > trackpos) { + $shadow.display = true; + $shadow[dim] = $thumbpos; + $shadow[pos] = 0; + } else if (trackpos > thumbpos + thumbdim) { + $shadow.display = true; + $shadow[dim] = $track[dim] - thumbdim - thumbpos; + $shadow[pos] = thumbdim + thumbpos; + } + } + + /** trap function to invoke setShadow() */ + var syncShadow = function(v) { + cascade = v; + if (v) setShadow(); + else $shadow.display = false; + } + + $track.action ++= syncShadow; + $track.repeat ++= syncShadow; + + </ui:Box> +</vexi> Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollpane.t (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollpane.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollpane.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/Scrollpane.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,38 @@ +<!-- Copyright 2015 - see COPYING for details [LGPL] --> + +<vexi xmlns:ui="vexi://ui" + xmlns:lib="org.vexi.lib.gui" + xmlns="vexi.theme"> + + <lib:Scrollpane redirect=":$content"> + <ui:Box orient="vertical"> + <ui:Box id="view" align="topleft" layout="place"> + <ui:Box id="content" align="topleft" /> + </ui:Box> + <Scrollbar id="hscroll" orient="horizontal" /> + </ui:Box> + <ui:Box orient="vertical" hshrink="true"> + <Scrollbar id="vscroll" orient="vertical" /> + <ui:Box id="inset" fill=":.Settings..panefill" shrink="true" /> + </ui:Box> + + thisbox.v_fillbox = $content; + thisbox.th_hscroll = $hscroll; + thisbox.th_vscroll = $vscroll; + thisbox.th_viewport = $view; + + $hscroll.height ++= function(v) { $inset.height = v; cascade = v; } + $vscroll.width ++= function(v) { $inset.width = v; cascade = v; } + + // REMARK: once the scrollbars are shown, they fix the minimum size + // in order to prevent a loop where the scrollbars appear increasing + // the size of $view beyond the content size, hiding the scrollbars + + $hscroll.contentwidth ++= function(v) { $view.minwidth = v; cascade = v; } + $vscroll.contentheight ++= function(v) { $view.minheight = v; cascade = v; } + + $hscroll.display ++= function(v) { $inset.display = (v and $vscroll.display); cascade = v; } + $vscroll.display ++= function(v) { $inset.display = (v and $hscroll.display); cascade = v; } + + </lib:Scrollpane> +</vexi> Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/Button.t (from rev 4793, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/button.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/Button.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/Button.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,24 @@ +<!-- Copyright (c) - see COPYING for details [LGPL] --> + +<vexi xmlns:gui="org.vexi.lib.gui" + xmlns:role="org.vexi.lib.role" + xmlns="org.vexi.theme.classic"> + + // a no-frills button i.e. no focus, margin, padding etc + + <role:Clickable /> + <Bevel> + { + const button_ = .Button[""]; + active ++= button_.activeWrite; + hover ++= button_.normalWrite; + hover ++= button_.normalWrite; + normal ++= button_.normalWrite; + v_defaultSettings = static.defaultSettings; + } + </Bevel> + <gui:Defaults /> + + static.defaultSettings = { fill: .Settings..buttonfill }; + +</vexi> Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/button.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/button.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/lib/button.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,21 +0,0 @@ -<!-- Copyright (c) - see COPYING for details [LGPL] --> - -<vexi xmlns:lay="org.vexi.lib.layout" - xmlns:role="org.vexi.lib.role" - xmlns="org.vexi.theme.classic"> - - // a no-frills button i.e. no focus, margin, padding etc - - <role:Clickable /> - <Bevel> - - var button_static = .Button[""]; - active ++= button_static.activeWrite; - hover ++= button_static.normalWrite; - hover ++= button_static.normalWrite; - normal ++= button_static.normalWrite; - v_init = button_static.init; - - </Bevel> - <lay:container /> -</vexi> Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollbar.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollbar.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollbar.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,73 +0,0 @@ -<!-- Copyright 2011 - see COPYING for details [LGPL] --> - -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme" - xmlns:lib="org.vexi.lib.widget" xmlns:role="org.vexi.lib.role"> - <meta:doc> - <author>Charles Goodwin</author> - </meta:doc> - - <lib:scrollbar /> - <ui:box minthumbsize="8"> - <lib.button id="back" width="16" height="16" repeats="true" shrink="true"> - <ui:box layout="place"><ui:box id="backimg" debug="true" shrink="true" /></ui:box> - </lib.button> - <role:clickable id="track" align="topleft" enabled="true" fill=":.image.scrollbg" layout="place" repeats="true"> - <ui:box id="shadow" fill="#c4c0b8" display="false" /> - <role:draggable id="thumb"> - <bevel fill=":.settings..widgetfill" form="up" /> - </role:draggable> - </role:clickable> - <lib.button id="next" width="16" height="16" repeats="true" shrink="true"> - <ui:box layout="place"><ui:box id="nextimg" debug="true" shrink="true" /></ui:box> - </lib.button> - - thisbox.th_back = $back; - thisbox.th_next = $next; - thisbox.th_thumb = $thumb; - thisbox.th_track = $track; - - /** set orient specific visual elements */ - thisbox.orient ++= function(v) { - cascade = v; - thisbox[shr] = false; - thisbox[flip(shr)] = true; - if (horizontal) { - $backimg.fill = .image.arrowleft; - $nextimg.fill = .image.arrowright; - } else { - $backimg.fill = .image.arrowup; - $nextimg.fill = .image.arrowdown; - } - } - - /** prevent thumb presses from activating track action */ - $track.Press1 ++= function(v) { if ($thumb.mouse.inside) return; cascade = v; } - - /** set shadow to cover track to one side of the thumb */ - var setShadow = function() { - var thumbpos = $thumb[pos]; - var thumbdim = $thumb[dim]; - var trackpos = $track.mouse[pos]; - if (thumbpos > trackpos) { - $shadow.display = true; - $shadow[dim] = $thumbpos; - $shadow[pos] = 0; - } else if (trackpos > thumbpos + thumbdim) { - $shadow.display = true; - $shadow[dim] = $track[dim] - thumbdim - thumbpos; - $shadow[pos] = thumbdim + thumbpos; - } - } - - /** trap function to invoke setShadow() */ - var syncShadow = function(v) { - cascade = v; - if (v) setShadow(); - else $shadow.display = false; - } - - $track.action ++= syncShadow; - $track.repeat ++= syncShadow; - - </ui:box> -</vexi> Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollpane.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollpane.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/scrollpane.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,40 +0,0 @@ -<!-- Copyright 2011 - see COPYING for details [LGPL] --> - -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme" - xmlns:lib="org.vexi.lib.widget"> - <meta:doc> - <author>Charles Goodwin</author> - </meta:doc> - - <lib:scrollpane redirect=":$content"> - <ui:box orient="vertical"> - <ui:box id="view" align="topleft" layout="place"> - <ui:box id="content" align="topleft" /> - </ui:box> - <scrollbar id="hscroll" orient="horizontal" /> - </ui:box> - <ui:box orient="vertical" hshrink="true"> - <scrollbar id="vscroll" orient="vertical" /> - <ui:box id="inset" fill=":.settings..panefill" shrink="true" /> - </ui:box> - - thisbox.v_fillbox = $content; - thisbox.th_hscroll = $hscroll; - thisbox.th_vscroll = $vscroll; - thisbox.th_viewport = $view; - - $hscroll.height ++= function(v) { $inset.height = v; cascade = v; } - $vscroll.width ++= function(v) { $inset.width = v; cascade = v; } - - // REMARK: once the scrollbars are shown, they fix the minimum size - // in order to prevent a loop where the scrollbars appear increasing - // the size of $view beyond the content size, hiding the scrollbars - - $hscroll.contentwidth ++= function(v) { $view.minwidth = v; cascade = v; } - $vscroll.contentheight ++= function(v) { $view.minheight = v; cascade = v; } - - $hscroll.display ++= function(v) { $inset.display = (v and $vscroll.display); cascade = v; } - $vscroll.display ++= function(v) { $inset.display = (v and $hscroll.display); cascade = v; } - - </lib:scrollpane> -</vexi> Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollbar.t (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollbar.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollbar.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollbar.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,27 @@ +<!-- Copyright 2015 - see COPYING for details [LGPL] --> + +<vexi xmlns:meta="vexi://meta" + xmlns="vexi.theme"> + + <meta:doc> + <name>Scrollbar</name> + <desc>A scrollbar widget, commonly found in scrollpanes</desc> + <usage> + It is recommended that you use vexi.widget.scrollpane in most + cases, as you have to manually set up a scrollbar. + + To set up a scrollbar, you assign a box to the viewport property + of the scrollbar. The viewport box should contain a child box, + and the viewport layout as place and align being topleft. + + <Box id="vp" align="topleft" layout="place"> + <Box id="c" /> + </Box> + <Scrollbar id="s" /> + + $s.viewport = $viewport; + </usage> + </meta:doc> + + <Scrollbar /> +</vexi> Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollpane.t (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollpane.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollpane.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/gui/Scrollpane.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,17 @@ +<!-- Copyright 2015 - see COPYING for details [LGPL] --> + +<vexi xmlns:meta="vexi://meta" + xmlns="vexi.theme"> + + <meta:doc> + <name>Scrollpane</name> + <desc>A scrollpane widget</desc> + <usage> + Wrap scrollpane around a box/set of boxes to allow panning. + To hide scrollbars automatically, set autohidehorizontal and autohidevertical. + To disable scrollbars, unset scrollhorizontal or scrollvertical. + </usage> + </meta:doc> + + <Scrollpane /> +</vexi> Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollbar.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollbar.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollbar.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,27 +0,0 @@ -<!-- Copyright 2009 - see COPYING for details [LGPL] --> - -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns:theme="vexi.theme" - xmlns="org.vexi.lib.layout"> - <meta:doc> - <name>Scrollbar</name> - <desc>A scrollbar widget, commonly found in scrollpanes</desc> - <usage> - It is recommended that you use vexi.widget.scrollpane in most - cases, as you have to manually set up a scrollbar. - - To set up a scrollbar, you assign a box to the viewport property - of the scrollbar. The viewport box should contain a child box, - and the viewport layout as place and align being topleft. - - <ui:box id="vp" align="topleft" layout="place"> - <ui:box id="c" /> - </ui:box> - <scrollbar id="s" /> - - $s.viewport = $viewport; - </usage> - </meta:doc> - - <margin /> - <theme:scrollbar /> -</vexi> Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollpane.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollpane.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_main/vexi/widget/scrollpane.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,19 +0,0 @@ -<!-- Copyright 2009 - see COPYING for details [LGPL] --> - -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns:theme="vexi.theme" - xmlns="org.vexi.lib.layout"> - <meta:doc> - <name>Scrollpane</name> - <desc>A scrollpane widget</desc> - <usage> - Wrap scrollpane around a box/set of boxes to allow panning. - To hide scrollbars automatically, set autohidehorizontal and autohidevertical. - To disable scrollbars, unset scrollhorizontal or scrollvertical. - </usage> - </meta:doc> - - <margin /> - <theme:scrollpane /> - <pad /> - <container /> -</vexi> Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/gui/Scroll.t (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/scroll.t) =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/gui/Scroll.t (rev 0) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/gui/Scroll.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -0,0 +1,19 @@ +<!-- public domain --> + +<vexi xmlns:ui="vexi://ui" xmlns:img="poke.image" xmlns="vexi.gui"> + <Surface /> + <ui:Box frameheight="200"> + <ui:Box> + <Scrollbar orient="horizontal" /> + </ui:Box> + <Bevel form="down"> + <Scrollpane> + <ui:Box fill=":img.pacman_origin" shrink="true" /> + </Scrollpane> + </Bevel> + <ui:Box> + <Scrollbar orient="vertical" /> + </ui:Box> + vexi.ui.frame = thisbox; + </ui:Box> +</vexi> \ No newline at end of file Copied: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/image/pacman_origin.jpg (from rev 4785, branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/pacman_origin.jpg) =================================================================== (Binary files differ) Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/pacman_origin.jpg =================================================================== (Binary files differ) Deleted: branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/scroll.t =================================================================== --- branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/scroll.t 2015-05-12 21:58:49 UTC (rev 4795) +++ branches/vexi3_integrated_layout/org.vexi-vexi.widgets/src_poke/poke/widgets/scroll.t 2015-05-23 11:30:20 UTC (rev 4796) @@ -1,21 +0,0 @@ -<!-- public domain --> - -<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget"> - <w:surface /> - <ui:box frameheight="200"> - <ui:box> - <w:scrollbar orient="horizontal" /> - </ui:box> - <w:bevel form="down"> - <w:scrollpane> - <ui:box shrink="true"> - fill = .test["pacman_origin.jpg"]; - </ui:box> - </w:scrollpane> - </w:bevel> - <ui:box> - <w:scrollbar orient="vertical" /> - </ui:box> - vexi.ui.frame = thisbox; - </ui:box> -</vexi> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn