166
bool Window::RelayKeyboardMessage(bool (Window::*msg)(const KeyEvent&),const KeyEvent& ke)
166
bool Window::RelayKeyboardMessage(bool (Window::*msg)(const KeyEvent&), const KeyEvent& ke)
168
// Abgeleitete Klassen fragen, ob das Weiterleiten von Nachrichten erlaubt ist
169
// (IngameFenster könnten ja z.B. minimiert sein)
170
if(!IsMessageRelayAllowed())
173
// Alle Controls durchgehen
174
// Falls das Fenster dann plötzlich nich mehr aktiv ist (z.b. neues Fenster geöffnet, sofort abbrechen!)
175
for(std::map<unsigned int,Window*>::iterator it = idmap.begin(); it != idmap.end() && active; ++it)
177
if(it->second->visible && it->second->active)
178
if((it->second->*msg)(ke))
168
// Abgeleitete Klassen fragen, ob das Weiterleiten von Nachrichten erlaubt ist
169
// (IngameFenster könnten ja z.B. minimiert sein)
170
if(!IsMessageRelayAllowed())
173
// Alle Controls durchgehen
174
// Falls das Fenster dann plötzlich nich mehr aktiv ist (z.b. neues Fenster geöffnet, sofort abbrechen!)
175
for(std::map<unsigned int, Window*>::iterator it = idmap.begin(); it != idmap.end() && active; ++it)
177
if(it->second->visible && it->second->active)
178
if((it->second->*msg)(ke))
185
bool Window::RelayMouseMessage(bool (Window::*msg)(const MouseCoords&),const MouseCoords& mc)
185
bool Window::RelayMouseMessage(bool (Window::*msg)(const MouseCoords&), const MouseCoords& mc)
187
// Abgeleitete Klassen fragen, ob das Weiterleiten von Mausnachrichten erlaubt ist
188
// (IngameFenster könnten ja z.B. minimiert sein)
189
if(!IsMessageRelayAllowed())
192
bool processed = false;
194
// Alle Controls durchgehen
195
// Falls das Fenster dann plötzlich nich mehr aktiv ist (z.b. neues Fenster geöffnet, sofort abbrechen!)
196
// Use reverse iterator because the topmost (=last elements) should receive the messages first!
197
for(std::map<unsigned int,Window*>::reverse_iterator it = idmap.rbegin(); it != idmap.rend() && active; ++it)
199
if(locked_areas.size())
200
if(TestWindowInRegion(it->second, mc))
203
if(it->second->visible && it->second->active)
204
// Falls von einem Steuerelement verarbeitet --> abbrechen
205
if((it->second->*msg)(mc))
213
if(processed && msg == &Window::Msg_LeftDown)
215
for(std::map<unsigned int,Window*>::iterator it = idmap.begin(); it != idmap.end() && active; ++it)
217
if(locked_areas.size())
218
if(TestWindowInRegion(it->second, mc))
221
if(it->second->visible && it->second->active)
222
// Falls von einem Steuerelement verarbeitet --> abbrechen
223
it->second->Msg_LeftDown_After(mc);
187
// Abgeleitete Klassen fragen, ob das Weiterleiten von Mausnachrichten erlaubt ist
188
// (IngameFenster könnten ja z.B. minimiert sein)
189
if(!IsMessageRelayAllowed())
192
bool processed = false;
194
// Alle Controls durchgehen
195
// Falls das Fenster dann plötzlich nich mehr aktiv ist (z.b. neues Fenster geöffnet, sofort abbrechen!)
196
// Use reverse iterator because the topmost (=last elements) should receive the messages first!
197
for(std::map<unsigned int, Window*>::reverse_iterator it = idmap.rbegin(); it != idmap.rend() && active; ++it)
199
if(locked_areas.size())
200
if(TestWindowInRegion(it->second, mc))
203
if(it->second->visible && it->second->active)
204
// Falls von einem Steuerelement verarbeitet --> abbrechen
205
if((it->second->*msg)(mc))
213
if(processed && msg == &Window::Msg_LeftDown)
215
for(std::map<unsigned int,Window*>::iterator it = idmap.begin(); it != idmap.end() && active; ++it)
217
if(locked_areas.size())
218
if(TestWindowInRegion(it->second, mc))
221
if(it->second->visible && it->second->active)
222
// Falls von einem Steuerelement verarbeitet --> abbrechen
223
it->second->Msg_LeftDown_After(mc);
231
231
///////////////////////////////////////////////////////////////////////////////
342
342
/// fügt einen Text-ButtonCtrl hinzu.
343
ctrlTextButton *Window::AddTextButton(unsigned int id, unsigned short x, unsigned short y,unsigned short width, unsigned short height, const TextureColor tc,const std::string& text, glArchivItem_Font *font, const std::string& tooltip)
343
ctrlTextButton* Window::AddTextButton(unsigned int id, unsigned short x, unsigned short y, unsigned short width, unsigned short height, const TextureColor tc, const std::string& text, glArchivItem_Font* font, const std::string& tooltip)
349
width = ScaleX(width);
350
height = ScaleY(height);
349
width = ScaleX(width);
350
height = ScaleY(height);
353
return AddCtrl(id, new ctrlTextButton(this, id, x, y, width, height, tc, text,font,tooltip));
353
return AddCtrl(id, new ctrlTextButton(this, id, x, y, width, height, tc, text, font, tooltip));
356
356
/// fügt einen Color-ButtonCtrl hinzu.
357
ctrlColorButton *Window::AddColorButton(unsigned int id, unsigned short x, unsigned short y,unsigned short width, unsigned short height, const TextureColor tc, const unsigned int fillColor, const std::string& tooltip)
357
ctrlColorButton* Window::AddColorButton(unsigned int id, unsigned short x, unsigned short y, unsigned short width, unsigned short height, const TextureColor tc, const unsigned int fillColor, const std::string& tooltip)
363
width = ScaleX(width);
364
height = ScaleY(height);
363
width = ScaleX(width);
364
height = ScaleY(height);
367
return AddCtrl(id, new ctrlColorButton(this, id, x, y, width, height, tc, fillColor, tooltip));
367
return AddCtrl(id, new ctrlColorButton(this, id, x, y, width, height, tc, fillColor, tooltip));
371
371
/// fügt einen Image-ButtonCtrl hinzu.
372
ctrlImageButton *Window::AddImageButton(unsigned int id, unsigned short x, unsigned short y,unsigned short width, unsigned short height, const TextureColor tc,glArchivItem_Bitmap * const image, const std::string& tooltip)
372
ctrlImageButton* Window::AddImageButton(unsigned int id, unsigned short x, unsigned short y, unsigned short width, unsigned short height, const TextureColor tc, glArchivItem_Bitmap* const image, const std::string& tooltip)
378
width = ScaleX(width);
379
height = ScaleY(height);
378
width = ScaleX(width);
379
height = ScaleY(height);
382
return AddCtrl(id, new ctrlImageButton(this, id, x, y, width, height, tc, image,tooltip));
382
return AddCtrl(id, new ctrlImageButton(this, id, x, y, width, height, tc, image, tooltip));
697
ctrlProgress *Window::AddProgress(unsigned int id,
700
unsigned short width,
701
unsigned short height,
703
unsigned short button_minus,
704
unsigned short button_plus,
705
unsigned short maximum,
706
const std::string& tooltip,
707
unsigned short x_padding,
708
unsigned short y_padding,
709
unsigned int force_color,
710
const std::string& button_minus_tooltip,
711
const std::string& button_plus_tooltip)
697
ctrlProgress* Window::AddProgress(unsigned int id,
700
unsigned short width,
701
unsigned short height,
703
unsigned short button_minus,
704
unsigned short button_plus,
705
unsigned short maximum,
706
const std::string& tooltip,
707
unsigned short x_padding,
708
unsigned short y_padding,
709
unsigned int force_color,
710
const std::string& button_minus_tooltip,
711
const std::string& button_plus_tooltip)
717
width = ScaleX(width);
718
height = ScaleY(height);
717
width = ScaleX(width);
718
height = ScaleY(height);
721
return AddCtrl(id, new ctrlProgress(this, id, x, y, width, height, tc, button_minus, button_plus, maximum, x_padding, y_padding, force_color, tooltip, button_minus_tooltip, button_plus_tooltip));
721
return AddCtrl(id, new ctrlProgress(this, id, x, y, width, height, tc, button_minus, button_plus, maximum, x_padding, y_padding, force_color, tooltip, button_minus_tooltip, button_plus_tooltip));
724
724
///////////////////////////////////////////////////////////////////////////////
964
void Window::Draw3D(const unsigned short x,
965
const unsigned short y,
966
const unsigned short width,
967
const unsigned short height,
968
const TextureColor tc,
969
const unsigned short type,
970
const bool illuminated,
971
const bool draw_content)
964
void Window::Draw3D(const unsigned short x,
965
const unsigned short y,
966
const unsigned short width,
967
const unsigned short height,
968
const TextureColor tc,
969
const unsigned short type,
970
const bool illuminated,
971
const bool draw_content)
973
if(width < 4 || height < 4)
979
LOADER.GetImageN("io", 12 + tc)->Draw(x, y, width, 2, 0, 0, width, 2);
980
LOADER.GetImageN("io", 12 + tc)->Draw(x, y, 2, height, 0, 0, 2, height);
984
// Modulate2x anmachen
985
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
986
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
993
LOADER.GetImageN("io", tc*2)->Draw(x+2,y+2,width-4,height-4,0, 0, width-4,height-4);
995
LOADER.GetImageN("io", tc*2+1)->Draw(x+2,y+2,width-4,height-4,0, 0, width-4,height-4);
1000
// Modulate2x wieder ausmachen
1001
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
1004
glDisable(GL_TEXTURE_2D);
1006
glColor3f(0.0f,0.0f,0.0f);
1010
glVertex2i(x+width-1,y);
1011
glVertex2i(x+width-1,y+height);
1012
glVertex2i(x+width,y+height);
1013
glVertex2i(x+width,y);
1015
glVertex2i(x+width-2,y+1);
1016
glVertex2i(x+width-2,y+height);
1017
glVertex2i(x+width-1,y+height);
1018
glVertex2i(x+width-1,y+1);
1020
glVertex2i(x,y+height-1);
1021
glVertex2i(x,y+height);
1022
glVertex2i(x+width-2,y+height);
1023
glVertex2i(x+width-2,y+height-1);
1025
glVertex2i(x+1,y+height-2);
1026
glVertex2i(x+1,y+height-1);
1027
glVertex2i(x+width-2,y+height-1);
1028
glVertex2i(x+width-2,y+height-2);
1034
LOADER.GetImageN("io",12+tc)->Draw(x,y+height-2,width,2,0, 0, width,2);
1035
LOADER.GetImageN("io",12+tc)->Draw(x+width-2,y, 2,height,0, 0,2,height);
1039
// Modulate2x anmachen
1040
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
1041
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
1044
LOADER.GetImageN("io",tc*2+1)->Draw(x+2,y+2,width-4,2,0, 0, width-4,2);
1045
LOADER.GetImageN("io",tc*2+1)->Draw(x+2,y+2,2,height-4,0, 0, 2,height-4);
1047
LOADER.GetImageN("io",tc*2+1)->Draw(x+4,y+4,width-6,height-6,0, 0, width-6,height-6);
1051
// Modulate2x wieder ausmachen
1052
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
1055
glDisable(GL_TEXTURE_2D);
1057
glColor3f(0.0f,0.0f,0.0f);
1063
glVertex2i(x+width,y+1);
1064
glVertex2i(x+width,y);
1068
glVertex2i(x+width-1,y+2);
1069
glVertex2i(x+width-1,y+1);
1072
glVertex2i(x,y+height);
1073
glVertex2i(x+1,y+height);
1074
glVertex2i(x+1,y+2);
1076
glVertex2i(x+1,y+2);
1077
glVertex2i(x+1,y+height-1);
1078
glVertex2i(x+2,y+height-1);
1079
glVertex2i(x+2,y+2);
1084
glEnable(GL_TEXTURE_2D);
973
if(width < 4 || height < 4)
979
LOADER.GetImageN("io", 12 + tc)->Draw(x, y, width, 2, 0, 0, width, 2);
980
LOADER.GetImageN("io", 12 + tc)->Draw(x, y, 2, height, 0, 0, 2, height);
984
// Modulate2x anmachen
985
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
986
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
993
LOADER.GetImageN("io", tc * 2)->Draw(x + 2, y + 2, width - 4, height - 4, 0, 0, width - 4, height - 4);
995
LOADER.GetImageN("io", tc * 2 + 1)->Draw(x + 2, y + 2, width - 4, height - 4, 0, 0, width - 4, height - 4);
1000
// Modulate2x wieder ausmachen
1001
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
1004
glDisable(GL_TEXTURE_2D);
1006
glColor3f(0.0f, 0.0f, 0.0f);
1010
glVertex2i(x + width - 1, y);
1011
glVertex2i(x + width - 1, y + height);
1012
glVertex2i(x + width, y + height);
1013
glVertex2i(x + width, y);
1015
glVertex2i(x + width - 2, y + 1);
1016
glVertex2i(x + width - 2, y + height);
1017
glVertex2i(x + width - 1, y + height);
1018
glVertex2i(x + width - 1, y + 1);
1020
glVertex2i(x, y + height - 1);
1021
glVertex2i(x, y + height);
1022
glVertex2i(x + width - 2, y + height);
1023
glVertex2i(x + width - 2, y + height - 1);
1025
glVertex2i(x + 1, y + height - 2);
1026
glVertex2i(x + 1, y + height - 1);
1027
glVertex2i(x + width - 2, y + height - 1);
1028
glVertex2i(x + width - 2, y + height - 2);
1034
LOADER.GetImageN("io", 12 + tc)->Draw(x, y + height - 2, width, 2, 0, 0, width, 2);
1035
LOADER.GetImageN("io", 12 + tc)->Draw(x + width - 2, y, 2, height, 0, 0, 2, height);
1039
// Modulate2x anmachen
1040
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
1041
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
1044
LOADER.GetImageN("io", tc * 2 + 1)->Draw(x + 2, y + 2, width - 4, 2, 0, 0, width - 4, 2);
1045
LOADER.GetImageN("io", tc * 2 + 1)->Draw(x + 2, y + 2, 2, height - 4, 0, 0, 2, height - 4);
1047
LOADER.GetImageN("io", tc * 2 + 1)->Draw(x + 4, y + 4, width - 6, height - 6, 0, 0, width - 6, height - 6);
1051
// Modulate2x wieder ausmachen
1052
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
1055
glDisable(GL_TEXTURE_2D);
1057
glColor3f(0.0f, 0.0f, 0.0f);
1062
glVertex2i(x, y + 1);
1063
glVertex2i(x + width, y + 1);
1064
glVertex2i(x + width, y);
1066
glVertex2i(x, y + 1);
1067
glVertex2i(x, y + 2);
1068
glVertex2i(x + width - 1, y + 2);
1069
glVertex2i(x + width - 1, y + 1);
1071
glVertex2i(x, y + 2);
1072
glVertex2i(x, y + height);
1073
glVertex2i(x + 1, y + height);
1074
glVertex2i(x + 1, y + 2);
1076
glVertex2i(x + 1, y + 2);
1077
glVertex2i(x + 1, y + height - 1);
1078
glVertex2i(x + 2, y + height - 1);
1079
glVertex2i(x + 2, y + 2);
1084
glEnable(GL_TEXTURE_2D);
1087
1087
///////////////////////////////////////////////////////////////////////////////