Merge branch 'master' into paging
This commit is contained in:
commit
55a815e816
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: CyB3RC0nN0R
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: CyB3RC0nN0R
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
52
README.md
52
README.md
@ -12,9 +12,12 @@ Verweis auf die Bibliothek im Aufruferprojekt anlegen:
|
||||
> Haken bei "MenuLib" setzen.
|
||||
|
||||
Zusätzliches Includeverzeichnis hinzufügen:
|
||||
> Rechtsklick auf Aufruferprojekt -> Eigenschaften -> Linked -> Eingabe -> Zusätzliche Abhängigkeiten -> Bearbeiten...
|
||||
> Rechtsklick auf Aufruferprojekt -> Eigenschaften -> C/C++ -> Allgemein -> Zusätzliche Includeverzeichnisse -> Bearbeiten...
|
||||
|
||||
> Ordner, der "menu.h" enthält, auswählen
|
||||
|
||||
> Diese Einstellung muss für die Konfiguration erfolgen, die später compiliert werden soll.
|
||||
|
||||
Headerdatei einbinden:
|
||||
> Zeile ```#include "menu.h"``` zur Quelldatei hinzufügen
|
||||
|
||||
@ -28,26 +31,47 @@ struct MenuItem items[] = {
|
||||
{"DB-Pruefziffer", '5', (void*)&db}, // (void*)& MUSS immer davor stehen!
|
||||
{"Modulo 11", '6', (void*)&mod11},
|
||||
{"BLANK", NULL, (void*)NULL}, // Fügt einen leere Zeile hinzu -> Gliederung
|
||||
{"Namen TEST", 'a', (void*)&namen},
|
||||
{"Strings", 'b', (void*)&strHeader},
|
||||
{"Namen TEST", '7', (void*)&namen},
|
||||
{"BLANK", NULL, (void*)NULL},
|
||||
{"Exit", 'q', (void*)&exit} // exit beendet das Programm
|
||||
};
|
||||
show_menu(sizeof(items) / sizeof(struct MenuItem), items, "Vorlesungsaufgaben", true, true, &NO_BORDER);
|
||||
|
||||
/*
|
||||
* 1. Argument: Anzahl der Elemente; Einfach so lassen
|
||||
* 2. Argument: Vorher angelegtes struct; Einfach so lassen
|
||||
* 3. Argument: Titel des Menüs
|
||||
* 4. Argument: Menü im loop; Nach beenden der Methode wieder Menü aufrufen
|
||||
struct MenuItem stringsEX[] = {
|
||||
{"strcat()", '1', (void*)&strcatEx},
|
||||
{"strlen()", '2', (void*)&strlenEx},
|
||||
{"strncpy()", '3', (void*)&strncpyEx},
|
||||
{"strchr()", '4', (void*)&strchrEx},
|
||||
{"strstr()", '5', (void*)&strstrEx},
|
||||
{"strtok()", '6', (void*)&strtokEx},
|
||||
{"BLANK", NULL, (void*)NULL},
|
||||
{"Ersetzen", '7', (void*)&replace}
|
||||
};
|
||||
|
||||
struct MenuPage pages[] = {
|
||||
{items, sizeof(items) / sizeof(struct MenuItem), "Vorlesungsaufgaben", true, true, &SOLID},
|
||||
{stringsEX, sizeof(stringsEX) / sizeof(struct MenuItem), "String - Beispiele", true, true, &SOLID}
|
||||
|
||||
/*
|
||||
* 1. Argument: Vorher angelegtes struct; Enthält alle Items der Seite
|
||||
* 2. Argument: Anzahl der Elemente der Seite; Einfach so lassen
|
||||
* 3. Argument: Titel der Seite
|
||||
* 4. Argument: Menü im Loop; Nach beenden der Methode wieder Menü aufrufen
|
||||
* 5. Argument: Pause nach dem Ausführen der Methode; Ausgaben lesbar
|
||||
* 6. Argument: Style des Menüs: Standardmäßig wird DEFAULT, MODERN, SOLID und NO_BORDER unterstützt
|
||||
*/
|
||||
````
|
||||
### Style hinzufügen
|
||||
Eigene Styles können wie folgt hinzugefügt werden:
|
||||
};
|
||||
page(pages, sizeof(pages) / sizeof(struct MenuPage), true);
|
||||
|
||||
/*
|
||||
* 1. Argument: Vorher angelegtes struct; Enthält alle Seiten des Menüs
|
||||
* 2. Argument: Anzahl der Seiten; Einfach so lassen
|
||||
* 3. Argument: Gesamtes Menü in einer unendlich-Schleife
|
||||
*/
|
||||
```
|
||||
### Border hinzufügen
|
||||
Eigene Border-Styles können wie folgt hinzugefügt werden:
|
||||
```C
|
||||
const struct MenuBoder NAME = {
|
||||
const struct MenuBorder NAME = {
|
||||
'a', // Char für den rechten und linken Rand
|
||||
'b', // Char für den oberen und unteren Rand
|
||||
'c', // Char für die linke obere Ecke
|
||||
@ -59,4 +83,4 @@ const struct MenuBoder NAME = {
|
||||
}
|
||||
```
|
||||
|
||||
Neue Styles am Besten direkt unter den #include Anweisungen einfügen. Der neue Style kann über den angegebenen Namen verwendet werden.
|
||||
Neue Border am Besten direkt unter den ```#include``` Anweisungen einfügen. Die neue Border kann über den angegebenen Namen, wie im obigen Beispiel erläutert, verwendet werden.
|
||||
|
15
menu.h
15
menu.h
@ -2,7 +2,6 @@
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
|
||||
/// <summary>Represents one menu item in a menu.</summary>
|
||||
struct MenuItem {
|
||||
char* text;
|
||||
@ -22,10 +21,10 @@ struct MenuBorder {
|
||||
char title_right;
|
||||
};
|
||||
|
||||
// Default borders initialized in menu.c
|
||||
const extern struct MenuBorder DEFAULT, MODERN, NO_BORDER, SOLID;
|
||||
|
||||
|
||||
/// <summary>Represents a page in the menu.</summary>
|
||||
/// <summary>Represents a page containing menu items inside a menu.</summary>
|
||||
struct MenuPage {
|
||||
const struct MenuItem* items;
|
||||
const size_t item_count;
|
||||
@ -34,16 +33,8 @@ struct MenuPage {
|
||||
const struct MenuBorder* border;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>Constructs a menu with a specific amount of pages</summary>
|
||||
/// <summary>Constructs a CUI menu with a specific amount of pages.</summary>
|
||||
/// <param name="pages">An array of all pages to display.</param>
|
||||
/// <param name="page_count">The length of the array <c>pages</c>.</param>
|
||||
/// <param name="infinite_loop">Always display the first page after a loopback=false item finished executing.</param>
|
||||
void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop);
|
||||
|
||||
/// <summary>Displaces a CUI menu to the user</summary>
|
||||
/// <param name="itemc">The length of the array <c>itemv</c> of menu items.</param>
|
||||
/// <param name="itemv">An array of all menu items to display in the menu.</param>
|
||||
/// <param name="title">The title of the menu.</param>
|
||||
/// <param name="border">Specifies the border in which the menu is displayed.</param>
|
||||
void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop);
|
||||
|
Reference in New Issue
Block a user