Browse Source

add base64 encoding and ZList 2D element

Kolja Strohm 1 year ago
parent
commit
5108479057

+ 4 - 5
Array.h

@@ -19,11 +19,10 @@ namespace Framework
 		ArrayEintrag< TYP >* next;
 
 		ArrayEintrag()
-			: set(0),
+			: var(),
+			set(0),
 			next(0)
-		{
-			memset(&var, 0, sizeof(TYP));
-		}
+		{}
 
 		//! Setzt den Eintrag auf die Werte des anderen Eintrages
 		ArrayEintrag& operator=(ArrayEintrag& r)
@@ -78,7 +77,7 @@ namespace Framework
 #pragma warning( once : 26495 )
 	};
 #else
-	};
+};
 #endif
 
 

+ 97 - 0
Base64.cpp

@@ -0,0 +1,97 @@
+#include "Base64.h"
+
+using namespace Framework;
+
+static Framework::Text base64_chars =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+"abcdefghijklmnopqrstuvwxyz"
+"0123456789+/";
+
+Text Framework::base64Encode(const char* data, int length)
+{
+	Text result;
+	int i = 0;
+	int j = 0;
+	unsigned char char_array_3[3];
+	unsigned char char_array_4[4];
+	while (length--)
+	{
+		char_array_3[i++] = *(data++);
+		if (i == 3)
+		{
+			char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+			char_array_4[1] = (unsigned char)(((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4));
+			char_array_4[2] = (unsigned char)(((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6));
+			char_array_4[3] = char_array_3[2] & 0x3f;
+			for (i = 0; (i < 4); i++)
+				result.append((char)base64_chars[char_array_4[i]]);
+			i = 0;
+		}
+	}
+	if (i)
+	{
+		for (j = i; j < 3; j++)
+			char_array_3[j] = '\0';
+		char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+		char_array_4[1] = (unsigned char)(((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4));
+		char_array_4[2] = (unsigned char)(((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6));
+		char_array_4[3] = char_array_3[2] & 0x3f;
+		for (j = 0; (j < i + 1); j++)
+			result.append((char)base64_chars[char_array_4[j]]);
+		while ((i++ < 3))
+			result.append('=');
+	}
+	return result;
+}
+
+bool Framework::base64Decode(Text base64, char** data, int* length)
+{
+	int i = 0;
+	int j = 0;
+	int k = 0;
+	int l = 0;
+	int n = 0;
+	unsigned char char_array_4[4];
+	unsigned char char_array_3[3];
+	*length = 0;
+	while (base64[l])
+	{
+		if (base64[l] == '=')
+			break;
+		if ((base64[l] - 'A' < 0 || base64[l] - 'A' > 25) && (base64[l] - 'a' < 0 || base64[l] - 'a' > 25) && (base64[l] - '0' < 0 || base64[l] - '0' > 9))
+			return false;
+		l++;
+	}
+	*length = (l * 3) / 4;
+	*data = new char[*length + 1];
+	while (base64[k])
+	{
+		char_array_4[i++] = base64[k];
+		if (i == 4)
+		{
+			for (i = 0; i < 4; i++)
+				char_array_4[i] = (unsigned char)(base64_chars.positionVon(char_array_4[i]));
+			char_array_3[0] = (unsigned char)((char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4));
+			char_array_3[1] = (unsigned char)(((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2));
+			char_array_3[2] = (unsigned char)(((char_array_4[2] & 0x3) << 6) + char_array_4[3]);
+			for (i = 0; (i < 3); i++)
+				(*data)[n++] = char_array_3[i];
+			i = 0;
+		}
+		k++;
+	}
+	if (i)
+	{
+		for (j = i; j < 4; j++)
+			char_array_4[j] = 0;
+		for (j = 0; j < 4; j++)
+			char_array_4[j] = (unsigned char)(base64_chars.positionVon(char_array_4[j]));
+		char_array_3[0] = (unsigned char)((char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4));
+		char_array_3[1] = (unsigned char)(((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2));
+		char_array_3[2] = (unsigned char)(((char_array_4[2] & 0x3) << 6) + char_array_4[3]);
+		for (j = 0; (j < i - 1); j++)
+			(*data)[n++] = char_array_3[j];
+	}
+	(*data)[*length] = '\0';
+	return true;
+}

+ 9 - 0
Base64.h

@@ -0,0 +1,9 @@
+#pragma once
+
+#include "Text.h"
+
+namespace Framework
+{
+	DLLEXPORT Text base64Encode(const char *data, int length);
+	DLLEXPORT bool base64Decode(Text base64, char **data, int *length);
+}

+ 22 - 22
DX12PixelShader.h

@@ -92,10 +92,10 @@ ret
 
 const BYTE DX12PixelShaderBytes[] =
 {
-     68,  88,  66,  67,  28,  97, 
-    103, 119,  56, 254, 214, 165, 
-    194,  39, 252, 135, 187, 181, 
-    153, 212,   1,   0,   0,   0, 
+     68,  88,  66,  67,  54,  42, 
+     77, 229,  40,  69, 240, 152, 
+    145, 117,  45, 192, 115, 122, 
+    153, 125,   1,   0,   0,   0, 
     184,  91,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
      36,   2,   0,   0, 188,   2, 
@@ -763,11 +763,11 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 148,  46, 
-     49,   1, 117,  36, 174,  98, 
-      1,   0,   0,   0,  38, 253, 
-     89, 154, 127, 144, 235,  69, 
-    159,  87,   2,  16,  81,  11, 
-     24, 230,   0,   0,   0,   0, 
+     49,   1, 131, 226, 182,  98, 
+      1,   0,   0,   0, 158, 195, 
+    147, 225, 246, 226, 123,  66, 
+    131, 104, 101, 195, 161, 204, 
+    217, 114,   0,   0,   0,   0, 
       0,   0,   0,   0,   1,   0, 
       0,   0,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -938,10 +938,10 @@ const BYTE DX12PixelShaderBytes[] =
       3,   0, 242,  56,   1,   0, 
      43, 236,   3,   0,  28,  19, 
       2,   0,  65,  36,   1,   0, 
-    236, 179,   1,   0,  70, 120, 
-      3,   0, 125,  10,   2,   0, 
-    125, 181,   2,   0,  12, 248, 
-      2,   0, 193,  33,   3,   0, 
+    236, 179,   1,   0,  69, 233, 
+      0,   0, 125,  10,   2,   0, 
+    125, 181,   2,   0,  83, 135, 
+      1,   0, 193,  33,   3,   0, 
      65, 185,   2,   0, 140, 239, 
       1,   0, 246,  49,   0,   0, 
     213, 255,   0,   0,  46, 248, 
@@ -1788,7 +1788,7 @@ const BYTE DX12PixelShaderBytes[] =
     117, 114, 101,  50,  68,  32, 
     115, 104,  97, 100,  27, 226, 
      48,   1, 128,   0,   0,   0, 
-    151,  81,  99, 219,  71, 131, 
+     22,   7,  64, 215, 125, 136, 
     216,   1,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -2348,14 +2348,14 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,  23,   0,   1,   0, 
       5,  16,   0,   0,  14,   0, 
      23,  21,   0,  16,   0,   0, 
-      3,   2, 240, 129,   0,   0, 
+      3,   2,  96, 184,   0,   0, 
     242, 241,  10,   0,  24,  21, 
       8,  16,   0,   0,   1,   0, 
       1,   0,  10,   0,  24,  21, 
       9,  16,   0,   0,   1,   0, 
       0,   2,  14,   0,  23,  21, 
       0,   0,   0,   0,  10,   2, 
-    240, 129,   0,   0, 242, 241, 
+     96, 184,   0,   0, 242, 241, 
      10,   0,  24,  21,  11,  16, 
       0,   0,   1,   0,   1,   0, 
      10,   0,  24,  21,  12,  16, 
@@ -3408,11 +3408,11 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 117,  36, 
-    174,  98,   1,   0,   0,   0, 
-     38, 253,  89, 154, 127, 144, 
-    235,  69, 159,  87,   2,  16, 
-     81,  11,  24, 230, 128,   0, 
+    148,  46,  49,   1, 131, 226, 
+    182,  98,   1,   0,   0,   0, 
+    158, 195, 147, 225, 246, 226, 
+    123,  66, 131, 104, 101, 195, 
+    161, 204, 217, 114, 128,   0, 
       0,   0,  47,  76, 105, 110, 
     107,  73, 110, 102, 111,   0, 
      47, 110,  97, 109, 101, 115, 
@@ -3512,7 +3512,7 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   2,   0,   9,   0, 
     220,   4,   0,   0,   0,   0, 
       0,   0, 156,   1,   0,   0, 
-      1,   0,  91,  72,   0,   0, 
+      1,   0,  39,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 109,  97, 
     105, 110,   0, 110, 111, 110, 

+ 17 - 17
DX12VertexShader.h

@@ -131,10 +131,10 @@ ret
 
 const BYTE DX12VertexShaderBytes[] =
 {
-     68,  88,  66,  67, 136, 215, 
-     92, 196, 107,  56, 204,  57, 
-    248,  16, 235,  58, 108,  70, 
-     13,  17,   1,   0,   0,   0, 
+     68,  88,  66,  67, 137,   6, 
+    171, 227, 189,  48, 198, 143, 
+     71,  18,  19, 161,  76,  77, 
+     29,  18,   1,   0,   0,   0, 
     144,  78,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
     124,   2,   0,   0,  52,   3, 
@@ -923,11 +923,11 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 117,  36, 
-    174,  98,   1,   0,   0,   0, 
-     85,  52, 213,  79, 124,  43, 
-     20,  77, 150,   0, 139, 153, 
-    236,  66,  82,  18,   0,   0, 
+    148,  46,  49,   1, 131, 226, 
+    182,  98,   1,   0,   0,   0, 
+    122,  75, 124, 236,  72,  37, 
+    128,  76, 182, 184, 237, 170, 
+    193,  10, 115, 220,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       1,   0,   0,   0,   1,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -1103,7 +1103,7 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0, 103, 159,   1,   0, 
     179, 120,   1,   0, 238,  97, 
       2,   0,  90,  28,   0,   0, 
-    186, 102,   1,   0,  53, 174, 
+    116, 210,   0,   0,  53, 174, 
       3,   0, 206,  21,   0,   0, 
     193, 205,   3,   0, 207, 193, 
       1,   0,  62,   3,   3,   0, 
@@ -1607,7 +1607,7 @@ const BYTE DX12VertexShaderBytes[] =
      97, 109, 101, 114,  97,  13, 
      10, 115, 116, 114,  27, 226, 
      48,   1, 128,   0,   0,   0, 
-     72, 218, 154, 219,  71, 131, 
+    142, 231, 119, 215, 125, 136, 
     216,   1,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -2125,7 +2125,7 @@ const BYTE DX12VertexShaderBytes[] =
      24,  21,  12,  16,   0,   0, 
       1,   0,   1,   0,  14,   0, 
      23,  21,  13,  16,   0,   0, 
-     36,   2,  64, 123,   0,   0, 
+     36,   2, 128, 187,   0,   0, 
     242, 241,  10,   0,  24,  21, 
      14,  16,   0,   0,   1,   0, 
       0,   2,  18,   0,  22,  21, 
@@ -3057,10 +3057,10 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    117,  36, 174,  98,   1,   0, 
-      0,   0,  85,  52, 213,  79, 
-    124,  43,  20,  77, 150,   0, 
-    139, 153, 236,  66,  82,  18, 
+    131, 226, 182,  98,   1,   0, 
+      0,   0, 122,  75, 124, 236, 
+     72,  37, 128,  76, 182, 184, 
+    237, 170, 193,  10, 115, 220, 
     129,   0,   0,   0,  47,  76, 
     105, 110, 107,  73, 110, 102, 
     111,   0,  47, 110,  97, 109, 
@@ -3160,7 +3160,7 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   2,   0, 
       9,   0, 156,   5,   0,   0, 
       0,   0,   0,   0, 236,   2, 
-      0,   0,   1,   0,   2, 123, 
+      0,   0,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
     109,  97, 105, 110,   0, 110, 

+ 2 - 0
Framework Linux.vcxproj

@@ -110,6 +110,7 @@
     <ClCompile Include="Animation3D.cpp" />
     <ClCompile Include="AsynchronCall.cpp" />
     <ClCompile Include="AuswahlBox.cpp" />
+    <ClCompile Include="Base64.cpp" />
     <ClCompile Include="Bild.cpp" />
     <ClCompile Include="Bildschirm.cpp" />
     <ClCompile Include="Critical.cpp" />
@@ -174,6 +175,7 @@
     <ClInclude Include="Array.h" />
     <ClInclude Include="AsynchronCall.h" />
     <ClInclude Include="AuswahlBox.h" />
+    <ClInclude Include="Base64.h" />
     <ClInclude Include="Betriebssystem.h" />
     <ClInclude Include="Bild.h" />
     <ClInclude Include="Bildschirm.h" />

+ 6 - 0
Framework Linux.vcxproj.filters

@@ -330,6 +330,9 @@
     <ClInclude Include="ObjFile.h">
       <Filter>Headerdateien\Framework\OS\Datei</Filter>
     </ClInclude>
+    <ClInclude Include="Base64.h">
+      <Filter>Headerdateien\Framework</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Prozess.cpp">
@@ -515,5 +518,8 @@
     <ClCompile Include="ObjFile.cpp">
       <Filter>Quelldateien\Framework\OS\Datei</Filter>
     </ClCompile>
+    <ClCompile Include="Base64.cpp">
+      <Filter>Quelldateien\Framework</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 1 - 0
Framework Tests/Array.cpp

@@ -1,5 +1,6 @@
 #include "pch.h"
 #include "CppUnitTest.h"
+
 #include <Array.h>
 
 using namespace Microsoft::VisualStudio::CppUnitTestFramework;

+ 44 - 0
Framework Tests/Base64.cpp

@@ -0,0 +1,44 @@
+#include "pch.h"
+#include "CppUnitTest.h"
+
+#include <Base64.h>
+#include <Text.h>
+
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+
+// test class for base64 encoding and decoding
+namespace FrameworkTests
+{
+	TEST_CLASS(Base64Tests)
+	{
+	public:
+		TEST_METHOD(TestEncoding)
+		{
+			const char* data = "Hello World!";
+			const char* encoded = "SGVsbG8gV29ybGQh";
+			Framework::Text encodedData = Framework::base64Encode(data, Framework::textLength(data));
+			Assert::AreEqual(encoded, encodedData.getText());
+		}
+		
+		TEST_METHOD(TestDecoding)
+		{
+			const char* data = "SGVsbG8gV29ybGQh";
+			const char* decoded = "Hello World!";
+			char* decodedData = 0;
+			int decodecLength;
+			Framework::base64Decode(data, &decodedData, &decodecLength);
+			Assert::AreEqual(decoded, decodedData);
+			delete[] decodedData;
+		}
+
+		TEST_METHOD(TestDecodingInvalid)
+		{
+			const char* data = "SGVsbG8.gVd29ybGQh";
+			char* decodedData = 0;
+			int decodecLength;
+			Framework::base64Decode(data, &decodedData, &decodecLength);
+			Assert::AreEqual(0, decodecLength);
+			delete[] decodedData;
+		}
+	};
+}

+ 1 - 0
Framework Tests/Framework Tests.vcxproj

@@ -166,6 +166,7 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="Array.cpp" />
+    <ClCompile Include="Base64.cpp" />
     <ClCompile Include="Cache.cpp" />
     <ClCompile Include="Json.cpp" />
     <ClCompile Include="pch.cpp">

+ 3 - 0
Framework Tests/Framework Tests.vcxproj.filters

@@ -30,6 +30,9 @@
     <ClCompile Include="XML.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
+    <ClCompile Include="Base64.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="pch.h">

BIN
Framework Tests/Framwork.dll


+ 2 - 0
Framework.vcxproj

@@ -202,6 +202,7 @@ copy "x64\Release\Framework.dll" "..\..\Spiele Platform\SMP\Fertig\x64\framework
     <ClInclude Include="Array.h" />
     <ClInclude Include="AsynchronCall.h" />
     <ClInclude Include="AuswahlBox.h" />
+    <ClInclude Include="Base64.h" />
     <ClInclude Include="Bild.h" />
     <ClInclude Include="Bildschirm.h" />
     <ClInclude Include="Cache.h" />
@@ -300,6 +301,7 @@ copy "x64\Release\Framework.dll" "..\..\Spiele Platform\SMP\Fertig\x64\framework
     <ClCompile Include="Animation3D.cpp" />
     <ClCompile Include="AsynchronCall.cpp" />
     <ClCompile Include="AuswahlBox.cpp" />
+    <ClCompile Include="Base64.cpp" />
     <ClCompile Include="Bild.cpp" />
     <ClCompile Include="Bildschirm.cpp" />
     <ClCompile Include="DX12Buffer.cpp" />

+ 6 - 0
Framework.vcxproj.filters

@@ -381,6 +381,9 @@
     <ClInclude Include="ObjFile.h">
       <Filter>Headerdateien\Framework\OS\Datei</Filter>
     </ClInclude>
+    <ClInclude Include="Base64.h">
+      <Filter>Headerdateien\Framework</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Maus.cpp">
@@ -617,6 +620,9 @@
     <ClCompile Include="ObjFile.cpp">
       <Filter>Quelldateien\Framework\OS\Datei</Filter>
     </ClCompile>
+    <ClCompile Include="Base64.cpp">
+      <Filter>Quelldateien\Framework</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <FxCompile Include="DX12VertexShader.hlsl">

+ 226 - 0
Liste.cpp

@@ -974,4 +974,230 @@ bool AuswahlListe::hatMsStyleNicht(int pos, __int64 style) const // pr
 	if (styles)
 		st = styles->get(pos);
 	return (st | style) != st;
+}
+
+
+//! Konstruktor 
+ZListe::ZListe()
+	: ZeichnungHintergrund()
+{
+	entrySeperatorSize = 1;
+	entrySeperatorColor = 0xFFFFFFFF;
+	setRahmenBreite(1);
+	setRahmenFarbe(0xFFFFFFFF);
+	setHintergrundFarbe(0xFF000000);
+}
+
+//! Destruktor 
+ZListe::~ZListe()
+{}
+
+//! Verarbeitet Tastatur Nachrichten
+//! \param me Das Ereignis, was durch die Tastatureingabe ausgelößt wurde
+void ZListe::doMausEreignis(MausEreignis& me, bool userRet)
+{
+	me.my -= (rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0;
+	me.mx -= (rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0;
+	int ySum = 0;
+	int index = 0;
+	for (Zeichnung* entry : list)
+	{
+		entry->doPublicMausEreignis(me);
+		ySum += entry->getHeight();
+		if (index < list.getLastIndex())
+		{
+			ySum += ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
+			me.my -= ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
+		}
+		me.my -= ySum;
+		index++;
+	}
+	me.my += ySum + (rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0;
+	me.mx += (rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0;
+}
+
+//! Fügt einen Eintrag hinzu
+//! \param entry Die Zeichnung die hinzugefügt werden soll
+void ZListe::addEintrag(Zeichnung* entry)
+{
+	list.add(entry);
+}
+
+//! Ändert einen Eintrag
+//! \param pos Der Index des Eintrags
+//! \param entry Die neue Zeichnung
+void ZListe::setEintrag(int pos, Zeichnung* entry)
+{
+	list.set(entry, pos);
+}
+
+//! Vertauscht die Positionen zweier Einträge
+//! \param vpos Der Index des ersten Eintrags
+//! \param npos Der Index des zweiten Eintrags
+void ZListe::tauschEintragPos(int vPos, int nPos)
+{
+	list.tausch(vPos, nPos);
+}
+
+//! Löscht einen Eintrag
+//! pos: Der Index des Eintrags
+void ZListe::removeEintrag(int pos)
+{
+	list.remove(pos);
+}
+
+//! Scrollt zu einem bestimmen Eintrag
+//! \param eintrag Der Index des Eintrags
+void ZListe::setVScrollZuEintrag(int eintrag)
+{
+	if (vertikalScrollBar)
+	{
+		if (eintrag > list.getLastIndex())
+			eintrag = list.getLastIndex();
+		int y = 0;
+		int index = 0;
+		for (Zeichnung* entry : list)
+		{
+			y += entry->getHeight();
+			if (index < list.getLastIndex())
+				y += ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
+			index++;
+		}
+		vertikalScrollBar->scroll(y);
+	}
+}
+
+//! Aktualisiert die maximale Scroll Höhe indem die Höhe aller Einträge addiert wird
+void ZListe::updateVScroll()
+{
+	if (vertikalScrollBar)
+	{
+		int y = 0;
+		int index = 0;
+		for (Zeichnung* entry : list)
+		{
+			y += entry->getHeight();
+			if (index < list.getLastIndex())
+				y += ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
+			index++;
+		}
+		vertikalScrollBar->update(y, gr.y - ((rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0));
+	}
+}
+
+//! Verarbeitet ein Tastatur Ereignis. Wird vom Framework automatisch aufgerufen
+//! \param te Das Ereignis
+void ZListe::doTastaturEreignis(TastaturEreignis& te)
+{
+	for (Zeichnung* entry : list)
+		entry->doTastaturEreignis(te);
+}
+
+//! Aktualisiert die zeichnung
+//! \param tickVal Die vergangene Zeit in Sekunden, die seit dem Letzten Aufruf dieser Funktion verstrichen ist
+//! \return 1, wenn sich die Zeichnung seit dem letzten aufruf verändert hat
+bool ZListe::tick(double tickVal)
+{
+	bool ret = ZeichnungHintergrund::tick(tickVal);
+	for (Zeichnung* entry : list)
+		ret |= entry->tick(tickVal);
+	return ret;
+}
+
+//! Zeichnet das Objekt nach zRObj, falls es sichtbar ist
+//! \param zRObj Das Bild, in welches gezeichnet werden soll
+void ZListe::render(Bild& rObj)
+{
+	ZeichnungHintergrund::render(rObj);
+	int ySum = 0;
+	int index = 0;
+	int rbr = rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen) ? rahmen->getRBreite() : 0;
+	bool vs = vertikalScrollBar && hatStyle(Style::VScroll);
+	if (rObj.setDrawOptions(pos + Punkt(rbr, rbr), gr - Punkt(rbr, rbr) * 2 - Punkt(0, vs ? 15 : 0)))
+	{
+		if(vs)
+			rObj.addScrollOffset(0, vertikalScrollBar->getScroll());
+		for (Zeichnung* entry : list)
+		{
+			entry->render(rObj);
+			ySum += entry->getHeight();
+			rObj.addScrollOffset(0, entry->getHeight());
+			if (index < list.getLastIndex())
+			{
+				ySum += ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
+				rObj.addScrollOffset(0, ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0);
+			}
+			index++;
+		}
+		rObj.releaseDrawOptions();
+	}
+}
+
+//! Gibt den Index eines Eintrags zurück, auf den die Maus zeigt
+//! \param my Die Position der Maus auf der Y Achse basierend auf dem oberend Rand der Liste
+int ZListe::getKlickEintrag(int my)
+{
+	if (my < 0)
+		return -1;
+	int index = 0;
+	int y = 0;
+	for (Zeichnung* entry : list)
+	{
+		if (my < y)
+			return index;
+		y += entry->getHeight();
+		if (index < list.getLastIndex())
+			y += ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
+		index++;
+	}
+	return -1;
+}
+
+//! Gibt die Anzahl an Einträgen zurück
+int ZListe::getEintragAnzahl() const
+{
+	return list.getEintragAnzahl();
+}
+
+//! Gibt den Index eines Eintrags zurück
+//! \param zEntry Die Zeichnung
+int ZListe::getEintragPos(Zeichnung* zEntry)
+{
+	int index = 0;
+	for (Zeichnung* entry : list)
+	{
+		if (zEntry == entry)
+			return index;
+		index++;
+	}
+	return -1;
+}
+
+//! Gibt einen Eintrag zurück
+//! \param pos Der Index des Eintrags
+Zeichnung* ZListe::getEintrag(int pos) const
+{
+	return list.get(pos);
+}
+
+//! Gibt einen Eintrag ohne erhöhten reference Counter zurück
+//! \param pos Der Index des Eintrags
+Zeichnung* ZListe::zEintrag(int pos) const
+{
+	return list.get(pos);
+}
+
+//! Gibt die benötigte Höhe zurück
+int ZListe::getNeededHeight() const
+{
+	int y = (rahmen && ZeichnungHintergrund::hatStyle(TextFeld::Style::Rahmen)) ? rahmen->getRBreite() * 2 : 0;
+	int index = 0;
+	for (Zeichnung* entry : list)
+	{
+		y += entry->getHeight();
+		if (index < list.getLastIndex())
+			y += ZeichnungHintergrund::hatStyle(ZListe::Style::EntrySeperator) ? entrySeperatorSize : 0;
+		index++;
+	}
+	return y;
 }

+ 72 - 0
Liste.h

@@ -257,6 +257,78 @@ namespace Framework
 		//! \param style Die zu prüfenden Styles
 		DLLEXPORT inline bool hatMsStyleNicht(int pos, __int64 style) const;
 	};
+
+	class ZListe : public ZeichnungHintergrund
+	{
+	public:
+		class Style : public ZeichnungHintergrund::Style
+		{
+		public:
+			const static __int64 EntrySeperator = 0x0001000; // draws a seperation line between the entries
+			const static __int64 Normal = Sichtbar | Erlaubt | Rahmen | Hintergrund | EntrySeperator; //! Vereint die Flags Sichtbar, Erlaubt, Rahmen, Hintergrund
+		};
+
+	private:
+		int entrySeperatorSize;
+		int entrySeperatorColor;
+		RCArray< Zeichnung > list;
+
+	protected:
+		//! Verarbeitet Tastatur Nachrichten
+		//! \param me Das Ereignis, was durch die Tastatureingabe ausgelößt wurde
+		DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override;
+
+	public:
+		//! Konstruktor 
+		DLLEXPORT ZListe();
+		//! Destruktor 
+		DLLEXPORT virtual ~ZListe();
+		//! Fügt einen Eintrag hinzu
+		//! \param entry Die Zeichnung die hinzugefügt werden soll
+		DLLEXPORT void addEintrag(Zeichnung *entry);
+		//! Ändert einen Eintrag
+		//! \param pos Der Index des Eintrags
+		//! \param entry Die neue Zeichnung
+		DLLEXPORT void setEintrag(int pos, Zeichnung* entry);
+		//! Vertauscht die Positionen zweier Einträge
+		//! \param vpos Der Index des ersten Eintrags
+		//! \param npos Der Index des zweiten Eintrags
+		DLLEXPORT void tauschEintragPos(int vpos, int npos);
+		//! Löscht einen Eintrag
+		//! pos: Der Index des Eintrags
+		DLLEXPORT void removeEintrag(int pos);
+		//! Scrollt zu einem bestimmen Eintrag
+		//! \param eintrag Der Index des Eintrags
+		DLLEXPORT void setVScrollZuEintrag(int eintrag);
+		//! Aktualisiert die maximale Scroll Höhe indem die Höhe aller Einträge addiert wird
+		DLLEXPORT void updateVScroll();
+		//! Verarbeitet ein Tastatur Ereignis. Wird vom Framework automatisch aufgerufen
+		//! \param te Das Ereignis
+		DLLEXPORT void doTastaturEreignis(TastaturEreignis& te) override;
+		//! Aktualisiert die zeichnung
+		//! \param tickVal Die vergangene Zeit in Sekunden, die seit dem Letzten Aufruf dieser Funktion verstrichen ist
+		//! \return 1, wenn sich die Zeichnung seit dem letzten aufruf verändert hat
+		DLLEXPORT bool tick(double tickVal) override;
+		//! Zeichnet das Objekt nach zRObj, falls es sichtbar ist
+		//! \param zRObj Das Bild, in welches gezeichnet werden soll
+		DLLEXPORT void render(Bild& rObj) override;
+		//! Gibt den Index eines Eintrags zurück, auf den die Maus zeigt
+		//! \param my Die Position der Maus auf der Y Achse basierend auf dem oberend Rand der Liste
+		DLLEXPORT int getKlickEintrag(int my);
+		//! Gibt die Anzahl an Einträgen zurück
+		DLLEXPORT int getEintragAnzahl() const;
+		//! Gibt den Index eines Eintrags zurück
+		//! \param zEntry Die Zeichnung
+		DLLEXPORT int getEintragPos(Zeichnung* zEntry);
+		//! Gibt einen Eintrag zurück
+		//! \param pos Der Index des Eintrags
+		DLLEXPORT Zeichnung* getEintrag(int pos) const;
+		//! Gibt einen Eintrag ohne erhöhten reference Counter zurück
+		//! \param pos Der Index des Eintrags
+		DLLEXPORT Zeichnung* zEintrag(int pos) const;
+		//! Gibt die benötigte Höhe zurück
+		DLLEXPORT int getNeededHeight() const;
+	};
 }
 
 #endif

+ 20 - 20
UIPixelShader.h

@@ -353,10 +353,10 @@ ret
 
 const BYTE UIPixelShader[] =
 {
-     68,  88,  66,  67, 163,  13, 
-    235, 102, 207, 122,  16, 202, 
-    150,  20, 215, 150,   4,   7, 
-    170, 204,   1,   0,   0,   0, 
+     68,  88,  66,  67, 123, 238, 
+    179,  56, 105, 164, 168,  67, 
+    235, 117, 198,  30,  13,  17, 
+     75, 160,   1,   0,   0,   0, 
      64, 134,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
     192,   6,   0,   0,  80,   7, 
@@ -1815,10 +1815,10 @@ const BYTE UIPixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    118,  36, 174,  98,   1,   0, 
-      0,   0,  90, 235,  80,  60, 
-     42, 242, 165,  78, 177, 193, 
-     19,  29, 190, 128,  64,  49, 
+    131, 226, 182,  98,   1,   0, 
+      0,   0,   7, 223,  79,  66, 
+    170, 134, 126,  64, 190,  13, 
+    216, 252,  41, 152,   6,  54, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   1,   0,   0,   0, 
       1,   0,   0,   0,   0,   0, 
@@ -1990,9 +1990,9 @@ const BYTE UIPixelShader[] =
     242,  56,   1,   0,  43, 236, 
       3,   0,  28,  19,   2,   0, 
      65,  36,   1,   0, 236, 179, 
-      1,   0,  70, 120,   3,   0, 
+      1,   0,  69, 233,   0,   0, 
     125,  10,   2,   0, 125, 181, 
-      2,   0,  12, 248,   2,   0, 
+      2,   0,  83, 135,   1,   0, 
     193,  33,   3,   0,  65, 185, 
       2,   0,   9, 241,   2,   0, 
     146, 230,   3,   0, 125, 218, 
@@ -3010,8 +3010,8 @@ const BYTE UIPixelShader[] =
     120, 116, 117, 114, 101,  50, 
      68,  32, 115, 104,  97, 100, 
      27, 226,  48,   1, 128,   0, 
-      0,   0, 177,  97, 195, 219, 
-     71, 131, 216,   1,   1,   0, 
+      0,   0,  99, 253, 162, 215, 
+    125, 136, 216,   1,   1,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -4253,14 +4253,14 @@ const BYTE UIPixelShader[] =
       0,   0,  23,   0,   1,   0, 
       5,  16,   0,   0,  14,   0, 
      23,  21,   0,  16,   0,   0, 
-      3,   2, 240, 129,   0,   0, 
+      3,   2,  96, 184,   0,   0, 
     242, 241,  10,   0,  24,  21, 
       8,  16,   0,   0,   1,   0, 
       1,   0,  10,   0,  24,  21, 
       9,  16,   0,   0,   1,   0, 
       0,   2,  14,   0,  23,  21, 
       0,   0,   0,   0,  10,   2, 
-    240, 129,   0,   0, 242, 241, 
+     96, 184,   0,   0, 242, 241, 
      10,   0,  24,  21,  11,  16, 
       0,   0,   1,   0,   1,   0, 
      10,   0,  24,  21,  12,  16, 
@@ -5484,11 +5484,11 @@ const BYTE UIPixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 148,  46, 
-     49,   1, 118,  36, 174,  98, 
-      1,   0,   0,   0,  90, 235, 
-     80,  60,  42, 242, 165,  78, 
-    177, 193,  19,  29, 190, 128, 
-     64,  49, 128,   0,   0,   0, 
+     49,   1, 131, 226, 182,  98, 
+      1,   0,   0,   0,   7, 223, 
+     79,  66, 170, 134, 126,  64, 
+    190,  13, 216, 252,  41, 152, 
+      6,  54, 128,   0,   0,   0, 
      47,  76, 105, 110, 107,  73, 
     110, 102, 111,   0,  47, 110, 
      97, 109, 101, 115,   0,  47, 
@@ -5588,7 +5588,7 @@ const BYTE UIPixelShader[] =
       2,   0,   9,   0, 204,   8, 
       0,   0,   0,   0,   0,   0, 
     164,  14,   0,   0,   1,   0, 
-    190, 227,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,  84, 101, 120, 116, 
     117, 114, 101,  80, 105, 120, 

+ 15 - 15
UIVertexShader.h

@@ -121,10 +121,10 @@ ret
 
 const BYTE UIVertexShader[] =
 {
-     68,  88,  66,  67,  17, 134, 
-    201,  60, 212,   6,  55, 206, 
-    186,  40,  99,  94,  30, 155, 
-    245,  40,   1,   0,   0,   0, 
+     68,  88,  66,  67, 246,  58, 
+     51, 215, 222,  66,  70,  30, 
+    132,  24, 172,  37, 224, 243, 
+    222,  69,   1,   0,   0,   0, 
     204,  77,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
      20,   2,   0,   0, 204,   2, 
@@ -881,10 +881,10 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    118,  36, 174,  98,   1,   0, 
-      0,   0, 252,  33, 169, 100, 
-     29, 200, 176,  75, 155, 213, 
-    182, 104, 158, 208,  56, 223, 
+    132, 226, 182,  98,   1,   0, 
+      0,   0,  46,  63, 171, 239, 
+    141, 170, 105,  79, 155,  67, 
+    114,  93, 189, 172,  52, 255, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   1,   0,   0,   0, 
       1,   0,   0,   0,   0,   0, 
@@ -1564,8 +1564,8 @@ const BYTE UIVertexShader[] =
      13,  10,  47,  47,  32,  84, 
      89,  80,  69,  68,  69,  70, 
      27, 226,  48,   1, 128,   0, 
-      0,   0,  10, 186,   2, 220, 
-     71, 131, 216,   1,   1,   0, 
+      0,   0,  31, 116, 223, 215, 
+    125, 136, 216,   1,   1,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -2929,10 +2929,10 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    118,  36, 174,  98,   1,   0, 
-      0,   0, 252,  33, 169, 100, 
-     29, 200, 176,  75, 155, 213, 
-    182, 104, 158, 208,  56, 223, 
+    132, 226, 182,  98,   1,   0, 
+      0,   0,  46,  63, 171, 239, 
+    141, 170, 105,  79, 155,  67, 
+    114,  93, 189, 172,  52, 255, 
     129,   0,   0,   0,  47,  76, 
     105, 110, 107,  73, 110, 102, 
     111,   0,  47, 110,  97, 109, 
@@ -3032,7 +3032,7 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   2,   0, 
       9,   0, 104,   5,   0,   0, 
       0,   0,   0,   0, 236,   2, 
-      0,   0,   1,   0, 240, 156, 
+      0,   0,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
      84, 101, 120, 116, 117, 114,