Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Membres des namespaces | Composants | Déclarations

# ExCWindowMessageBox.cpp

Aller à la documentation de ce fichier.

    00001 /*
    00002  * ExNihilo 3D Engine
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  *
    00018  * Please read AUTHORS file !!!
    00019  *
    00020  *
    00021  */
    00022
    00023 #include "ExCWindowMessageBox.h"
    00024 //--------------------------------
    00025 // Constructor // Destructor
    00026 //--------------------------------
    00027 ExCWindowMessageBox::ExCWindowMessageBox(void)
    00028 {
    00029 Guard(ExCWindowMessageBox::ExCWindowMessageBox(void))
    00030         Init();
    00031 UnGuard
    00032 }
    00033
    00034 ExCWindowMessageBox::ExCWindowMessageBox(std::string Message)
    00035 {
    00036 Guard(ExCWindowMessageBox::ExCWindowMessageBox(std::string Message))
    00037         Init();
    00038         m_Message=Message;
    00039         RefreshSize();
    00040         RefreshPosotion();
    00041 UnGuard
    00042 }
    00043
    00044 void ExCWindowMessageBox::Init(void)
    00045 {
    00046 Guard(void ExCWindowMessageBox::Init(void))
    00047         ExCWindow::Init();
    00048         SetName("ExCWindow");
    00049         SetType(typeid(this).name());
    00050         SetPosition(ExCVec2D(ExNihilo::GetResolutionX()/2-150,(ExNihilo::GetResolutionY()/2)-50));
    00051         SetOldPosition(ExCVec2D(ExNihilo::GetResolutionX()/2-150,(ExNihilo::GetResolutionY()/2)-50));
    00052         SetWindowSize(ExCVec2D(300,100));
    00053         SetOldWindowSize(ExCVec2D(300,100));
    00054         m_Window.SetBackroundColor(ExCVec3D(0.5f,0.5f,0.5f));
    00055         m_Window.SetBorderColor(ExCVec3D(0.2f,0.2f,0.2f));
    00056         m_OkButton = new ExCWindowButton;
    00057         m_OkButton->SetWindowSize(ExCVec2D(50,20));
    00058         m_OkButton->SetPosition(ExCVec2D(125,50));
    00059         m_OkButton->SetWindowTitle("   OK   ");
    00060         m_OkButton->ShowWindowTitle(true);
    00061         m_OkButton->AddActionCommand(ExCAction(CLOSE_OBJECT_WINDOW),ExCCommand(MOUSE_LEFT_BUTTON_DOWN));
    00062         m_Window.AddObjectControl(m_OkButton);
    00063 UnGuard
    00064 }
    00065
    00066 ExCWindowMessageBox::~ExCWindowMessageBox(void)
    00067 {
    00068 }
    00069
    00070 //--------------------------------
    00071 // Methode
    00072 //--------------------------------
    00073 void ExCWindowMessageBox::Draw(void)
    00074 {
    00075 Guard(void ExCWindowMessageBox::Draw(void))
    00076         //std::cout<<"Draw ExCWindowMessageBox"<<std::endl;
    00077         ExNihilo::EnterOrthoMode();
    00078         glPushAttrib(GL_ALL_ATTRIB_BITS);
    00079                 glDisable(GL_LIGHTING);
    00080                 m_Window.Draw();
    00081                 glColor3f(0.0f,0.0f,0.0f);
    00082                 ExNihilo::WriteToScreen(m_Position.GetX()+5,m_Position.GetY()+5+m_WindowSize.GetY()/2,m_Message);
    00083         glPopAttrib();
    00084         ExNihilo::LeaveOrthoMode();
    00085 UnGuard
    00086 }
    00087
    00088
    00089
    00090 ExCAction ExCWindowMessageBox::InputCommand(ExCCommand Command)
    00091 {
    00092 Guard(ExCAction ExCWindowMessageBox::InputCommand(ExCCommand Command))
    00093         //std::cout<<"ExCWindow::Input Command window:"<<Command.m_Command<<std::endl;
    00094         switch(Command.m_Command)
    00095         {
    00096         case KEYBOARD_DOWN_ENTER:
    00097                 return CLOSE_OBJECT_WINDOW;
    00098         default :
    00099                 if(m_TitleBar.PointInWindow(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)))
    00100                 {
    00101                         //std::cout<<"Dans la bar"<<std::endl;
    00102                         return InputAction(m_TitleBar.InputCommand(Command));
    00103                 }
    00104                 if(m_Window.PointInWindow(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)))
    00105                 {
    00106                         //std::cout<<"Dans la fenetre"<<std::endl;
    00107                         return InputAction(m_Window.InputCommand(Command));
    00108                 }
    00109
    00110                 break;
    00111         }
    00112
    00113         return NOTHING;
    00114 UnGuard
    00115 }
    00116
    00117 ExCAction ExCWindowMessageBox::InputAction(ExCAction Action)
    00118 {
    00119 Guard(ExCAction ExCWindowMessageBox::InputAction(ExCAction Action))
    00120         /*switch(Action.m_Action)
    00121         {
    00122         default:
    00123                 return Action;
    00124         }
    00125         if(Action.m_NextAction){return *Action.m_NextAction;}
    00126         else{return NOTHING;}*/
    00127         return Action;
    00128 UnGuard
    00129 }
    00130
    00131