Fix for the problem that SDL applications exited
[AROS-Contrib.git] / Games / lbreakout2 / client / item.h
blob346b991d34a5df64bc33fe54ec0f71c6f55be0c1
1 /***************************************************************************
2 item.h - description
3 -------------------
4 begin : Thu Sep 20 2001
5 copyright : (C) 2001 by Michael Speck
6 email : kulkanie@gmx.net
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef __ITEM_H
19 #define __ITEM_H
21 #include "hint.h"
24 ====================================================================
25 Item of menu
26 ====================================================================
28 enum {
29 ITEM_SEPARATOR = 0,
30 ITEM_SWITCH,
31 ITEM_SWITCH_X,
32 ITEM_RANGE,
33 ITEM_KEY,
34 ITEM_EDIT,
35 ITEM_LINK,
36 ITEM_ACTION
38 typedef struct {
39 Value *value; /* value of item */
40 int type; /* type as listed above */
41 char *name; /* name of item -- duplicated */
42 int item_id; /* id of item (returned as action if ITEM_ACTION) */
43 int x, y, w, h; /* position and size in screen */
44 int nx, ny; /* position where name is drawn */
45 int nalign; /* align of name: either left-aligned
46 or centered (only if link to another menu) */
47 int vx, vy; /* position where value string is drawn right-aligned */
48 int valign; /* alignment of value string */
49 float alpha; /* alpha of normal font (which vanishes when selected) */
50 float halpha; /* alpha of highlight font */
51 int highlighted; /* keep alpha at 0 (will raise to 255 if not set) */
52 void (*callback)(); /* if value of item has been modified this functions is called */
53 void *link; /* menu link */
54 StkFont *font, *hfont; /* if set use these fonts instead of standard font */
55 Hint *hint; /* if not NULL this hint is displayed when quick-help's enabled:
56 created by item itself */
57 SDL_Surface *bkgnd; /* background surface for item */
58 } Item;
61 ====================================================================
62 Create item.
63 Return Value: item
64 ====================================================================
66 Item *item_create_separator( char *name );
67 Item *item_create_range( char *name, char *hint, int *val_int, int min, int max, int step );
68 Item *item_create_switch( char *name, char *hint, int *val_int, char *str_off, char *str_on );
69 Item *item_create_switch_x( char *name, char *hint, int *val_int, char **strings, int count );
70 Item *item_create_key( char *name, char *hint, int *val_int, int *filter );
71 Item *item_create_edit( char *name, char *hint, char *val_str, int limit );
72 Item *item_create_link( char *name, char *hint, void *menu );
73 Item *item_create_action( char *name, char *hint, int item_id );
75 ====================================================================
76 Delete item (void pointer for compatiblity when using with list)
77 ====================================================================
79 void item_delete( void *item );
81 ====================================================================
82 Adjust alignment of name and value strings
83 ====================================================================
85 void item_adjust( Item *item );
87 ====================================================================
88 Hide/Show item
89 ====================================================================
91 void item_hide( Item *item );
92 void item_show( Item *item );
94 ====================================================================
95 Update alpha of item
96 ====================================================================
98 void item_update_alpha( Item *item, int ms );
100 ====================================================================
101 Check if position's on item.
102 ====================================================================
104 int item_focus( Item *item, int x, int y );
106 #endif