00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "3d.h"
00020 #include "input.h"
00021 #include "controlEngine.h"
00022 #include "myList.h"
00023 #include "texture.h"
00024 #include "button.h"
00025 #include "textBox.h"
00026 #include "container.h"
00027 #include "window.h"
00028 #include "taskWindow.h"
00029
00030
00031 extern ControlEngine ce;
00032
00033 TaskWindow::TaskWindow()
00034 {
00035 name="TaskWindow";
00036
00037 title.SetText("Task");
00038 title.useClose = FALSE;
00039 title.useMax = FALSE;
00040
00041 txtTranche="Task";
00042 }
00043
00044 TaskWindow::~TaskWindow()
00045 {
00046 }
00047
00048 void TaskWindow::Create()
00049 {
00050 Window::Create(20);
00051 Size(200,200);
00052 XDockLeft(0,200);
00053 YDockBottom(0,150);
00054 Move(0,0,-25);
00055 Rotate(0,45,0);
00056
00057 FaceNode *nodeCur;
00058 ce.Push(this);
00059 nodeCur = ce.primitive.GoTo(FACE_RIGHT);
00060
00061 txtTranche.Create();
00062 txtTranche.text.scale=0.5;
00063 txtTranche.text.material.SetDS(0,0,1);
00064 txtTranche.faceNode->elem->angle.z=90;
00065 txtTranche.faceNode->elem->size.x.Set(0,1,&nodeCur->elem->computeSize.y);
00066 txtTranche.faceNode->elem->size.y.Set(0,1,&nodeCur->elem->computeSize.x);
00067 ce.Pop();
00068 }
00069
00070 BOOL TaskWindow::Add(Title *title)
00071 {
00072 ce.Push(&client);
00073 FaceNode *node = ce.primitive.GoTo(FACE_FRONT);
00074 ElemTaskWindow *elem = tasks.i.AddNewLast();
00075 elem->title = title;
00076 elem->button.Create();
00077 elem->button.SetText(title->caption->GetText());
00078 elem->button.text.SetWrapping(FALSE,FALSE,TRUE);
00079 elem->button.onButton.click.connect(title,Title::OnOriginal);
00080 ce.Pop();
00081 Refresh();
00082 return TRUE;
00083 }
00084
00091 void TaskWindow::Refresh()
00092 {
00093 ElemTaskWindow *elem;
00094 double xSize=70,ySize=30;
00095 double xPos=2,yPos=2;
00096
00097 Face * face = client.faceNode->Elems(FACE_FRONT);
00098 double deltaX = face->computeSize.x;
00099 double deltaY = face->computeSize.y;
00100 for (tasks.i=0;tasks.i.More();tasks.i++)
00101 {
00102 elem = tasks.i.GetElemPtr();
00103 if ((xPos+xSize)>deltaX)
00104 {
00105 xPos=2;
00106 yPos+=ySize+2;
00107
00108 }
00109 elem->button.XDockLeft(xPos,xSize);
00110 elem->button.YDockTop(yPos,ySize);
00111 xPos+=xSize+2;
00112 }
00113 }
00114
00115 int TaskWindow::Find(Title *title)
00116 {
00117 ElemTaskWindow *elem;
00118 for (tasks.i=0;tasks.i.More();tasks.i++)
00119 {
00120 elem = tasks.i.GetElemPtr();
00121 if (elem->title==title) return tasks.i.GetIndex();
00122 }
00123 return -1;
00124 }
00125
00128 BOOL TaskWindow::Restore(Title *title)
00129 {
00130 int num = Find(title);
00131 if (num==-1) return FALSE;
00132
00133 ce.timerRefresh.onTimer.connect(this,OnTimerSupr);
00134 return TRUE;
00135 }
00136
00137 int TaskWindow::OnTimerSupr(Timer *)
00138 {
00139 Debug0Param("TaskWindow::OnTimerSupr()");
00140 ce.timerRefresh.onTimer.disconnect(this);
00141 ce.pickingCursor.ResetCurrent();
00142 tasks.i.Supr();
00143 Refresh();
00144 return 0;
00145 }