rnd-20031130-1-src
[rocksndiamonds.git] / src / libgame / gadgets.c
index aacadafad4cfec7fd7d80e42199eae8294ebc91b..ddc5ac6016e98877dade4bc05699ed682fc4ad05 100644 (file)
@@ -358,8 +358,9 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
 
        /* gadget text value */
        DrawTextToTextArea(gi->x + border_x, gi->y + border_y,
-                          gi->textarea.value, font_nr,
-                          gi->textarea.xsize, gi->textarea.ysize);
+                          gi->textarea.value, font_nr, gi->textarea.xsize,
+                          gi->textarea.xsize, gi->textarea.ysize,
+                          BLIT_ON_BACKGROUND);
 
        cursor_letter = gi->textarea.value[gi->textarea.cursor_position];
        cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
@@ -588,7 +589,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
                               xpos, ypos);
 
        /* middle part of gadget */
-       for (i=0; i<num_steps; i++)
+       for (i=0; i < num_steps; i++)
          BlitBitmapOnBackground(gd->bitmap, drawto,
                                 gd->x, gd->y + gi->border.ysize,
                                 gi->width, design_body,
@@ -635,7 +636,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
                               xpos, ypos);
 
        /* middle part of gadget */
-       for (i=0; i<num_steps; i++)
+       for (i=0; i < num_steps; i++)
          BlitBitmapOnBackground(gd->bitmap, drawto,
                                 gd->x + gi->border.xsize, gd->y,
                                 design_body, gi->height,
@@ -1301,7 +1302,7 @@ void ClickOnGadget(struct GadgetInfo *gi, int button)
   HandleGadgets(gi->x, gi->y, 0);
 }
 
-void HandleGadgets(int mx, int my, int button)
+boolean HandleGadgets(int mx, int my, int button)
 {
   static struct GadgetInfo *last_info_gi = NULL;
   static unsigned long pressed_delay = 0;
@@ -1326,7 +1327,7 @@ void HandleGadgets(int mx, int my, int button)
 
   /* check if there are any gadgets defined */
   if (gadget_list_first_entry == NULL)
-    return;
+    return FALSE;
 
   /* simulated release of mouse button over last gadget */
   if (mx == -1 && my == -1 && button == 0)
@@ -1590,7 +1591,7 @@ void HandleGadgets(int mx, int my, int button)
        /* don't handle this scrollbar anymore while mouse button pressed */
        last_gi = NULL;
 
-       return;
+       return TRUE;
       }
     }
 
@@ -1722,6 +1723,9 @@ void HandleGadgets(int mx, int my, int button)
   /* handle gadgets unmapped/mapped between pressing and releasing */
   if (release_event && !gadget_released && new_gi)
     new_gi->state = GD_BUTTON_UNPRESSED;
+
+  return (gadget_pressed || gadget_pressed_repeated ||
+         gadget_released || gadget_moving);
 }
 
 static void insertCharIntoTextArea(struct GadgetInfo *gi, char c)
@@ -1739,7 +1743,7 @@ static void insertCharIntoTextArea(struct GadgetInfo *gi, char c)
   setTextAreaCursorPosition(gi, gi->textarea.cursor_position + 1);
 }
 
-void HandleGadgetsKeyInput(Key key)
+boolean HandleGadgetsKeyInput(Key key)
 {
   struct GadgetInfo *gi = last_gi;
 
@@ -1747,7 +1751,7 @@ void HandleGadgetsKeyInput(Key key)
       !(gi->type & GD_TYPE_TEXT_INPUT ||
        gi->type & GD_TYPE_TEXT_AREA ||
        gi->type & GD_TYPE_SELECTBOX))
-    return;
+    return FALSE;
 
   if (key == KSYM_Return)      /* valid for both text input and selectbox */
   {
@@ -1899,4 +1903,6 @@ void HandleGadgetsKeyInput(Key key)
       DrawGadget(gi, DG_PRESSED, gi->direct_draw);
     }
   }
+
+  return TRUE;
 }