emWin Examples

From SEGGER Wiki
Jump to: navigation, search

The emWin examples have the purpose to explain and visualize emWin's features in a straight-forward and simplified way. Thus, most of these examples do not have elaborate graphics, but instead have code that is easy to read and understand.

How to use the examples

The examples are ready-to-run and can be run on most hardware targets and in the Windows simulation. All of the examples are stand-alone, meaning only one C file is required to run the application, with the exception of samples that include file access to external files. For the latter type of samples, the external file referred to in the sample is required as well.

File header

Every example file has a header at the beginning of the file. This header states the file name of the example, a small description about the example and how it should be used and a list of required emWin add-ons that are necessary to run the example.

File        : GUI_VNC_FileTransfer.c
Purpose     : Sample that demonstrates how to use a VNC server with
              emWin and use it for file transfer.
Requirements: WindowManager - ( )
              MemoryDevices - ( )
              AntiAliasing  - ( )
              VNC-Server    - (x)
              PNG-Library   - ( )
              TrueTypeFonts - ( )

For example, the VNC server add-on is required for the VNC-related emWin examples.

List of examples

2D graphic operations

Name of sample Description
GUI_DIRTYDEVICE_Usage.c Demonstrates how to use DIRTYDEVICES. A DIRTYDEVICE monitors the area on the screen that is 'dirty', meaning the area where screen changes happened.
GUI_Polygon.c Demonstrates how to draw polygons and what can be done with them.
GUI_QRCode.c Shows how to draw a QR code with emWin.
GUI_SPLINE.c Demonstrates how splines can be drawn with emWin.
GUI_YUV_PixelData.c Demonstrates how splines can be drawn with emWin.

Animations

Name of sample Description
GUI_AdvancedAnimation.c This sample demonstrates how more advanced animations can be created with emWin. The advanced animation makes use of slice callbacks, custom position calculation and several animation items.
GUI_SimpleAnimation.c Shows how to perform simple animations using emWin. This example shows the basic steps for creating an animation, such as creating and running it, adding animation items and using a delete callback routine.

Bitmaps and images

Name of sample Description
GUI_CreateBitmapFromStream.c Creates and draws a streamed bitmap from an external .dta file. The example supports both the usage of Windows file system and emFile, if run on a target.
GUI_DrawAnimatedGIFBin.c Draws an animated GIF image after it has been converted into binary form using Bin2C.
GUI_DrawAnimatedSprite.c Draws an animated GIF image after it has been converted into an animated sprite using the Bitmap Converter.
GUI_DrawExternalImage_BMP.c Shows how to draw BMP images in emWin from external memory. Supports both the usage of Windows file system and emFile.
GUI_DrawExternalImage_GIF.c Shows how to draw GIF images in emWin from external memory. Supports both the usage of Windows file system and emFile.
GUI_DrawExternalImage_JPG.c Shows how to draw JPG images in emWin from external memory. Supports both the usage of Windows file system and emFile.
GUI_DrawExternalImage_PNG.c Shows how to draw PNG images in emWin from external memory. Supports both the usage of Windows file system and emFile.
GUI_DrawStreamedBitmap.c Demonstrates how streamed bitmaps can be drawn from external .dta files. Supports both the usage of Windows file system and emFile.
GUI_SerializeBMP.c Example that shows how screenshots can be created by serializing the LCD contents into a .bmp file. Supports both the usage of Windows file system and emFile.

Fonts

Name of sample Description
GUI_SetExternalFont_TTF.c Shows how to create a custom font from an external .ttf file. Supports both the usage of Windows file system and emFile.
GUI_SetExternalFont_XBF.c Shows how to create a custom font from an external .xbf file. Supports both the usage of Windows file system and emFile.
GUI_SetFont_TTF.c Shows how to create a custom font from a .ttf file located in accessible memory.

Timers

Name of sample Description
GUI_Timers.c Demonstrates how to use timers without the use of the WindowManager in emWin.

MultiTouch

Name of sample Description
GUI_MultiTouch.c Demonstrates how to use timers without the use of the WindowManager in emWin.

Dialogs

Name of sample Description
CALENDAR_Usage.c Demonstrates the usage of CALENDAR dialogs.
CHOOSECOLOR_Usage.c Demonstrates the usage of CHOOSECOLOR dialogs.
CHOOSEFILE_Usage.c Demonstrates the usage of CHOOSEFILE dialogs.
DIALOG_CreateDialogs.c Shows how custom dialogs can be created.
GUI_Messagebox.c Demonstrates the usage of MESSAGEBOX dialogs.

Language Support

Name of sample Description
GUI_LANG_BiDiArabic.c Demonstrates how arabic text can be displayed/used via bi-directional text support.
GUI_LANG_ReadCSV.c Shows how to read different languages from a .csv file that has been converted into binary form.
GUI_LANG_ReadCSVEx.c Shows how to read different languages from a .csv file that is located in external memory. Supports both the usage of Windows file system and emFile.
GUI_LANG_Thai.c Demonstrates how thai text can be displayed/used via thai text support.

Memory Devices

Name of sample Description
GUI_MEMDEV_BlurringAndBlending.c Shows how blurring and blending operations are done using memory devices.
GUI_MEMDEV_Container.c Shows how memory devices can be used as a container to pre-load JPEG images (or something else) to avoid flickering.
GUI_MEMDEV_Fading.c Demonstrates how a fading animation between two windows can be executed using memory devices.
GUI_MEMDEV_Rotate.c Shows how to rotate images using memory devices.
GUI_MEMDEV_SerializeBMP.c Shows how bitmap files can be created from the contents of a memory device. Supports both the usage of Windows file system and emFile.

Movies

Name of sample Description
GUI_MOVIE_CreateMovie.c Demonstrates how to display an emWin movie from accessable memory.
GUI_MOVIE_CreateMovieEx.c Demonstrates how to display an emWin movie from external memory.

VNC

Name of sample Description
GUI_VNC_FileTransfer.c Shows how to use a VNC server with emWin to transfer files.
GUI_VNC_StartServer.c Shows how to use a VNC server with emWin.

Widgets

General

Name of sample Description
WIDGET_CustomScrollbar.c Explains how the SCROLLBAR of a widget can be customized and manipulated.
WIDGET_CustomCallback.c Explains how the callback of a widget can be overwritten.
WIDGET_OwnerDraw.c Shows how OwnerDraw routines can be set for widgets that support OwnerDraw.
WIDGET_ReactOnMessages.c Demonstrates how the application can react on messages sent by widgets.
WIDGET_SkinningProps.c Shows how the appearance of widgets can be changed using skinning properties. This can only be done for widgets that support skinning.
WIDGET_SkinningRoutine.c Shows how the appearance of widgets can be changed using a skinning routine. This can only be done for widgets that support skinning.

BUTTON widget

Name of sample Description
BUTTON_Custom.c Custom drawing of a BUTTON widget.
BUTTON_Usage.c Usage of a BUTTON widget.

CHECKBOX widget

Name of sample Description
CHECKBOX_Custom.c Custom drawing of a CHECKBOX widget.
CHECKBOX_Usage.c Usage of a CHECKBOX widget.

DROPDOWN widget

Name of sample Description
DROPDOWN_Custom.c Custom drawing of a DROPDOWN widget.
DROPDOWN_Usage.c Usage of a DROPDOWN widget.

FRAMEWIN widget

Name of sample Description
FRAMEWIN_Custom.c Custom drawing of a FRAMEWIN widget.
FRAMEWIN_Usage.c Usage of a FRAMEWIN widget.

GAUGE widget

Name of sample Description
GAUGE_Usage.c Usage and custom drawing of a GAUGE widget.

GRAPH widget

Name of sample Description
GRAPH_Custom.c Custom drawing of a GRAPH widget.
GRAPH_Usage.c Usage of a GRAPH widget.

ICONVIEW widget

Name of sample Description
ICONVIEW_Custom.c Custom drawing of a ICONVIEW widget.
ICONVIEW_Usage.c Usage of a ICONVIEW widget.

KEYBOARD widget

Name of sample Description
KEYBOARD_Usage.c Usage of a KEYBOARD widget.

LISTBOX widget

Name of sample Description
LISTBOX_Custom.c Custom drawing of a LISTBOX widget.
LISTBOX_Usage.c Usage of a LISTBOX widget.

LISTVIEW widget

Name of sample Description
LISTVIEW_Usage.c Usage of a LISTVIEW widget.
LISTVIEW_Custom.c Custom drawing of a LISTVIEW widget.

LISTWHEEL widget

Name of sample Description
LISTWHEEL_Custom.c Custom drawing of a LISTWHEEL widget.
LISTWHEEL_Usage.c Usage of a LISTWHEEL widget.

MULTIPAGE widget

Name of sample Description
MULTIPAGE_Custom.c Custom drawing of a MULTIPAGE widget.
MULTIPAGE_Usage.c Usage of a MULTIPAGE widget.

PROGBAR widget

Name of sample Description
PROGBAR_Custom.c Custom drawing of a PROGBAR widget.
PROGBAR_Usage.c Usage of a PROGBAR widget.

RADIO widget

Name of sample Description
RADIO_Custom.c Custom drawing of a RADIO widget.
RADIO_Usage.c Usage of a RADIO widget.

ROTARY widget

Name of sample Description
ROTARY_Usage.c Usage and custom drawing of a ROTARY widget.

SLIDER widget

Name of sample Description
SLIDER_Custom.c Custom drawing of a SLIDER widget.
SLIDER_Usage.c Usage of a SLIDER widget.

SPINBOX widget

Name of sample Description
SPINBOX_Custom.c Custom drawing of a SPINBOX widget.
SPINBOX_Usage.c Usage of a SPINBOX widget.

SWIPELIST widget

Name of sample Description
SWIPELIST_Custom.c Custom drawing of a SWIPELIST widget.
SWIPELIST_Usage.c Usage of a SWIPELIST widget.

SWITCH widget

Name of sample Description
SWITCH_Usage.c Usage and custom drawing of a SWITCH widget.
SWITCH_SetFocusAndToggle.c Set focus to SWITCH widget and toggle by button.

TREEVIEW widget

Name of sample Description
TREEVIEW_Custom.c Custom drawing of a TREEVIEW widget.
TREEVIEW_Usage.c Usage of a TREEVIEW widget.

Window Manager

Name of sample Description
WM_AllMessages.c Example that shows all window messages that can be used.
WM_ChildWindows.c Demonstrates how child windows work and how they are created.
WM_Clipping.c Shows how clipping is performed in emWin.
WM_CreateWindows.c Demonstrates how to create windows.
WM_CustomMessage.c Demonstrates how custom messages can be sent between windows.
WM_FocusableWindow.c Shows how a window can accept focus like most other widgets.
WM_IrregularFill_ClipRect.c Demonstrates how irregular objects can be filled in emWin with clipping rectangles.
WM_IrregularFill_MemDev.c Demonstrates how irregular objects can be filled in emWin using a memory device as a mask.
WM_LateClipping.c Demonstrates the difference between late and early clipping.
WM_MOTION_MoveContent.c Shows how motion support works for movable content, such as text that can be scrolled.
WM_MOTION_MoveWindows.c Shows how motion support can be used for moving windows.
WM_SetUntouchable.c Demonstrates how windows can be marked as "untouchable".
WM_SetUserData.c Example that shows how to set extra data to a window or widget. User data are extra bytes that are allocated upon creation of the window or widget. This can be utilized to transfer data between windows.
WM_SimpleTimer.c Sample that demonstrates how to use timers with the Window Manager.
WM_TransparentWindows.c Shows how transparent windows can be created.