Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

taskWindow.cpp

Go to the documentation of this file.
00001 /* *************************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2003-2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html
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                 // text sur la tranche
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;//200;
00099         double deltaY = face->computeSize.y;//200;
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                         //if (yPos>deltaY) return; // en dehors du conteneur
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 }

Generated on Fri Aug 20 19:19:49 2004 for 3d Controls by doxygen 1.3.6