60 lines
1.5 KiB
C
60 lines
1.5 KiB
C
#include "gintrace/gui/fkey.h"
|
|
|
|
#include <gint/display.h>
|
|
|
|
/* fkey_action(): A black-on-white F-key */
|
|
void fkey_action(int position, char const *text)
|
|
{
|
|
int width;
|
|
dsize(text, NULL, &width, NULL);
|
|
|
|
int x = 4 + 65 * (position - 1);
|
|
int y = 207;
|
|
int w = 63;
|
|
|
|
dline(x + 1, y, x + w - 2, y, C_BLACK);
|
|
dline(x + 1, y + 14, x + w - 2, y + 14, C_BLACK);
|
|
drect(x, y + 1, x + 1, y + 13, C_BLACK);
|
|
drect(x + w - 2, y + 1, x + w - 1, y + 13, C_BLACK);
|
|
|
|
dtext(x + ((w - width) >> 1), y + 3, C_BLACK, text);
|
|
}
|
|
|
|
/* fkey_button(): A rectangular F-key */
|
|
void fkey_button(int position, char const *text)
|
|
{
|
|
int width;
|
|
dsize(text, NULL, &width, NULL);
|
|
|
|
int x = 4 + 65 * (position - 1);
|
|
int y = 207;
|
|
int w = 63;
|
|
|
|
dline(x + 1, y, x + w - 2, y, C_BLACK);
|
|
dline(x + 1, y + 14, x + w - 2, y + 14, C_BLACK);
|
|
drect(x, y + 1, x + w - 1, y + 13, C_BLACK);
|
|
|
|
dtext(x + ((w - width) >> 1), y + 3, C_WHITE, text);
|
|
}
|
|
|
|
/* fkey_menu(): A rectangular F-key with the bottom right corner removed */
|
|
void fkey_menu(int position, char const *text)
|
|
{
|
|
int width;
|
|
dsize(text, NULL, &width, NULL);
|
|
|
|
int x = 4 + 65 * (position - 1);
|
|
int y = 207;
|
|
int w = 63;
|
|
|
|
dline(x + 1, y + 0, x + w - 1, y + 0, C_BLACK);
|
|
drect(x + 0, y + 1, x + w - 0, y + 9, C_BLACK);
|
|
dline(x + 0, y + 10, x + w - 1, y + 10, C_BLACK);
|
|
dline(x + 0, y + 11, x + w - 2, y + 11, C_BLACK);
|
|
dline(x + 0, y + 12, x + w - 3, y + 12, C_BLACK);
|
|
dline(x + 0, y + 13, x + w - 4, y + 13, C_BLACK);
|
|
dline(x + 1, y + 14, x + w - 5, y + 14, C_BLACK);
|
|
|
|
dtext(x + ((w - width) >> 1), y + 3, C_WHITE, text);
|
|
}
|