00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "ExCWindowTitleBar.h"
00024
00025
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
00050
00051 void ExCWindowTitleBar::Init(void)
00052 {
00053 Guard(void ExCWindowTitleBar::Init(void))
00054
00055
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
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
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
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 return true;
00241 UnGuard
00242 }