Revision: 4725 http://sourceforge.net/p/vexi/code/4725 Author: clrg Date: 2014-09-06 23:53:57 +0000 (Sat, 06 Sep 2014) Log Message: ----------- Datepicker - highlight weekends - cursor = "hand" on valid selections
Modified Paths: -------------- branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datepicker.t Modified: branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datepicker.t =================================================================== --- branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datepicker.t 2014-09-05 21:14:48 UTC (rev 4724) +++ branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datepicker.t 2014-09-06 23:53:57 UTC (rev 4725) @@ -1,4 +1,4 @@ -<!-- Copyright 2013 - see COPYING for details [LGPL] --> +<!-- Copyright 2014 - see COPYING for details [LGPL] --> <vexi xmlns:ui="vexi://ui" xmlns:lay="vexi.layout" @@ -9,43 +9,77 @@ <role:focusable /> <util:date /> - <ui:box orient="vertical"> - <ui:box fill="white" vshrink="true"> + <ui:Box orient="vertical"> + <ui:Box fill="white" vshrink="true"> <button id="decmonth" focusable="false" hshrink="true"> - <lay:pad padding="4 3"><ui:box fill=":image.arrowleft" /></lay:pad> + <lay:pad padding="4 3"><ui:Box fill=":image.arrowleft" /></lay:pad> </button> - <ui:box id="month" /> + <ui:Box id="month" /> <button id="incmonth" focusable="false" hshrink="true"> - <lay:pad padding="4 3"><ui:box fill=":image.arrowright" /></lay:pad> + <lay:pad padding="4 3"><ui:Box fill=":image.arrowright" /></lay:pad> </button> <button id="decyear" focusable="false" hshrink="true"> - <lay:pad padding="4 3"><ui:box fill=":image.arrowleft" /></lay:pad> + <lay:pad padding="4 3"><ui:Box fill=":image.arrowleft" /></lay:pad> </button> - <ui:box id="year" /> + <ui:Box id="year" /> <button id="incyear" focusable="false" hshrink="true"> - <lay:pad padding="4 3"><ui:box fill=":image.arrowright" /></lay:pad> + <lay:pad padding="4 3"><ui:Box fill=":image.arrowright" /></lay:pad> </button> <button id="close" focusable="false" hshrink="true"> - <lay:pad padding="4 2"><ui:box fill=":image.close" /></lay:pad> + <lay:pad padding="4 2"><ui:Box fill=":image.close" /></lay:pad> </button> - </ui:box> - <ui:box fill="black" height="1" vshrink="true" /> - <lay:pad padding="5 0" vshrink="true"> - <ui:box text="S" textcolor="#888888" /> - <ui:box text="M" textcolor="#888888" /> - <ui:box text="T" textcolor="#888888" /> - <ui:box text="W" textcolor="#888888" /> - <ui:box text="T" textcolor="#888888" /> - <ui:box text="F" textcolor="#888888" /> - <ui:box text="S" textcolor="#888888" /> - </lay:pad> - <ui:box fill="black" height="1" vshrink="true" /> + </ui:Box> + <ui:Box fill="black" height="1" vshrink="true" /> + <ui:Box height="5"> + <ui:Box fill="#dedede" /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box fill="#dedede" /> + </ui:Box> + <ui:Box vshrink="true"> + <ui:Box text="S" textcolor="#888888" fill="#dedede" /> + <ui:Box text="M" textcolor="#888888" /> + <ui:Box text="T" textcolor="#888888" /> + <ui:Box text="W" textcolor="#888888" /> + <ui:Box text="T" textcolor="#888888" /> + <ui:Box text="F" textcolor="#888888" /> + <ui:Box text="S" textcolor="#888888" fill="#dedede" /> + </ui:Box> + <ui:Box height="5"> + <ui:Box fill="#dedede" /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box fill="#dedede" /> + </ui:Box> + <ui:Box fill="black" height="1" vshrink="true" /> + <ui:Box height="5"> + <ui:Box fill="#dedede" /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box fill="#dedede" /> + </ui:Box> <ui:Box id="base" align="topleft" layout="layer"> - <lay:pad padding="5 0"> - <lay:grid id="dategrid" cols="7" /> - </lay:pad> + <lay:grid id="dategrid" cols="7" /> <ui:Box id="circle" display="false" fill=":image.datecircle" shrink="true" /> </ui:Box> + <ui:Box height="5"> + <ui:Box fill="#dedede" /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box /> + <ui:Box fill="#dedede" /> + </ui:Box> /** * required because mouse press on the popbox would @@ -90,14 +124,17 @@ //nextmonthdays = showmonth==12 ? getDaysInMonth(showyear+1, 1) : getDaysInMonth(showyear, showmonth+1); // establish month length var i=0; - var j=0; - // reset leading days - while (showweekday>i) { $dategrid[i][0].text = " "; i++; } - // set active day dates - while (9+showweekday>i) { $dategrid[i][0].text = ' '+(i+1-showweekday); i++; } - while (showmonthdays+showweekday>i) { $dategrid[i][0].text = i+1-showweekday; i++; } - // reset trailing days - while (42>i) { $dategrid[i][0].text = " "; i++; } + for (var i=0; 42>i; i++) { + var b = $dategrid[i]; + if ((showweekday>i) or (i>showmonthdays+showweekday)) { + // reset leading/trailing days + b[0].text = " "; + b.cursor = null; + } else { + b[0].text = i+1-showweekday; + b.cursor = "hand"; + } + } $month.text = getMonthName(showmonth); $year.text = showyear; @@ -184,7 +221,9 @@ b.active ++= static.activeTrap; b.hover ++= static.hoverTrap; b.normal ++= static.normalTrap; - b.isCurrent = isCurrent; + b.isCurrent = isCurrent; // function + // highlight sat/sun + b.isWeekend = (i%7 == 0) or (i%7 == 6); $dategrid.add(b); } } @@ -210,16 +249,18 @@ } } - </ui:box> + </ui:Box> + const getFill = function(box) { return box.isWeekend ? "#dedede" : "white"; } + static.activeTrap = function(v) { - trapee.fill = trapee[0].text == " " ? "white" : "lightblue"; + trapee.fill = trapee[0].text != " " ? "lightblue" : getFill(trapee); trapee[0].textcolor = "black"; cascade = v; } static.hoverTrap = function(v) { - trapee.fill = trapee[0].text == " " ? "white" : "lightgreen"; + trapee.fill = trapee[0].text != " " ? "lightgreen" : getFill(trapee); trapee[0].textcolor = "black"; cascade = v; } @@ -229,7 +270,7 @@ trapee.fill = "darkblue"; trapee[0].textcolor = "white"; } else { - trapee.fill = "white"; + trapee.fill = getFill(trapee); trapee[0].textcolor = "black"; } cascade = v; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn