rnd-20060726-2-src
[rocksndiamonds.git] / src / libgame / gadgets.h
index 160bd611a375311d5372208270f92499be2f21a3..86b9bfb13ea8414fa49ad3b7601da69069537108 100644 (file)
@@ -17,7 +17,8 @@
 #include "system.h"
 
 
-#define GADGET_FRAME_DELAY     150     /* delay between gadget actions */
+#define GADGET_FRAME_DELAY_FIRST       250     /* delay after first click */
+#define GADGET_FRAME_DELAY             100     /* delay for pressed butten */
 
 /* gadget types */
 #define GD_TYPE_NORMAL_BUTTON          (1 << 0)
@@ -152,6 +153,7 @@ struct GadgetTextButton
 struct GadgetTextInput
 {
   char value[MAX_GADGET_TEXTSIZE];     /* text string in input field */
+  char last_value[MAX_GADGET_TEXTSIZE];        /* last text string in input field */
   int cursor_position;                 /* actual text cursor position */
   int number_value;                    /* integer value, if numeric */
   int number_min;                      /* minimal allowed numeric value */
@@ -162,6 +164,7 @@ struct GadgetTextInput
 struct GadgetTextArea
 {
   char value[MAX_GADGET_TEXTSIZE];     /* text string in input field */
+  char last_value[MAX_GADGET_TEXTSIZE];        /* last text string in input field */
   int cursor_position;                 /* actual text cursor position */
   int cursor_x;                                /* actual x cursor position */
   int cursor_y;                                /* actual y cursor position */
@@ -193,7 +196,9 @@ struct GadgetScrollbar
   int items_max;                       /* number of items to access */
   int items_visible;                   /* number of visible items */
   int item_position;                   /* actual item position */
+  int size_min;                                /* minimal scrollbar size */
   int size_max;                                /* this is either width or height */
+  int size_max_cmp;                    /* needed for minimal scrollbar size */
   int size;                            /* scrollbar size on screen */
   int position;                                /* scrollbar position on screen */
   int position_max;                    /* bottom/right scrollbar position */
@@ -209,8 +214,8 @@ struct GadgetInfo
   char info_text[MAX_INFO_TEXTSIZE];   /* short popup info text */
   int x, y;                            /* gadget position */
   int width, height;                   /* gadget size */
-  unsigned long type;                  /* type (button, text input, ...) */
-  unsigned long state;                 /* state (pressed, released, ...) */
+  unsigned int type;                   /* type (button, text input, ...) */
+  unsigned int state;                  /* state (pressed, released, ...) */
   boolean checked;                     /* check/radio button state */
   int radio_nr;                                /* number of radio button series */
   boolean mapped;                      /* gadget is mapped on the screen */
@@ -222,7 +227,7 @@ struct GadgetInfo
   struct GadgetDesign design[2];       /* 0: normal; 1: pressed */
   struct GadgetDesign alt_design[2];   /* alternative design */
   struct GadgetDecoration deco;                /* decoration on top of gadget */
-  unsigned long event_mask;            /* possible events for this gadget */
+  unsigned int event_mask;             /* possible events for this gadget */
   struct GadgetEvent event;            /* actual gadget event */
   gadget_function callback_info;       /* function for pop-up info text */
   gadget_function callback_action;     /* function for gadget action */
@@ -246,10 +251,15 @@ void UnmapGadget(struct GadgetInfo *);
 void UnmapAllGadgets();
 void RemapAllGadgets();
 
+boolean anyTextInputGadgetActive();
+boolean anyTextAreaGadgetActive();
+boolean anySelectboxGadgetActive();
+boolean anyScrollbarGadgetActive();
 boolean anyTextGadgetActive();
+
 void ClickOnGadget(struct GadgetInfo *, int);
 
-void HandleGadgets(int, int, int);
-void HandleGadgetsKeyInput(Key);
+boolean HandleGadgets(int, int, int);
+boolean HandleGadgetsKeyInput(Key);
 
 #endif /* GADGETS_H */