mgh: fix for default HDD DMA mode, that wasn't correctly set
[open-ps2-loader.git] / include / dia.h
blob7be25d8d3040b30fe36c149ded3d28d7f693db87
1 #ifndef __DIA_H
2 #define __DIA_H
4 #include "include/usbld.h"
6 // UI dialog item definition
7 typedef enum {
8 // terminates the definition of dialog. Mandatory
9 UI_TERMINATOR,
10 // A string label
11 UI_LABEL,
12 // Break to next line
13 UI_BREAK,
14 // Break to next line, draw line splitter
15 UI_SPLITTER,
16 // A spacer of a few pixels
17 UI_SPACER,
18 // Ok button
19 UI_OK, // Just a shortcut for BUTTON with OK label and id 1!
20 // Universal button (display's label, returns id on X)
21 UI_BUTTON,
22 // draw integer input box
23 UI_INT,
24 // draw string input box
25 UI_STRING,
26 // draw password string input box
27 UI_PASSWORD,
28 // bool value (On/Off). (Uses int value for storage)
29 UI_BOOL,
30 // enumeration (multiple strings)
31 UI_ENUM,
32 // Colour selection
33 UI_COLOUR
34 } UIItemType;
36 // UI item definition (for dialogues)
37 struct UIItem {
38 UIItemType type;
39 int id; // id of this item
40 short enabled;
41 int hintId; // shown if not NULL
42 int fixedWidth; // 0: no fixed width, >0: width in pixels, <0: width in %
43 int fixedHeight;
45 union {
46 struct {
47 const char *text;
48 int stringId; // if zero, the text is used
49 } label;
51 struct { // integer value
52 // default value
53 int def;
54 int current;
55 int min;
56 int max;
57 // if UI_ENUM is used, this contains enumeration values
58 const char **enumvalues; // last one has to be NULL
59 } intvalue;
61 struct { // fixed 32 character string
62 // default value
63 char def[32];
64 char text[32];
65 int (*handler)(char *text, int maxLen);
66 } stringvalue;
68 struct {
69 unsigned char r;
70 unsigned char g;
71 unsigned char b;
72 } colourvalue;
76 /// Dialog display
77 int diaExecuteDialog(struct UIItem *ui, int uiId, short inMenu, int (*updater)(int modified));
78 void diaRenderUI(struct UIItem *ui, short inMenu, struct UIItem *cur, int haveFocus);
79 int diaShowKeyb(char* text, int maxLen);
80 void diaSetEnabled(struct UIItem* ui, int id, int enabled);
81 int diaGetInt(struct UIItem* ui, int id, int *value);
82 int diaSetInt(struct UIItem* ui, int id, int value);
83 int diaGetString(struct UIItem* ui, int id, char *value);
84 int diaSetString(struct UIItem* ui, int id, const char *text);
85 int diaGetColor(struct UIItem* ui, int id, unsigned char *col);
86 int diaSetColor(struct UIItem* ui, int id, const unsigned char *col);
87 int diaSetU64Color(struct UIItem* ui, int id, u64 col);
88 // set label pointer into the label's text (must be valid while rendering dialog)
89 int diaSetLabel(struct UIItem* ui, int id, const char *text);
90 // sets the current enum value list for given control
91 int diaSetEnum(struct UIItem* ui, int id, const char **enumvals);
93 #endif