PatchworkOS
Loading...
Searching...
No Matches
main.c File Reference
#include <libpatchwork/patchwork.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  calculator_t
 

Macros

#define LABEL_ID   1234
 
#define LABEL_HEIGHT   (42)
 
#define NUMPAD_COLUMNS   4
 
#define NUMPAD_ROWS   4
 
#define NUMPAD_PADDING   6
 
#define NUMPAD_BUTTON_WIDTH   (64)
 
#define NUMPAD_COLUMN_TO_WINDOW(column)   (NUMPAD_PADDING * ((column) + 1) + NUMPAD_BUTTON_WIDTH * (column))
 
#define NUMPAD_ROW_TO_WINDOW(row)   (LABEL_HEIGHT + NUMPAD_PADDING * ((row) + 2) + NUMPAD_BUTTON_WIDTH * (row))
 
#define LABEL_WIDTH   (NUMPAD_COLUMN_TO_WINDOW(NUMPAD_COLUMNS) - NUMPAD_PADDING * 2)
 
#define WINDOW_WIDTH   (NUMPAD_COLUMN_TO_WINDOW(NUMPAD_COLUMNS))
 
#define WINDOW_HEIGHT   (NUMPAD_ROW_TO_WINDOW(NUMPAD_ROWS))
 

Functions

static uint64_t numpad_button_create (element_t *elem, font_t *font, uint64_t column, uint64_t row, const char *name, element_id_t id)
 
static uint64_t procedure (window_t *win, element_t *elem, const event_t *event)
 
int main (void)
 

Macro Definition Documentation

◆ LABEL_HEIGHT

#define LABEL_HEIGHT   (42)

Definition at line 8 of file main.c.

◆ LABEL_ID

#define LABEL_ID   1234

Definition at line 7 of file main.c.

◆ LABEL_WIDTH

#define LABEL_WIDTH   (NUMPAD_COLUMN_TO_WINDOW(NUMPAD_COLUMNS) - NUMPAD_PADDING * 2)

Definition at line 18 of file main.c.

◆ NUMPAD_BUTTON_WIDTH

#define NUMPAD_BUTTON_WIDTH   (64)

Definition at line 13 of file main.c.

◆ NUMPAD_COLUMN_TO_WINDOW

#define NUMPAD_COLUMN_TO_WINDOW (   column)    (NUMPAD_PADDING * ((column) + 1) + NUMPAD_BUTTON_WIDTH * (column))

Definition at line 15 of file main.c.

◆ NUMPAD_COLUMNS

#define NUMPAD_COLUMNS   4

Definition at line 10 of file main.c.

◆ NUMPAD_PADDING

#define NUMPAD_PADDING   6

Definition at line 12 of file main.c.

◆ NUMPAD_ROW_TO_WINDOW

#define NUMPAD_ROW_TO_WINDOW (   row)    (LABEL_HEIGHT + NUMPAD_PADDING * ((row) + 2) + NUMPAD_BUTTON_WIDTH * (row))

Definition at line 16 of file main.c.

◆ NUMPAD_ROWS

#define NUMPAD_ROWS   4

Definition at line 11 of file main.c.

◆ WINDOW_HEIGHT

#define WINDOW_HEIGHT   (NUMPAD_ROW_TO_WINDOW(NUMPAD_ROWS))

Definition at line 21 of file main.c.

◆ WINDOW_WIDTH

#define WINDOW_WIDTH   (NUMPAD_COLUMN_TO_WINDOW(NUMPAD_COLUMNS))

Definition at line 20 of file main.c.

Function Documentation

◆ main()

◆ numpad_button_create()

static uint64_t numpad_button_create ( element_t elem,
font_t font,
uint64_t  column,
uint64_t  row,
const char *  name,
element_id_t  id 
)
static

◆ procedure()