GUI: Made slider controls movable even if you bring mouse cursor far from them. Makes it much easier to maximize or minimize a value.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@920 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									3a5b460184
								
							
						
					
					
						commit
						c596b80b8d
					
				
							
								
								
									
										382
									
								
								engine.c
									
									
									
									
									
								
							
							
						
						
									
										382
									
								
								engine.c
									
									
									
									
									
								
							@ -2334,60 +2334,7 @@ short Window_normal_button_onclick(word x_pos, word y_pos, word width, word heig
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns true if the mouse cursor sits inside the boundary of control.
 | 
			
		||||
short Window_click_in_control(short control)
 | 
			
		||||
{
 | 
			
		||||
  T_Normal_button   * temp1;
 | 
			
		||||
  T_Palette_button  * temp2;
 | 
			
		||||
  T_Scroller_button * temp3;
 | 
			
		||||
  T_Special_button  * temp4;
 | 
			
		||||
  T_Dropdown_button * temp5;
 | 
			
		||||
  
 | 
			
		||||
  for (temp1=Window_normal_button_list; temp1; temp1=temp1->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (temp1->Number == control)
 | 
			
		||||
      return Window_click_in_rectangle(temp1->Pos_X,temp1->Pos_Y,temp1->Pos_X+temp1->Width-1,temp1->Pos_Y+temp1->Height-1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  for (temp2=Window_palette_button_list; temp2; temp2=temp2->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (temp2->Number == control)
 | 
			
		||||
      return Window_click_in_rectangle(temp2->Pos_X+5,temp2->Pos_Y+3,temp2->Pos_X+160,temp2->Pos_Y+82);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  for (temp3=Window_scroller_button_list; temp3; temp3=temp3->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (temp3->Number == (control & 1023))
 | 
			
		||||
    {
 | 
			
		||||
      // top scroller arrow
 | 
			
		||||
      if (control & 1024)
 | 
			
		||||
        return Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y,temp3->Pos_X+10,temp3->Pos_Y+10);
 | 
			
		||||
      // bottom scroller arrow
 | 
			
		||||
      if (control & 2048)
 | 
			
		||||
        return Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-1);
 | 
			
		||||
      // middle slider
 | 
			
		||||
      return Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+12,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-13);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Test du click sur une zone spéciale
 | 
			
		||||
  for (temp4=Window_special_button_list; temp4; temp4=temp4->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (temp4->Number == control)
 | 
			
		||||
      return Window_click_in_rectangle(temp4->Pos_X,temp4->Pos_Y,temp4->Pos_X+temp4->Width-1,temp4->Pos_Y+temp4->Height-1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Test du click sur une dropdown
 | 
			
		||||
  for (temp5=Window_dropdown_button_list; temp5; temp5=temp5->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (temp5->Number == control)
 | 
			
		||||
      return Window_click_in_rectangle(temp5->Pos_X,temp5->Pos_Y,temp5->Pos_X+temp5->Width-1,temp5->Pos_Y+temp5->Height-1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// --- Renvoie le numéro du bouton clicke (-1:hors de la fenêtre, 0:aucun) ---
 | 
			
		||||
// --- Returns the number of the clicked button (-1:out of the window, 0:none) ---
 | 
			
		||||
short Window_get_clicked_button(void)
 | 
			
		||||
{
 | 
			
		||||
  T_Normal_button   * temp1;
 | 
			
		||||
@ -2400,10 +2347,11 @@ short Window_get_clicked_button(void)
 | 
			
		||||
 | 
			
		||||
  Window_attribute1=Mouse_K;
 | 
			
		||||
 | 
			
		||||
  // Test du click sur les boutons normaux
 | 
			
		||||
  // Test click on normal buttons
 | 
			
		||||
  for (temp1=Window_normal_button_list; temp1; temp1=temp1->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (Window_click_in_rectangle(temp1->Pos_X,temp1->Pos_Y,temp1->Pos_X+temp1->Width-1,temp1->Pos_Y+temp1->Height-1))
 | 
			
		||||
    if ((Input_sticky_control == 0 || Input_sticky_control == temp1->Number)
 | 
			
		||||
      && Window_click_in_rectangle(temp1->Pos_X,temp1->Pos_Y,temp1->Pos_X+temp1->Width-1,temp1->Pos_Y+temp1->Height-1))
 | 
			
		||||
    {
 | 
			
		||||
      Input_sticky_control = temp1->Number;
 | 
			
		||||
      if (temp1->Repeatable)
 | 
			
		||||
@ -2421,141 +2369,143 @@ short Window_get_clicked_button(void)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Test du click sur les zones "palette"
 | 
			
		||||
  // Test click on "Palette" buttons
 | 
			
		||||
  for (temp2=Window_palette_button_list; temp2; temp2=temp2->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (Window_click_in_rectangle(temp2->Pos_X+5,temp2->Pos_Y+3,temp2->Pos_X+160,temp2->Pos_Y+82))
 | 
			
		||||
    if ((Input_sticky_control == 0 || Input_sticky_control == temp2->Number)
 | 
			
		||||
      && Window_click_in_rectangle(temp2->Pos_X+5,temp2->Pos_Y+3,temp2->Pos_X+160,temp2->Pos_Y+82))
 | 
			
		||||
    {
 | 
			
		||||
      Input_sticky_control = temp2->Number;
 | 
			
		||||
      // On stocke dans Attribut2 le numero de couleur cliqué
 | 
			
		||||
      // We store the clicked color in Attribute2
 | 
			
		||||
      Window_attribute2 = (((Mouse_X-Window_pos_X)/Menu_factor_X)-(temp2->Pos_X+2)) / 10 * 16 +
 | 
			
		||||
        (((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-(temp2->Pos_Y+3)) / 5;
 | 
			
		||||
        return temp2->Number;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Test du click sur les barres de défilement
 | 
			
		||||
  // Test click oin slider/scroller bars
 | 
			
		||||
  for (temp3=Window_scroller_button_list; temp3; temp3=temp3->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-1))
 | 
			
		||||
    // Button Up arrow
 | 
			
		||||
    if ((Input_sticky_control == 0 || Input_sticky_control == (temp3->Number|1024))
 | 
			
		||||
      && Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y,temp3->Pos_X+10,temp3->Pos_Y+10))
 | 
			
		||||
    {
 | 
			
		||||
      // Button flèche Haut
 | 
			
		||||
      if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y,temp3->Pos_X+10,temp3->Pos_Y+10))
 | 
			
		||||
      Input_sticky_control = temp3->Number | 1024;
 | 
			
		||||
      Hide_cursor();
 | 
			
		||||
      Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
 | 
			
		||||
 | 
			
		||||
      if (temp3->Position)
 | 
			
		||||
      {
 | 
			
		||||
        Input_sticky_control = temp3->Number | 1024;
 | 
			
		||||
        Hide_cursor();
 | 
			
		||||
        Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
 | 
			
		||||
 | 
			
		||||
        if (temp3->Position)
 | 
			
		||||
        {
 | 
			
		||||
          temp3->Position--;
 | 
			
		||||
          Window_attribute1=1;
 | 
			
		||||
          Window_attribute2=temp3->Position;
 | 
			
		||||
          Window_draw_slider(temp3);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
          Window_attribute1=0;
 | 
			
		||||
        
 | 
			
		||||
        Display_cursor();
 | 
			
		||||
 | 
			
		||||
        Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
 | 
			
		||||
 | 
			
		||||
        Hide_cursor();
 | 
			
		||||
        Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
 | 
			
		||||
        Display_cursor();
 | 
			
		||||
        temp3->Position--;
 | 
			
		||||
        Window_attribute1=1;
 | 
			
		||||
        Window_attribute2=temp3->Position;
 | 
			
		||||
        Window_draw_slider(temp3);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      // Button flèche Bas
 | 
			
		||||
      if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-1))
 | 
			
		||||
        Window_attribute1=0;
 | 
			
		||||
      
 | 
			
		||||
      Display_cursor();
 | 
			
		||||
 | 
			
		||||
      Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
 | 
			
		||||
 | 
			
		||||
      Hide_cursor();
 | 
			
		||||
      Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y,11,11);
 | 
			
		||||
      Display_cursor();
 | 
			
		||||
      
 | 
			
		||||
      return (Window_attribute1)? temp3->Number : 0;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    // Button Down arrow
 | 
			
		||||
    if ((Input_sticky_control == 0 || Input_sticky_control == (temp3->Number|2048))
 | 
			
		||||
      && Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-1))
 | 
			
		||||
    {
 | 
			
		||||
      Input_sticky_control = temp3->Number | 2048;
 | 
			
		||||
      Hide_cursor();
 | 
			
		||||
      Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
 | 
			
		||||
 | 
			
		||||
      if (temp3->Position+temp3->Nb_visibles<temp3->Nb_elements)
 | 
			
		||||
      {
 | 
			
		||||
        Input_sticky_control = temp3->Number | 2048;
 | 
			
		||||
        Hide_cursor();
 | 
			
		||||
        Window_select_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
 | 
			
		||||
 | 
			
		||||
        if (temp3->Position+temp3->Nb_visibles<temp3->Nb_elements)
 | 
			
		||||
        {
 | 
			
		||||
          temp3->Position++;
 | 
			
		||||
          Window_attribute1=2;
 | 
			
		||||
          Window_attribute2=temp3->Position;
 | 
			
		||||
          Window_draw_slider(temp3);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
          Window_attribute1=0;
 | 
			
		||||
 | 
			
		||||
        Display_cursor();
 | 
			
		||||
 | 
			
		||||
        Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
 | 
			
		||||
 | 
			
		||||
        Hide_cursor();
 | 
			
		||||
        Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
 | 
			
		||||
        Display_cursor();
 | 
			
		||||
        temp3->Position++;
 | 
			
		||||
        Window_attribute1=2;
 | 
			
		||||
        Window_attribute2=temp3->Position;
 | 
			
		||||
        Window_draw_slider(temp3);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      // Jauge
 | 
			
		||||
      if (Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+12,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-13))
 | 
			
		||||
      {
 | 
			
		||||
        Input_sticky_control = temp3->Number;
 | 
			
		||||
        if (temp3->Nb_elements>temp3->Nb_visibles)
 | 
			
		||||
        {
 | 
			
		||||
          // S'il y a la place de faire scroller le curseur:
 | 
			
		||||
 | 
			
		||||
          max_slider_height=(temp3->Height-24);
 | 
			
		||||
 | 
			
		||||
          // Window_attribute2 reçoit la position dans la jauge correspondant au click
 | 
			
		||||
          Window_attribute2 =(Mouse_Y-Window_pos_Y) / Menu_factor_Y;
 | 
			
		||||
          Window_attribute2-=(temp3->Pos_Y+12+((temp3->Cursor_height-1)>>1));
 | 
			
		||||
          Window_attribute2*=(temp3->Nb_elements-temp3->Nb_visibles);
 | 
			
		||||
 | 
			
		||||
          if (Window_attribute2<0)
 | 
			
		||||
            Window_attribute2=0;
 | 
			
		||||
          else
 | 
			
		||||
          {
 | 
			
		||||
            Window_attribute2 =Round_div(Window_attribute2,max_slider_height-temp3->Cursor_height);
 | 
			
		||||
            if (Window_attribute2+temp3->Nb_visibles>temp3->Nb_elements)
 | 
			
		||||
              Window_attribute2=temp3->Nb_elements-temp3->Nb_visibles;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          // Si le curseur de la jauge bouge:
 | 
			
		||||
 | 
			
		||||
          if (temp3->Position!=Window_attribute2)
 | 
			
		||||
          {
 | 
			
		||||
            temp3->Position=Window_attribute2;
 | 
			
		||||
            Window_attribute1=3;
 | 
			
		||||
            Hide_cursor();
 | 
			
		||||
            Window_draw_slider(temp3);
 | 
			
		||||
            Display_cursor();
 | 
			
		||||
          }
 | 
			
		||||
          else
 | 
			
		||||
            // Si le curseur de la jauge ne bouge pas:
 | 
			
		||||
            Window_attribute1=0;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
          // S'il n'y a pas la place de bouger le curseur de la jauge:
 | 
			
		||||
          Window_attribute1=0;
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
        // Le click se situe dans la zone de la jauge mais n'est sur aucune
 | 
			
		||||
        // des 3 parties importantes de la jauge
 | 
			
		||||
        Window_attribute1=0;
 | 
			
		||||
 | 
			
		||||
      Display_cursor();
 | 
			
		||||
 | 
			
		||||
      Slider_timer((Mouse_K==1)? Config.Delay_left_click_on_slider : Config.Delay_right_click_on_slider);
 | 
			
		||||
 | 
			
		||||
      Hide_cursor();
 | 
			
		||||
      Window_unselect_normal_button(temp3->Pos_X,temp3->Pos_Y+temp3->Height-11,11,11);
 | 
			
		||||
      Display_cursor();
 | 
			
		||||
      
 | 
			
		||||
      return (Window_attribute1)? temp3->Number : 0;
 | 
			
		||||
    }
 | 
			
		||||
    // Middle slider
 | 
			
		||||
    if ((Input_sticky_control == temp3->Number) || (Input_sticky_control==0 &&
 | 
			
		||||
        Window_click_in_rectangle(temp3->Pos_X,temp3->Pos_Y+12,temp3->Pos_X+10,temp3->Pos_Y+temp3->Height-13)))
 | 
			
		||||
    {
 | 
			
		||||
      Input_sticky_control = temp3->Number;
 | 
			
		||||
      if (temp3->Nb_elements>temp3->Nb_visibles)
 | 
			
		||||
      {
 | 
			
		||||
        // If there is enough room to make the cursor move:
 | 
			
		||||
 | 
			
		||||
        max_slider_height=(temp3->Height-24);
 | 
			
		||||
 | 
			
		||||
        // Window_attribute2 receives the position of the cursor.
 | 
			
		||||
        Window_attribute2 =(Mouse_Y-Window_pos_Y) / Menu_factor_Y;
 | 
			
		||||
        Window_attribute2-=(temp3->Pos_Y+12+((temp3->Cursor_height-1)>>1));
 | 
			
		||||
        Window_attribute2*=(temp3->Nb_elements-temp3->Nb_visibles);
 | 
			
		||||
 | 
			
		||||
        if (Window_attribute2<0)
 | 
			
		||||
          Window_attribute2=0;
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
          Window_attribute2 =Round_div(Window_attribute2,max_slider_height-temp3->Cursor_height);
 | 
			
		||||
          if (Window_attribute2+temp3->Nb_visibles>temp3->Nb_elements)
 | 
			
		||||
            Window_attribute2=temp3->Nb_elements-temp3->Nb_visibles;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // If the cursor moved
 | 
			
		||||
 | 
			
		||||
        if (temp3->Position!=Window_attribute2)
 | 
			
		||||
        {
 | 
			
		||||
          temp3->Position=Window_attribute2;
 | 
			
		||||
          Window_attribute1=3;
 | 
			
		||||
          Hide_cursor();
 | 
			
		||||
          Window_draw_slider(temp3);
 | 
			
		||||
          Display_cursor();
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
          // If the cursor moved
 | 
			
		||||
          Window_attribute1=0;
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
        // If there's not enough room to make the cursor move:
 | 
			
		||||
        Window_attribute1=0;
 | 
			
		||||
        
 | 
			
		||||
      return (Window_attribute1)? temp3->Number : 0; 
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Test du click sur une zone spéciale
 | 
			
		||||
  // Test click on a special button
 | 
			
		||||
  for (temp4=Window_special_button_list; temp4; temp4=temp4->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (Window_click_in_rectangle(temp4->Pos_X,temp4->Pos_Y,temp4->Pos_X+temp4->Width-1,temp4->Pos_Y+temp4->Height-1))
 | 
			
		||||
    if ((Input_sticky_control == 0 || Input_sticky_control == temp4->Number)
 | 
			
		||||
      && Window_click_in_rectangle(temp4->Pos_X,temp4->Pos_Y,temp4->Pos_X+temp4->Width-1,temp4->Pos_Y+temp4->Height-1))
 | 
			
		||||
    {
 | 
			
		||||
       Input_sticky_control = temp4->Number;
 | 
			
		||||
       return temp4->Number;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Test du click sur une dropdown
 | 
			
		||||
  // Test click on a dropdown box
 | 
			
		||||
  for (temp5=Window_dropdown_button_list; temp5; temp5=temp5->Next)
 | 
			
		||||
  {
 | 
			
		||||
    if (Window_click_in_rectangle(temp5->Pos_X,temp5->Pos_Y,temp5->Pos_X+temp5->Width-1,temp5->Pos_Y+temp5->Height-1))
 | 
			
		||||
    if ((Input_sticky_control == 0 || Input_sticky_control == temp5->Number)
 | 
			
		||||
     && Window_click_in_rectangle(temp5->Pos_X,temp5->Pos_Y,temp5->Pos_X+temp5->Width-1,temp5->Pos_Y+temp5->Height-1))
 | 
			
		||||
    {
 | 
			
		||||
      Input_sticky_control = temp5->Number;
 | 
			
		||||
      if (Mouse_K & temp5->Active_button)
 | 
			
		||||
@ -2660,78 +2610,70 @@ short Window_clicked_button(void)
 | 
			
		||||
        return 0;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (Input_sticky_control != 0 && !Window_click_in_control(Input_sticky_control))
 | 
			
		||||
     
 | 
			
		||||
    if (!Input_sticky_control && Mouse_Y < Window_pos_Y+(12*Menu_factor_Y))
 | 
			
		||||
    {
 | 
			
		||||
      // do nothing
 | 
			
		||||
      Move_window(Mouse_X-Window_pos_X,Mouse_Y-Window_pos_Y);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
       
 | 
			
		||||
      if (Mouse_Y < Window_pos_Y+(12*Menu_factor_Y))
 | 
			
		||||
      short clicked_button;
 | 
			
		||||
      T_List_button * list;
 | 
			
		||||
      
 | 
			
		||||
      // Check which controls was clicked (by rectangular area)
 | 
			
		||||
      clicked_button = Window_get_clicked_button();
 | 
			
		||||
      
 | 
			
		||||
      // Check if it's part of a list control
 | 
			
		||||
      for (list=Window_list_button_list; list!=NULL; list=list->Next)
 | 
			
		||||
      {
 | 
			
		||||
        Move_window(Mouse_X-Window_pos_X,Mouse_Y-Window_pos_Y);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        short clicked_button;
 | 
			
		||||
        T_List_button * list;
 | 
			
		||||
        
 | 
			
		||||
        // Check which controls was clicked (by rectangular area)
 | 
			
		||||
        clicked_button = Window_get_clicked_button();
 | 
			
		||||
        
 | 
			
		||||
        // Check if it's part of a list control
 | 
			
		||||
        for (list=Window_list_button_list; list!=NULL; list=list->Next)
 | 
			
		||||
        if (list->Entry_button->Number == clicked_button)
 | 
			
		||||
        {
 | 
			
		||||
          if (list->Entry_button->Number == clicked_button)
 | 
			
		||||
          {
 | 
			
		||||
            // Click in the textual part of a list.
 | 
			
		||||
            short clicked_line;            
 | 
			
		||||
            clicked_line = (((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-list->Entry_button->Pos_Y)>>3;
 | 
			
		||||
            if (clicked_line == list->Cursor_position ||   // Same as before
 | 
			
		||||
              clicked_line >= list->Scroller->Nb_elements) // Below last line              
 | 
			
		||||
              return 0;
 | 
			
		||||
            
 | 
			
		||||
            Hide_cursor();
 | 
			
		||||
            // Redraw one item as disabled
 | 
			
		||||
            if (list->Cursor_position>=0 && list->Cursor_position<list->Scroller->Nb_visibles)
 | 
			
		||||
              list->Draw_list_item(
 | 
			
		||||
                list->Entry_button->Pos_X,
 | 
			
		||||
                list->Entry_button->Pos_Y + list->Cursor_position * 8,
 | 
			
		||||
                list->List_start + list->Cursor_position,
 | 
			
		||||
                0);
 | 
			
		||||
            list->Cursor_position = clicked_line;
 | 
			
		||||
            // Redraw one item as enabled
 | 
			
		||||
            if (list->Cursor_position>=0 && list->Cursor_position<list->Scroller->Nb_visibles)
 | 
			
		||||
              list->Draw_list_item(
 | 
			
		||||
                list->Entry_button->Pos_X,
 | 
			
		||||
                list->Entry_button->Pos_Y + list->Cursor_position * 8,
 | 
			
		||||
                list->List_start + list->Cursor_position,
 | 
			
		||||
                1);
 | 
			
		||||
            Display_cursor();
 | 
			
		||||
  
 | 
			
		||||
            // Store the selected value as attribute2
 | 
			
		||||
            Window_attribute2=list->List_start + list->Cursor_position;
 | 
			
		||||
            // Return the control ID of the list.
 | 
			
		||||
            return ((Input_sticky_control = list->Number));
 | 
			
		||||
          }
 | 
			
		||||
          else if (list->Scroller->Number == clicked_button)
 | 
			
		||||
          {
 | 
			
		||||
            // Click in the scroller part of a list
 | 
			
		||||
            if (list->List_start == list->Scroller->Position)
 | 
			
		||||
              return 0; // Didn't actually move
 | 
			
		||||
            // Update scroller indices
 | 
			
		||||
            list->Cursor_position += list->List_start;
 | 
			
		||||
            list->List_start = list->Scroller->Position;
 | 
			
		||||
            list->Cursor_position -= list->List_start;
 | 
			
		||||
            // Need to redraw all
 | 
			
		||||
            Hide_cursor();
 | 
			
		||||
            Window_redraw_list(list);
 | 
			
		||||
            Display_cursor();
 | 
			
		||||
          }
 | 
			
		||||
          // Click in the textual part of a list.
 | 
			
		||||
          short clicked_line;            
 | 
			
		||||
          clicked_line = (((Mouse_Y-Window_pos_Y)/Menu_factor_Y)-list->Entry_button->Pos_Y)>>3;
 | 
			
		||||
          if (clicked_line == list->Cursor_position ||   // Same as before
 | 
			
		||||
            clicked_line >= list->Scroller->Nb_elements) // Below last line              
 | 
			
		||||
            return 0;
 | 
			
		||||
          
 | 
			
		||||
          Hide_cursor();
 | 
			
		||||
          // Redraw one item as disabled
 | 
			
		||||
          if (list->Cursor_position>=0 && list->Cursor_position<list->Scroller->Nb_visibles)
 | 
			
		||||
            list->Draw_list_item(
 | 
			
		||||
              list->Entry_button->Pos_X,
 | 
			
		||||
              list->Entry_button->Pos_Y + list->Cursor_position * 8,
 | 
			
		||||
              list->List_start + list->Cursor_position,
 | 
			
		||||
              0);
 | 
			
		||||
          list->Cursor_position = clicked_line;
 | 
			
		||||
          // Redraw one item as enabled
 | 
			
		||||
          if (list->Cursor_position>=0 && list->Cursor_position<list->Scroller->Nb_visibles)
 | 
			
		||||
            list->Draw_list_item(
 | 
			
		||||
              list->Entry_button->Pos_X,
 | 
			
		||||
              list->Entry_button->Pos_Y + list->Cursor_position * 8,
 | 
			
		||||
              list->List_start + list->Cursor_position,
 | 
			
		||||
              1);
 | 
			
		||||
          Display_cursor();
 | 
			
		||||
 | 
			
		||||
          // Store the selected value as attribute2
 | 
			
		||||
          Window_attribute2=list->List_start + list->Cursor_position;
 | 
			
		||||
          // Return the control ID of the list.
 | 
			
		||||
          return list->Number;
 | 
			
		||||
        }
 | 
			
		||||
        else if (list->Scroller->Number == clicked_button)
 | 
			
		||||
        {
 | 
			
		||||
          // Click in the scroller part of a list
 | 
			
		||||
          if (list->List_start == list->Scroller->Position)
 | 
			
		||||
            return 0; // Didn't actually move
 | 
			
		||||
          // Update scroller indices
 | 
			
		||||
          list->Cursor_position += list->List_start;
 | 
			
		||||
          list->List_start = list->Scroller->Position;
 | 
			
		||||
          list->Cursor_position -= list->List_start;
 | 
			
		||||
          // Need to redraw all
 | 
			
		||||
          Hide_cursor();
 | 
			
		||||
          Window_redraw_list(list);
 | 
			
		||||
          Display_cursor();
 | 
			
		||||
        }
 | 
			
		||||
        return clicked_button;
 | 
			
		||||
      }
 | 
			
		||||
      return clicked_button;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user