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

ExCWindowEditLabel.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 "ExCWindowEditLabel.h"
00024 //--------------------------------
00025 // Constructor // Destructor
00026 //--------------------------------
00027 ExCWindowEditLabel::ExCWindowEditLabel(void)
00028 {
00029 Guard(ExCWindowEditLabel::ExCWindowEditLabel(void))
00030         Init();
00031 UnGuard
00032 }
00033 
00034 ExCWindowEditLabel::ExCWindowEditLabel(ExCVec2D Size,ExCVec2D Position)
00035 {
00036 Guard(ExCWindowEditLabel::ExCWindowEditLabel(ExCVec2D Size,ExCVec2D Position))
00037         Init();
00038         SetPosition(Position);
00039         SetOldPosition(Position);
00040         SetWindowSize(Size);
00041         SetOldWindowSize(Size);
00042 UnGuard
00043 }
00044 
00045 ExCWindowEditLabel::~ExCWindowEditLabel(void)
00046 {
00047 }
00048 //--------------------------------
00049 // Methode
00050 //--------------------------------
00051 void ExCWindowEditLabel::Init(void)
00052 {
00053 Guard(void ExCWindowEditLabel::Init(void))
00054         ExCWindowLabel::Init();
00055         SetName("ExCWindowLabel");
00056         SetType(typeid(this).name());
00057         SetWindowTitle("Edit Label");
00058         m_GetText=false;
00059 UnGuard
00060 }
00061 void ExCWindowEditLabel::Draw(void)
00062 {
00063 //Guard(void ExCWindowEditLabel::Draw(void))
00064         int time=0.01*glutGet(GLUT_ELAPSED_TIME);
00065         //std::cout<<"Time:"<<time<<std::endl;
00066         if((time%4)==0&&m_GetText)
00067         {
00068                 m_WindowTitle=m_WindowTitle+"|";        
00069         }
00070         ExCWindowObject::Draw();
00071         if((time%4)==0&&m_GetText)
00072         {
00073                 m_WindowTitle.resize(m_WindowTitle.size()-1);
00074         }
00075 //UnGuard
00076 }
00077 
00078 ExCAction ExCWindowEditLabel::InputCommand(ExCCommand Command)
00079 {
00080 Guard(ExCAction ExCWindowEditLabel::InputCommand(ExCCommand Command))
00081         std::cout<<"ExCWindowEditLabel::Input Command window:"<<Command.m_Command<<std::endl;
00082         if(m_GetText)
00083         {
00084                 std::string bufferstring;
00085                 ExNihilo::AddKeyToBuffer(Command.m_Command,bufferstring);
00086                 m_WindowTitle=m_WindowTitle+bufferstring;
00087                 std::cout<<"Add:"<<bufferstring<<std::endl;
00088         }
00089         switch(Command.m_Command) 
00090         {
00091         case KEYBOARD_DOWN_BACKSPACE:
00092                 if(m_WindowTitle.size()>0)
00093                 {
00094                         m_WindowTitle.resize(m_WindowTitle.size()-1);
00095                 }
00096                 break;
00097         case KEYBOARD_DOWN_ENTER:
00098                 m_GetText=false;
00099                 //return RELEASE_FOCUS_OBJECT_WINDOW;
00100                 break;
00101         case MOUSE_LEFT_BUTTON_DOWN:
00102                 m_GetText=true;
00103                 //return REQUEST_FOCUS_OBJECT_WINDOW;
00104                 //request focus until enter is pressed
00105                 break;
00106 /*      case WINDOW_LOSE_FOCUS:
00107                 std::cout<<"Lose focus"<<std::endl;
00108                 m_GetText=false;
00109         case WINDOW_GET_FOCUS:
00110                 std::cout<<"Get focus"<<std::endl;
00111                 m_GetText=true;*/
00112         }
00113 
00114         for(unsigned int i=0;i<m_VecCommandAction.size();i++)
00115         {
00116                 if(m_VecCommandAction.at(i).first.m_Command==Command.m_Command)
00117                 {
00118                         return InputAction(m_VecCommandAction.at(i).second);
00119                 }
00120         }
00121 
00122         return NOTHING;
00123 UnGuard
00124 }
00125 
00126 ExCAction ExCWindowEditLabel::InputAction(ExCAction Action)
00127 {
00128 Guard(ExCAction ExCWindowEditLabel::InputAction(ExCAction Action))
00129         switch(Action.m_Action) 
00130         {
00131         /*case CUSTOM_ACTION_2:
00132                 
00133                 break;
00134         case CUSTOM_ACTION_3:
00135                 m_GetText=true;
00136                 break;
00137         case CUSTOM_ACTION_4:
00138                 m_GetText=false;
00139                 break;*/
00140         default :
00141                 return Action;
00142         }       
00143         return NOTHING;
00144 UnGuard
00145 }

Généré le Tue Oct 28 12:43:33 2003 pour ExNihilo par doxygen 1.3.4