Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #include "../../stdafx.h"
00013 #include "script_window.hpp"
00014 #include "script_game.hpp"
00015 #include "../../window_func.h"
00016 #include "../../window_gui.h"
00017
00018 void ScriptWindow::Close(WindowClass window, uint32 number)
00019 {
00020 if (ScriptGame::IsMultiplayer()) return;
00021
00022 if (number == NUMBER_ALL) {
00023 DeleteWindowByClass((::WindowClass)window);
00024 return;
00025 }
00026
00027 DeleteWindowById((::WindowClass)window, number);
00028 }
00029
00030 bool ScriptWindow::IsOpen(WindowClass window, uint32 number)
00031 {
00032 if (ScriptGame::IsMultiplayer()) return false;
00033
00034 if (number == NUMBER_ALL) {
00035 return (FindWindowByClass((::WindowClass)window) != NULL);
00036 }
00037
00038 return FindWindowById((::WindowClass)window, number) != NULL;
00039 }
00040
00041 void ScriptWindow::Highlight(WindowClass window, uint32 number, uint8 widget, TextColour colour)
00042 {
00043 if (ScriptGame::IsMultiplayer()) return;
00044 if (number == NUMBER_ALL) return;
00045 if (!IsOpen(window, number)) return;
00046 if (colour != TC_INVALID && (::TextColour)colour >= ::TC_END) return;
00047
00048 Window *w = FindWindowById((::WindowClass)window, number);
00049
00050 if (widget == WIDGET_ALL) {
00051 if (colour != TC_INVALID) return;
00052 w->DisableAllWidgetHighlight();
00053 return;
00054 }
00055
00056 const NWidgetBase *wid = w->GetWidget<NWidgetBase>(widget);
00057 if (wid == NULL) return;
00058 w->SetWidgetHighlight(widget, (::TextColour)colour);
00059 }