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

msgBox.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 "msgBox.h"
00029 
00030 
00031 extern ControlEngine ce;
00032 
00033 MsgBox::MsgBox()
00034 {
00035         useCancel=TRUE;
00036         name="MsgBox";
00037         title="Question";
00038         title.useMax = FALSE;
00039         title.useMin = FALSE;
00040 
00041 
00042         title.btnClose.onButton.click.connect(this,OnClose);
00043         btnOk="Ok";
00044         btnOk.name="btnOk";
00045         btnOk.onButton.click.connect(this,OnButtonOk);
00046 
00047         btnCancel="Cancel";
00048         btnCancel.name="btnCancel";
00049         btnCancel.onButton.click.connect(this,OnClose);
00050 
00051         txtInfo="Information";
00052         txtInfo.name="txtInfo";
00053         txtInfo.isReadOnly=TRUE;
00054 
00055         txtHelp="Aide:\n\nUn MsgBox permet d'afficher des valeurs simples";
00056 
00057         txtTranche="MsgBox";
00058 }
00059 
00060 MsgBox::~MsgBox()
00061 {
00062 }
00063 
00064 void MsgBox::Create()
00065 {
00066         Window::Create();
00067         FaceNode *nodeCur;
00068         ce.Push(&client);
00069         nodeCur = ce.primitive.GoTo(FACE_FRONT);
00070                 // bouton OK
00071                 btnOk.Create(); // create doit il passer en parametre un layout ?
00072                 btnOk.Size(50,20);
00073                 btnOk.faceNode->elem->center.Set(0,1);
00074                 btnOk.faceNode->elem->position.x.Set(0,useCancel?1/4.0:0,&nodeCur->elem->computeSize.x);
00075                 btnOk.faceNode->elem->position.y.Set(2,-0.5,&nodeCur->elem->computeSize.y);
00076 
00077                 // bouton cancel
00078                 if (useCancel)
00079                 {
00080                         btnCancel.Create(); 
00081                         btnCancel.Size(50,20);
00082                         btnCancel.faceNode->elem->center.Set(0,1);
00083                         btnCancel.faceNode->elem->position.x.Set(0,-1/4.0,&nodeCur->elem->computeSize.x);
00084                         btnCancel.faceNode->elem->position.y.Set(2,-0.5,&nodeCur->elem->computeSize.y);
00085                 }
00086 
00087                 // text d'information
00088                 txtInfo.Create();
00089                 txtInfo.XDockCenter(2,0);
00090                 txtInfo.YDockTop(2,0);
00091 
00092                 txtInfo.faceNode->elem->size.y.Set(-26,1,&nodeCur->elem->computeSize.y);
00093         ce.Pop();
00094         ce.Push(this);
00095                 nodeCur = ce.primitive.GoTo(FACE_BACK);
00096                 // text aide
00097                 txtHelp.Create();
00098                 txtHelp.faceNode->elem->angle.z=180;
00099                 txtHelp.XDockCenter(2,2);
00100                 txtHelp.YDockCenter(2,2);
00101                 ce.primitive.GoToParent();
00102         
00103                 nodeCur = ce.primitive.GoTo(FACE_LEFT);
00104                 // text sur la tranche
00105                 txtTranche.Create();
00106                 txtTranche.text.scale=0.5;
00107                 txtTranche.text.material.SetDS(0,0,1);
00108                 txtTranche.faceNode->elem->angle.z=90;
00109                 txtTranche.faceNode->elem->size.x.Set(0,1,&nodeCur->elem->computeSize.y);
00110                 txtTranche.faceNode->elem->size.y.Set(0,1,&nodeCur->elem->computeSize.x);
00111         ce.Pop();
00112 }
00113 
00119 int MsgBox::OnButtonOk ()
00120 {
00121         Debug0Param("MsgBox::OnButtonOK");
00122         OnClose();
00123         return 0;
00124 }
00125 
00126 // bouton Cancel de la zone client clicker
00127 int MsgBox::OnClose()
00128 {
00129         Debug0Param ("MsgBox::OnClose");
00130         MsgBox::Delete();
00131         Window::OnClose();
00132         return 0;
00133 }

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