Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/WolfireGames/overgrowth.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Source/GUI/IMUI/im_events.cpp')
-rw-r--r--Source/GUI/IMUI/im_events.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/Source/GUI/IMUI/im_events.cpp b/Source/GUI/IMUI/im_events.cpp
new file mode 100644
index 00000000..41d65898
--- /dev/null
+++ b/Source/GUI/IMUI/im_events.cpp
@@ -0,0 +1,53 @@
+//-----------------------------------------------------------------------------
+// Name: im_events.cpp
+// Developer: Wolfire Games LLC
+// Description:
+// License: Read below
+//-----------------------------------------------------------------------------
+//
+//
+// Copyright 2022 Wolfire Games LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-----------------------------------------------------------------------------
+#include "im_events.h"
+
+#include <GUI/IMUI/imgui.h>
+#include <GUI/IMUI/im_element.h>
+
+IMEvents imevents;
+
+void IMEvents::RegisterListener( IMEventListener *listener ) {
+ listeners.push_back(listener);
+}
+
+void IMEvents::DeRegisterListener( IMEventListener *listener ) {
+ for( int i = listeners.size()-1; i >= 0; i-- ) {
+ if( listeners[i] == listener ) {
+ listeners.erase(listeners.begin()+i);
+ }
+ }
+}
+
+void IMEvents::TriggerDestroyed(IMElement* elem) {
+ for( unsigned i = 0; i < listeners.size(); i++ ) {
+ listeners[i]->DestroyedIMElement(elem);
+ }
+}
+
+void IMEvents::TriggerDestroyed(IMGUI* imgui) {
+ for( unsigned i = 0; i < listeners.size(); i++ ) {
+ listeners[i]->DestroyedIMGUI(imgui);
+ }
+}