making another try with frontend. this time with nanogui

This commit is contained in:
jakani24
2024-03-14 22:00:54 +01:00
parent b4d42bfe32
commit 7ea487d0e1
69 changed files with 776 additions and 79 deletions

View File

@@ -0,0 +1,122 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:ui.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:choose_element.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:choose_element.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:id.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:ui.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "choose_element.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h",
"RelativeDocumentMoniker": "choose_element.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h",
"RelativeToolTip": "choose_element.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAGAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T17:06:27.941Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "choose_element.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp",
"RelativeDocumentMoniker": "choose_element.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp",
"RelativeToolTip": "choose_element.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABcAAABJAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T17:06:16.884Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "id.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h",
"RelativeDocumentMoniker": "id.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h",
"RelativeToolTip": "id.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAEAAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T16:31:43.692Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "ui.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h",
"RelativeDocumentMoniker": "ui.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h",
"RelativeToolTip": "ui.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAMAAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T16:28:38.361Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "ui.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp",
"RelativeDocumentMoniker": "ui.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp",
"RelativeToolTip": "ui.cpp",
"ViewState": "AQIAACoAAAAAAAAAAAAwwC8AAAAwAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T16:28:29.863Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "client_frontend.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeDocumentMoniker": "client_frontend.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeToolTip": "client_frontend.cpp",
"ViewState": "AQIAAHsAAAAAAAAAAAAAAJwAAAA3AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T16:22:29.931Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -0,0 +1,33 @@
#include "choose_element.h"
#include <Windows.h>
#include <iostream>
#include <string>
std::wstring open_file(HWND hWnd)
{
OPENFILENAME ofn;
WCHAR szFile[MAX_PATH] = L"";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"All Files\0*.*\0"; // Filter for all files
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE)
{
// User selected a file, 'szFile' contains the selected file path
return std::wstring(szFile);
}
else
{
// User canceled the dialog
//MessageBox(hWnd, L"File selection canceled.", L"Canceled", MB_OK | MB_ICONEXCLAMATION);
return L"cancel";
}
}

View File

@@ -0,0 +1,6 @@
#pragma once
#include "id.h"
#include <Windows.h>
#include <string>
#include <iostream>
std::wstring open_file(HWND hWnd);

View File

@@ -1,19 +1,21 @@
// client_frontend.cpp : Definiert den Einstiegspunkt für die Anwendung.
//
#include <windows.h>
#include "framework.h"
#include "client_frontend.h"
#define width 1000
#define height 700
#include "ui.h"
#include "id.h"
#include "choose_element.h"
#define MAX_LOADSTRING 100
// Globale Variablen:
HINSTANCE hInst; // Aktuelle Instanz
WCHAR szTitle[MAX_LOADSTRING]; // Titelleistentext
WCHAR szWindowClass[MAX_LOADSTRING]; // Der Klassenname des Hauptfensters.
// Vorwärtsdeklarationen der in diesem Codemodul enthaltenen Funktionen:
ATOM MyRegisterClass(HINSTANCE hInstance);
ATOM frontend_class(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
@@ -31,7 +33,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
// Globale Zeichenfolgen initialisieren
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_CLIENTFRONTEND, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
frontend_class(hInstance);
// Anwendungsinitialisierung ausführen:
if (!InitInstance (hInstance, nCmdShow))
@@ -63,7 +65,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
//
// ZWECK: Registriert die Fensterklasse.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
ATOM frontend_class(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
@@ -99,7 +101,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
hInst = hInstance; // Instanzenhandle in der globalen Variablen speichern
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, width,height, nullptr, nullptr, hInstance, nullptr);
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
@@ -121,69 +123,66 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
// WM_PAINT - Darstellen des Hauptfensters
// WM_DESTROY - Ausgeben einer Beendenmeldung und zurückkehren
//
//main loop
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int windowWidth=0;
int windowHeight=0;
RECT clientRect;
GetClientRect(hWnd, &clientRect);
windowWidth = clientRect.right - clientRect.left;
windowHeight = clientRect.bottom - clientRect.top;
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Menüauswahl analysieren:
switch (wmId)
{
int wmId = LOWORD(wParam);
// Menüauswahl analysieren:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
case ID_HOME_BUTTON: // Handle the home button click
//set page to 0
ui_clear();
ui_display_page(0, windowWidth, windowHeight, hWnd);
break;
case ID_SCAN_FILE_BUTTON: // Handle the scan file button click
//set page to 1
ui_clear();
ui_display_page(1, windowWidth, windowHeight, hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: Zeichencode, der hdc verwendet, hier einfügen...
EndPaint(hWnd, &ps);
}
break;
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: Zeichencode, der hdc verwendet, hier einfügen...
EndPaint(hWnd, &ps);
}
break;
case WM_CREATE:
{
//ui_create();
ui_display_page(0, windowWidth, windowHeight, hWnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CREATE:
{
HWND textbox_, learn_button_, make_button_, settings_button_;
//for this text we need to get some data from the backend
//e.g. rtp
//database status
//infected files
//etc
textbox_ = CreateWindow(L"EDIT",
L"Welcome to cyberhex\r\n\r\nPlease select an option:\r\n\r\n",
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, width - 30, height - 200,
hWnd, (HMENU)0, NULL, NULL);
learn_button_ = CreateWindow(L"BUTTON",
L"Learn a set of Voc",
WS_VISIBLE | WS_CHILD | WS_BORDER,
160, 550, 200, 30, //wo, xy // wie gross xy
hWnd, (HMENU)1, NULL, NULL);
make_button_ = CreateWindow(L"BUTTON",
L"Make a set of Voc",
WS_VISIBLE | WS_CHILD | WS_BORDER,
380, 550, 200, 30,
hWnd, (HMENU)2, NULL, NULL);
settings_button_ = CreateWindow(L"BUTTON",
L"Settings",
WS_VISIBLE | WS_CHILD | WS_BORDER,
600, 550, 200, 30,
hWnd, (HMENU)3, NULL, NULL);
break;
}
case WM_SIZE:
//ui_resize();
ui_clear();
ui_display_page(0, windowWidth, windowHeight, hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}

View File

@@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_frontend", "client_frontend.vcxproj", "{714B1F08-886A-4AB5-89D4-B9919264F524}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_frontend", "client_frontend.vcxproj", "{644C9824-2298-46C6-9A62-7E080C98A0BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,19 +13,19 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x64.ActiveCfg = Debug|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x64.Build.0 = Debug|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x86.ActiveCfg = Debug|Win32
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x86.Build.0 = Debug|Win32
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x64.ActiveCfg = Release|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x64.Build.0 = Release|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x86.ActiveCfg = Release|Win32
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x86.Build.0 = Release|Win32
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x64.ActiveCfg = Debug|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x64.Build.0 = Debug|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x86.ActiveCfg = Debug|Win32
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x86.Build.0 = Debug|Win32
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x64.ActiveCfg = Release|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x64.Build.0 = Release|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x86.ActiveCfg = Release|Win32
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D94BC215-E973-42E4-A7F3-33EFCC3C89C9}
SolutionGuid = {F67EF8DC-E0C4-4EE3-9BBA-D7BD7AC687A9}
EndGlobalSection
EndGlobal

View File

@@ -21,7 +21,7 @@
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{714b1f08-886a-4ab5-89d4-b9919264f524}</ProjectGuid>
<ProjectGuid>{644c9824-2298-46c6-9a62-7e080c98a0bb}</ProjectGuid>
<RootNamespace>clientfrontend</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
@@ -127,13 +127,18 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="choose_element.h" />
<ClInclude Include="client_frontend.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="id.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="ui.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="choose_element.cpp" />
<ClCompile Include="client_frontend.cpp" />
<ClCompile Include="ui.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="client_frontend.rc" />

View File

@@ -27,11 +27,26 @@
<ClInclude Include="client_frontend.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="ui.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="id.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="choose_element.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="client_frontend.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="ui.cpp">
<Filter>Headerdateien</Filter>
</ClCompile>
<ClCompile Include="choose_element.cpp">
<Filter>Headerdateien</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="client_frontend.rc">

View File

@@ -1,2 +1,2 @@
 client_frontend.cpp
 ui.cpp
client_frontend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.exe

View File

@@ -0,0 +1,3 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\choose_element.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\choose_element.obj
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.obj
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\ui.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\ui.obj

View File

@@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.38.33130:TargetPlatformVersion=10.0.22621.0:VcpkgTriplet=x64-windows:
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:VcpkgTriplet=x64-windows:
Debug|x64|C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\|

View File

@@ -0,0 +1,2 @@
^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CHOOSE_ELEMENT.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.RES|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\UI.OBJ
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.ilk

8
src/client_frontend/id.h Normal file
View File

@@ -0,0 +1,8 @@
#pragma once
#define ID_HOME_BUTTON 0
#define ID_STARTUP_BUTTON 1
#define ID_SCAN_FILE_BUTTON 2
#define ID_SCAN_FOLDER_BUTTON 3
#define ID_SETTINGS_BUTTON 4
#define ID_WELCOME_TEXT 1000

View File

@@ -0,0 +1,95 @@
#include "ui.h"
#include "id.h"
#include <windows.h>
#include "choose_element.h"
HWND hwnd_[100];
int num_hwnd = 0;
void draw_main_page(int window_width, int window_height, HWND hwnd);
void draw_scan_file_page(int window_width, int window_height, HWND hwnd);
void ui_display_page(int page_id,int window_width, int window_height, HWND hwnd) {
//create one button in middle of screen
//hwnd_[num_hwnd] = CreateWindowW(L"BUTTON", L"OK", WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,(window_width-50)/2,(window_height-15)/2, 100, 30, hwnd, (HMENU)ID_STARTUP_BUTTON, NULL, NULL);
//num_hwnd++;
switch (page_id) {
case 0: //main page
draw_main_page(window_width,window_height,hwnd);
break;
case 1: //scan file page
draw_scan_file_page(window_width, window_height, hwnd);
break;
}
}
void ui_clear() {
//clear all windows
for (int i = 0; i < num_hwnd; i++) {
if (hwnd_[i] != NULL) {
DestroyWindow(hwnd_[i]);
}
}
num_hwnd = 0;
}
void draw_main_page(int window_width, int window_height, HWND hwnd) {
//draw main page
hwnd_[num_hwnd] = CreateWindow(L"EDIT",
L"Welcome to cyberhex\r\n\r\nPlease select an option:\r\n\r\n",
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, window_width - 30, window_height - 200,
hwnd, (HMENU)0, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd]= CreateWindow(L"BUTTON",
L"Scan a file",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(window_width)/4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SCAN_FILE_BUTTON, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Scan a folder",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(2* window_width) / 4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SCAN_FOLDER_BUTTON, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Settings",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(3* window_width) / 4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SETTINGS_BUTTON, NULL, NULL);
num_hwnd++;
}
void draw_scan_file_page(int window_width, int window_height, HWND hwnd) {
//draw scan file page
std::wstring message = L"File to scan: ";
std::wstring path=open_file(hwnd);
if (path == L"cancel") {
ui_clear();
ui_display_page(0, window_width, window_height, hwnd);
return;
}
message += path;
hwnd_[num_hwnd] = CreateWindow(L"EDIT",
message.c_str(),
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, window_width - 30, window_height - 200,
hwnd, (HMENU)0, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Home",
WS_VISIBLE | WS_CHILD | WS_BORDER,
10, window_height - 50, 200, 30,
hwnd, (HMENU)ID_HOME_BUTTON, NULL, NULL);
num_hwnd++;
}
void update_scan_results(int window_width, int window_height, HWND hwnd,std::wstring& message) {
//draw scan results
//get value from the text field of draw_scan_file_page
//add to thetextfield the string message
}

4
src/client_frontend/ui.h Normal file
View File

@@ -0,0 +1,4 @@
#pragma once
#include <Windows.h>
void ui_display_page(int page_id, int window_width, int window_height, HWND hwnd);
void ui_clear();

View File

@@ -1 +0,0 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.obj

View File

@@ -1 +0,0 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.exe