Quellcode durchsuchen

Button, which has a link, now will handle it

rsredsq vor 10 Jahren
Ursprung
Commit
66600ebfd6
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen
  1. 8 0
      Source/Atomic/UI/UIButton.cpp

+ 8 - 0
Source/Atomic/UI/UIButton.cpp

@@ -3,6 +3,7 @@
 #include <TurboBadger/tb_widgets_common.h>
 #include <TurboBadger/tb_widgets_common.h>
 
 
 #include <Atomic/IO/Log.h>
 #include <Atomic/IO/Log.h>
+#include <Atomic/IO/FileSystem.h>
 
 
 #include "UIEvents.h"
 #include "UIEvents.h"
 #include "UI.h"
 #include "UI.h"
@@ -38,6 +39,13 @@ void UIButton::SetSqueezable(bool value)
 
 
 bool UIButton::OnEvent(const tb::TBWidgetEvent &ev)
 bool UIButton::OnEvent(const tb::TBWidgetEvent &ev)
 {
 {
+	if (ev.type == EVENT_TYPE_CLICK) {
+		String text = GetText();
+		if (text.StartsWith("http://") || text.StartsWith("https://")) {
+			FileSystem* fileSystem = GetSubsystem<FileSystem>();
+			fileSystem->SystemOpen(text);
+		}
+	}
     return UIWidget::OnEvent(ev);
     return UIWidget::OnEvent(ev);
 }
 }