var skin="skins\\alfred-like\\";
var SkinWidth=500;
var SkinHeight=300;
var SkinBorder=10;
function draw(ui)
{
// set the text color
ui.textcolor=0x88000000;
ui.fontsize=12;
// draw the canvas
ui.drawBitmap(skin+"background.png", 0, 0, SkinWidth, SkinHeight);
// draw the input box
// HELP > ----------------------------------------------------------
// HELP >
// HELP > ui.fontsize=16; /* doesnt affect the size of the input box below */
// HELP > ----------------------------------------------------------
ui.drawInput(30,42,SkinWidth-((SkinBorder+10)*2),15);
// now draw the items - pane one
if(qatapult.argscount==1)
{
drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
//ui.drawBitmap(skin+"next.png",190,SkinHeight - 37, 15, 15);
}
// now draw the items - pane two
if (qatapult.argscount==2)
{
drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
drawItem(ui,1, SkinBorder + 200, SkinHeight - 47, 150, 36);
ui.drawBitmap(skin+"next.png",190,SkinHeight - 37, 15, 15);
}
// now draw the items - pane three
if (qatapult.argscount==3)
{
drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
drawItem(ui,1, SkinBorder + 200, SkinHeight - 47, 150, 36);
drawItem(ui,2, SkinBorder + 350, SkinHeight - 47, 150, 36);
ui.drawBitmap(skin+"next.png",340,SkinHeight - 37, 15, 15);
}
// draw results box
if(/*qatapult.resultsvisible && */qatapult.resultscount!=0)
{
var resultscount=Math.min(5,qatapult.resultscount);
// HELP > ----------------------------------------------------------
// HELP > can we change the background or color of the results box?
// HELP > I have am using a white skin so that it matchs the background of the results
// HELP > ----------------------------------------------------------
// HELP > ----------------------------------------------------------
// HELP > can the size of the items be set. If it where smaller i could fit in more results
// HELP > ----------------------------------------------------------
ui.drawResults(SkinBorder,65,(SkinWidth/2) - SkinBorder,SkinHeight -(100+SkinBorder));
}
if(qatapult.argscount>1)
{
// whats the type?
type = qatapult.getArgValue(0, "type")
if (type == "TEXT")
{
// set text size and color
ui.fontsize=8;
ui.textcolor=0x88000000;
// draw the frame - this can be used for images or something.
ui.drawBitmap(skin+"frame.png",320 ,65, 107, 91);
// display some info in text
status = qatapult.getArgValue(0, "status")
email = qatapult.getArgValue(0, "email")
text = qatapult.getArgValue(0, "text")
ui.drawText("type : "+type, SkinWidth/2 + SkinBorder,160,200,15); // seams static in the wrong position ?
ui.drawText("status : "+status, SkinWidth/2 + SkinBorder,180,200,15); // seams centered?
ui.drawText("email : "+email, SkinWidth/2 + SkinBorder,200,200,15); // seams static in the wrong position ?
ui.drawText("text : "+text, SkinWidth/2 + SkinBorder,220,200,15); // seams centered?
ui.fontsize=12;
// the first result at the bottom in free text is white. ? Add it here instead.
ui.drawText(status, SkinBorder + 20,SkinHeight - 47, 150, 36);
}
if (type == "FILE")
{
// set text size and color
ui.fontsize=14;
ui.textcolor=0x88000000;
// draw the Icon
drawItem(ui,0,320 ,65, 107, 91);
// display some info in text
filedir = qatapult.getArgValue(0, "rdirectory")
filename = qatapult.getArgValue(0, "rfilename")
ui.drawText(filename, SkinWidth/2 + SkinBorder,160,200,25);
ui.fontsize=8;
ui.drawText("directory : ", SkinWidth/2 + SkinBorder,190,200,15);
ui.drawText(filedir, SkinWidth/2 + SkinBorder,205,200,30);
ui.fontsize=12;
}
if (type == "WINDOW")
{
// set text size and color
ui.fontsize=8;
ui.textcolor=0x88000000;
// draw the frame - this can be used for images or something.
ui.drawBitmap(skin+"frame.png",320 ,65, 107, 91);
// display some info in text
winTitle = qatapult.getArgValue(0, "title")
winHWD = qatapult.getArgValue(0, "hwnd")
text = qatapult.getArgValue(0, "text")
ui.drawText(winTitle, SkinWidth/2 + SkinBorder,160,200,15); // seams static in the wrong position ?
ui.drawText("Windows Handle : "+winHWD, SkinWidth/2 + SkinBorder,180,200,15); // seams centered?
ui.fontsize=12;
}
else
{
drawItem(ui,0,320 ,65, 107, 91);
}
}
// draw the menu button
ui.drawBitmap(skin+"ui-radio-button.png", SkinWidth-40, SkinBorder, 16, 16);
// drawn index progress
ui.fontsize=8;
ui.textcolor=0x88000000;
if(qatapult.crawlprogress!=0 && qatapult.crawlprogress!=100)
ui.drawText("Updating index : "+qatapult.crawlprogress+"%",SkinBorder,SkinBorder,SkinWidth-(SkinBorder*2),15)
// this drew status line - opting out of this as i dont know where to put it at the moment
/*
var focus=qatapult.getFocus();
ui.drawEmphased(qatapult.getArgValue(focus,"status"),qatapult.getQuery(focus),15,SkinHeight-20,SkinWidth-30,10);
*/
// determine the mode - will add support for this later.
/*
if(qatapult.textmode)
{
//ui.drawBitmap(skin+"textbackground.png", 0, 0, 350, 200);
//ui.drawInput(25,25,305,138);
//height=200;
}
else
{
//ui.textcolor=0xFF000000;
// draw the background according to the number of current args
if(qatapult.argscount<3)
{
//ui.drawBitmap(skin+"background.png", 0, 0, 350, 120);
//height=120;
}
else
{
//ui.drawBitmap(skin+"background_3.png", 0, 0, 350, 170);
//height=170;
}
}
*/
}
function drawItem(ui,i,x,y,w,h) {
if(qatapult.getArgValue(i,"type")=="TEXT") {
// HELP > ----------------------------------------------------------
// HELP > free text always appears in white. Dont know how to set the color?
// ui.drawItem(i,x+5,y+5,w-10,h-20);
} else {
// draw the item visual and draw it's label below
ui.drawItem(i,x+2,y+2,h-4,h-4);
var text="";
//if(qatapult.getArgValue(i,"email")!="")
// var text=" <"+qatapult.getArgValue(i,"email")+">";
ui.drawEmphased(qatapult.getArgValue(i,"text")+text,qatapult.getQuery(i),x+h,y+10,w-2*h,30);
}
}
function onClick(x,y) {
if(x>SkinWidth-(SkinBorder*2) && x<SkinWidth-(SkinBorder*2)+16 && y>SkinBorder && y<SkinBorder+20)
qatapult.showmenu(x,y);
}