GUI Generic list control: now takes cursors and mousewheel shortcuts. Still some mouse cursor problems, but almost done.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@882 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
142
buttons.c
142
buttons.c
@@ -5501,147 +5501,7 @@ void Button_Text()
|
||||
|
||||
clicked_button=Window_clicked_button();
|
||||
if (clicked_button==0)
|
||||
{/*
|
||||
if (Key==SDLK_UP && (cursor_position+list_start)>0)
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
cursor_position--;
|
||||
if (cursor_position<0)
|
||||
{
|
||||
list_start=list_start+cursor_position;
|
||||
cursor_position=0;
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
}
|
||||
redraw_is_needed=1;
|
||||
preview_is_needed=1;
|
||||
}
|
||||
if (Key==SDLK_DOWN && (cursor_position+list_start)<(Nb_fonts-1))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
cursor_position++;
|
||||
if (cursor_position>(NB_FONTS-1))
|
||||
{
|
||||
list_start=list_start+cursor_position-(NB_FONTS-1);
|
||||
cursor_position=(NB_FONTS-1);
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
}
|
||||
redraw_is_needed=1;
|
||||
preview_is_needed=1;
|
||||
}
|
||||
if (Key==SDLK_HOME && (cursor_position!=0 || list_start!=0))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
cursor_position=0;
|
||||
list_start=0;
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
redraw_is_needed=1;
|
||||
preview_is_needed=1;
|
||||
}
|
||||
if (Key==SDLK_END && (cursor_position+list_start)<(Nb_fonts-1))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
cursor_position=(Nb_fonts-1)-list_start;
|
||||
if (cursor_position>(NB_FONTS-1))
|
||||
{
|
||||
list_start=list_start+cursor_position-(NB_FONTS-1);
|
||||
cursor_position=(NB_FONTS-1);
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
}
|
||||
redraw_is_needed=1;
|
||||
preview_is_needed=1;
|
||||
}
|
||||
if (Key==SDLK_PAGEDOWN && (cursor_position+list_start)<(Nb_fonts-1))
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
if (Nb_fonts<NB_FONTS)
|
||||
{
|
||||
cursor_position=Nb_fonts-1;
|
||||
}
|
||||
else if(cursor_position!=NB_FONTS-1)
|
||||
{
|
||||
cursor_position=NB_FONTS-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
list_start+=NB_FONTS;
|
||||
if (list_start+NB_FONTS>Nb_fonts)
|
||||
{
|
||||
list_start=Nb_fonts-NB_FONTS;
|
||||
}
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
}
|
||||
redraw_is_needed=1;
|
||||
preview_is_needed=1;
|
||||
}
|
||||
if (Key==SDLK_PAGEUP && (cursor_position+list_start)>0)
|
||||
{
|
||||
Key=0;
|
||||
Hide_cursor();
|
||||
if(cursor_position!=0)
|
||||
{
|
||||
cursor_position=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
list_start-=NB_FONTS;
|
||||
if (list_start<0)
|
||||
{
|
||||
list_start=0;
|
||||
}
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
}
|
||||
redraw_is_needed=1;
|
||||
preview_is_needed=1;
|
||||
}
|
||||
if (Key == KEY_MOUSEWHEELUP && list_start>0)
|
||||
{
|
||||
cursor_position+=list_start;
|
||||
if (list_start>=3)
|
||||
list_start-=3;
|
||||
else
|
||||
list_start=0;
|
||||
cursor_position-=list_start;
|
||||
// On affiche à nouveau la liste
|
||||
Hide_cursor();
|
||||
redraw_is_needed=1;
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
}
|
||||
if (Key==KEY_MOUSEWHEELDOWN && list_start<Nb_fonts-NB_FONTS)
|
||||
{
|
||||
cursor_position+=list_start;
|
||||
list_start+=3;
|
||||
if (list_start+NB_FONTS>Nb_fonts)
|
||||
{
|
||||
list_start=Nb_fonts-NB_FONTS;
|
||||
}
|
||||
cursor_position-=list_start;
|
||||
// On affiche à nouveau la liste
|
||||
Hide_cursor();
|
||||
redraw_is_needed=1;
|
||||
// Mise à jour du scroller
|
||||
font_scroller->Position=list_start;
|
||||
Window_draw_slider(font_scroller);
|
||||
}
|
||||
*/
|
||||
{
|
||||
if (Is_shortcut(Key,0x100+BUTTON_HELP))
|
||||
Window_help(BUTTON_TEXT, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user