00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "gui/components/startmenu.h"
00019
00020 char *menu[] = {"Game - X","Calculator","Editor","Run Command","Shut Down"};
00021 char *file[] = {"\\explorer","\\calc","\\editor","\\run",""};
00022
00023 void startmenu::startmenu_init()
00024 {
00025 start_opened = _false;
00026
00027 no_option = 5;
00028 width = 120;
00029 height = (no_option +1) * MENU_Y_OFFSET + DEFAULT_EMBOSS_SIZE;
00030 x = START_X;
00031 y = SCREEN_HEIGHT - height;
00032
00033 skincolor = TASKBAR_COLOR;
00034
00035 bk_buf = (COLOR *)kmalloc((width+2) * (height+2) * 2);
00036 }
00037
00038 void startmenu::draw()
00039 {
00040 DW i, j;
00041
00042 restoreImage(mcurx,mcury);
00043
00044 if(start_opened == _true)
00045 {
00046
00047 getimage(x,y,width+2,height+2,bk_buf);
00048
00049 fillrect(x,y,width,height,skincolor);
00050 emboss3D(x,y,width,height,LEFT|TOP|RIGHT,_false,2);
00051
00052 for(i=0;i<no_option;i++)
00053 {
00054 cprint(x+MENU_X_OFFSET,y+(i+1)*MENU_Y_OFFSET,menu[i],0x0);
00055 }
00056
00057
00058 emboss3D(START_X,SCREEN_HEIGHT + START_Y,START_WIDTH,START_HEIGHT,0,_true,2);
00059 }
00060 else
00061 {
00062 putimage(x,y,width+2,height+2,bk_buf);
00063 emboss3D(START_X,SCREEN_HEIGHT + START_Y,START_WIDTH,START_HEIGHT,0,_false,2);
00064 }
00065
00066 if(mouse_inited)
00067 {
00068 getimage(mcurx,mcury,16,16, &mouseimg[0][0]);
00069
00070 for(i = mcurx ; i < mcurx+16 ; i++)
00071 {
00072 for(j = mcury ; j < mcury+16 ; j++)
00073 {
00074 if(mouseptr[j-mcury][i-mcurx])
00075 {
00076 setPixel(i,j,0x0);
00077 }
00078 }
00079 }
00080 }
00081
00082 }
00083
00084
00085 SDB startmenu::processClick(DW _x, DW _y)
00086 {
00087
00088 DW i;
00089
00090 if(iswithin(_x,_y,START_X,SCREEN_HEIGHT + START_Y,START_WIDTH,START_HEIGHT))
00091 {
00092 if(start_opened == _true)
00093 {
00094 start_opened = _false;
00095 }
00096 else
00097 start_opened = _true;
00098
00099 draw();
00100 return 0;
00101 }
00102
00103 if(start_opened == _true)
00104 {
00105 if(iswithin(_x,_y,x,y,width,height))
00106 {
00107 for(i=0;i<no_option;i++)
00108 {
00109 if(iswithin(_x,_y,x+MENU_X_OFFSET,y+(i+1)*MENU_Y_OFFSET,width,MENU_Y_OFFSET))
00110 {
00111 if(i == 4)
00112 {
00113
00114 asm("hlt");
00115 }
00116 ginfo(500,100,menu[i]);
00117
00118 __asm__ __volatile__("pushl %%eax"::"a"(file[i]));
00119 asm("movl $0x1, %eax");
00120 asm("int $0x30");
00121 }
00122 }
00123 start_opened = _false;
00124 draw();
00125 return 0;
00126 }
00127 else
00128 {
00129 start_opened = _false;
00130 draw();
00131 return -1;
00132 }
00133 }
00134 return -1;
00135 }