# modules/uwindows/UWindows.h File Reference

`#include "list.h"`
`#include "UW_Config.h"`

## Data Structures
struct | tstrTimer
struct | UW_CallBack
struct | UW_Window
struct | UW_ListBox
## Defines
#define | DEFAULT_FORM_LENGTH 160
#define | DEFAULT_FORM_HEIGHT 104
#define | DEFAULT_BTN_LENGTH 16
#define | DEFAULT_BTN_HEIGHT 16
#define | DEFAULT_EDIT_LENGTH 16
#define | DEFAULT_EDIT_HEIGHT 16
#define | DEFAULT_CHECK_LENGTH 16
#define | DEFAULT_CHECK_HEIGHT 16
#define | DEFAULT_LABEL_LENGTH 16
#define | DEFAULT_LABEL_HEIGHT 16
#define | DEFAULT_LIST_LENGTH 16
#define | DEFAULT_LIST_HEIGHT 16
#define | DEFAULT_ICON_LENGTH 32
#define | DEFAULT_ICON_HEIGHT 32
#define | DEFAULT_FADER_LENGTH 4
#define | DEFAULT_FADER_HEIGHT 32
#define | DEFAULT_POT_LENGTH 8
#define | DEFAULT_POT_HEIGHT 8
#define | RGB_MAKE(xR, xG, xB)
#define | RGB_RED 0x00F8
#define | RGB_BLACK 0x0000
#define | RGB_WHITE 0xffff
#define | RGB_BLUE 0x1F00
#define | RGB_GREEN 0xE007
#define | RGB_YELLOW (RGB_GREEN|RGB_RED)
#define | RGB_MAGENTA (RGB_BLUE|RGB_RED)
#define | RGB_LIGHTBLUE (RGB_BLUE|RGB_GREEN)
#define | RGB_ORANGE (RGB_RED | 0xE001)
#define | RGB_PINK (RGB_MAGENTA | 0xE001)
#define | GRAY (RGB_MAKE(180,180,180))
#define | BLUE (RGB_BLUE)
#define | RED (RGB_RED)
#define | BLACK (RGB_BLACK)
#define | WHITE (RGB_WHITE)
#define | SIMPLE_BLACK 0x00
#define | SIMPLE_BLUE 0x01
#define | SIMPLE_GRAY 0x02
#define | SIMPLE_WHITE 0x03
#define | CH_WIDTH 0x07
#define | CH_HEIGHT 0x10
#define | UW_SetType(pWindow, Type) (pWindow->type = Type)
#define | UW_SetPosition(pWindow, x, y)
#define | UW_SetSize(pWindow, x, y)
#define | UW_SetCaption(pWindow, pcaption, length)
#define | UW_SetVisible(pWindow, vvisible)
#define | UW_SetEnable(pWindow, value)
#define | UW_SetOnClick(pWindow, pFunction)
#define | UW_SetOnButtonPress(pWindow, pFunction)
#define | UW_SetTimer(pWindow, pFunction, Duration)
#define | UW_SetValue(pCheckBox, vvalue)
## Enumerations
enum | UW_Type { UW_FORM = 0, UW_BUTTON = 1, UW_LABEL = 2, UW_EDIT = 3, UW_CHECKBOX = 4, UW_ICON = 5, UW_LISTBOX = 6, UW_FADER = 100, UW_POT = 101, UW_ENVELOPE = 102 }
enum | UW_ButtonState { PUSHED = 0, LEFT = 1, UP = 2, RIGHT = 3, DOWN = 4 }
enum | MENU_code { MENU_LEAVE = 0, MENU_CONTINUE = 1, MENU_REFRESH = 2, MENU_CHANGE = 3, MENU_CONTINUE_COMMAND = 4, MENU_LEAVE_AS_IT = 5, MENU_RESTORE_COMMAND = 6 }
## Functions
void | UW_ListBoxSetItemHeight (UW_Window *pListBox, u8 value)
| API Set List Box Items Height.
void | UW_ListBoxAddItem (UW_Window *ListBox, UW_Window *Item)
| API add item to list box.
void | UW_ListBoxRemoveItem (UW_Window *ListBox, UW_Window *Item)
| API remove item from list box.
UW_Window * | UW_ListBoxGetActiveItem (UW_Window *ListBox)
| get active item
UW_Window * | UW_ListBoxGetItem (UW_Window *ListBox, u32 index)
| get item with a certain index
s32 | UW_ListBoxGetIndex (UW_Window *ListBox, UW_Window *Item)
void | ialloc ()
char * | UW_Malloc (unsigned long nbytes)
void | UW_Free (char *ap)
void * | UW_MemCpy (void *s1, const void *s2, int n)
void * | UW_MemSet (void *s1, unsigned char val, int n)
## Variables
UW_Window | UWindows
UW_Window * | pUW_Infocus
bool | Refresh

## Define Documentation

#define BLACK (RGB_BLACK)

#define BLUE (RGB_BLUE)

#define CH_HEIGHT 0x10

#define CH_WIDTH 0x07

#define DEFAULT_BTN_HEIGHT 16

#define DEFAULT_BTN_LENGTH 16

#define DEFAULT_CHECK_HEIGHT 16

#define DEFAULT_CHECK_LENGTH 16

#define DEFAULT_EDIT_HEIGHT 16

#define DEFAULT_EDIT_LENGTH 16

#define DEFAULT_FADER_HEIGHT 32

#define DEFAULT_FADER_LENGTH 4

#define DEFAULT_FORM_HEIGHT 104

#define DEFAULT_FORM_LENGTH 160

#define DEFAULT_ICON_HEIGHT 32

#define DEFAULT_ICON_LENGTH 32

#define DEFAULT_LABEL_HEIGHT 16

#define DEFAULT_LABEL_LENGTH 16

#define DEFAULT_LIST_HEIGHT 16

#define DEFAULT_LIST_LENGTH 16

#define DEFAULT_POT_HEIGHT 8

#define DEFAULT_POT_LENGTH 8

#define GRAY (RGB_MAKE(180,180,180))

#define RED (RGB_RED)

#define RGB_BLACK 0x0000

#define RGB_BLUE 0x1F00

#define RGB_GREEN 0xE007

#define RGB_LIGHTBLUE (RGB_BLUE|RGB_GREEN)

#define RGB_MAGENTA (RGB_BLUE|RGB_RED)

#define RGB_MAKE | ( | xR,
|  | xG,
|  | xB |  | ) |

Value:

    ( ( (xG&0x07)<<13 ) + ( (xG)>>5 )  +      \
                                     ( ((xB)>>3) << 8 )          +      \
                                     ( ((xR)>>3) << 3 ) )

#define RGB_ORANGE (RGB_RED | 0xE001)

#define RGB_PINK (RGB_MAGENTA | 0xE001)

#define RGB_RED 0x00F8

#define RGB_WHITE 0xffff

#define RGB_YELLOW (RGB_GREEN|RGB_RED)

#define SIMPLE_BLACK 0x00

#define SIMPLE_BLUE 0x01

#define SIMPLE_GRAY 0x02

#define SIMPLE_WHITE 0x03

#define UW_SetCaption | ( | pWindow,
|  | pcaption,
|  | length |  | ) |

Value:

    do                                                                                              \
    {                                                                                               \
            (pWindow)->caption              = (u8 *)pcaption;                       \
            (pWindow)->captionlen   = (u8)length    ;                       \
            Refresh                                 = 1;                                    \
    } while(0)

#define UW_SetEnable | ( | pWindow,
|  | value |  | ) |

Value:

    do                                                                                                      \
    {                                                                                                       \
            (pWindow)->enable               = (bool)value;                          \
            Refresh                                 = 1;                                    \
    } while(0)

#define UW_SetOnButtonPress | ( | pWindow,
|  | pFunction |  | ) |

Value:

    do                                                                                                      \
    {                                                                                                       \
            (pWindow)->CallBacks.ButtonPress        = pFunction;            \
    } while(0)

#define UW_SetOnClick | ( | pWindow,
|  | pFunction |  | ) |

Value:

    do                                                                                      \
    {                                                                                       \
            (pWindow)->CallBacks.Click      = (void *)pFunction;    \
    } while(0)

#define UW_SetPosition | ( | pWindow,
|  | x,
|  | y |  | ) |

Value:

    do                                                                              \
    {                                                                               \
            (pWindow)->Absx                 = (s32)x;                       \
            (pWindow)->Absy                 = (s32)y;                       \
            Refresh                                 = 1;                    \
    } while(0)

#define UW_SetSize | ( | pWindow,
|  | x,
|  | y |  | ) |

Value:

    do                                                                                      \
    {                                                                                       \
            (pWindow)->length               = (s32)x;                               \
            (pWindow)->height               = (s32)y;                               \
            Refresh                                 = 1;                            \
    } while(0)

#define UW_SetTimer | ( | pWindow,
|  | pFunction,
|  | Duration |  | ) |

Value:

    do                                                                                                                              \
    {                                                                                                                               \
            (pWindow)->CallBacks.TimerCallBack.u32TimeOut = Duration;       \
            (pWindow)->CallBacks.TimerCallBack.u32CurrentTime = 0;          \
            (pWindow)->CallBacks.TimerCallBack.Timer        = pFunction;    \
    } while(0)

#define UW_SetType | ( | pWindow,
|  | Type |  | ) | (pWindow->type = Type)

#define UW_SetValue | ( | pCheckBox,
|  | vvalue |  | ) |

Value:

    do                                                                                                      \
    {                                                                                                       \
            (pCheckBox)->value              = vvalue;                                       \
            Refresh                                 = 1;                                            \
    } while(0)

#define UW_SetVisible | ( | pWindow,
|  | vvisible |  | ) |

Value:

    do                                                                                      \
    {                                                                                       \
            (pWindow)->visible              = (bool)vvisible;               \
            Refresh                                 = 1;                            \
    } while(0)

#define WHITE (RGB_WHITE)

## Enumeration Type Documentation

enum MENU_code

Enumerator:

  MENU_LEAVE |
  MENU_CONTINUE |
  MENU_REFRESH |
  MENU_CHANGE |
  MENU_CONTINUE_COMMAND |
  MENU_LEAVE_AS_IT |
  MENU_RESTORE_COMMAND |

enum UW_ButtonState

Enumerator:

  PUSHED | Joystick was just pressed down.
  LEFT | Joystick was just pushed left.
  UP | Joystick was just pushed up.
  RIGHT | Joystick was just pushed right.
  DOWN | Joystick was just pushed down.

enum UW_Type

Enumerator:

  UW_FORM |
  UW_BUTTON |
  UW_LABEL |
  UW_EDIT |
  UW_CHECKBOX |
  UW_ICON |
  UW_LISTBOX |
  UW_FADER |
  UW_POT |
  UW_ENVELOPE |

## Function Documentation

void ialloc | ( |  | ) |

void UW_Free | ( | char * | ap | ) |

void UW_ListBoxAddItem | ( | UW_Window * | ListBox,
|  | UW_Window * | Item |
| ) |  |  |

API add item to list box.

This is used add item to list box

Parameters:

  `[in]` | pListBox,: | pointer to UWindow Object treated as ListBox
  `[in]` | Item,: | a new Item, pointer t UWindow treated as EditBox

Returns:
  none

UW_Window* UW_ListBoxGetActiveItem | ( | UW_Window * | ListBox | ) |

get active item

This is used get current item currently pointed to in ListBox

Parameters:

  `[in]` | pListBox,: | pointer to UWindow Object treated as ListBox

Returns:
  pointer to UWindow Object Active Item in list Box

s32 UW_ListBoxGetIndex | ( | UW_Window * | ListBox,
|  | UW_Window * | Item |
| ) |  |  |

UW_Window* UW_ListBoxGetItem | ( | UW_Window * | ListBox,
|  | u32 | index |
| ) |  |  |

get item with a certain index

Items are indexed from 0 to TotalCount-1, This is used get item with certain index

Parameters:

  `[in]` | pListBox,: | pointer to UWindow Object treated as ListBox
  `[in]` | index,: | index of the Item

Returns:
  pointer to UWindow Object Active Item in list Box

void UW_ListBoxRemoveItem | ( | UW_Window * | ListBox,
|  | UW_Window * | Item |
| ) |  |  |

API remove item from list box.

This is used remove item from list box

Parameters:

  `[in]` | pListBox,: | pointer to UWindow Object treated as ListBox
  `[in]` | Item,: | a new Item, pointer t UWindow treated as EditBox

Returns:
  none

void UW_ListBoxSetItemHeight | ( | UW_Window * | pListBox,
|  | u8 | value |
| ) |  |  |

API Set List Box Items Height.

This should set List Box Items Height

Parameters:

  `[in]` | pListBox,: | pointer to UWindow Object treated as ListBox
  `[in]` | value | : Height of Items

Returns:
  none

char* UW_Malloc | ( | unsigned long | nbytes | ) |

void* UW_MemCpy | ( | void * | s1,
|  | const void * | s2,
|  | int | n |
| ) |  |  |

void* UW_MemSet | ( | void * | s1,
|  | unsigned char | val,
|  | int | n |
| ) |  |  |

## Variable Documentation

UW_Window* pUW_Infocus

bool Refresh

UW_Window UWindows