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("ExCWindowEditLabel");
00056         SetType(typeid(this).name());
00057         SetWindowTitle("Edit Label");
00058         m_GetText=false;
00059         std::cout<<"plok"<<std::endl;
00060 UnGuard
00061 }
00062 
00063 void ExCWindowEditLabel::Draw(void)
00064 {
00065 //Guard(void ExCWindowEditLabel::Draw(void))
00066         int time=0.01*glutGet(GLUT_ELAPSED_TIME);
00067         //std::cout<<"Time:"<<time<<std::endl;
00068         if((time%4)==0&&m_GetText)
00069         {
00070                 m_WindowTitle=m_WindowTitle+"|";        
00071         }
00072         ExCWindowObject::Draw();
00073         if((time%4)==0&&m_GetText)
00074         {
00075                 m_WindowTitle.resize(m_WindowTitle.size()-1);
00076         }
00077 //UnGuard
00078 }
00079 
00080 ExCAction ExCWindowEditLabel::InputCommand(ExCCommand Command)
00081 {
00082 Guard(ExCAction ExCWindowEditLabel::InputCommand(ExCCommand Command))
00083         std::cout<<"ExCWindowEditLabel::Input Command window:"<<Command.m_Command<<std::endl;
00084         if(m_GetText)
00085         {
00086                 std::string bufferstring;
00087                 ExNihilo::AddKeyToBuffer(Command.m_Command,bufferstring);
00088                 m_WindowTitle=m_WindowTitle+bufferstring;
00089                 std::cout<<"Add:"<<bufferstring<<std::endl;
00090         }
00091         switch(Command.m_Command) 
00092         {
00093         case KEYBOARD_DOWN_BACKSPACE:
00094                 if(m_WindowTitle.size()>0)
00095                 {
00096                         m_WindowTitle.resize(m_WindowTitle.size()-1);
00097                 }
00098                 break;
00099         case KEYBOARD_DOWN_ENTER:
00100                 m_GetText=false;
00101                 //return RELEASE_FOCUS_OBJECT_WINDOW;
00102                 break;
00103         case MOUSE_LEFT_BUTTON_DOWN:
00104                 m_GetText=true;
00105                 //return REQUEST_FOCUS_OBJECT_WINDOW;
00106                 //request focus until enter is pressed
00107                 break;
00108 /*      case WINDOW_LOSE_FOCUS:
00109                 std::cout<<"Lose focus"<<std::endl;
00110                 m_GetText=false;
00111         case WINDOW_GET_FOCUS:
00112                 std::cout<<"Get focus"<<std::endl;
00113                 m_GetText=true;*/
00114         }
00115 
00116         for(unsigned int i=0;i<m_VecCommandAction.size();i++)
00117         {
00118                 if(m_VecCommandAction.at(i).first.m_Command==Command.m_Command)
00119                 {
00120                         return InputAction(m_VecCommandAction.at(i).second);
00121                 }
00122         }
00123 
00124         return NOTHING;
00125 UnGuard
00126 }
00127 
00128 ExCAction ExCWindowEditLabel::InputAction(ExCAction Action)
00129 {
00130 Guard(ExCAction ExCWindowEditLabel::InputAction(ExCAction Action))
00131         switch(Action.m_Action) 
00132         {
00133         /*case CUSTOM_ACTION_2:
00134                 
00135                 break;
00136         case CUSTOM_ACTION_3:
00137                 m_GetText=true;
00138                 break;
00139         case CUSTOM_ACTION_4:
00140                 m_GetText=false;
00141                 break;*/
00142         default :
00143                 return Action;
00144         }       
00145         return NOTHING;
00146 UnGuard
00147 }

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