forked from enlightenment/enlightenment
now uses .e_epplets.bits.db for main epplet positioning
SVN revision: 5938
This commit is contained in:
parent
3ecca04798
commit
3b7aab7dea
|
@ -10,50 +10,112 @@ uses String, Time;
|
|||
/* global vars */
|
||||
global {
|
||||
object epp;
|
||||
object dateObj;
|
||||
string theDay = "";
|
||||
}
|
||||
|
||||
/* function to update clock display */
|
||||
function clock_update(object data, number val){
|
||||
string date = String.copySection(Time.ctime(Time.time()),8,20);
|
||||
string time = String.copySection(Time.ctime(Time.time()),11,20);
|
||||
/* function to update time display */
|
||||
function time_update(object data, number val){
|
||||
string date = Time.ctime(Time.time());
|
||||
string month = String.copySection(date,4,7);
|
||||
string day = String.copySection(date,8,10);
|
||||
string year = String.copySection(date,20,24);
|
||||
string time = String.copySection(date,11,20);
|
||||
number hour = String.toLong(String.copySection(time,0,2));
|
||||
string min = String.copySection(time,3,5);
|
||||
string seconds = String.copySection(time,6,8);
|
||||
string timeofday = "AM";
|
||||
|
||||
if(hour=>12){
|
||||
if(hour>12||hour==12){
|
||||
timeofday = "PM";
|
||||
hour -= 12;
|
||||
hour = hour - 12;
|
||||
}
|
||||
if(hour==0) hour = 12;
|
||||
|
||||
data.setText("$hour $min $seconds $timeofday");
|
||||
epp.addTimer("clockTimer",0.5,"clock_update",0,data);
|
||||
|
||||
/* Is it time to update the date? */
|
||||
if(day!=theDay){
|
||||
theDay = day;
|
||||
switch(month){
|
||||
case "Jan":
|
||||
month = "January";
|
||||
break;
|
||||
case "Feb":
|
||||
month = "February";
|
||||
break;
|
||||
case "Mar":
|
||||
month = "March";
|
||||
break;
|
||||
case "Apr":
|
||||
month = "April";
|
||||
break;
|
||||
case "Jun":
|
||||
month = "June";
|
||||
break;
|
||||
case "Jul":
|
||||
month = "July";
|
||||
break;
|
||||
case "Aug":
|
||||
month = "August";
|
||||
break;
|
||||
case "Sep":
|
||||
month = "September";
|
||||
break;
|
||||
case "Oct":
|
||||
month = "October";
|
||||
break;
|
||||
case "Nov":
|
||||
month = "November";
|
||||
break;
|
||||
case "Dec":
|
||||
month = "December";
|
||||
break;
|
||||
}
|
||||
dateObj.setText("$month $day, $year");
|
||||
}
|
||||
|
||||
|
||||
data.setText("$hour:$min:$seconds $timeofday");
|
||||
epp.addTimer("clockTimer",0.5,"time_update",0,data);
|
||||
}
|
||||
|
||||
/* main function */
|
||||
|
||||
/* declare vars */
|
||||
object clock;
|
||||
object timeObj;
|
||||
object backgroundObj;
|
||||
|
||||
/* create a new epplet */
|
||||
epp = new Epplet();
|
||||
|
||||
/* move the epplet to desired position*/
|
||||
epp.move(epp.getViewW() - 250, 0);
|
||||
epp.resize(100, 30);
|
||||
|
||||
/* create background image object for clock */
|
||||
backgroundObj = new EvasObject(epp);
|
||||
backgroundObj.addImage(epp.getEppletDir()+"clock.png");
|
||||
backgroundObj.move(epp.getX(),epp.getY());
|
||||
backgroundObj.setLayer(9998);
|
||||
backgroundObj.show();
|
||||
|
||||
/* create text object for clock display */
|
||||
clock = new EvasObject(epp);
|
||||
clock.addText("plank",15,"");
|
||||
/*clock.addText("borzoib",13,"");*/
|
||||
clock.move(epp.getX()+2, epp.getY()+2);
|
||||
clock.setLayer(9999);
|
||||
clock.setColor(0,0,0,140);
|
||||
clock.show();
|
||||
timeObj = new EvasObject(epp);
|
||||
timeObj.addText("borzoib",6,"Hi");
|
||||
timeObj.move(epp.getX()+epp.getW()-40, epp.getY()+4);
|
||||
timeObj.setLayer(9999);
|
||||
timeObj.setColor(0,0,0,140);
|
||||
timeObj.show();
|
||||
|
||||
/* create text object for date display */
|
||||
dateObj = new EvasObject(epp);
|
||||
dateObj.addText("borzoib",6,"Hello");
|
||||
dateObj.move(epp.getX()+epp.getW()-60,epp.getY()+12);
|
||||
dateObj.setLayer(9999);
|
||||
dateObj.setColor(0,0,0,140);
|
||||
dateObj.show();
|
||||
|
||||
/* update clock display */
|
||||
clock_update(clock,0);
|
||||
time_update(timeObj,0);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue