00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "ExCWindowMessageBox.h"
00024
00025
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
00072
00073 void ExCWindowMessageBox::Draw(void)
00074 {
00075 Guard(void ExCWindowMessageBox::Draw(void))
00076
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
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
00102 return InputAction(m_TitleBar.InputCommand(Command));
00103 }
00104 if(m_Window.PointInWindow(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)))
00105 {
00106
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
00121
00122
00123
00124
00125
00126
00127 return Action;
00128 UnGuard
00129 }
00130
00131