Custom scrollbar (Sample)

From SEGGER Wiki
Jump to: navigation, search
WIDGET_CustomScrollbar.c
WIDGET CustomScrollbar.gif
File(s) required
  • WIDGET_CustomScrollbar.c
Runs in simulation Yes
Runs on target Yes
Download WIDGET_CustomScrollbar.c

This sample shows how an attached scrollbar of a widget can be manipulated and customized. In this example, the scrollbar of a MULTIEDIT is not visible and its scrolling position is increased or decreased by the buttons above/below the MULTIEDIT.

Code

/*********************************************************************
*                    SEGGER Microcontroller GmbH                     *
*        Solutions for real time microcontroller applications        *
**********************************************************************
*                                                                    *
*        (c) 1996 - 2020  SEGGER Microcontroller GmbH                *
*                                                                    *
*        Internet: www.segger.com    Support:  support@segger.com    *
*                                                                    *
**********************************************************************

** emWin V6.10 - Graphical user interface for embedded applications **
emWin is protected by international copyright laws.   Knowledge of the
source code may not be used to write a similar product.  This file may
only  be used  in accordance  with  a license  and should  not be  re-
distributed in any way. We appreciate your understanding and fairness.
----------------------------------------------------------------------
File        : WIDGET_CustomScrollbar.c
Purpose     : Sample that demonstrates how the behavior of an attached
              scrollbar can be customized.
Requirements: WindowManager - (x)
              MemoryDevices - ( )
              AntiAliasing  - ( )
              VNC-Server    - ( )
              PNG-Library   - ( )
              TrueTypeFonts - ( )
---------------------------END-OF-HEADER------------------------------
*/

#include "DIALOG.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define TEXT           "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy" \
                       "eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam" \
                       " voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet" \
                       " clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit" \
                       " amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam" \
                       " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, " \
                       "sed diam voluptua. At vero eos et accusam et justo duo dolores"
#define ID_BUTTON_UP   GUI_ID_BUTTON0
#define ID_BUTTON_DOWN GUI_ID_BUTTON1
#define LCD_X          LCD_GetXSize()
#define LCD_Y          LCD_GetYSize()

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/
static GUI_CONST_STORAGE unsigned char _acArrowUp[] = {
  /* RLE: 017 Pixels @ 000,000 */ 17, 0xFF, 
  /* ABS: 006 Pixels @ 017,000 */ 0, 6, 0xC4, 0x40, 0x04, 0x04, 0x41, 0xC5, 
  /* RLE: 033 Pixels @ 023,000 */ 33, 0xFF, 
  /* ABS: 002 Pixels @ 016,001 */ 0, 2, 0xAC, 0x0C, 
  /* RLE: 004 Pixels @ 018,001 */ 4, 0x00, 
  /* ABS: 002 Pixels @ 022,001 */ 0, 2, 0x0D, 0xAE, 
  /* RLE: 031 Pixels @ 024,001 */ 31, 0xFF, 
  /* ABS: 002 Pixels @ 015,002 */ 0, 2, 0xA8, 0x0F, 
  /* RLE: 006 Pixels @ 017,002 */ 6, 0x00, 
  /* ABS: 002 Pixels @ 023,002 */ 0, 2, 0x10, 0xA9, 
  /* RLE: 029 Pixels @ 025,002 */ 29, 0xFF, 
  /* ABS: 002 Pixels @ 014,003 */ 0, 2, 0x9C, 0x0E, 
  /* RLE: 008 Pixels @ 016,003 */ 8, 0x00, 
  /* ABS: 002 Pixels @ 024,003 */ 0, 2, 0x0F, 0x9E, 
  /* RLE: 027 Pixels @ 026,003 */ 27, 0xFF, 
  /* ABS: 002 Pixels @ 013,004 */ 0, 2, 0x9C, 0x0E, 
  /* RLE: 010 Pixels @ 015,004 */ 10, 0x00, 
  /* ABS: 002 Pixels @ 025,004 */ 0, 2, 0x0E, 0x9E, 
  /* RLE: 025 Pixels @ 027,004 */ 25, 0xFF, 
  /* ABS: 002 Pixels @ 012,005 */ 0, 2, 0xAA, 0x0F, 
  /* RLE: 012 Pixels @ 014,005 */ 12, 0x00, 
  /* ABS: 002 Pixels @ 026,005 */ 0, 2, 0x0F, 0xAC, 
  /* RLE: 023 Pixels @ 028,005 */ 23, 0xFF, 
  /* ABS: 002 Pixels @ 011,006 */ 0, 2, 0xB4, 0x11, 
  /* RLE: 014 Pixels @ 013,006 */ 14, 0x00, 
  /* ABS: 002 Pixels @ 027,006 */ 0, 2, 0x12, 0xB6, 
  /* RLE: 021 Pixels @ 029,006 */ 21, 0xFF, 
  /* ABS: 002 Pixels @ 010,007 */ 0, 2, 0xB1, 0x12, 
  /* RLE: 016 Pixels @ 012,007 */ 16, 0x00, 
  /* ABS: 002 Pixels @ 028,007 */ 0, 2, 0x13, 0xB3, 
  /* RLE: 019 Pixels @ 030,007 */ 19, 0xFF, 
  /* ABS: 002 Pixels @ 009,008 */ 0, 2, 0xA6, 0x11, 
  /* RLE: 018 Pixels @ 011,008 */ 18, 0x00, 
  /* ABS: 002 Pixels @ 029,008 */ 0, 2, 0x12, 0xA7, 
  /* RLE: 017 Pixels @ 031,008 */ 17, 0xFF, 
  /* ABS: 002 Pixels @ 008,009 */ 0, 2, 0xA4, 0x11, 
  /* RLE: 020 Pixels @ 010,009 */ 20, 0x00, 
  /* ABS: 002 Pixels @ 030,009 */ 0, 2, 0x12, 0xA5, 
  /* RLE: 015 Pixels @ 032,009 */ 15, 0xFF, 
  /* ABS: 002 Pixels @ 007,010 */ 0, 2, 0xB0, 0x12, 
  /* RLE: 022 Pixels @ 009,010 */ 22, 0x00, 
  /* ABS: 002 Pixels @ 031,010 */ 0, 2, 0x13, 0xB2, 
  /* RLE: 013 Pixels @ 033,010 */ 13, 0xFF, 
  /* ABS: 002 Pixels @ 006,011 */ 0, 2, 0xBC, 0x14, 
  /* RLE: 011 Pixels @ 008,011 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 019,011 */ 0, 2, 0x18, 0x18, 
  /* RLE: 011 Pixels @ 021,011 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 032,011 */ 0, 2, 0x15, 0xBD, 
  /* RLE: 011 Pixels @ 034,011 */ 11, 0xFF, 
  /* ABS: 002 Pixels @ 005,012 */ 0, 2, 0xBA, 0x15, 
  /* RLE: 011 Pixels @ 007,012 */ 11, 0x00, 
  /* ABS: 004 Pixels @ 018,012 */ 0, 4, 0x1E, 0xCB, 0xC8, 0x1D, 
  /* RLE: 011 Pixels @ 022,012 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 033,012 */ 0, 2, 0x16, 0xBC, 
  /* RLE: 009 Pixels @ 035,012 */ 9, 0xFF, 
  /* ABS: 002 Pixels @ 004,013 */ 0, 2, 0xAE, 0x15, 
  /* RLE: 011 Pixels @ 006,013 */ 11, 0x00, 
  /* ABS: 006 Pixels @ 017,013 */ 0, 6, 0x22, 0xC3, 0xFF, 0xFF, 0xC2, 0x21, 
  /* RLE: 011 Pixels @ 023,013 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 034,013 */ 0, 2, 0x16, 0xB1, 
  /* RLE: 007 Pixels @ 036,013 */ 7, 0xFF, 
  /* ABS: 002 Pixels @ 003,014 */ 0, 2, 0xAA, 0x15, 
  /* RLE: 011 Pixels @ 005,014 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 016,014 */ 0, 2, 0x18, 0xC3, 
  /* RLE: 004 Pixels @ 018,014 */ 4, 0xFF, 
  /* ABS: 002 Pixels @ 022,014 */ 0, 2, 0xC1, 0x17, 
  /* RLE: 011 Pixels @ 024,014 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 035,014 */ 0, 2, 0x16, 0xAD, 
  /* RLE: 005 Pixels @ 037,014 */ 5, 0xFF, 
  /* ABS: 002 Pixels @ 002,015 */ 0, 2, 0xB5, 0x16, 
  /* RLE: 011 Pixels @ 004,015 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 015,015 */ 0, 2, 0x0A, 0xC7, 
  /* RLE: 006 Pixels @ 017,015 */ 6, 0xFF, 
  /* ABS: 002 Pixels @ 023,015 */ 0, 2, 0xC3, 0x0A, 
  /* RLE: 011 Pixels @ 025,015 */ 11, 0x00, 
  /* ABS: 007 Pixels @ 036,015 */ 0, 7, 0x17, 0xB7, 0xFF, 0xFF, 0xFF, 0xC3, 0x17, 
  /* RLE: 011 Pixels @ 003,016 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 014,016 */ 0, 2, 0x0B, 0xC7, 
  /* RLE: 008 Pixels @ 016,016 */ 8, 0xFF, 
  /* ABS: 002 Pixels @ 024,016 */ 0, 2, 0xC3, 0x0B, 
  /* RLE: 011 Pixels @ 026,016 */ 11, 0x00, 
  /* ABS: 005 Pixels @ 037,016 */ 0, 5, 0x18, 0xC5, 0xFF, 0xDA, 0x18, 
  /* RLE: 011 Pixels @ 002,017 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 013,017 */ 0, 2, 0x17, 0xC3, 
  /* RLE: 010 Pixels @ 015,017 */ 10, 0xFF, 
  /* ABS: 002 Pixels @ 025,017 */ 0, 2, 0xC0, 0x17, 
  /* RLE: 011 Pixels @ 027,017 */ 11, 0x00, 
  /* ABS: 003 Pixels @ 038,017 */ 0, 3, 0x19, 0xDB, 0x5D, 
  /* RLE: 011 Pixels @ 001,018 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 012,018 */ 0, 2, 0x1D, 0xBD, 
  /* RLE: 012 Pixels @ 014,018 */ 12, 0xFF, 
  /* ABS: 002 Pixels @ 026,018 */ 0, 2, 0xBB, 0x1C, 
  /* RLE: 011 Pixels @ 028,018 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 039,018 */ 0, 2, 0x60, 0x15, 
  /* RLE: 010 Pixels @ 001,019 */ 10, 0x00, 
  /* ABS: 002 Pixels @ 011,019 */ 0, 2, 0x15, 0xBC, 
  /* RLE: 014 Pixels @ 013,019 */ 14, 0xFF, 
  /* ABS: 002 Pixels @ 027,019 */ 0, 2, 0xB9, 0x14, 
  /* RLE: 010 Pixels @ 029,019 */ 10, 0x00, 
  /* ABS: 002 Pixels @ 039,019 */ 0, 2, 0x17, 0x1E, 
  /* RLE: 009 Pixels @ 001,020 */ 9, 0x00, 
  /* ABS: 002 Pixels @ 010,020 */ 0, 2, 0x06, 0xC0, 
  /* RLE: 016 Pixels @ 012,020 */ 16, 0xFF, 
  /* ABS: 002 Pixels @ 028,020 */ 0, 2, 0xBD, 0x06, 
  /* RLE: 009 Pixels @ 030,020 */ 9, 0x00, 
  /* ABS: 002 Pixels @ 039,020 */ 0, 2, 0x21, 0x76, 
  /* RLE: 008 Pixels @ 001,021 */ 8, 0x00, 
  /* ABS: 002 Pixels @ 009,021 */ 0, 2, 0x05, 0xC1, 
  /* RLE: 018 Pixels @ 011,021 */ 18, 0xFF, 
  /* ABS: 002 Pixels @ 029,021 */ 0, 2, 0xBD, 0x05, 
  /* RLE: 008 Pixels @ 031,021 */ 8, 0x00, 
  /* ABS: 003 Pixels @ 039,021 */ 0, 3, 0x79, 0xF1, 0x32, 
  /* RLE: 006 Pixels @ 002,022 */ 6, 0x00, 
  /* ABS: 002 Pixels @ 008,022 */ 0, 2, 0x11, 0xBE, 
  /* RLE: 020 Pixels @ 010,022 */ 20, 0xFF, 
  /* ABS: 002 Pixels @ 030,022 */ 0, 2, 0xBA, 0x10, 
  /* RLE: 006 Pixels @ 032,022 */ 6, 0x00, 
  /* ABS: 005 Pixels @ 038,022 */ 0, 5, 0x33, 0xF2, 0xFF, 0xDE, 0x39, 
  /* RLE: 004 Pixels @ 003,023 */ 4, 0x00, 
  /* ABS: 002 Pixels @ 007,023 */ 0, 2, 0x19, 0xB7, 
  /* RLE: 022 Pixels @ 009,023 */ 22, 0xFF, 
  /* ABS: 002 Pixels @ 031,023 */ 0, 2, 0xB4, 0x18, 
  /* RLE: 004 Pixels @ 033,023 */ 4, 0x00, 
  /* ABS: 011 Pixels @ 037,023 */ 0, 11, 0x3B, 0xDF, 0xFF, 0xFF, 0xFF, 0xE0, 0x79, 0x14, 0x07, 0x59, 0xC7, 
  /* RLE: 024 Pixels @ 008,024 */ 24, 0xFF, 
  /* ABS: 008 Pixels @ 032,024 */ 0, 8, 0xC6, 0x58, 0x06, 0x15, 0x7A, 0xE0, 0xFF, 0xFF, 
  0
};  // 416 bytes for 1000 pixels

GUI_CONST_STORAGE GUI_BITMAP bmArrowUp = {
  40, // xSize
  25, // ySize
  40, // BytesPerLine
  GUI_COMPRESS_RLE8, // BitsPerPixel
  (const unsigned char *)_acArrowUp,  // Pointer to picture data
  NULL,  // Pointer to palette
  GUI_DRAW_RLEALPHA
};

static GUI_CONST_STORAGE unsigned char _acArrowDown[] = {
  /* ABS: 008 Pixels @ 000,000 */ 0, 8, 0xFF, 0xFF, 0xE0, 0x7A, 0x15, 0x06, 0x58, 0xC6, 
  /* RLE: 024 Pixels @ 008,000 */ 24, 0xFF, 
  /* ABS: 011 Pixels @ 032,000 */ 0, 11, 0xC7, 0x59, 0x07, 0x14, 0x79, 0xE0, 0xFF, 0xFF, 0xFF, 0xDF, 0x3B, 
  /* RLE: 004 Pixels @ 003,001 */ 4, 0x00, 
  /* ABS: 002 Pixels @ 007,001 */ 0, 2, 0x18, 0xB4, 
  /* RLE: 022 Pixels @ 009,001 */ 22, 0xFF, 
  /* ABS: 002 Pixels @ 031,001 */ 0, 2, 0xB7, 0x19, 
  /* RLE: 004 Pixels @ 033,001 */ 4, 0x00, 
  /* ABS: 005 Pixels @ 037,001 */ 0, 5, 0x39, 0xDE, 0xFF, 0xF2, 0x33, 
  /* RLE: 006 Pixels @ 002,002 */ 6, 0x00, 
  /* ABS: 002 Pixels @ 008,002 */ 0, 2, 0x10, 0xBA, 
  /* RLE: 020 Pixels @ 010,002 */ 20, 0xFF, 
  /* ABS: 002 Pixels @ 030,002 */ 0, 2, 0xBE, 0x11, 
  /* RLE: 006 Pixels @ 032,002 */ 6, 0x00, 
  /* ABS: 003 Pixels @ 038,002 */ 0, 3, 0x32, 0xF1, 0x79, 
  /* RLE: 008 Pixels @ 001,003 */ 8, 0x00, 
  /* ABS: 002 Pixels @ 009,003 */ 0, 2, 0x05, 0xBD, 
  /* RLE: 018 Pixels @ 011,003 */ 18, 0xFF, 
  /* ABS: 002 Pixels @ 029,003 */ 0, 2, 0xC1, 0x05, 
  /* RLE: 008 Pixels @ 031,003 */ 8, 0x00, 
  /* ABS: 002 Pixels @ 039,003 */ 0, 2, 0x76, 0x21, 
  /* RLE: 009 Pixels @ 001,004 */ 9, 0x00, 
  /* ABS: 002 Pixels @ 010,004 */ 0, 2, 0x06, 0xBD, 
  /* RLE: 016 Pixels @ 012,004 */ 16, 0xFF, 
  /* ABS: 002 Pixels @ 028,004 */ 0, 2, 0xC0, 0x06, 
  /* RLE: 009 Pixels @ 030,004 */ 9, 0x00, 
  /* ABS: 002 Pixels @ 039,004 */ 0, 2, 0x1E, 0x17, 
  /* RLE: 010 Pixels @ 001,005 */ 10, 0x00, 
  /* ABS: 002 Pixels @ 011,005 */ 0, 2, 0x14, 0xB9, 
  /* RLE: 014 Pixels @ 013,005 */ 14, 0xFF, 
  /* ABS: 002 Pixels @ 027,005 */ 0, 2, 0xBC, 0x15, 
  /* RLE: 010 Pixels @ 029,005 */ 10, 0x00, 
  /* ABS: 002 Pixels @ 039,005 */ 0, 2, 0x15, 0x60, 
  /* RLE: 011 Pixels @ 001,006 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 012,006 */ 0, 2, 0x1C, 0xBB, 
  /* RLE: 012 Pixels @ 014,006 */ 12, 0xFF, 
  /* ABS: 002 Pixels @ 026,006 */ 0, 2, 0xBD, 0x1D, 
  /* RLE: 011 Pixels @ 028,006 */ 11, 0x00, 
  /* ABS: 003 Pixels @ 039,006 */ 0, 3, 0x5D, 0xDB, 0x19, 
  /* RLE: 011 Pixels @ 002,007 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 013,007 */ 0, 2, 0x17, 0xC0, 
  /* RLE: 010 Pixels @ 015,007 */ 10, 0xFF, 
  /* ABS: 002 Pixels @ 025,007 */ 0, 2, 0xC3, 0x17, 
  /* RLE: 011 Pixels @ 027,007 */ 11, 0x00, 
  /* ABS: 005 Pixels @ 038,007 */ 0, 5, 0x18, 0xDA, 0xFF, 0xC5, 0x18, 
  /* RLE: 011 Pixels @ 003,008 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 014,008 */ 0, 2, 0x0B, 0xC3, 
  /* RLE: 008 Pixels @ 016,008 */ 8, 0xFF, 
  /* ABS: 002 Pixels @ 024,008 */ 0, 2, 0xC7, 0x0B, 
  /* RLE: 011 Pixels @ 026,008 */ 11, 0x00, 
  /* ABS: 007 Pixels @ 037,008 */ 0, 7, 0x17, 0xC3, 0xFF, 0xFF, 0xFF, 0xB7, 0x17, 
  /* RLE: 011 Pixels @ 004,009 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 015,009 */ 0, 2, 0x0A, 0xC3, 
  /* RLE: 006 Pixels @ 017,009 */ 6, 0xFF, 
  /* ABS: 002 Pixels @ 023,009 */ 0, 2, 0xC7, 0x0A, 
  /* RLE: 011 Pixels @ 025,009 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 036,009 */ 0, 2, 0x16, 0xB5, 
  /* RLE: 005 Pixels @ 038,009 */ 5, 0xFF, 
  /* ABS: 002 Pixels @ 003,010 */ 0, 2, 0xAD, 0x16, 
  /* RLE: 011 Pixels @ 005,010 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 016,010 */ 0, 2, 0x17, 0xC1, 
  /* RLE: 004 Pixels @ 018,010 */ 4, 0xFF, 
  /* ABS: 002 Pixels @ 022,010 */ 0, 2, 0xC3, 0x18, 
  /* RLE: 011 Pixels @ 024,010 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 035,010 */ 0, 2, 0x15, 0xAA, 
  /* RLE: 007 Pixels @ 037,010 */ 7, 0xFF, 
  /* ABS: 002 Pixels @ 004,011 */ 0, 2, 0xB1, 0x16, 
  /* RLE: 011 Pixels @ 006,011 */ 11, 0x00, 
  /* ABS: 006 Pixels @ 017,011 */ 0, 6, 0x21, 0xC2, 0xFF, 0xFF, 0xC3, 0x22, 
  /* RLE: 011 Pixels @ 023,011 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 034,011 */ 0, 2, 0x15, 0xAE, 
  /* RLE: 009 Pixels @ 036,011 */ 9, 0xFF, 
  /* ABS: 002 Pixels @ 005,012 */ 0, 2, 0xBC, 0x16, 
  /* RLE: 011 Pixels @ 007,012 */ 11, 0x00, 
  /* ABS: 004 Pixels @ 018,012 */ 0, 4, 0x1D, 0xC8, 0xCB, 0x1E, 
  /* RLE: 011 Pixels @ 022,012 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 033,012 */ 0, 2, 0x15, 0xBA, 
  /* RLE: 011 Pixels @ 035,012 */ 11, 0xFF, 
  /* ABS: 002 Pixels @ 006,013 */ 0, 2, 0xBD, 0x15, 
  /* RLE: 011 Pixels @ 008,013 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 019,013 */ 0, 2, 0x18, 0x18, 
  /* RLE: 011 Pixels @ 021,013 */ 11, 0x00, 
  /* ABS: 002 Pixels @ 032,013 */ 0, 2, 0x14, 0xBC, 
  /* RLE: 013 Pixels @ 034,013 */ 13, 0xFF, 
  /* ABS: 002 Pixels @ 007,014 */ 0, 2, 0xB2, 0x13, 
  /* RLE: 022 Pixels @ 009,014 */ 22, 0x00, 
  /* ABS: 002 Pixels @ 031,014 */ 0, 2, 0x12, 0xB0, 
  /* RLE: 015 Pixels @ 033,014 */ 15, 0xFF, 
  /* ABS: 002 Pixels @ 008,015 */ 0, 2, 0xA5, 0x12, 
  /* RLE: 020 Pixels @ 010,015 */ 20, 0x00, 
  /* ABS: 002 Pixels @ 030,015 */ 0, 2, 0x11, 0xA4, 
  /* RLE: 017 Pixels @ 032,015 */ 17, 0xFF, 
  /* ABS: 002 Pixels @ 009,016 */ 0, 2, 0xA7, 0x12, 
  /* RLE: 018 Pixels @ 011,016 */ 18, 0x00, 
  /* ABS: 002 Pixels @ 029,016 */ 0, 2, 0x11, 0xA6, 
  /* RLE: 019 Pixels @ 031,016 */ 19, 0xFF, 
  /* ABS: 002 Pixels @ 010,017 */ 0, 2, 0xB3, 0x13, 
  /* RLE: 016 Pixels @ 012,017 */ 16, 0x00, 
  /* ABS: 002 Pixels @ 028,017 */ 0, 2, 0x12, 0xB1, 
  /* RLE: 021 Pixels @ 030,017 */ 21, 0xFF, 
  /* ABS: 002 Pixels @ 011,018 */ 0, 2, 0xB6, 0x12, 
  /* RLE: 014 Pixels @ 013,018 */ 14, 0x00, 
  /* ABS: 002 Pixels @ 027,018 */ 0, 2, 0x11, 0xB4, 
  /* RLE: 023 Pixels @ 029,018 */ 23, 0xFF, 
  /* ABS: 002 Pixels @ 012,019 */ 0, 2, 0xAC, 0x0F, 
  /* RLE: 012 Pixels @ 014,019 */ 12, 0x00, 
  /* ABS: 002 Pixels @ 026,019 */ 0, 2, 0x0F, 0xAA, 
  /* RLE: 025 Pixels @ 028,019 */ 25, 0xFF, 
  /* ABS: 002 Pixels @ 013,020 */ 0, 2, 0x9E, 0x0E, 
  /* RLE: 010 Pixels @ 015,020 */ 10, 0x00, 
  /* ABS: 002 Pixels @ 025,020 */ 0, 2, 0x0E, 0x9C, 
  /* RLE: 027 Pixels @ 027,020 */ 27, 0xFF, 
  /* ABS: 002 Pixels @ 014,021 */ 0, 2, 0x9E, 0x0F, 
  /* RLE: 008 Pixels @ 016,021 */ 8, 0x00, 
  /* ABS: 002 Pixels @ 024,021 */ 0, 2, 0x0E, 0x9C, 
  /* RLE: 029 Pixels @ 026,021 */ 29, 0xFF, 
  /* ABS: 002 Pixels @ 015,022 */ 0, 2, 0xA9, 0x10, 
  /* RLE: 006 Pixels @ 017,022 */ 6, 0x00, 
  /* ABS: 002 Pixels @ 023,022 */ 0, 2, 0x0F, 0xA8, 
  /* RLE: 031 Pixels @ 025,022 */ 31, 0xFF, 
  /* ABS: 002 Pixels @ 016,023 */ 0, 2, 0xAE, 0x0D, 
  /* RLE: 004 Pixels @ 018,023 */ 4, 0x00, 
  /* ABS: 002 Pixels @ 022,023 */ 0, 2, 0x0C, 0xAC, 
  /* RLE: 033 Pixels @ 024,023 */ 33, 0xFF, 
  /* ABS: 006 Pixels @ 017,024 */ 0, 6, 0xC5, 0x41, 0x04, 0x04, 0x40, 0xC4, 
  /* RLE: 017 Pixels @ 023,024 */ 17, 0xFF, 
  0
};  // 416 bytes for 1000 pixels

GUI_CONST_STORAGE GUI_BITMAP bmArrowDown = {
  40, // xSize
  25, // ySize
  40, // BytesPerLine
  GUI_COMPRESS_RLE8, // BitsPerPixel
  (const unsigned char *)_acArrowDown,  // Pointer to picture data
  NULL,  // Pointer to palette
  GUI_DRAW_RLEALPHA
};

static WM_HWIN _hScroll;

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/
/*********************************************************************
*
*       _cbButton
*/
static void _cbButton(WM_MESSAGE * pMsg) {
  int             Id;
  WM_SCROLL_STATE State;

  switch(pMsg->MsgId) {
  case WM_PAINT:
    //
    // Check if we draw the up or down button.
    //
    Id = WM_GetId(pMsg->hWin);
    WM_GetScrollState(_hScroll, &State);
    if(Id == ID_BUTTON_UP) {
      //
      // Select the button color based on if we can still scroll.
      //
      if(State.v > 0) {
        GUI_SetColor(GUI_LIGHTGREEN);
      } else {
        GUI_SetColor(GUI_GRAY_C0);
      }
      GUI_DrawBitmap(&bmArrowUp, 0, 0);
    } else if (Id == ID_BUTTON_DOWN) {
      //
      // Select the button color based on if we can still scroll.
      //
      if(State.v < (State.NumItems - State.PageSize - 1)) {
        GUI_SetColor(GUI_LIGHTGREEN);
      } else {
        GUI_SetColor(GUI_GRAY_C0);
      }
      GUI_DrawBitmap(&bmArrowDown, 0, 0);
    }
    break;
  default:
    BUTTON_Callback(pMsg);
  }
}

/*********************************************************************
*
*       _cbBk
*/
static void _cbBk(WM_MESSAGE * pMsg) {
  WM_HWIN         hItem;
  WM_SCROLL_STATE State;
  int             Id, NCode;

  switch(pMsg->MsgId) {
  case WM_SET_CALLBACK:
    //
    // Create MULTIEDIT widget.
    //
    hItem = MULTIEDIT_CreateEx(10, 50, 460, 170, WM_HBKWIN, WM_CF_SHOW, 0, MULTIEDIT_CF_READONLY, 500, TEXT);
    MULTIEDIT_SetFont(hItem, &GUI_Font32B_1);
    MULTIEDIT_SetWrapChar(hItem);
    //
    // Attach scrollbar to MULTEDIT.
    //
    WM_SetScrollbarV(hItem, 1);
    //
    // Get SCROLLBAR handle and hide the window.
    //
    _hScroll = WM_GetScrollbarV(hItem);
    WM_HideWindow(_hScroll);
    //
    // Create scroll buttons.
    //
    hItem = BUTTON_CreateEx((LCD_X / 2) - (bmArrowDown.XSize / 2), 12, bmArrowDown.XSize, bmArrowDown.YSize, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS, 0, ID_BUTTON_UP);
    WM_SetCallback(hItem, _cbButton);
    hItem = BUTTON_CreateEx((LCD_X / 2) - (bmArrowDown.XSize / 2), 233, bmArrowDown.XSize, bmArrowDown.YSize, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS, 0, ID_BUTTON_DOWN);
    WM_SetCallback(hItem, _cbButton);
    break;
  case WM_PAINT:
    GUI_SetBkColor(GUI_WHITE);
    GUI_Clear();
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch (Id) {
    case ID_BUTTON_UP:
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        //
        // Get scroll state and check if can be decreased.
        //
        WM_GetScrollState(_hScroll, &State);
        if(State.v > 0) {
          State.v--;
        }
        //
        // Set new scroll state.
        //
        WM_SetScrollState(_hScroll, &State);
        //
        // Redraw other button since the scroll state has changed.
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_DOWN);
        WM_InvalidateWindow(hItem);
        break;
      }
      break;
    case ID_BUTTON_DOWN:
      switch (NCode) {
      case WM_NOTIFICATION_RELEASED:
        //
        // Get scroll state and check if can be increased.
        //
        WM_GetScrollState(_hScroll, &State);
        if(State.v < (State.NumItems - State.PageSize - 1)) {
          State.v++;
        }
        //
        // Set new scroll state.
        //
        WM_SetScrollState(_hScroll, &State);
        //
        // Redraw other button since the scroll state has changed.
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_UP);
        WM_InvalidateWindow(hItem);
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  //
  // Init GUI.
  //
  GUI_Init();
  WM_MULTIBUF_Enable(1);
  //
  // Set callback to background window.
  //
  WM_SetCallback(WM_HBKWIN, _cbBk);

  while (1) {
    GUI_Delay(100);
  }
}

/*************************** End of file ****************************/