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

ExCWindowTitleBar.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 "ExCWindowTitleBar.h"
00024 //--------------------------------
00025 // Constructor // Destructor
00026 //--------------------------------
00027 ExCWindowTitleBar::ExCWindowTitleBar(ExCWindowObject *Parent,ExManagerTexture *Texture,ExCVec2D Size)
00028 {
00029 Guard(ExCWindowTitleBar::ExCWindowTitleBar(ExCWindowObject *Parent,ExManagerTexture *Texture,ExCVec2D Size);)
00030         ExCWindowObject::Init();        
00031         SetName("ExCWindowTitleBar");
00032         SetType(typeid(this).name());
00033         m_HasCloseButton=true;
00034         m_HasMaximizeButton=true;
00035         m_HasMinimizeButton=true;
00036         m_HasMinimizeToBarButton=true;
00037         Init();
00038         SetWindowSize(Size);
00039         ExCWindowContent::SetManagerTexture(Texture);
00040         ExCWindowObject::SetParrent(Parent);
00041 UnGuard
00042 }
00043 
00044 
00045 ExCWindowTitleBar::~ExCWindowTitleBar(void)
00046 {
00047 }
00048 //--------------------------------
00049 // Methode
00050 //--------------------------------
00051 void ExCWindowTitleBar::Init(void)
00052 {
00053 Guard(void ExCWindowTitleBar::Init(void))
00054         //-----------------------------
00055         //Create Bar
00056         //-----------------------------
00057         SetName("BarWindow");
00058         SetBackroundTexturing1(true,"bar");
00059         SetBackroundTexturing2(true,"back3");
00060         SetTextureIsMouving(true);
00061         SetTextureMouvingVec(ExCVec2D(0.0001f,0.0f));
00062         SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00063         SetBorderColor(ExCVec3D(0.5f,0.5f,0.5f));
00064         //------------------------------
00065 
00066         //------------------------------
00067         m_CloseButton = new ExCWindowButton;
00068         m_CloseButton->SetName("CloseButton");
00069         m_CloseButton->SetBackroundTexturing1(true,"ButtClose.bmp");
00070         m_CloseButton->SetBackroundTexturing2(false,"NONE");
00071         m_CloseButton->SetBackroundColor(ExCVec3D(0.5f,0.5f,0.5f));
00072         m_CloseButton->AddActionCommand(ExCAction(CLOSE_OBJECT_WINDOW),ExCCommand(MOUSE_LEFT_BUTTON_DOWN));
00073         AddObject(m_CloseButton);
00074         //------------------------------
00075         m_MaximizeButton = new ExCWindowButton;
00076         m_MaximizeButton->SetName("ButtMax");
00077         m_MaximizeButton->SetBackroundTexturing1(true,"ButtMax.bmp");
00078         m_MaximizeButton->SetBackroundTexturing2(false,"NONE");
00079         m_MaximizeButton->SetBackroundColor(ExCVec3D(0.5f,0.5f,0.5f));
00080         m_MaximizeButton->AddActionCommand(ExCAction(MAXIMIZE_OBJECT_WINDOW),ExCCommand(MOUSE_LEFT_BUTTON_DOWN));
00081         AddObject(m_MaximizeButton);
00082         //------------------------------
00083         m_MinimizeButton = new ExCWindowButton;
00084         m_MinimizeButton->SetName("ButtMin");
00085         m_MinimizeButton->SetBackroundTexturing1(true,"ButtMin.bmp");
00086         m_MinimizeButton->SetBackroundTexturing2(false,"NONE");
00087         m_MinimizeButton->SetBackroundColor(ExCVec3D(0.5f,0.5f,0.5f));
00088         m_MinimizeButton->AddActionCommand(ExCAction(MINIMIZE_OBJECT_WINDOW),ExCCommand(MOUSE_LEFT_BUTTON_DOWN));
00089         AddObject(m_MinimizeButton);
00090         //------------------------------
00091         m_MinimizeToBarButton = new ExCWindowButton;
00092         m_MinimizeToBarButton->SetName("ButtBar");
00093         m_MinimizeToBarButton->SetBackroundTexturing1(true,"ButtBar.bmp");
00094         m_MinimizeToBarButton->SetBackroundTexturing2(false,"NONE");
00095         m_MinimizeToBarButton->SetBackroundColor(ExCVec3D(0.5f,0.5f,0.5f));
00096         m_MinimizeToBarButton->AddActionCommand(ExCAction(MINIMIZE_TO_BAR_OBJECT_WINDOW),ExCCommand(MOUSE_LEFT_BUTTON_DOWN));
00097         AddObject(m_MinimizeToBarButton);
00098 
00099 
00100 
00101 UnGuard
00102 }
00103 
00104 void ExCWindowTitleBar::SetWindowSize(ExCVec2D Size)
00105 {
00106 Guard(void ExCWindowTitleBar::SetWindowSize(ExCVec2D Size))
00107         //ExCWindowObject::SetOldWindowSize(GetWindowSize());   
00108         ExCWindowObject::SetWindowSize(Size);   
00109         
00110         float buttonsize=GetWindowSize().GetY()-4;
00111         m_CloseButton->SetWindowSize(ExCVec2D(buttonsize,buttonsize));
00112         m_CloseButton->SetPosition(ExCVec2D(GetWindowSize().GetX()-buttonsize,1));
00113         m_MaximizeButton->SetWindowSize(ExCVec2D(buttonsize,buttonsize));
00114         m_MaximizeButton->SetPosition(ExCVec2D(GetWindowSize().GetX()-(buttonsize)*2-4,1));
00115         m_MinimizeButton->SetWindowSize(ExCVec2D(buttonsize,buttonsize));
00116         m_MinimizeButton->SetPosition(ExCVec2D(GetWindowSize().GetX()-(buttonsize)*3-8,1));
00117         m_MinimizeToBarButton->SetWindowSize(ExCVec2D(buttonsize,buttonsize));
00118         m_MinimizeToBarButton->SetPosition(ExCVec2D(GetWindowSize().GetX()-(buttonsize)*4-12,1));
00119 UnGuard
00120 }
00121 
00122 
00123 void ExCWindowTitleBar::Draw(void)
00124 {
00125 Guard(void ExCWindowTitleBar::Draw(void))
00126         ExCWindowObject::Draw();
00127         ExCWindowContent::Draw();
00128 UnGuard
00129 }
00130 
00131 ExCAction ExCWindowTitleBar::InputCommand(ExCCommand Command)
00132 {
00133 Guard(ExCAction ExCWindowTitleBar::InputCommand(ExCCommand Command))
00134 //std::cout<<"Bar"<<std::endl;
00135         return InputAction(ExCWindowContent::InputCommand(Command));
00136 UnGuard
00137 }
00138 
00139 ExCAction ExCWindowTitleBar::InputAction(ExCAction Action)
00140 {
00141 Guard(ExCAction ExCWindowTitleBar::InputAction(ExCAction Action))
00142         return ExCWindowContent::InputAction(Action);
00143 UnGuard
00144 }
00145 
00146 bool ExCWindowTitleBar::LoadFile(std::string FileName)
00147 {
00148 Guard(void ExCWindowTitleBar::LoadFile(std::string FileName))
00149         /*char                  buffer[255],b[255];
00150         std::string buffstring;
00151         std::ifstream file,fileButton,fileControl;
00152         #ifdef UNIX_SRC
00153         sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", FileName.data());
00154         #else
00155         sprintf(buffer, "../Data/Window/%s", FileName.data());
00156         #endif
00157         std::cout<<buffer<<std::endl;
00158         file.open(buffer,std::ios::in);
00159         if(file.is_open())
00160         {
00161                 memset(b,0,255);file.getline(b,256,'\n');
00162                 try
00163                 {
00164                         buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00165                         Load(&file);
00166                         //READ CLOSE BUTTON
00167                         memset(b,0,255);file.getline(b,256,'\n');
00168                         buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonClose>","<#FileForButtonClose>");
00169                         #ifdef UNIX_SRC
00170                         sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00171                         #else
00172                         sprintf(buffer, "../Data/Window/%s", buffstring.data());
00173                         #endif
00174                         fileButton.open(buffer,std::ios::in);
00175                         if(fileButton.is_open())
00176                         {
00177                                 memset(b,0,255);fileButton.getline(b,256,'\n');
00178                                 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00179                                 m_CloseButton->Load(&fileButton);
00180                                 m_CloseButton->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00181                         }fileButton.close();
00182                         //READ Maximize BUTTON
00183                         memset(b,0,255);file.getline(b,256,'\n');
00184                         buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonMaximize>","<#FileForButtonMaximize>");
00185 #ifdef UNIX_SRC
00186                         sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00187 #else
00188                         sprintf(buffer, "../Data/Window/%s", buffstring.data());
00189 #endif
00190                         fileButton.open(buffer,std::ios::in);
00191                         if(fileButton.is_open())
00192                         {
00193                                 memset(b,0,255);fileButton.getline(b,256,'\n');
00194                                 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00195                                 m_MaximizeButton->Load(&fileButton);
00196                                 m_MaximizeButton->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00197                         }fileButton.close();
00198                         //READ Minimize BUTTON
00199                         memset(b,0,255);file.getline(b,256,'\n');
00200                         buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonMinimize>","<#FileForButtonMinimize>");
00201 #ifdef UNIX_SRC
00202                         sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00203 #else
00204                         sprintf(buffer, "../Data/Window/%s", buffstring.data());
00205 #endif
00206                         fileButton.open(buffer,std::ios::in);
00207                         if(fileButton.is_open())
00208                         {
00209                                 memset(b,0,255);fileButton.getline(b,256,'\n');
00210                                 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00211                                 m_MinimizeButton->Load(&fileButton);
00212                                 m_MinimizeButton->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00213                         }fileButton.close();
00214                         //READ MinimizeToBar BUTTON
00215                         memset(b,0,255);file.getline(b,256,'\n');
00216                         buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonMinimizeToBar>","<#FileForButtonMinimizeToBar>");
00217 #ifdef UNIX_SRC
00218                         sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00219 #else
00220                         sprintf(buffer, "../Data/Window/%s", buffstring.data());
00221 #endif
00222                         fileButton.open(buffer,std::ios::in);
00223                         if(fileButton.is_open())
00224                         {
00225                                 memset(b,0,255);fileButton.getline(b,256,'\n');
00226                                 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00227                                 //ReadWindowObject(win->GetButtonMinimizeToBar(),&fileButton);
00228                                 m_MinimizeToBarButton->Load(&fileButton);
00229                                 m_MinimizeToBarButton->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00230                         }fileButton.close();
00231 
00232                         
00233                 }catch(ExCExpStringNotFound)
00234                 {
00235                         std::cout<<"ReadWindowSubObject::ExCExpStringNotFound";
00236                 }
00237         }else throw   ExCExpFileNotFound();
00238         file.close();
00239                 */
00240                 return true;
00241 UnGuard
00242 }

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