aboutsummaryrefslogtreecommitdiff
path: root/src/button.h
blob: 9303ea57624284a69da1c9052ea59d96ab173131 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
 * @file button.h
 * @author Joe Wingbermuehle
 * @date 2004-2006
 *
 * @brief Header file for button functions.
 *
 */

#ifndef BUTTON_H
#define BUTTON_H

#include "font.h"

struct IconNode;

/** Button types. */
typedef enum {
	BUTTON_LABEL,        /**< Label. */
	BUTTON_MENU,         /**< Menu item. */
	BUTTON_MENU_ACTIVE,  /**< Active menu item. */
	BUTTON_TASK,         /**< Item in the task list. */
	BUTTON_TASK_ACTIVE   /**< Active item in the task list. */
} ButtonType;

/** Alignment of content in a button. */
typedef enum {
	ALIGN_LEFT,   /**< Left align. */
	ALIGN_CENTER, /**< Center align. */
	ALIGN_RIGHT   /**< Right align. */
} AlignmentType;

/** Data used for drawing a button. */
typedef struct {

	ButtonType type;         /**< The type of button to draw. */
	Drawable drawable;       /**< The place to put the button. */
	GC gc;                   /**< Graphics context used for drawing. */
	FontType font;           /**< The font for button text. */
	AlignmentType alignment; /**< Alignment of the button content. */

	int x, y;           /**< The coordinates to render the button. */
	int width, height;  /**< The size of the button. */

	struct IconNode *icon;  /**< Icon used in the button. */
	const char *text;       /**< Text used in the button. */

} ButtonNode;

/** Draw a button.
 * @param bp The button to draw.
 */
void DrawButton(ButtonNode *bp);

/** Reset the contents of a ButtonNode structure.
 * @param bp The structure to reset.
 * @param d The drawable to use.
 * @param g The graphics context to use.
 */
void ResetButton(ButtonNode *bp, Drawable d, GC g);

#endif