- Implement generic list PageUp/PageDown

svn path=/trunk/; revision=33512
This commit is contained in:
Marc Piulachs 2008-05-14 14:01:06 +00:00
parent 5e27385583
commit 57a0b9d688
3 changed files with 93 additions and 7 deletions

View file

@ -52,6 +52,7 @@ typedef struct _GENERIC_LIST
SHORT Top; SHORT Top;
SHORT Right; SHORT Right;
SHORT Bottom; SHORT Bottom;
BOOL Redraw;
PGENERIC_LIST_ENTRY CurrentEntry; PGENERIC_LIST_ENTRY CurrentEntry;
PGENERIC_LIST_ENTRY BackupEntry; PGENERIC_LIST_ENTRY BackupEntry;
@ -74,6 +75,7 @@ CreateGenericList(VOID)
List->Top = 0; List->Top = 0;
List->Right = 0; List->Right = 0;
List->Bottom = 0; List->Bottom = 0;
List->Redraw = TRUE;
List->CurrentEntry = NULL; List->CurrentEntry = NULL;
@ -351,6 +353,47 @@ DrawGenericList(PGENERIC_LIST List,
DrawScrollBarGenericList(List); DrawScrollBarGenericList(List);
} }
VOID
ScrollPageDownGenericList (PGENERIC_LIST List)
{
SHORT i;
/* Suspend auto-redraw */
List->Redraw = FALSE;
for (i = List->Top + 1; i < List->Bottom - 1; i++)
{
ScrollDownGenericList (List);
}
/* Update user interface */
DrawListEntries(List);
DrawScrollBarGenericList(List);
/* Re enable auto-redraw */
List->Redraw = TRUE;
}
VOID
ScrollPageUpGenericList (PGENERIC_LIST List)
{
SHORT i;
/* Suspend auto-redraw */
List->Redraw = FALSE;
for (i = List->Bottom - 1; i > List->Top + 1; i--)
{
ScrollUpGenericList (List);
}
/* Update user interface */
DrawListEntries(List);
DrawScrollBarGenericList(List);
/* Re enable auto-redraw */
List->Redraw = TRUE;
}
VOID VOID
ScrollDownGenericList (PGENERIC_LIST List) ScrollDownGenericList (PGENERIC_LIST List)
@ -370,8 +413,11 @@ ScrollDownGenericList (PGENERIC_LIST List)
} }
List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
DrawListEntries(List); if (List->Redraw)
DrawScrollBarGenericList(List); {
DrawListEntries(List);
DrawScrollBarGenericList(List);
}
} }
} }
@ -394,8 +440,11 @@ ScrollUpGenericList (PGENERIC_LIST List)
} }
List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
DrawListEntries(List); if (List->Redraw)
DrawScrollBarGenericList(List); {
DrawListEntries(List);
DrawScrollBarGenericList(List);
}
} }
} }

View file

@ -61,6 +61,12 @@ ScrollDownGenericList(PGENERIC_LIST List);
VOID VOID
ScrollUpGenericList(PGENERIC_LIST List); ScrollUpGenericList(PGENERIC_LIST List);
VOID
ScrollPageDownGenericList(PGENERIC_LIST List);
VOID
ScrollPageUpGenericList(PGENERIC_LIST List);
VOID VOID
SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry); SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry);

View file

@ -621,21 +621,37 @@ LanguagePage(PINPUT_RECORD Ir)
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{ {
#if 0 //Dynamically update user interface #if 0
SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData; SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
/* Redraw language selection page in native language */
MUIDisplayPage(LANGUAGE_PAGE); MUIDisplayPage(LANGUAGE_PAGE);
#endif #endif
ScrollDownGenericList (LanguageList); ScrollDownGenericList (LanguageList);
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{ {
#if 0 #if 0
SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData; SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
/* Redraw language selection page in native language */
MUIDisplayPage(LANGUAGE_PAGE); MUIDisplayPage(LANGUAGE_PAGE);
#endif #endif
ScrollUpGenericList (LanguageList); ScrollUpGenericList (LanguageList);
} }
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
{
ScrollPageDownGenericList (LanguageList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
{
ScrollPageUpGenericList (LanguageList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
{ {
@ -1269,6 +1285,16 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
{ {
ScrollUpGenericList (LayoutList); ScrollUpGenericList (LayoutList);
} }
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
{
ScrollPageDownGenericList (LayoutList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
{
ScrollPageUpGenericList (LayoutList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
{ {
@ -1287,6 +1313,11 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
{ {
return DEVICE_SETTINGS_PAGE; return DEVICE_SETTINGS_PAGE;
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
{
/* a-z */
GenericListKeyPress (LayoutList , Ir->Event.KeyEvent.uChar.AsciiChar);
}
} }
return DISPLAY_SETTINGS_PAGE; return DISPLAY_SETTINGS_PAGE;