summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-03-22 21:22:59 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-03-22 21:22:59 +0000
commit4dedf494c242b2c4b52707441eefe2a36fbacf0f (patch)
tree36728130c995053f18637c019829f492f0c3b3fe
parentaf2319a52f4b11df952a5a1060c76cc0cdff0b98 (diff)
downloadnuttx-4dedf494c242b2c4b52707441eefe2a36fbacf0f.tar.gz
nuttx-4dedf494c242b2c4b52707441eefe2a36fbacf0f.tar.bz2
nuttx-4dedf494c242b2c4b52707441eefe2a36fbacf0f.zip
First check-in of NxWidgets
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4505 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--NxWidgets/Doxygen/Doxyfile1551
-rw-r--r--NxWidgets/Doxygen/README.txt45
-rwxr-xr-xNxWidgets/Doxygen/gendoc.sh94
-rw-r--r--NxWidgets/UnitTests/CButton/Makefile172
-rw-r--r--NxWidgets/UnitTests/CButton/cbuttontest.cxx325
-rw-r--r--NxWidgets/UnitTests/CButton/cbuttontest.hxx167
-rw-r--r--NxWidgets/UnitTests/CButton/main.cxx155
-rw-r--r--NxWidgets/UnitTests/CButtonArray/Makefile172
-rw-r--r--NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.cxx301
-rw-r--r--NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.hxx182
-rw-r--r--NxWidgets/UnitTests/CButtonArray/main.cxx327
-rw-r--r--NxWidgets/UnitTests/CCheckBox/Makefile172
-rw-r--r--NxWidgets/UnitTests/CCheckBox/ccheckboxtest.cxx297
-rw-r--r--NxWidgets/UnitTests/CCheckBox/ccheckboxtest.hxx152
-rw-r--r--NxWidgets/UnitTests/CCheckBox/main.cxx209
-rw-r--r--NxWidgets/UnitTests/CGlyphButton/Makefile172
-rw-r--r--NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.cxx307
-rw-r--r--NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.hxx182
-rw-r--r--NxWidgets/UnitTests/CGlyphButton/main.cxx225
-rw-r--r--NxWidgets/UnitTests/CImage/Makefile172
-rw-r--r--NxWidgets/UnitTests/CImage/cimagetest.cxx240
-rw-r--r--NxWidgets/UnitTests/CImage/cimagetest.hxx150
-rw-r--r--NxWidgets/UnitTests/CImage/main.cxx222
-rw-r--r--NxWidgets/UnitTests/CKeypad/Makefile172
-rw-r--r--NxWidgets/UnitTests/CKeypad/ckeypadtest.cxx458
-rw-r--r--NxWidgets/UnitTests/CKeypad/ckeypadtest.hxx192
-rw-r--r--NxWidgets/UnitTests/CKeypad/main.cxx274
-rw-r--r--NxWidgets/UnitTests/CLabel/Makefile172
-rw-r--r--NxWidgets/UnitTests/CLabel/clabeltest.cxx263
-rw-r--r--NxWidgets/UnitTests/CLabel/clabeltest.hxx148
-rw-r--r--NxWidgets/UnitTests/CLabel/main.cxx130
-rw-r--r--NxWidgets/UnitTests/CLatchButton/Makefile172
-rw-r--r--NxWidgets/UnitTests/CLatchButton/clatchbuttontest.cxx321
-rw-r--r--NxWidgets/UnitTests/CLatchButton/clatchbuttontest.hxx165
-rw-r--r--NxWidgets/UnitTests/CLatchButton/main.cxx199
-rw-r--r--NxWidgets/UnitTests/CLatchButtonArray/Makefile172
-rw-r--r--NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.cxx301
-rw-r--r--NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.hxx182
-rw-r--r--NxWidgets/UnitTests/CLatchButtonArray/main.cxx301
-rw-r--r--NxWidgets/UnitTests/CListBox/Makefile172
-rw-r--r--NxWidgets/UnitTests/CListBox/clistboxtest.cxx224
-rw-r--r--NxWidgets/UnitTests/CListBox/clistboxtest.hxx147
-rw-r--r--NxWidgets/UnitTests/CListBox/main.cxx327
-rw-r--r--NxWidgets/UnitTests/CProgressBar/Makefile172
-rw-r--r--NxWidgets/UnitTests/CProgressBar/cprogressbartest.cxx224
-rw-r--r--NxWidgets/UnitTests/CProgressBar/cprogressbartest.hxx147
-rw-r--r--NxWidgets/UnitTests/CProgressBar/main.cxx238
-rw-r--r--NxWidgets/UnitTests/CRadioButton/Makefile172
-rw-r--r--NxWidgets/UnitTests/CRadioButton/cradiobuttontest.cxx305
-rw-r--r--NxWidgets/UnitTests/CRadioButton/cradiobuttontest.hxx162
-rw-r--r--NxWidgets/UnitTests/CRadioButton/main.cxx238
-rw-r--r--NxWidgets/UnitTests/CScrollbarHorizontal/Makefile172
-rw-r--r--NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.cxx225
-rw-r--r--NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.hxx147
-rw-r--r--NxWidgets/UnitTests/CScrollbarHorizontal/main.cxx231
-rw-r--r--NxWidgets/UnitTests/CScrollbarVertical/Makefile172
-rw-r--r--NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.cxx225
-rw-r--r--NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.hxx147
-rw-r--r--NxWidgets/UnitTests/CScrollbarVertical/main.cxx231
-rw-r--r--NxWidgets/UnitTests/CSliderHorizonal/Makefile172
-rw-r--r--NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.cxx224
-rw-r--r--NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.hxx147
-rw-r--r--NxWidgets/UnitTests/CSliderHorizonal/main.cxx231
-rw-r--r--NxWidgets/UnitTests/CSliderVertical/Makefile172
-rw-r--r--NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.cxx225
-rw-r--r--NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.hxx147
-rw-r--r--NxWidgets/UnitTests/CSliderVertical/main.cxx231
-rw-r--r--NxWidgets/UnitTests/CTextBox/Makefile172
-rw-r--r--NxWidgets/UnitTests/CTextBox/ctextboxtest.cxx287
-rw-r--r--NxWidgets/UnitTests/CTextBox/ctextboxtest.hxx152
-rw-r--r--NxWidgets/UnitTests/CTextBox/main.cxx141
-rw-r--r--NxWidgets/UnitTests/README.txt394
-rwxr-xr-xNxWidgets/UnitTests/tools/addobjs.sh141
-rwxr-xr-xNxWidgets/UnitTests/tools/install.sh152
-rw-r--r--NxWidgets/libnxwidgets/COPYING70
-rw-r--r--NxWidgets/libnxwidgets/Makefile135
-rw-r--r--NxWidgets/libnxwidgets/include/cbgwindow.hxx314
-rw-r--r--NxWidgets/libnxwidgets/include/cbitmap.hxx204
-rw-r--r--NxWidgets/libnxwidgets/include/cbutton.hxx235
-rw-r--r--NxWidgets/libnxwidgets/include/cbuttonarray.hxx317
-rw-r--r--NxWidgets/libnxwidgets/include/ccallback.hxx220
-rw-r--r--NxWidgets/libnxwidgets/include/ccheckbox.hxx210
-rw-r--r--NxWidgets/libnxwidgets/include/ccyclebutton.hxx356
-rw-r--r--NxWidgets/libnxwidgets/include/cglyphbutton.hxx229
-rw-r--r--NxWidgets/libnxwidgets/include/cgraphicsport.hxx411
-rw-r--r--NxWidgets/libnxwidgets/include/cimage.hxx199
-rw-r--r--NxWidgets/libnxwidgets/include/ckeypad.hxx156
-rw-r--r--NxWidgets/libnxwidgets/include/clabel.hxx355
-rw-r--r--NxWidgets/libnxwidgets/include/clatchbutton.hxx173
-rw-r--r--NxWidgets/libnxwidgets/include/clatchbuttonarray.hxx170
-rw-r--r--NxWidgets/libnxwidgets/include/clistbox.hxx431
-rw-r--r--NxWidgets/libnxwidgets/include/clistboxdataitem.hxx180
-rw-r--r--NxWidgets/libnxwidgets/include/clistdata.hxx351
-rw-r--r--NxWidgets/libnxwidgets/include/clistdataeventargs.hxx121
-rw-r--r--NxWidgets/libnxwidgets/include/clistdataitem.hxx189
-rw-r--r--NxWidgets/libnxwidgets/include/cmultilinetextbox.hxx621
-rw-r--r--NxWidgets/libnxwidgets/include/cnxfont.hxx238
-rw-r--r--NxWidgets/libnxwidgets/include/cnxserver.hxx199
-rw-r--r--NxWidgets/libnxwidgets/include/cnxstring.hxx484
-rw-r--r--NxWidgets/libnxwidgets/include/cnxtimer.hxx220
-rw-r--r--NxWidgets/libnxwidgets/include/cnxtkwindow.hxx327
-rw-r--r--NxWidgets/libnxwidgets/include/cnxtoolbar.hxx304
-rw-r--r--NxWidgets/libnxwidgets/include/cnxwidget.hxx1627
-rw-r--r--NxWidgets/libnxwidgets/include/cnxwindow.hxx307
-rw-r--r--NxWidgets/libnxwidgets/include/cprogressbar.hxx251
-rw-r--r--NxWidgets/libnxwidgets/include/cradiobutton.hxx207
-rw-r--r--NxWidgets/libnxwidgets/include/cradiobuttongroup.hxx253
-rw-r--r--NxWidgets/libnxwidgets/include/crect.hxx424
-rw-r--r--NxWidgets/libnxwidgets/include/crectcache.hxx222
-rw-r--r--NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx259
-rw-r--r--NxWidgets/libnxwidgets/include/cscrollbarhorizontal.hxx293
-rw-r--r--NxWidgets/libnxwidgets/include/cscrollbarpanel.hxx309
-rw-r--r--NxWidgets/libnxwidgets/include/cscrollbarvertical.hxx291
-rw-r--r--NxWidgets/libnxwidgets/include/cscrollinglistbox.hxx480
-rw-r--r--NxWidgets/libnxwidgets/include/cscrollingpanel.hxx372
-rw-r--r--NxWidgets/libnxwidgets/include/cscrollingtextbox.hxx467
-rw-r--r--NxWidgets/libnxwidgets/include/csliderhorizontal.hxx344
-rw-r--r--NxWidgets/libnxwidgets/include/csliderhorizontalgrip.hxx203
-rw-r--r--NxWidgets/libnxwidgets/include/cslidervertical.hxx344
-rw-r--r--NxWidgets/libnxwidgets/include/csliderverticalgrip.hxx202
-rw-r--r--NxWidgets/libnxwidgets/include/cstickybutton.hxx237
-rw-r--r--NxWidgets/libnxwidgets/include/cstickybuttonarray.hxx174
-rw-r--r--NxWidgets/libnxwidgets/include/cstringiterator.hxx192
-rw-r--r--NxWidgets/libnxwidgets/include/ctext.hxx386
-rw-r--r--NxWidgets/libnxwidgets/include/ctextbox.hxx375
-rw-r--r--NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx641
-rw-r--r--NxWidgets/libnxwidgets/include/cwidgeteventargs.hxx237
-rw-r--r--NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx316
-rw-r--r--NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx382
-rw-r--r--NxWidgets/libnxwidgets/include/cwidgetstyle.hxx135
-rw-r--r--NxWidgets/libnxwidgets/include/glyphs.hxx131
-rw-r--r--NxWidgets/libnxwidgets/include/ibitmap.hxx165
-rw-r--r--NxWidgets/libnxwidgets/include/ilistbox.hxx273
-rw-r--r--NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx127
-rw-r--r--NxWidgets/libnxwidgets/include/inxwindow.hxx268
-rw-r--r--NxWidgets/libnxwidgets/include/iscrollable.hxx208
-rw-r--r--NxWidgets/libnxwidgets/include/islider.hxx188
-rw-r--r--NxWidgets/libnxwidgets/include/itextbox.hxx209
-rw-r--r--NxWidgets/libnxwidgets/include/nxconfig.hxx444
-rw-r--r--NxWidgets/libnxwidgets/include/singletons.hxx136
-rw-r--r--NxWidgets/libnxwidgets/include/teventargs.hxx136
-rw-r--r--NxWidgets/libnxwidgets/include/tnxarray.hxx437
-rw-r--r--NxWidgets/libnxwidgets/src/cbgwindow.cxx364
-rw-r--r--NxWidgets/libnxwidgets/src/cbitmap.cxx197
-rw-r--r--NxWidgets/libnxwidgets/src/cbutton.cxx300
-rw-r--r--NxWidgets/libnxwidgets/src/cbuttonarray.cxx608
-rw-r--r--NxWidgets/libnxwidgets/src/ccallback.cxx195
-rw-r--r--NxWidgets/libnxwidgets/src/ccheckbox.cxx265
-rw-r--r--NxWidgets/libnxwidgets/src/ccyclebutton.cxx482
-rw-r--r--NxWidgets/libnxwidgets/src/cglyphbutton.cxx297
-rw-r--r--NxWidgets/libnxwidgets/src/cgraphicsport.cxx988
-rw-r--r--NxWidgets/libnxwidgets/src/cimage.cxx343
-rw-r--r--NxWidgets/libnxwidgets/src/ckeypad.cxx214
-rw-r--r--NxWidgets/libnxwidgets/src/clabel.cxx426
-rw-r--r--NxWidgets/libnxwidgets/src/clatchbutton.cxx131
-rw-r--r--NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx116
-rw-r--r--NxWidgets/libnxwidgets/src/clistbox.cxx661
-rw-r--r--NxWidgets/libnxwidgets/src/clistboxdataitem.cxx114
-rw-r--r--NxWidgets/libnxwidgets/src/clistdata.cxx462
-rw-r--r--NxWidgets/libnxwidgets/src/clistdataitem.cxx128
-rw-r--r--NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx1284
-rw-r--r--NxWidgets/libnxwidgets/src/cnxfont.cxx276
-rw-r--r--NxWidgets/libnxwidgets/src/cnxserver.cxx386
-rw-r--r--NxWidgets/libnxwidgets/src/cnxstring.cxx799
-rw-r--r--NxWidgets/libnxwidgets/src/cnxtimer.cxx382
-rw-r--r--NxWidgets/libnxwidgets/src/cnxtkwindow.cxx387
-rw-r--r--NxWidgets/libnxwidgets/src/cnxtoolbar.cxx364
-rw-r--r--NxWidgets/libnxwidgets/src/cnxwidget.cxx2424
-rw-r--r--NxWidgets/libnxwidgets/src/cnxwindow.cxx342
-rw-r--r--NxWidgets/libnxwidgets/src/cprogressbar.cxx230
-rw-r--r--NxWidgets/libnxwidgets/src/cradiobutton.cxx225
-rw-r--r--NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx344
-rw-r--r--NxWidgets/libnxwidgets/src/crect.cxx380
-rw-r--r--NxWidgets/libnxwidgets/src/crectcache.cxx521
-rw-r--r--NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx414
-rw-r--r--NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx402
-rw-r--r--NxWidgets/libnxwidgets/src/cscrollbarpanel.cxx438
-rw-r--r--NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx404
-rw-r--r--NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx415
-rw-r--r--NxWidgets/libnxwidgets/src/cscrollingpanel.cxx320
-rw-r--r--NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx577
-rw-r--r--NxWidgets/libnxwidgets/src/csliderhorizontal.cxx402
-rw-r--r--NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx246
-rw-r--r--NxWidgets/libnxwidgets/src/cslidervertical.cxx402
-rw-r--r--NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx245
-rw-r--r--NxWidgets/libnxwidgets/src/cstickybutton.cxx168
-rw-r--r--NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx292
-rw-r--r--NxWidgets/libnxwidgets/src/cstringiterator.cxx198
-rw-r--r--NxWidgets/libnxwidgets/src/ctext.cxx675
-rw-r--r--NxWidgets/libnxwidgets/src/ctextbox.cxx679
-rw-r--r--NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx890
-rw-r--r--NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx606
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_arrowright.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_arrowup.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_backspace.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_capslock.cxx155
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx121
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_control.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_cycle.cxx155
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_nxlogo.cxx3450
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx156
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_return.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_shift.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_windowclose.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx154
-rw-r--r--NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx156
-rw-r--r--NxWidgets/libnxwidgets/src/singletons.cxx202
217 files changed, 66325 insertions, 0 deletions
diff --git a/NxWidgets/Doxygen/Doxyfile b/NxWidgets/Doxygen/Doxyfile
new file mode 100644
index 000000000..0451ce6a0
--- /dev/null
+++ b/NxWidgets/Doxygen/Doxyfile
@@ -0,0 +1,1551 @@
+# Doxyfile 1.6.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = NXWidgets
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = "1.0"
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 2
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = YES
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= NO
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = "../libnxwidgets"
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = NO
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = NO
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = YES
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = NO
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = NO
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = NO
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/NxWidgets/Doxygen/README.txt b/NxWidgets/Doxygen/README.txt
new file mode 100644
index 000000000..4546d4903
--- /dev/null
+++ b/NxWidgets/Doxygen/README.txt
@@ -0,0 +1,45 @@
+README
+======
+
+This directory contains the documentation automatically generated by Doxygen.
+
+Contents
+========
+
+ o Installing the necessary packages in Ubuntu
+ o Generating documentation
+
+Installing the necessary packages in Ubuntu
+===========================================
+
+1. Install the following packages.
+
+ $ sudo aptitude install doxygen doxygen-doc doxygen-gui dot2tex graphviz
+
+2. (Optional) Install from the latest sourcode.
+
+ The Ubuntu package is outdated. The newer the version of Doxygen, the cooler
+ the documentation looks.
+
+ Place yourself in some temporary folder where you can download the source,
+ and run (http://www.stack.nl/~dimitri/doxygen/download.html):
+
+ $ svn co https://doxygen.svn.sourceforge.net/svnroot/doxygen/trunk doxygen-svn
+ $ cd doxygen-svn
+ $ ./configure
+ $ make
+ $ make install
+
+Generating documentation
+========================
+
+1. Position the shell into this folder:
+
+ misc/NXWidgets/Doxygen
+
+ The file "Doxyfile" contains the configuration of the Doxygen settings
+ for the run, edit only if necessary.
+
+ To generate the documentation type:
+
+ $ doxygen Doxyfile
diff --git a/NxWidgets/Doxygen/gendoc.sh b/NxWidgets/Doxygen/gendoc.sh
new file mode 100755
index 000000000..0132f8162
--- /dev/null
+++ b/NxWidgets/Doxygen/gendoc.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+#################################################################################
+# NxWidgets/Doxygen/gendoc.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Jose Pablo Carballo <jcarballo@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+#
+# set -x
+# Functions
+
+function ShowUsage()
+{
+ echo ""
+ echo "USAGE: $0 <doxygen-output-directory-path>"
+ echo ""
+ echo "Where:"
+ echo " <doxygen-output-directory-path> is the full, absolut path to place the doxygen output"
+ echo ""
+}
+
+# Input parameters
+
+DOXYGENOUTPUT_DIR=$1
+if [ -z "${DOXYGENOUTPUT_DIR}" ]; then
+ echo "Missing required arguments"
+ ShowUsage
+ exit 1
+fi
+
+# Check that the directory exist
+
+if [ ! -d "${DOXYGENOUTPUT_DIR}" ]; then
+ echo "Directory ${DOXYGENOUTPUT_DIR} does not exist"
+ exit 1
+fi
+
+# Find the doxygen configuration file
+
+DOXYFILE="Doxyfile"
+if [ ! -e "${DOXYFILE}" ]; then
+ echo "This script must be executed in the documentation/ directory"
+ exit 1
+fi
+
+doxygen "${DOXYFILE}" || \
+ {
+ echo "Failed to run doxygen"; \
+ exit 1;
+
+ }
+
+cp -rf html "${DOXYGENOUTPUT_DIR}" || \
+ {
+ echo "Failed to move html output"; \
+ exit 1;
+ }
+
+rm -rf html || \
+ {
+ echo "Failed to remove the html/ directory"; \
+ exit 1;
+ }
+
+echo "open ${DOXYGENOUTPUT_DIR}/html/index.html to start browsing"
+
diff --git a/NxWidgets/UnitTests/CButton/Makefile b/NxWidgets/UnitTests/CButton/Makefile
new file mode 100644
index 000000000..fbb7d815b
--- /dev/null
+++ b/NxWidgets/UnitTests/CButton/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/Unitests/CButton/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cbuttontest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cbutton
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CButton/cbuttontest.cxx b/NxWidgets/UnitTests/CButton/cbuttontest.cxx
new file mode 100644
index 000000000..49f32f551
--- /dev/null
+++ b/NxWidgets/UnitTests/CButton/cbuttontest.cxx
@@ -0,0 +1,325 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CButton/cbuttontest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbuttontest.hxx"
+#include "cbgwindow.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CButtonTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CButtonTest Constructor
+
+CButtonTest::CButtonTest()
+{
+ m_bgWindow = (CBgWindow *)NULL;
+ m_nxFont = (CNxFont *)NULL;
+ m_text = (CNxString *)NULL;
+}
+
+// CButtonTest Descriptor
+
+CButtonTest::~CButtonTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CButtonTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Create the default font instance
+
+ m_nxFont = new CNxFont(NXFONT_DEFAULT,
+ CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+ if (!m_nxFont)
+ {
+ printf("CButtonTest::connect: Failed to create the default font\n");
+ }
+
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CBUTTONTEST_BGCOLOR))
+ {
+ printf("CButtonTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CButtonTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Free the display string
+
+ if (m_text)
+ {
+ delete m_text;
+ m_text = (CNxString *)NULL;
+ }
+
+ // Free the default font
+
+ if (m_nxFont)
+ {
+ delete m_nxFont;
+ m_nxFont = (CNxFont *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CButtonTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ printf("CButtonTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ printf("CButtonTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CButton instance
+
+CButton *CButtonTest::createButton(FAR const char *text)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CButtonTest::createGraphics: Failed to get window size\n");
+ return (CButton *)NULL;
+ }
+
+ // Create a CNxString instance to contain the C string
+
+ m_text = new CNxString(text);
+
+ // Get the height and width of the text display area
+
+ nxgl_coord_t stringWidth = m_nxFont->getStringWidth(*m_text);
+ nxgl_coord_t stringHeight = (nxgl_coord_t)m_nxFont->getHeight();
+
+ // The default CButton has borders enabled with thickness of the border
+ // width. Add twice the thickness of the borderto the width and height. (We
+ // could let CButton do this for us by calling CButton::getPreferredDimensions())
+
+ stringWidth += 2 * 1;
+ stringHeight += 2 * 1;
+
+ // Pick an X/Y position such that the button will be centered in the display
+
+ nxgl_coord_t buttonX;
+ if (stringWidth >= windowSize.w)
+ {
+ buttonX = 0;
+ }
+ else
+ {
+ buttonX = (windowSize.w - stringWidth) >> 1;
+ }
+
+ nxgl_coord_t buttonY;
+ if (stringHeight >= windowSize.h)
+ {
+ buttonY = 0;
+ }
+ else
+ {
+ buttonY = (windowSize.h - stringHeight) >> 1;
+ }
+
+ // Save the center position of the button for use by click and release
+
+ m_center.x = buttonX + (stringWidth >> 1);
+ m_center.y = buttonY + (stringHeight >> 1);
+
+ // Now we have enough information to create the button
+
+ return new CButton(m_widgetControl, buttonX, buttonY, stringWidth, stringHeight, *m_text);
+}
+
+// Draw the button
+
+void CButtonTest::showButton(CButton *button)
+{
+ button->enable(); // Un-necessary, the widget is enabled by default
+ button->enableDrawing();
+ button->redraw();
+}
+
+// Perform a simulated mouse click on the button. This method injects
+// the mouse click through the NX heirarchy just as would real mouse
+// hardward.
+
+void CButtonTest::click(void)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, m_center.x, m_center.y, NX_MOUSE_LEFTBUTTON);
+}
+
+// The counterpart to click. This simulates a button release through
+// the same mechanism.
+
+void CButtonTest::release(void)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, m_center.x, m_center.y, NX_MOUSE_NOBUTTONS);
+}
+
+// Widget events are normally handled in a modal loop (by calling goModal()).
+// However, for this case we know when there should be press and release
+// events so we don't have to poll. We can just perform a one pass poll
+// then check if the event was processed corredly.
+
+bool CButtonTest::poll(CButton *button)
+{
+ // Poll for mouse events
+
+ m_widgetControl->pollEvents(button);
+
+ // And return the button clicked state
+
+ return button->isClicked();
+}
+
diff --git a/NxWidgets/UnitTests/CButton/cbuttontest.hxx b/NxWidgets/UnitTests/CButton/cbuttontest.hxx
new file mode 100644
index 000000000..f125af6b3
--- /dev/null
+++ b/NxWidgets/UnitTests/CButton/cbuttontest.hxx
@@ -0,0 +1,167 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CButton/cbuttontest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CBUTTON_CBUTTONTEST_HXX
+#define __UNITTESTS_CBUTTON_CBUTTONTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "cbutton.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CBUTTONTEST_BGCOLOR
+# define CONFIG_CBUTTONTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+#ifndef CONFIG_CBUTTONTEST_FONTCOLOR
+# define CONFIG_CBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cbutton_main
+# define MAIN_STRING "cbutton_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CButtonTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CNxFont *m_nxFont; // Default font
+ CBgWindow *m_bgWindow; // Background window instance
+ CNxString *m_text; // The button string
+ struct nxgl_point_s m_center; // X, Y position the center of the button
+
+public:
+ // Constructor/destructors
+
+ CButtonTest();
+ ~CButtonTest();
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CButton instance. This method will show you how to create
+ // a CButton widget
+
+ CButton *createButton(FAR const char *text);
+
+ // Draw the button. This method illustrates how to draw the CButton widget.
+
+ void showButton(CButton *button);
+
+ // Perform a simulated mouse click on the button. This method injects
+ // the mouse click through the NX heirarchy just as would real mouse
+ // hardward.
+
+ void click(void);
+
+ // The counterpart to click. This simulates a button release through
+ // the same mechanism.
+
+ void release(void);
+
+ // Widget events are normally handled in a model loop (by calling goModel()).
+ // However, for this case we know when there should be press and release
+ // events so we don't have to poll. We can just perform a one pass poll
+ // then check if the event was processed corredly.
+
+ bool poll(CButton *button);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif // __UNITTESTS_CBUTTON_CBUTTONTEST_HXX
diff --git a/NxWidgets/UnitTests/CButton/main.cxx b/NxWidgets/UnitTests/CButton/main.cxx
new file mode 100644
index 000000000..13e9099d9
--- /dev/null
+++ b/NxWidgets/UnitTests/CButton/main.cxx
@@ -0,0 +1,155 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CButton/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cbuttontest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static const char g_pushme[] = "Push Me";
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Create an instance of the font test
+
+ printf(MAIN_STRING "Create CButtonTest instance\n");
+ CButtonTest *test = new CButtonTest();
+
+ // Connect the NX server
+
+ printf(MAIN_STRING "Connect the CButtonTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ printf(MAIN_STRING "Failed to connect the CButtonTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a window to draw into
+
+ printf(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ printf(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a CButton instance
+
+ CButton *button = test->createButton(g_pushme);
+ if (!button)
+ {
+ printf(MAIN_STRING "Failed to create a button\n");
+ delete test;
+ return 1;
+ }
+
+ // Show the button
+
+ printf(MAIN_STRING "Show the button\n");
+ test->showButton(button);
+
+ // Wait two seconds, then perform a simulated mouse click on the button
+
+ sleep(2);
+ printf(MAIN_STRING "Click the button\n");
+ test->click();
+
+ // Poll for the mouse click event (of course this can hang if something fails)
+
+ bool clicked = test->poll(button);
+ printf(MAIN_STRING "Button is %s\n", clicked ? "clicked" : "released");
+
+ // Wait a second, then release the mouse buttone
+
+ sleep(1);
+ test->release();
+
+ // Poll for the mouse release event (of course this can hang if something fails)
+
+ clicked = test->poll(button);
+ printf(MAIN_STRING "Button is %s\n", clicked ? "clicked" : "released");
+
+ // Wait a few more seconds so that the tester can ponder the result
+
+ sleep(3);
+
+ // Clean up and exit
+
+ printf(MAIN_STRING "Clean-up and exit\n");
+ delete button;
+ delete test;
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CButtonArray/Makefile b/NxWidgets/UnitTests/CButtonArray/Makefile
new file mode 100644
index 000000000..6bb67424c
--- /dev/null
+++ b/NxWidgets/UnitTests/CButtonArray/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CButtonArray/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cbuttonarraytest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cbuttonarray
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.cxx b/NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.cxx
new file mode 100644
index 000000000..4e4f4487f
--- /dev/null
+++ b/NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.cxx
@@ -0,0 +1,301 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbuttonarraytest.hxx"
+#include "cbgwindow.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CButtonArrayTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CButtonArrayTest Constructor
+
+CButtonArrayTest::CButtonArrayTest()
+{
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CButtonArrayTest Descriptor
+
+CButtonArrayTest::~CButtonArrayTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CButtonArrayTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CBUTTONARRAYTEST_BGCOLOR))
+ {
+ message("CButtonArrayTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CButtonArrayTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Destroy the widget control
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CButtonArrayTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CButtonArrayTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CButtonArrayTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CButtonArray instance
+
+CButtonArray *CButtonArrayTest::createButtonArray(void)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CButtonArrayTest::createGraphics: Failed to get window size\n");
+ return (CButtonArray *)NULL;
+ }
+
+ // Pick an X/Y position such that the button array will be centered in the display
+
+ nxgl_coord_t buttonArrayX;
+ if (BUTTONARRAY_WIDTH >= windowSize.w)
+ {
+ buttonArrayX = 0;
+ }
+ else
+ {
+ buttonArrayX = (windowSize.w - BUTTONARRAY_WIDTH) >> 1;
+ }
+
+ nxgl_coord_t buttonArrayY;
+ if (BUTTONARRAY_HEIGHT >= windowSize.h)
+ {
+ buttonArrayY = 0;
+ }
+ else
+ {
+ buttonArrayY = (windowSize.h - BUTTONARRAY_HEIGHT) >> 1;
+ }
+
+ // Now we have enough information to create the button array
+
+ return new CButtonArray(m_widgetControl,
+ buttonArrayX, buttonArrayY,
+ BUTTONARRAY_NCOLUMNS, BUTTONARRAY_NROWS,
+ BUTTONARRAY_BUTTONWIDTH, BUTTONARRAY_BUTTONHEIGHT);
+}
+
+// Draw the button array
+
+void CButtonArrayTest::showButton(CButtonArray *buttonArray)
+{
+ buttonArray->enable(); // Un-necessary, the widget is enabled by default
+ buttonArray->enableDrawing();
+ buttonArray->redraw();
+}
+
+// Perform a simulated mouse click on a button in the array. This method injects
+// the mouse click through the NX heirarchy just as would real mouse
+// hardward.
+
+void CButtonArrayTest::click(CButtonArray *buttonArray, int column, int row)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the selected button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // The the coorinates of the center of the button
+
+ nxgl_coord_t buttonX = buttonArray->getX() +
+ column * BUTTONARRAY_BUTTONWIDTH +
+ BUTTONARRAY_BUTTONWIDTH/2;
+ nxgl_coord_t buttonY = buttonArray->getY() +
+ row * BUTTONARRAY_BUTTONHEIGHT +
+ BUTTONARRAY_BUTTONHEIGHT/2;
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, buttonX, buttonY, NX_MOUSE_LEFTBUTTON);
+}
+
+// The counterpart to click. This simulates a button release through
+// the same mechanism.
+
+void CButtonArrayTest::release(CButtonArray *buttonArray, int column, int row)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // The the coorinates of the center of the button
+
+ nxgl_coord_t buttonX = buttonArray->getX() +
+ column * BUTTONARRAY_BUTTONWIDTH +
+ BUTTONARRAY_BUTTONWIDTH/2;
+ nxgl_coord_t buttonY = buttonArray->getY() +
+ row * BUTTONARRAY_BUTTONHEIGHT +
+ BUTTONARRAY_BUTTONHEIGHT/2;
+
+ // Then inject the mouse release
+
+ (void)nx_mousein(handle, buttonX, buttonY, NX_MOUSE_NOBUTTONS);
+}
+
+// Widget events are normally handled in a modal loop (by calling goModal()).
+// However, for this case we know when there should be press and release
+// events so we don't have to poll. We can just perform a one pass poll
+// then check if the event was processed corredly.
+
+void CButtonArrayTest::poll(CButtonArray *button)
+{
+ // Poll for mouse events
+
+ m_widgetControl->pollEvents(button);
+}
+
diff --git a/NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.hxx b/NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.hxx
new file mode 100644
index 000000000..ef265efbf
--- /dev/null
+++ b/NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.hxx
@@ -0,0 +1,182 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CButtonArray/cbuttonarraytest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CBUTTONARRAY_CBUTTONARRAYTEST_HXX
+#define __UNITTESTS_CBUTTONARRAY_CBUTTONARRAYTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "cbuttonarray.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CBUTTONARRAYTEST_BGCOLOR
+# define CONFIG_CBUTTONARRAYTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+#ifndef CONFIG_CBUTTONARRAYTEST_FONTCOLOR
+# define CONFIG_CBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cbuttonarray_main
+# define MAIN_STRING "cbuttonarray_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+// The geometry of the button array
+
+#define BUTTONARRAY_NCOLUMNS 4
+#define BUTTONARRAY_NROWS 7
+#define BUTTONARRAY_BUTTONWIDTH 60
+#define BUTTONARRAY_BUTTONHEIGHT 32
+#define BUTTONARRAY_WIDTH (BUTTONARRAY_BUTTONWIDTH * BUTTONARRAY_NCOLUMNS)
+#define BUTTONARRAY_HEIGHT (BUTTONARRAY_BUTTONHEIGHT * BUTTONARRAY_NROWS)
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CButtonArrayTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The widget control for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CButtonArrayTest();
+ ~CButtonArrayTest();
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CButtonArray instance. This method will show you how to create
+ // a CButtonArray widget
+
+ CButtonArray *createButtonArray(void);
+
+ // Draw the button array. This method illustrates how to draw the CButtonArray widget.
+
+ void showButton(CButtonArray *buttonArray);
+
+ // Perform a simulated mouse click on a button in the array. This method injects
+ // the mouse click through the NX heirarchy just as would real mouse
+ // hardward.
+
+ void click(CButtonArray *buttonArray, int column, int row);
+
+ // The counterpart to click. This simulates a button release through
+ // the same mechanism.
+
+ void release(CButtonArray *buttonArray, int column, int row);
+
+ // Widget events are normally handled in a model loop (by calling goModel()).
+ // However, for this case we know when there should be press and release
+ // events so we don't have to poll. We can just perform a one pass poll
+ // then check if the event was processed corredly.
+
+ void poll(CButtonArray *buttonArray);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif // __UNITTESTS_CBUTTONARRAY_CBUTTONARRAYTEST_HXX
diff --git a/NxWidgets/UnitTests/CButtonArray/main.cxx b/NxWidgets/UnitTests/CButtonArray/main.cxx
new file mode 100644
index 000000000..fa02413a4
--- /dev/null
+++ b/NxWidgets/UnitTests/CButtonArray/main.cxx
@@ -0,0 +1,327 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CButtonArray/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cnxstring.hxx"
+#include "cbuttonarraytest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmPrevious;
+static unsigned int g_mmPeak;
+
+static FAR const char *g_buttonLabels[BUTTONARRAY_NCOLUMNS*BUTTONARRAY_NROWS] = {
+ "=>", "A", "B", "<DEL",
+ "C", "D", "E", "F",
+ "G", "H", "I", "J",
+ "K", "L", "M", "N",
+ "O", "P", "Q", "R",
+ "S", "T", "U", "V",
+ "W", "X", "Y", "Z"
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("%s: Before: %8d After: %8d Change: %8d\n",
+ msg, previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmPrevious = mmcurrent.uordblks;
+ if ((unsigned int)mmcurrent.uordblks > g_mmPeak)
+ {
+ g_mmPeak = mmcurrent.uordblks;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmPrevious = mmcurrent.uordblks;
+ g_mmPeak = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: checkHighlighting
+/////////////////////////////////////////////////////////////////////////////
+
+static void checkHighlighting(CButtonArray *buttonArray)
+{
+ // Turn highlighting on
+
+ buttonArray->setCursorPosition(0, 0);
+ buttonArray->cursor(true);
+
+ // Then test the cursor movement
+
+ for (int row = 0; row < BUTTONARRAY_NROWS; row++)
+ {
+ for (int column = 0; column < BUTTONARRAY_NCOLUMNS; column++)
+ {
+ // Set cursor position
+
+ buttonArray->setCursorPosition(column, row);
+
+ // Check cursor position
+
+ int checkColumn;
+ int checkRow;
+ if (buttonArray->isCursorPosition(checkColumn, checkRow))
+ {
+ printf("ERROR: Not button selected\n");
+ printf(" Expected (%d,%d)\n", column, row);
+ }
+ else if (checkColumn != column || checkRow != row)
+ {
+ printf("ERROR: Wrong button selected\n");
+ printf(" Expected (%d,%d)\n", column, row);
+ printf(" Selected (%d,%d)\n", checkColumn, checkRow);
+ }
+
+ // Wait a bit so that we can see the highlighting
+
+ usleep(500*1000);
+ }
+ }
+
+ // Turn highlighting off
+
+ buttonArray->cursor(false);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the button array test
+
+ printf(MAIN_STRING "Create CButtonArrayTest instance\n");
+ CButtonArrayTest *test = new CButtonArrayTest();
+ updateMemoryUsage(g_mmPrevious, "After creating CButtonArrayTest");
+
+ // Connect the NX server
+
+ printf(MAIN_STRING "Connect the CButtonArrayTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ printf(MAIN_STRING "Failed to connect the CButtonArrayTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After connecting to the server");
+
+ // Create a window to draw into
+
+ printf(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ printf(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After creating a window");
+
+ // Create a CButtonArray instance
+
+ CButtonArray *buttonArray = test->createButtonArray();
+ if (!buttonArray)
+ {
+ printf(MAIN_STRING "Failed to create a button array\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After creating CButtonArray");
+
+ // Add the labels to each button
+
+ FAR const char **ptr = g_buttonLabels;
+ for (int j = 0; j < BUTTONARRAY_NROWS; j++)
+ {
+ for (int i = 0; i < BUTTONARRAY_NCOLUMNS; i++)
+ {
+ printf(MAIN_STRING "Label (%d,%d): %s\n", i, j, *ptr);
+ CNxString string = *ptr++;
+ buttonArray->setText(i, j, string);
+ }
+ }
+ updateMemoryUsage(g_mmPrevious, "After adding labels to the buttons");
+
+ // Show the button array
+
+ printf(MAIN_STRING "Show the button array\n");
+ test->showButton(buttonArray);
+ sleep(1);
+
+ // Verify that button highlighting works
+
+ checkHighlighting(buttonArray);
+ updateMemoryUsage(g_mmPrevious, "After highliting");
+
+ // Then perform a simulated mouse click on a button in the array
+
+ for (int j = 0; j < BUTTONARRAY_NROWS; j++)
+ {
+ for (int i = 0; i < BUTTONARRAY_NCOLUMNS; i++)
+ {
+ printf(MAIN_STRING "Click the button (%d,%d)\n", i, j);
+ test->click(buttonArray, i, j);
+
+ // Poll for the mouse click event
+
+ test->poll(buttonArray);
+
+ // Is anything clicked?
+
+ int clickColumn;
+ int clickRow;
+ if (buttonArray->isButtonClicked(clickColumn, clickRow))
+ {
+ printf(MAIN_STRING "%s: Button (%d, %d) is clicked\n",
+ clickColumn == i && clickRow == j ? "OK" : "ERROR",
+ clickColumn, clickRow);
+ }
+ else
+ {
+ printf(MAIN_STRING "ERROR: No button is clicked\n");
+ }
+
+ // Wait a bit, then release the mouse button
+
+ usleep(500*1000);
+ test->release(buttonArray, i, j);
+
+ // Poll for the mouse release event (of course this can hang if something fails)
+
+ test->poll(buttonArray);
+ if (buttonArray->isButtonClicked(clickColumn, clickRow))
+ {
+ printf(MAIN_STRING "ERROR: Button (%d, %d) is clicked\n",
+ clickColumn, clickRow);
+ }
+
+ usleep(500*1000);
+ }
+ }
+ updateMemoryUsage(g_mmPrevious, "After pushing buttons");
+
+ // Clean up and exit
+
+ printf(MAIN_STRING "Clean-up and exit\n");
+ delete buttonArray;
+ updateMemoryUsage(g_mmPrevious, "After deleting the button array");
+ delete test;
+ updateMemoryUsage(g_mmPrevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ message("Peak memory usage: %8d\n", g_mmPeak - g_mmInitial);
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CCheckBox/Makefile b/NxWidgets/UnitTests/CCheckBox/Makefile
new file mode 100644
index 000000000..9dae246ce
--- /dev/null
+++ b/NxWidgets/UnitTests/CCheckBox/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CCheckBox/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx ccheckboxtest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = ccheckbox
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CCheckBox/ccheckboxtest.cxx b/NxWidgets/UnitTests/CCheckBox/ccheckboxtest.cxx
new file mode 100644
index 000000000..90abf2e67
--- /dev/null
+++ b/NxWidgets/UnitTests/CCheckBox/ccheckboxtest.cxx
@@ -0,0 +1,297 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CCheckBox/ccheckboxtest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "ccheckboxtest.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CCheckBoxTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CCheckBoxTest Constructor
+
+CCheckBoxTest::CCheckBoxTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+ m_checkBox = (CCheckBox *)NULL;
+}
+
+// CCheckBoxTest Descriptor
+
+CCheckBoxTest::~CCheckBoxTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CCheckBoxTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CCHECKBOXTEST_BGCOLOR))
+ {
+ message("CCheckBoxTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CCheckBoxTest::disconnect(void)
+{
+ // Free the radiobutton group
+
+ if (m_checkBox)
+ {
+ delete m_checkBox;
+ m_checkBox = (CCheckBox *)NULL;
+ }
+
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow *)NULL;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ m_widgetControl = (CWidgetControl *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CCheckBoxTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CCheckBoxTest::createWindow: Failed to create CBgWindow instance\n");
+ disconnect();
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CCheckBoxTest::createWindow: Failed to open background window\n");
+ disconnect();
+ return false;
+ }
+
+ // Get the size of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CCheckBoxTest::createWindow: Failed to get window size\n");
+ disconnect();
+ return false;
+ }
+
+ // Use the the size of the ON checkbox glyph. (adding twice the border thickness)
+
+ nxgl_coord_t width = g_checkBoxOn.width + 2 * 1;
+ nxgl_coord_t height = g_checkBoxOn.height + 2 * 1;
+
+ nxgl_coord_t checkboxX = (windowSize.w - width) >> 1;
+ nxgl_coord_t checkboxY = (windowSize.h - height) >> 1;
+
+ // Create the checkbox
+
+ m_checkBox = new CCheckBox(m_widgetControl, checkboxX, checkboxY,
+ width, height, (CWidgetStyle *)NULL);
+ if (!m_checkBox)
+ {
+ printf("CCheckBoxTest::createWindow: Failed to create CCheckBox\n");
+ disconnect();
+ return false;
+ }
+
+ return true;
+}
+
+// (Re-)draw the check box.
+
+void CCheckBoxTest::showCheckBox(void)
+{
+ m_checkBox->enable(); // Un-necessary, the widget is enabled by default
+ m_checkBox->enableDrawing();
+ m_checkBox->redraw();
+}
+
+// Push the radio button
+
+void CCheckBoxTest::clickCheckBox(void)
+{
+ // Get the checkbox center coordinates
+
+ nxgl_coord_t checkboxX = m_checkBox->getX() + (m_checkBox->getWidth() >> 1);
+ nxgl_coord_t checkboxY = m_checkBox->getY() + (m_checkBox->getHeight() >> 1);
+
+ // Click the checkbox by calling nx_mousein. nx_mousein is meant to be
+ // called by mouse handling software. Here we just inject a left-button click
+ // directly in the center of the radio button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, checkboxX, checkboxY, NX_MOUSE_LEFTBUTTON);
+
+ // Poll for mouse events
+ //
+ // Widget events are normally handled in a modal loop (by calling goModal()).
+ // However, for this case we know that we just pressed the mouse button
+ // so we don't have to poll. We can just perform a one pass poll then
+ // then check if the mouse event was processed corredly.
+
+ m_widgetControl->pollEvents(m_checkBox);
+
+ // Then inject the mouse release
+
+ (void)nx_mousein(handle, checkboxX, checkboxY, 0);
+
+ // And poll for more mouse events
+
+ m_widgetControl->pollEvents(m_checkBox);
+
+ // And re-draw the buttons (the mouse click event should have automatically
+ // triggered the re-draw)
+ //
+ // showCheckBox();
+}
+
+// Show the state of the radio button group
+
+void CCheckBoxTest::showCheckBoxState(void)
+{
+ CCheckBox::CheckBoxState state = m_checkBox->getState();
+ switch (state)
+ {
+ case CCheckBox::CHECK_BOX_STATE_OFF: // Checkbox is unticked
+ message("CCheckBoxTest::showCheckBoxState Checkbox is in the unticked state\n");
+ break;
+
+ case CCheckBox::CHECK_BOX_STATE_ON: // Checkbox is ticked
+ message("CCheckBoxTest::showCheckBoxState Check is in the ticked state\n");
+ break;
+
+ default:
+ case CCheckBox::CHECK_BOX_STATE_MU: // Checkbox is in the third state
+ message("CCheckBoxTest::showCheckBoxState Checkbox is in the 3rd state\n");
+ break;
+ }
+}
diff --git a/NxWidgets/UnitTests/CCheckBox/ccheckboxtest.hxx b/NxWidgets/UnitTests/CCheckBox/ccheckboxtest.hxx
new file mode 100644
index 000000000..52371ab73
--- /dev/null
+++ b/NxWidgets/UnitTests/CCheckBox/ccheckboxtest.hxx
@@ -0,0 +1,152 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CCheckBox/ccheckboxtest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CCHECKBOX_CCHECKBOXTEST_HXX
+#define __UNITTESTS_CCHECKBOX_CCHECKBOXTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "ccheckbox.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CCHECKBOXTEST_BGCOLOR
+# define CONFIG_CCHECKBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME ccheckbox_main
+# define MAIN_STRING "ccheckbox_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CCheckBoxTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+ CCheckBox *m_checkBox; // Checkgox instance under test
+
+public:
+ // Constructor/destructors
+
+ CCheckBoxTest(void);
+ ~CCheckBoxTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // (Re-)draw the checkbox.
+
+ void showCheckBox(void);
+
+ // Simulate pushing and releasing of the radio button
+
+ void clickCheckBox(void);
+
+ // Show the state of the radio button group
+
+ void showCheckBoxState(void);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CCHECKBOX_CCHECKBOXTEST_HXX
diff --git a/NxWidgets/UnitTests/CCheckBox/main.cxx b/NxWidgets/UnitTests/CCheckBox/main.cxx
new file mode 100644
index 000000000..e9e8b516f
--- /dev/null
+++ b/NxWidgets/UnitTests/CCheckBox/main.cxx
@@ -0,0 +1,209 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CCheckBox/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "crlepalettebitmap.hxx"
+#include "glyphs.hxx"
+#include "ccheckboxtest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the checkbox test
+
+ message(MAIN_STRING "Create CCheckBoxTest instance\n");
+ CCheckBoxTest *test = new CCheckBoxTest();
+ updateMemoryUsage(g_mmprevious, "After creating CCheckBoxTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CCheckBoxTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CCheckBoxTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a window");
+
+ // Show the initial state of the checkbox
+
+ test->showCheckBox();
+ test->showCheckBoxState();
+ sleep(1);
+
+ // Now click the checkbox
+
+ message(MAIN_STRING "Click 1\n");
+ test->clickCheckBox();
+ usleep(500*1000);
+ test->showCheckBoxState();
+ updateMemoryUsage(g_mmprevious, "After click 1");
+ usleep(500*1000);
+
+ message(MAIN_STRING "Click 2\n");
+ test->clickCheckBox();
+ usleep(500*1000);
+ test->showCheckBoxState();
+ updateMemoryUsage(g_mmprevious, "After click 2");
+ usleep(500*1000);
+
+ message(MAIN_STRING "Click 3\n");
+ test->clickCheckBox();
+ usleep(500*1000);
+ test->showCheckBoxState();
+ updateMemoryUsage(g_mmprevious, "After click 3");
+ sleep(2);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CGlyphButton/Makefile b/NxWidgets/UnitTests/CGlyphButton/Makefile
new file mode 100644
index 000000000..527d882fa
--- /dev/null
+++ b/NxWidgets/UnitTests/CGlyphButton/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CGlyphButton/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cglyphbuttontest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cglyphbutton
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.cxx b/NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.cxx
new file mode 100644
index 000000000..d44238c78
--- /dev/null
+++ b/NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.cxx
@@ -0,0 +1,307 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cglyphbuttontest.hxx"
+#include "cbgwindow.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CGlyphButtonTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CGlyphButtonTest Constructor
+
+CGlyphButtonTest::CGlyphButtonTest()
+{
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+ m_center.x = 0;
+ m_center.y = 0;
+}
+
+// CGlyphButtonTest Descriptor
+
+CGlyphButtonTest::~CGlyphButtonTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CGlyphButtonTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CGLYPHBUTTONTEST_BGCOLOR))
+ {
+ message("CGlyphButtonTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CGlyphButtonTest::disconnect(void)
+{
+ // Delete the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ }
+
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CGlyphButtonTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CGlyphButtonTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CGlyphButtonTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CGlyphButton instance
+
+CGlyphButton *CGlyphButtonTest::createButton(FAR const struct SBitmap *clickGlyph,
+ FAR const struct SBitmap *unClickedGlyph)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CGlyphButtonTest::createGraphics: Failed to get window size\n");
+ return (CGlyphButton *)NULL;
+ }
+
+ // Get the height and width of the glyph display area
+
+ nxgl_coord_t glyphWidth = MAX(clickGlyph->width, unClickedGlyph->width);
+ nxgl_coord_t glyphHeight = MAX(clickGlyph->height, unClickedGlyph->height);
+
+ // The default CGlyphButton has borders enabled with thickness of the border
+ // width. Add twice the thickness of the border to the width and height. (We
+ // could let CGlyphButton do this for us by calling
+ // CGlyphButton::getPreferredDimensions())
+
+ glyphWidth += 2 * 1;
+ glyphHeight += 2 * 1;
+
+ // Pick an X/Y position such that the button will be centered in the display
+
+ nxgl_coord_t buttonX;
+ if (glyphWidth >= windowSize.w)
+ {
+ buttonX = 0;
+ }
+ else
+ {
+ buttonX = (windowSize.w - glyphWidth) >> 1;
+ }
+
+ nxgl_coord_t buttonY;
+ if (glyphHeight >= windowSize.h)
+ {
+ buttonY = 0;
+ }
+ else
+ {
+ buttonY = (windowSize.h - glyphHeight) >> 1;
+ }
+
+ // Save the center position of the button for use by click and release
+
+ m_center.x = buttonX + (glyphWidth >> 1);
+ m_center.y = buttonY + (glyphHeight >> 1);
+
+ // Now we have enough information to create the button
+
+ return new CGlyphButton(m_widgetControl, buttonX, buttonY,
+ glyphWidth, glyphHeight,
+ unClickedGlyph, clickGlyph);
+}
+
+// Draw the button
+
+void CGlyphButtonTest::showButton(CGlyphButton *button)
+{
+ button->enable(); // Un-necessary, the widget is enabled by default
+ button->enableDrawing();
+ button->redraw();
+}
+
+// Perform a simulated mouse click on the button. This method injects
+// the mouse click through the NX heirarchy just as would real mouse
+// hardward.
+
+void CGlyphButtonTest::click(void)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, m_center.x, m_center.y, NX_MOUSE_LEFTBUTTON);
+}
+
+// The counterpart to click. This simulates a button release through
+// the same mechanism.
+
+void CGlyphButtonTest::release(void)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, m_center.x, m_center.y, NX_MOUSE_NOBUTTONS);
+}
+
+// Widget events are normally handled in a modal loop (by calling goModal()).
+// However, for this case we know when there should be press and release
+// events so we don't have to poll. We can just perform a one pass poll
+// then check if the event was processed corredly.
+
+bool CGlyphButtonTest::poll(CGlyphButton *button)
+{
+ // Poll for mouse events
+
+ m_widgetControl->pollEvents(button);
+
+ // And return the button clicked state
+
+ return button->isClicked();
+}
+
diff --git a/NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.hxx b/NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.hxx
new file mode 100644
index 000000000..889ce21ca
--- /dev/null
+++ b/NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.hxx
@@ -0,0 +1,182 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CGlyphButton/cglyphbuttontest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CGLYPHBUTTON_CGLYPHBUTTONTEST_HXX
+#define __UNITTESTS_CGLYPHBUTTON_CGLYPHBUTTONTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "cglyphbutton.hxx"
+#include "cbitmap.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CGLYPHBUTTONTEST_BGCOLOR
+# define CONFIG_CGLYPHBUTTONTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+#ifndef CONFIG_CGLYPHBUTTONTEST_FONTCOLOR
+# define CONFIG_CGLYPHBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cglyphbutton_main
+# define MAIN_STRING "cglyphbutton_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+// Helper macros
+
+#ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CGlyphButtonTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+ struct nxgl_point_s m_center; // X, Y position the center of the button
+
+public:
+ // Constructor/destructors
+
+ CGlyphButtonTest();
+ ~CGlyphButtonTest();
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CGlyphButton instance. This method will show you how to create
+ // a CGlyphButton widget
+
+ CGlyphButton *createButton(FAR const struct SBitmap *clickGlyph,
+ FAR const struct SBitmap *unClickedGlyph);
+
+ // Draw the button. This method illustrates how to draw the CGlyphButton widget.
+
+ void showButton(CGlyphButton *button);
+
+ // Perform a simulated mouse click on the button. This method injects
+ // the mouse click through the NX heirarchy just as would real mouse
+ // hardward.
+
+ void click(void);
+
+ // The counterpart to click. This simulates a button release through
+ // the same mechanism.
+
+ void release(void);
+
+ // Widget events are normally handled in a model loop (by calling goModel()).
+ // However, for this case we know when there should be press and release
+ // events so we don't have to poll. We can just perform a one pass poll
+ // then check if the event was processed corredly.
+
+ bool poll(CGlyphButton *button);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif // __UNITTESTS_CGLYPHBUTTON_CGLYPHBUTTONTEST_HXX
diff --git a/NxWidgets/UnitTests/CGlyphButton/main.cxx b/NxWidgets/UnitTests/CGlyphButton/main.cxx
new file mode 100644
index 000000000..7812fa9e9
--- /dev/null
+++ b/NxWidgets/UnitTests/CGlyphButton/main.cxx
@@ -0,0 +1,225 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CGlyphButton/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cglyphbuttontest.hxx"
+#include "glyphs.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the font test
+
+ message(MAIN_STRING "Create CGlyphButtonTest instance\n");
+ CGlyphButtonTest *test = new CGlyphButtonTest();
+ updateMemoryUsage(g_mmprevious, "After creating CGlyphButtonTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CGlyphButtonTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CGlyphButtonTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, "After creating a window");
+
+ // Create a CGlyphButton instance
+
+ CGlyphButton *button = test->createButton(&g_arrowDown, &g_arrowUp);
+ if (!button)
+ {
+ message(MAIN_STRING "Failed to create a button\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, "After creating the glyph button");
+
+ // Show the button
+
+ message(MAIN_STRING "Show the button\n");
+ test->showButton(button);
+ updateMemoryUsage(g_mmprevious, "After showing the glyph button");
+
+ // Wait two seconds, then perform a simulated mouse click on the button
+
+ sleep(2);
+ message(MAIN_STRING "Click the button\n");
+ test->click();
+ updateMemoryUsage(g_mmprevious, "After clicking glyph button");
+
+ // Poll for the mouse click event (of course this can hang if something fails)
+
+ bool clicked = test->poll(button);
+ message(MAIN_STRING "Button is %s\n", clicked ? "clicked" : "released");
+
+ // Wait a second, then release the mouse buttone
+
+ sleep(1);
+ test->release();
+ updateMemoryUsage(g_mmprevious, "After releasing glyph button");
+
+ // Poll for the mouse release event (of course this can hang if something fails)
+
+ clicked = test->poll(button);
+ message(MAIN_STRING "Button is %s\n", clicked ? "clicked" : "released");
+
+ // Wait a few more seconds so that the tester can ponder the result
+
+ sleep(3);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete button;
+ updateMemoryUsage(g_mmprevious, "After deleting the glyph button");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CImage/Makefile b/NxWidgets/UnitTests/CImage/Makefile
new file mode 100644
index 000000000..e248761e7
--- /dev/null
+++ b/NxWidgets/UnitTests/CImage/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CImage/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cimagetest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cimage
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CImage/cimagetest.cxx b/NxWidgets/UnitTests/CImage/cimagetest.cxx
new file mode 100644
index 000000000..48814c4ce
--- /dev/null
+++ b/NxWidgets/UnitTests/CImage/cimagetest.cxx
@@ -0,0 +1,240 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CImage/cimagetest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "ibitmap.hxx"
+#include "cbgwindow.hxx"
+#include "cimagetest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CImageTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CImageTest Constructor
+
+CImageTest::CImageTest()
+{
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CImageTest Descriptor
+
+CImageTest::~CImageTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CImageTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CIMAGETEST_BGCOLOR))
+ {
+ message("CImageTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CImageTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CImageTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CImageTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CImageTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CImage instance
+
+CImage *CImageTest::createImage(IBitmap *bitmap)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CImageTest::createGraphics: Failed to get window size\n");
+ return (CImage *)NULL;
+ }
+
+ // Get the height and width of the image
+
+ nxgl_coord_t imageWidth = bitmap->getWidth();
+ nxgl_coord_t imageHeight = (nxgl_coord_t)bitmap->getHeight();
+
+ // The default CImage has borders enabled with thickness of the border
+ // width. Add twice the thickness of the border to the width and height. (We
+ // could let CImage do this for us by calling CImage::getPreferredDimensions())
+
+ imageWidth += 2 * 1;
+ imageHeight += 2 * 1;
+
+ // Pick an X/Y position such that the image will be centered in the display
+
+ nxgl_coord_t imageX;
+ if (imageWidth >= windowSize.w)
+ {
+ imageX = 0;
+ }
+ else
+ {
+ imageX = (windowSize.w - imageWidth) >> 1;
+ }
+
+ nxgl_coord_t imageY;
+ if (imageHeight >= windowSize.h)
+ {
+ imageY = 0;
+ }
+ else
+ {
+ imageY = (windowSize.h - imageHeight) >> 1;
+ }
+
+ // Now we have enough information to create the image
+
+ return new CImage(m_widgetControl, imageX, imageY, imageWidth, imageHeight, bitmap);
+}
+
+// Draw the image
+
+void CImageTest::showImage(CImage *image)
+{
+ image->enable();
+ image->enableDrawing();
+ image->redraw();
+ image->disableDrawing();
+}
diff --git a/NxWidgets/UnitTests/CImage/cimagetest.hxx b/NxWidgets/UnitTests/CImage/cimagetest.hxx
new file mode 100644
index 000000000..8a8a55556
--- /dev/null
+++ b/NxWidgets/UnitTests/CImage/cimagetest.hxx
@@ -0,0 +1,150 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CImage/cimagetest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CIMAGE_CIMAGETEST_HXX
+#define __UNITTESTS_CIMAGE_CIMAGETEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "cimage.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CIMAGETEST_BGCOLOR
+# define CONFIG_CIMAGETEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cimage_main
+# define MAIN_STRING "cimage_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CImageTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CImageTest(void);
+ ~CImageTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CImage instance. This method will show you how to create
+ // a CImage widget
+
+ CImage *createImage(IBitmap *bitmap);
+
+ // Draw the image. This method illustrates how to draw the CImage widget.
+
+ void showImage(CImage *image);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CIMAGE_CIMAGETEST_HXX
diff --git a/NxWidgets/UnitTests/CImage/main.cxx b/NxWidgets/UnitTests/CImage/main.cxx
new file mode 100644
index 000000000..dd066b809
--- /dev/null
+++ b/NxWidgets/UnitTests/CImage/main.cxx
@@ -0,0 +1,222 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CImage/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "crlepalettebitmap.hxx"
+#include "glyphs.hxx"
+#include "cimagetest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static struct mallinfo g_mmInitial;
+static struct mallinfo g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: showMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void showMemoryUsage(FAR struct mallinfo *mmbefore,
+ FAR struct mallinfo *mmafter)
+{
+ message("VARIABLE BEFORE AFTER\n");
+ message("======== ======== ========\n");
+ message("arena %8d %8d\n", mmbefore->arena, mmafter->arena);
+ message("ordblks %8d %8d\n", mmbefore->ordblks, mmafter->ordblks);
+ message("mxordblk %8d %8d\n", mmbefore->mxordblk, mmafter->mxordblk);
+ message("uordblks %8d %8d\n", mmbefore->uordblks, mmafter->uordblks);
+ message("fordblks %8d %8d\n", mmbefore->fordblks, mmafter->fordblks);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(FAR struct mallinfo *previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ showMemoryUsage(previous, &mmcurrent);
+
+ /* Set up for the next test */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ g_mmprevious = mmcurrent;
+#else
+ memcpy(&g_mmprevious, &mmcurrent, sizeof(struct mallinfo));
+#endif
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ g_mmInitial = mallinfo();
+ g_mmprevious = g_mmInitial;
+#else
+ (void)mallinfo(&g_mmInitial);
+ memcpy(&g_mmprevious, &g_mmInitial, sizeof(struct mallinfo));
+#endif
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the font test
+
+ message(MAIN_STRING "Create CImageTest instance\n");
+ CImageTest *test = new CImageTest();
+ updateMemoryUsage(&g_mmprevious, "After creating CImageTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CImageTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CImageTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(&g_mmprevious, "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(&g_mmprevious, "After creating a window");
+
+ // Create an instance of the NuttX logo
+
+ CRlePaletteBitmap *nuttxBitmap = new CRlePaletteBitmap(&g_nuttxBitmap);
+ updateMemoryUsage(&g_mmprevious, "After creating the bitmap");
+
+ // Create a CImage instance
+
+ CImage *image = test->createImage(static_cast<IBitmap*>(nuttxBitmap));
+ if (!image)
+ {
+ message(MAIN_STRING "Failed to create a image\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(&g_mmprevious, "After creating CImage");
+
+ // Show the image
+
+ test->showImage(image);
+ updateMemoryUsage(&g_mmprevious, "After showing the image");
+ sleep(5);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete image;
+ updateMemoryUsage(&g_mmprevious, "After deleting CImage");
+
+ delete nuttxBitmap;
+ updateMemoryUsage(&g_mmprevious, "After deleting the bitmap");
+
+ delete test;
+ updateMemoryUsage(&g_mmprevious, "After deleting the test");
+ updateMemoryUsage(&g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CKeypad/Makefile b/NxWidgets/UnitTests/CKeypad/Makefile
new file mode 100644
index 000000000..631be3b68
--- /dev/null
+++ b/NxWidgets/UnitTests/CKeypad/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CKeyPad/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx ckeypadtest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = ckeypad
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CKeypad/ckeypadtest.cxx b/NxWidgets/UnitTests/CKeypad/ckeypadtest.cxx
new file mode 100644
index 000000000..5d3eeda2a
--- /dev/null
+++ b/NxWidgets/UnitTests/CKeypad/ckeypadtest.cxx
@@ -0,0 +1,458 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CKeypad/ckeypadtest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "ckeypadtest.hxx"
+#include "cbgwindow.hxx"
+#include "cnxstring.hxx"
+#include "cnxfont.hxx"
+#include "crect.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CKeypadTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CKeypadTest Constructor
+
+CKeypadTest::CKeypadTest()
+{
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+ m_buttonWidth = 0;
+ m_buttonHeight = 0;
+ m_displayHeight = 0;
+}
+
+// CKeypadTest Descriptor
+
+CKeypadTest::~CKeypadTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CKeypadTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CKEYPADTEST_BGCOLOR))
+ {
+ message("CKeypadTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CKeypadTest::disconnect(void)
+{
+ // Destroy the text box
+
+ if (m_textbox)
+ {
+ delete m_textbox;
+ }
+
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Destroy the widget control
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CKeypadTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CKeypadTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CKeypadTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ // Then determine the display size
+
+ setDisplaySize();
+ return true;
+}
+
+// Pick size of the display
+
+void CKeypadTest::setDisplaySize(void)
+{
+ // Get the height and width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CKeypadTest::createGraphics: Failed to get window size\n");
+ return;
+ }
+
+ // Pick a height and width of a button. Here we use inside information
+ // that the number of rows and columns in the keypad. This should not matter in
+ // a "real" application.
+
+ // Lets aim for a width of 4*60 = 240
+
+ if (windowSize.w > KEYPAD_NCOLUMNS*60)
+ {
+ m_buttonWidth = 60;
+ }
+ else
+ {
+ // Otherwise, let's use what we have
+
+ m_buttonWidth = windowSize.w >> 2;
+ }
+
+ // Lets aim for a height of 7*32 = 224. But lets bump up the number of rows
+ // to allow one for the text box.
+
+ if (windowSize.h > (KEYPAD_NROWS+1)*32)
+ {
+ m_buttonHeight = 32;
+ m_displayHeight = (KEYPAD_NROWS+1)*32;
+ }
+ else
+ {
+ // Otherwise, let's use what we have
+
+ m_buttonHeight = windowSize.h >> 3;
+ m_displayHeight = windowSize.h;
+ }
+}
+
+// Create a CKeypad instance
+
+CKeypad *CKeypadTest::createKeypad(void)
+{
+ // Get the height and width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CKeypadTest::createGraphics: Failed to get window size\n");
+ return (CKeypad *)NULL;
+ }
+
+ // Pick a height and width. Here we use inside information that the number
+ // of rows in the keypad is 7. This should not matter in a "real" application.
+
+ nxgl_coord_t keypadWidth = KEYPAD_NCOLUMNS * m_buttonWidth;
+ nxgl_coord_t keypadHeight = KEYPAD_NROWS * m_buttonHeight;
+
+ // Pick an X/Y position such that the keypad will be centered in the display
+
+ nxgl_coord_t keypadOffset = m_displayHeight - keypadHeight;
+
+ nxgl_coord_t keypadX = (windowSize.w - keypadWidth) >> 1;
+ nxgl_coord_t keypadY = keypadOffset + ((windowSize.h - m_displayHeight) >> 1);
+
+ // Now we have enough information to create the keypad
+
+ CKeypad *keypad = new CKeypad(m_widgetControl, getServer(), keypadX, keypadY,
+ keypadWidth, keypadHeight);
+ if (keypad)
+ {
+ // Create a text box to catch the keyboard inputs
+
+ m_textbox = createTextBox();
+ if (!m_textbox)
+ {
+ delete keypad;
+ keypad = (CKeypad *)NULL;
+ }
+ else
+ {
+ // Always show the cursor and wrap the cursor if it goes past the end
+
+ m_textbox->showCursor(SHOW_CURSOR_ALWAYS);
+ m_textbox->wrapCursor(true);
+
+ // Align text on the left
+
+ m_textbox->setTextAlignmentHoriz(CTextBox::TEXT_ALIGNMENT_HORIZ_LEFT);
+
+ // Configure the text box to receive the keyboard input
+
+ keypad->addWidgetEventHandler(m_textbox);
+ }
+ }
+
+ return keypad;
+}
+
+// Create a CTextBox instance so that we can see the keypad output
+
+CTextBox *CKeypadTest::createTextBox(void)
+{
+ // Get the height and width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CKeypadTest::createGraphics: Failed to get window size\n");
+ return (CTextBox *)NULL;
+ }
+
+ // Pick a height and width. Here we use inside information that the number
+ // of rows in the keypad is 7. This should not matter in a "real" application.
+
+ nxgl_coord_t textboxWidth = KEYPAD_NCOLUMNS * m_buttonWidth;
+ nxgl_coord_t textboxHeight = m_displayHeight - KEYPAD_NROWS * m_buttonHeight;
+
+ // Pick an X/Y position such that the keypad will be centered in the display
+
+ nxgl_coord_t textboxX = (windowSize.w - textboxWidth) >> 1;
+ nxgl_coord_t textboxY = (windowSize.h - m_displayHeight) >> 1;
+
+ // Now we have enough information to create the TextBox
+
+ return new CTextBox(m_widgetControl, textboxX, textboxY,
+ textboxWidth, textboxHeight, "");
+}
+
+// Draw the keypad
+
+void CKeypadTest::showKeypad(CKeypad *keypad)
+{
+ // Re-draw the keypad
+
+ keypad->enable(); // Un-necessary, the widget is enabled by default
+ keypad->enableDrawing();
+ keypad->redraw();
+
+ // Then redraw the text box
+
+ m_textbox->enable(); // Un-necessary, the widget is enabled by default
+ m_textbox->enableDrawing();
+ m_textbox->redraw();
+}
+
+// Perform a simulated mouse click on a button in the array. This method injects
+// the mouse click through the NX heirarchy just as would real mouse
+// hardward.
+
+void CKeypadTest::click(CKeypad *keypad, int column, int row)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the selected button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // The the coorinates of the center of the button
+
+ nxgl_coord_t buttonX = keypad->getX() + column * m_buttonWidth + (m_buttonWidth >> 1);
+ nxgl_coord_t buttonY = keypad->getY() + row * m_buttonHeight + (m_buttonHeight >> 1);
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, buttonX, buttonY, NX_MOUSE_LEFTBUTTON);
+}
+
+// The counterpart to click. This simulates a button release through
+// the same mechanism.
+
+void CKeypadTest::release(CKeypad *keypad, int column, int row)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // The the coorinates of the center of the button
+
+ nxgl_coord_t buttonX = keypad->getX() +
+ column * m_buttonWidth +
+ m_buttonWidth/2;
+ nxgl_coord_t buttonY = keypad->getY() +
+ row * m_buttonHeight +
+ m_buttonHeight/2;
+
+ // Then inject the mouse release
+
+ (void)nx_mousein(handle, buttonX, buttonY, NX_MOUSE_NOBUTTONS);
+}
+
+// Widget events are normally handled in a modal loop (by calling goModal()).
+// However, for this case we know when there should be press and release
+// events so we don't have to poll. We can just perform a one pass poll
+// then check if the event was processed corredly.
+
+void CKeypadTest::poll(CKeypad *button)
+{
+ // Poll for mouse events
+
+ m_widgetControl->pollEvents(button);
+
+ // Limit the amount of text in the TextBox
+
+ reverseAlignment();
+}
+
+// Start with left text alignment. When the text reaches the right sice
+// of the text box, switch to right text alignment.
+
+void CKeypadTest::reverseAlignment(void)
+{
+ // Get the current horizontal text alignment
+
+ CTextBox::TextAlignmentHoriz hAlign = m_textbox->getTextAlignmentHoriz();
+
+ // Are we still using left text alignment?
+
+ if (hAlign == CTextBox::TEXT_ALIGNMENT_HORIZ_LEFT)
+ {
+ // Yes.. Get the string in the text box
+
+ CNxString string = m_textbox->getText();
+
+ // Get the font
+
+ CNxFont *font = m_textbox->getFont();
+
+ // Get the TextBox bounding box
+
+ CRect rect;
+ m_textbox->getRect(rect);
+
+ // When the length of string approaches the width of the display
+ // region, then switch to right text alignment
+
+ int mxWidth = font->getMaxWidth();
+ if (font->getStringWidth(string) + mxWidth >= rect.getWidth())
+ {
+ // Switch to right text alignment
+
+ m_textbox->setTextAlignmentHoriz(CTextBox::TEXT_ALIGNMENT_HORIZ_RIGHT);
+ }
+ }
+}
+
diff --git a/NxWidgets/UnitTests/CKeypad/ckeypadtest.hxx b/NxWidgets/UnitTests/CKeypad/ckeypadtest.hxx
new file mode 100644
index 000000000..820113960
--- /dev/null
+++ b/NxWidgets/UnitTests/CKeypad/ckeypadtest.hxx
@@ -0,0 +1,192 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CKeypad/ckeypadtest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CKEYPAD_CKEYPADTEST_HXX
+#define __UNITTESTS_CKEYPAD_CKEYPADTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "ctextbox.hxx"
+#include "ckeypad.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CKEYPADTEST_BGCOLOR
+# define CONFIG_CKEYPADTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME ckeypad_main
+# define MAIN_STRING "ckeypad_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+// This is the size of the keypad
+
+#define KEYPAD_NROWS 7
+#define KEYPAD_NCOLUMNS 4
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CKeypadTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The widget control for the window
+ CBgWindow *m_bgWindow; // Background window instance
+ CTextBox *m_textbox; // TextBox to show the key presses
+ nxgl_coord_t m_buttonWidth; // The width of one button
+ nxgl_coord_t m_buttonHeight; // The height of one button
+ nxgl_coord_t m_displayHeight; // The height of the display
+
+ // Pick size of the display
+
+ void setDisplaySize(void);
+
+ // Start with left text alignment. When the text reaches the right sice
+ // of the text box, switch to right text alignment.
+
+ void reverseAlignment(void);
+
+ // Create a CTextBox instance so that we can see the keypad output
+
+ CTextBox *createTextBox(void);
+
+public:
+
+ // Constructor/destructors
+
+ CKeypadTest();
+ ~CKeypadTest();
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CKeypad instance. This method will show you how to create
+ // a CKeypad widget
+
+ CKeypad *createKeypad(void);
+
+ // Draw the keypad. This method illustrates how to draw the CKeypad widget.
+
+ void showKeypad(CKeypad *keypad);
+
+ // Perform a simulated mouse click on a button in the array. This method injects
+ // the mouse click through the NX heirarchy just as would real mouse
+ // hardward.
+
+ void click(CKeypad *keypad, int column, int row);
+
+ // The counterpart to click. This simulates a button release through
+ // the same mechanism.
+
+ void release(CKeypad *keypad, int column, int row);
+
+ // Widget events are normally handled in a model loop (by calling goModel()).
+ // However, for this case we know when there should be press and release
+ // events so we don't have to poll. We can just perform a one pass poll
+ // then check if the event was processed corredly.
+
+ void poll(CKeypad *keypad);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CKEYPAD_CKEYPADTEST_HXX
diff --git a/NxWidgets/UnitTests/CKeypad/main.cxx b/NxWidgets/UnitTests/CKeypad/main.cxx
new file mode 100644
index 000000000..1c7679ee2
--- /dev/null
+++ b/NxWidgets/UnitTests/CKeypad/main.cxx
@@ -0,0 +1,274 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CKeypad/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cnxstring.hxx"
+#include "ckeypadtest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmPrevious;
+static unsigned int g_mmPeak;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("%s: Before: %8d After: %8d Change: %8d\n",
+ msg, previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmPrevious = mmcurrent.uordblks;
+ if ((unsigned int)mmcurrent.uordblks > g_mmPeak)
+ {
+ g_mmPeak = mmcurrent.uordblks;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmPrevious = mmcurrent.uordblks;
+ g_mmPeak = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: clickButtons
+/////////////////////////////////////////////////////////////////////////////
+
+static void clickButtons(CKeypadTest *test, CKeypad *keypad)
+{
+ // Perform a simulated mouse click on a button in the keypad
+
+ for (int j = 0; j < KEYPAD_NROWS; j++)
+ {
+ for (int i = 0; i < KEYPAD_NCOLUMNS; i++)
+ {
+ printf(MAIN_STRING "Click the button (%d,%d)\n", i, j);
+ test->click(keypad, i, j);
+
+ // Poll for the mouse click event
+
+ test->poll(keypad);
+
+ // Is anything clicked?
+
+ int clickColumn;
+ int clickRow;
+ if (keypad->isButtonClicked(clickColumn, clickRow))
+ {
+ printf(MAIN_STRING "%s: Button (%d, %d) is clicked\n",
+ clickColumn == i && clickRow == j ? "OK" : "ERROR",
+ clickColumn, clickRow);
+ }
+ else
+ {
+ printf(MAIN_STRING "ERROR: No button is clicked\n");
+ }
+
+ // Wait a bit, then release the mouse button
+
+ usleep(250*1000);
+ test->release(keypad, i, j);
+
+ // Poll for the mouse release event (of course this can hang if something fails)
+
+ test->poll(keypad);
+ if (keypad->isButtonClicked(clickColumn, clickRow))
+ {
+ printf(MAIN_STRING "ERROR: Button (%d, %d) is clicked\n",
+ clickColumn, clickRow);
+ }
+
+ usleep(500*1000);
+ }
+ }
+ updateMemoryUsage(g_mmPrevious, "After pushing buttons");
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the keypad test
+
+ printf(MAIN_STRING "Create CKeypadTest instance\n");
+ CKeypadTest *test = new CKeypadTest();
+ updateMemoryUsage(g_mmPrevious, "After creating CKeypadTest");
+
+ // Connect the NX server
+
+ printf(MAIN_STRING "Connect the CKeypadTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ printf(MAIN_STRING "Failed to connect the CKeypadTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After connecting to the server");
+
+ // Create a window to draw into
+
+ printf(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ printf(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After creating a window");
+
+ // Create a CKeypad instance
+
+ CKeypad *keypad = test->createKeypad();
+ if (!keypad)
+ {
+ printf(MAIN_STRING "Failed to create a keypad\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After creating CKeypad");
+
+ // Show the keypad in alphabetic mode
+
+ printf(MAIN_STRING "Show the keypad in alphabetic mode\n");
+ keypad->setKeypadMode(false);
+ test->showKeypad(keypad);
+ sleep(1);
+
+ // Then click some buttons
+
+ clickButtons(test, keypad);
+ sleep(1);
+
+ // Show the keypad in numeric mode
+
+ printf(MAIN_STRING "Show the keypad in numeric mode\n");
+ keypad->setKeypadMode(true);
+ sleep(1);
+
+ // Then click some buttons
+
+ clickButtons(test, keypad);
+ sleep(1);
+
+ // Clean up and exit
+
+ printf(MAIN_STRING "Clean-up and exit\n");
+ delete keypad;
+ updateMemoryUsage(g_mmPrevious, "After deleting the keypad");
+ delete test;
+ updateMemoryUsage(g_mmPrevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ message("Peak memory usage: %8d\n", g_mmPeak - g_mmInitial);
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CLabel/Makefile b/NxWidgets/UnitTests/CLabel/Makefile
new file mode 100644
index 000000000..163d04175
--- /dev/null
+++ b/NxWidgets/UnitTests/CLabel/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CLabel/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx clabeltest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = clabel
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CLabel/clabeltest.cxx b/NxWidgets/UnitTests/CLabel/clabeltest.cxx
new file mode 100644
index 000000000..ef78cc3ce
--- /dev/null
+++ b/NxWidgets/UnitTests/CLabel/clabeltest.cxx
@@ -0,0 +1,263 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLabel/clabeltest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "clabeltest.hxx"
+#include "cbgwindow.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CLabelTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CLabelTest Constructor
+
+CLabelTest::CLabelTest()
+{
+ m_bgWindow = (CBgWindow *)NULL;
+ m_nxFont = (CNxFont *)NULL;
+ m_text = (CNxString *)NULL;
+}
+
+// CLabelTest Descriptor
+
+CLabelTest::~CLabelTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CLabelTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Create the default font instance
+
+ m_nxFont = new CNxFont(NXFONT_DEFAULT,
+ CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+ if (!m_nxFont)
+ {
+ printf("CLabelTest::connect: Failed to create the default font\n");
+ }
+
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CLABELTEST_BGCOLOR))
+ {
+ printf("CLabelTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CLabelTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Free the display string
+
+ if (m_text)
+ {
+ delete m_text;
+ m_text = (CNxString *)NULL;
+ }
+
+ // Free the default font
+
+ if (m_nxFont)
+ {
+ delete m_nxFont;
+ m_nxFont = (CNxFont *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CLabelTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ printf("CLabelTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ printf("CLabelTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CLabel instance
+
+CLabel *CLabelTest::createLabel(FAR const char *text)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CLabelTest::createGraphics: Failed to get window size\n");
+ return (CLabel *)NULL;
+ }
+
+ // Create a CNxString instance to contain the C string
+
+ m_text = new CNxString(text);
+
+ // Get the height and width of the text display area
+
+ nxgl_coord_t stringWidth = m_nxFont->getStringWidth(*m_text);
+ nxgl_coord_t stringHeight = (nxgl_coord_t)m_nxFont->getHeight();
+
+ // The default CLabel has borders enabled with thickness of the border
+ // width. Add twice the thickness of the border to the width and height. (We
+ // could let CLabel do this for us by calling CLabel::getPreferredDimensions())
+
+ stringWidth += 2 * 1;
+ stringHeight += 2 * 1;
+
+ // Pick an X/Y position such that the label will be centered in the display
+
+ nxgl_coord_t labelX;
+ if (stringWidth >= windowSize.w)
+ {
+ labelX = 0;
+ }
+ else
+ {
+ labelX = (windowSize.w - stringWidth) >> 1;
+ }
+
+ nxgl_coord_t labelY;
+ if (stringHeight >= windowSize.h)
+ {
+ labelY = 0;
+ }
+ else
+ {
+ labelY = (windowSize.h - stringHeight) >> 1;
+ }
+
+ // Now we have enough information to create the label
+
+ return new CLabel(m_widgetControl, labelX, labelY, stringWidth, stringHeight, *m_text);
+}
+
+// Draw the label
+
+void CLabelTest::showLabel(CLabel *label)
+{
+ label->enable();
+ label->enableDrawing();
+ label->redraw();
+ label->disableDrawing();
+}
diff --git a/NxWidgets/UnitTests/CLabel/clabeltest.hxx b/NxWidgets/UnitTests/CLabel/clabeltest.hxx
new file mode 100644
index 000000000..2d404b2df
--- /dev/null
+++ b/NxWidgets/UnitTests/CLabel/clabeltest.hxx
@@ -0,0 +1,148 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLabel/clabeltest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CLABEL_CLABELTEST_HXX
+#define __UNITTESTS_CLABEL_CLABELTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "clabel.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CLABELTEST_BGCOLOR
+# define CONFIG_CLABELTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+#ifndef CONFIG_CLABELTEST_FONTCOLOR
+# define CONFIG_CLABELTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME clabel_main
+# define MAIN_STRING "clabel_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CLabelTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CNxFont *m_nxFont; // Default font
+ CBgWindow *m_bgWindow; // Background window instance
+ CNxString *m_text; // The label string
+
+public:
+ // Constructor/destructors
+
+ CLabelTest();
+ ~CLabelTest();
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CLabel instance. This method will show you how to create
+ // a CLabel widget
+
+ CLabel *createLabel(FAR const char *text);
+
+ // Draw the label. This method illustrates how to draw the CLabel widget.
+
+ void showLabel(CLabel *label);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif // __UNITTESTS_CLABEL_CLABELTEST_HXX
diff --git a/NxWidgets/UnitTests/CLabel/main.cxx b/NxWidgets/UnitTests/CLabel/main.cxx
new file mode 100644
index 000000000..953e6afbc
--- /dev/null
+++ b/NxWidgets/UnitTests/CLabel/main.cxx
@@ -0,0 +1,130 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLabel/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "clabeltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static const char g_hello[] = "Hello, World!";
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Create an instance of the font test
+
+ printf(MAIN_STRING "Create CLabelTest instance\n");
+ CLabelTest *test = new CLabelTest();
+
+ // Connect the NX server
+
+ printf(MAIN_STRING "Connect the CLabelTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ printf(MAIN_STRING "Failed to connect the CLabelTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a window to draw into
+
+ printf(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ printf(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a CLabel instance
+
+ CLabel *label = test->createLabel(g_hello);
+ if (!label)
+ {
+ printf(MAIN_STRING "Failed to create a label\n");
+ delete test;
+ return 1;
+ }
+
+ // Show the label
+
+ test->showLabel(label);
+ sleep(5);
+
+ // Clean up and exit
+
+ printf(MAIN_STRING "Clean-up and exit\n");
+ delete label;
+ delete test;
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CLatchButton/Makefile b/NxWidgets/UnitTests/CLatchButton/Makefile
new file mode 100644
index 000000000..ea6e7d662
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButton/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CLatchButton/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx clatchbuttontest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = clatchbutton
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CLatchButton/clatchbuttontest.cxx b/NxWidgets/UnitTests/CLatchButton/clatchbuttontest.cxx
new file mode 100644
index 000000000..2b41eca63
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButton/clatchbuttontest.cxx
@@ -0,0 +1,321 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLatchButton/clatchbuttontest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "clatchbuttontest.hxx"
+#include "cbgwindow.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CLatchButtonTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CLatchButtonTest Constructor
+
+CLatchButtonTest::CLatchButtonTest()
+{
+ m_bgWindow = (CBgWindow *)NULL;
+ m_nxFont = (CNxFont *)NULL;
+ m_text = (CNxString *)NULL;
+}
+
+// CLatchButtonTest Descriptor
+
+CLatchButtonTest::~CLatchButtonTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CLatchButtonTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Create the default font instance
+
+ m_nxFont = new CNxFont(NXFONT_DEFAULT,
+ CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+ if (!m_nxFont)
+ {
+ printf("CLatchButtonTest::connect: Failed to create the default font\n");
+ }
+
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CLATCHBUTTONTEST_BGCOLOR))
+ {
+ printf("CLatchButtonTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CLatchButtonTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Free the display string
+
+ if (m_text)
+ {
+ delete m_text;
+ m_text = (CNxString *)NULL;
+ }
+
+ // Free the default font
+
+ if (m_nxFont)
+ {
+ delete m_nxFont;
+ m_nxFont = (CNxFont *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CLatchButtonTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ printf("CLatchButtonTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ printf("CLatchButtonTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CLatchButton instance
+
+CLatchButton *CLatchButtonTest::createButton(FAR const char *text)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CLatchButtonTest::createGraphics: Failed to get window size\n");
+ return (CLatchButton *)NULL;
+ }
+
+ // Create a CNxString instance to contain the C string
+
+ m_text = new CNxString(text);
+
+ // Get the height and width of the text display area
+
+ nxgl_coord_t stringWidth = m_nxFont->getStringWidth(*m_text);
+ nxgl_coord_t stringHeight = (nxgl_coord_t)m_nxFont->getHeight();
+
+ // The default CLatchButton has borders enabled with thickness of the border
+ // width. Add twice the thickness of border the to the width and height. (We
+ // could let CLatchButton do this for us by calling
+ // CLatchButton::getPreferredDimensions())
+
+ stringWidth += 2 * 1;
+ stringHeight += 2 * 1;
+
+ // Pick an X/Y position such that the button will be centered in the display
+
+ nxgl_coord_t buttonX;
+ if (stringWidth >= windowSize.w)
+ {
+ buttonX = 0;
+ }
+ else
+ {
+ buttonX = (windowSize.w - stringWidth) >> 1;
+ }
+
+ nxgl_coord_t buttonY;
+ if (stringHeight >= windowSize.h)
+ {
+ buttonY = 0;
+ }
+ else
+ {
+ buttonY = (windowSize.h - stringHeight) >> 1;
+ }
+
+ // Save the center position of the button for use by click and release
+
+ m_center.x = buttonX + (stringWidth >> 1);
+ m_center.y = buttonY + (stringHeight >> 1);
+
+ // Now we have enough information to create the button
+
+ return new CLatchButton(m_widgetControl, buttonX, buttonY, stringWidth, stringHeight, *m_text);
+}
+
+// Draw the button
+
+void CLatchButtonTest::showButton(CLatchButton *button)
+{
+ button->enable(); // Un-necessary, the widget is enabled by default
+ button->enableDrawing();
+ button->redraw();
+}
+
+// Perform a simulated mouse click on the button. This method injects
+// the mouse click through the NX heirarchy just as would real mouse
+// hardward.
+
+void CLatchButtonTest::click(void)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, m_center.x, m_center.y, NX_MOUSE_LEFTBUTTON);
+}
+
+// The counterpart to click. This simulates a button release through
+// the same mechanism.
+
+void CLatchButtonTest::release(void)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, m_center.x, m_center.y, NX_MOUSE_NOBUTTONS);
+}
+
+// Widget events are normally handled in a modal loop (by calling goModal()).
+// However, for this case we know when there should be press and release
+// events so we don't have to poll. We can just perform a one pass poll.
+
+void CLatchButtonTest::poll(CLatchButton *button)
+{
+ // Poll for mouse events
+
+ m_widgetControl->pollEvents(button);
+}
+
diff --git a/NxWidgets/UnitTests/CLatchButton/clatchbuttontest.hxx b/NxWidgets/UnitTests/CLatchButton/clatchbuttontest.hxx
new file mode 100644
index 000000000..22ded3d77
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButton/clatchbuttontest.hxx
@@ -0,0 +1,165 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLatchButton/clatchbuttontest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CLATCHBUTTON_CLATCHBUTTONTEST_HXX
+#define __UNITTESTS_CLATCHBUTTON_CLATCHBUTTONTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "clatchbutton.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CLATCHBUTTONTEST_BGCOLOR
+# define CONFIG_CLATCHBUTTONTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+#ifndef CONFIG_CLATCHBUTTONTEST_FONTCOLOR
+# define CONFIG_CLATCHBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME clatchbutton_main
+# define MAIN_STRING "clatchbutton_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CLatchButtonTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CNxFont *m_nxFont; // Default font
+ CBgWindow *m_bgWindow; // Background window instance
+ CNxString *m_text; // The button string
+ struct nxgl_point_s m_center; // X, Y position the center of the button
+
+public:
+ // Constructor/destructors
+
+ CLatchButtonTest(void);
+ ~CLatchButtonTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CLatchButton instance. This method will show you how to create
+ // a CLatchButton widget
+
+ CLatchButton *createButton(FAR const char *text);
+
+ // Draw the button. This method illustrates how to draw the CLatchButton widget.
+
+ void showButton(CLatchButton *button);
+
+ // Perform a simulated mouse click on the button. This method injects
+ // the mouse click through the NX heirarchy just as would real mouse
+ // hardward.
+
+ void click(void);
+
+ // The counterpart to click. This simulates a button release through
+ // the same mechanism.
+
+ void release(void);
+
+ // Widget events are normally handled in a model loop (by calling goModel()).
+ // However, for this case we know when there should be press and release
+ // events so we don't have to poll. We can just perform a one pass poll.
+
+ void poll(CLatchButton *button);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CLATCHBUTTON_CLATCHBUTTONTEST_HXX
diff --git a/NxWidgets/UnitTests/CLatchButton/main.cxx b/NxWidgets/UnitTests/CLatchButton/main.cxx
new file mode 100644
index 000000000..d51f613c1
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButton/main.cxx
@@ -0,0 +1,199 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLatchButton/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "clatchbuttontest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static const char g_pushme[] = "Push Me";
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: showButtonState
+/////////////////////////////////////////////////////////////////////////////
+
+static void showButtonState(CLatchButton *button, bool &clicked, bool &latched)
+{
+ bool nowClicked = button->isClicked();
+ bool nowLatched = button->isLatched();
+
+ printf(MAIN_STRING "Button state: %s and %s\n",
+ nowClicked ? "clicked" : "released",
+ nowLatched ? "latched" : "unlatched");
+
+ if (clicked != nowClicked || latched != nowLatched)
+ {
+ printf(MAIN_STRING "ERROR: Expected %s and %s\n",
+ clicked ? "clicked" : "released",
+ latched ? "latched" : "unlatched");
+
+ clicked = nowClicked;
+ latched = nowLatched;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Create an instance of the font test
+
+ printf(MAIN_STRING "Create CLatchButtonTest instance\n");
+ CLatchButtonTest *test = new CLatchButtonTest();
+
+ // Connect the NX server
+
+ printf(MAIN_STRING "Connect the CLatchButtonTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ printf(MAIN_STRING "Failed to connect the CLatchButtonTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a window to draw into
+
+ printf(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ printf(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a CLatchButton instance
+
+ CLatchButton *button = test->createButton(g_pushme);
+ if (!button)
+ {
+ printf(MAIN_STRING "Failed to create a button\n");
+ delete test;
+ return 1;
+ }
+
+ // Show the button
+
+ printf(MAIN_STRING "Show the button\n");
+ test->showButton(button);
+
+ bool clicked = false;
+ bool latched = false;
+ showButtonState(button, clicked, latched);
+
+ // Toggle the button state a few times
+
+ for (int i = 0; i < 8; i++)
+ {
+ // Wait two seconds, then perform a simulated mouse click on the button
+
+ sleep(2);
+ printf(MAIN_STRING "Click the button\n");
+ test->click();
+ test->poll(button);
+
+ // Test the button state it should be clicked with the latch state
+ // toggled
+
+ clicked = true;
+ latched = !latched;
+ showButtonState(button, clicked, latched);
+
+ // And release the button after 0.5 seconds
+
+ usleep(500 * 1000);
+ printf(MAIN_STRING "Release the button\n");
+ test->release();
+ test->poll(button);
+
+ // Test the button state it should be unclicked with the latch state
+ // unchanged
+
+ clicked = false;
+ showButtonState(button, clicked, latched);
+ fflush(stdout);
+ }
+
+ // Wait a few more seconds so that the tester can ponder the result
+
+ sleep(3);
+
+ // Clean up and exit
+
+ printf(MAIN_STRING "Clean-up and exit\n");
+ delete button;
+ delete test;
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CLatchButtonArray/Makefile b/NxWidgets/UnitTests/CLatchButtonArray/Makefile
new file mode 100644
index 000000000..faa9d8fd9
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButtonArray/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CLatchButtonArray/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx clatchbuttonarraytest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = clatchbuttonarray
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.cxx b/NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.cxx
new file mode 100644
index 000000000..5b1737e06
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.cxx
@@ -0,0 +1,301 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "clatchbuttonarraytest.hxx"
+#include "cbgwindow.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CLatchButtonArrayTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CLatchButtonArrayTest Constructor
+
+CLatchButtonArrayTest::CLatchButtonArrayTest()
+{
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CLatchButtonArrayTest Descriptor
+
+CLatchButtonArrayTest::~CLatchButtonArrayTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CLatchButtonArrayTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CLATCHBUTTONARRAYTEST_BGCOLOR))
+ {
+ message("CLatchButtonArrayTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CLatchButtonArrayTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Destroy the widget control
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CLatchButtonArrayTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CLatchButtonArrayTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CLatchButtonArrayTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CLatchButtonArray instance
+
+CLatchButtonArray *CLatchButtonArrayTest::createButtonArray(void)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CLatchButtonArrayTest::createGraphics: Failed to get window size\n");
+ return (CLatchButtonArray *)NULL;
+ }
+
+ // Pick an X/Y position such that the button array will be centered in the display
+
+ nxgl_coord_t buttonArrayX;
+ if (BUTTONARRAY_WIDTH >= windowSize.w)
+ {
+ buttonArrayX = 0;
+ }
+ else
+ {
+ buttonArrayX = (windowSize.w - BUTTONARRAY_WIDTH) >> 1;
+ }
+
+ nxgl_coord_t buttonArrayY;
+ if (BUTTONARRAY_HEIGHT >= windowSize.h)
+ {
+ buttonArrayY = 0;
+ }
+ else
+ {
+ buttonArrayY = (windowSize.h - BUTTONARRAY_HEIGHT) >> 1;
+ }
+
+ // Now we have enough information to create the button array
+
+ return new CLatchButtonArray(m_widgetControl,
+ buttonArrayX, buttonArrayY,
+ BUTTONARRAY_NCOLUMNS, BUTTONARRAY_NROWS,
+ BUTTONARRAY_BUTTONWIDTH, BUTTONARRAY_BUTTONHEIGHT);
+}
+
+// Draw the button array
+
+void CLatchButtonArrayTest::showButton(CLatchButtonArray *buttonArray)
+{
+ buttonArray->enable(); // Un-necessary, the widget is enabled by default
+ buttonArray->enableDrawing();
+ buttonArray->redraw();
+}
+
+// Perform a simulated mouse click on a button in the array. This method injects
+// the mouse click through the NX heirarchy just as would real mouse
+// hardward.
+
+void CLatchButtonArrayTest::click(CLatchButtonArray *buttonArray, int column, int row)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the selected button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // The the coorinates of the center of the button
+
+ nxgl_coord_t buttonX = buttonArray->getX() +
+ column * BUTTONARRAY_BUTTONWIDTH +
+ BUTTONARRAY_BUTTONWIDTH/2;
+ nxgl_coord_t buttonY = buttonArray->getY() +
+ row * BUTTONARRAY_BUTTONHEIGHT +
+ BUTTONARRAY_BUTTONHEIGHT/2;
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, buttonX, buttonY, NX_MOUSE_LEFTBUTTON);
+}
+
+// The counterpart to click. This simulates a button release through
+// the same mechanism.
+
+void CLatchButtonArrayTest::release(CLatchButtonArray *buttonArray, int column, int row)
+{
+ // nx_mousein is meant to be called by mouse handling software.
+ // Here we just inject a left-button click directly in the center of
+ // the button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // The the coorinates of the center of the button
+
+ nxgl_coord_t buttonX = buttonArray->getX() +
+ column * BUTTONARRAY_BUTTONWIDTH +
+ BUTTONARRAY_BUTTONWIDTH/2;
+ nxgl_coord_t buttonY = buttonArray->getY() +
+ row * BUTTONARRAY_BUTTONHEIGHT +
+ BUTTONARRAY_BUTTONHEIGHT/2;
+
+ // Then inject the mouse release
+
+ (void)nx_mousein(handle, buttonX, buttonY, NX_MOUSE_NOBUTTONS);
+}
+
+// Widget events are normally handled in a modal loop (by calling goModal()).
+// However, for this case we know when there should be press and release
+// events so we don't have to poll. We can just perform a one pass poll
+// then check if the event was processed corredly.
+
+void CLatchButtonArrayTest::poll(CLatchButtonArray *button)
+{
+ // Poll for mouse events
+
+ m_widgetControl->pollEvents(button);
+}
+
diff --git a/NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.hxx b/NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.hxx
new file mode 100644
index 000000000..89ed242e7
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.hxx
@@ -0,0 +1,182 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLatchButtonArray/clatchbuttonarraytest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CLATCHBUTTONARRAY_CLATCHBUTTONARRAYTEST_HXX
+#define __UNITTESTS_CLATCHBUTTONARRAY_CLATCHBUTTONARRAYTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "clatchbuttonarray.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CLATCHBUTTONARRAYTEST_BGCOLOR
+# define CONFIG_CLATCHBUTTONARRAYTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+#ifndef CONFIG_CLATCHBUTTONARRAYTEST_FONTCOLOR
+# define CONFIG_CLATCHBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME clatchbuttonarray_main
+# define MAIN_STRING "clatchbuttonarray_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+// The geometry of the button array
+
+#define BUTTONARRAY_NCOLUMNS 4
+#define BUTTONARRAY_NROWS 7
+#define BUTTONARRAY_BUTTONWIDTH 60
+#define BUTTONARRAY_BUTTONHEIGHT 32
+#define BUTTONARRAY_WIDTH (BUTTONARRAY_BUTTONWIDTH * BUTTONARRAY_NCOLUMNS)
+#define BUTTONARRAY_HEIGHT (BUTTONARRAY_BUTTONHEIGHT * BUTTONARRAY_NROWS)
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CLatchButtonArrayTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The widget control for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CLatchButtonArrayTest();
+ ~CLatchButtonArrayTest();
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CLatchButtonArray instance. This method will show you how to create
+ // a CLatchButtonArray widget
+
+ CLatchButtonArray *createButtonArray(void);
+
+ // Draw the button array. This method illustrates how to draw the CLatchButtonArray widget.
+
+ void showButton(CLatchButtonArray *buttonArray);
+
+ // Perform a simulated mouse click on a button in the array. This method injects
+ // the mouse click through the NX heirarchy just as would real mouse
+ // hardward.
+
+ void click(CLatchButtonArray *buttonArray, int column, int row);
+
+ // The counterpart to click. This simulates a button release through
+ // the same mechanism.
+
+ void release(CLatchButtonArray *buttonArray, int column, int row);
+
+ // Widget events are normally handled in a model loop (by calling goModel()).
+ // However, for this case we know when there should be press and release
+ // events so we don't have to poll. We can just perform a one pass poll
+ // then check if the event was processed corredly.
+
+ void poll(CLatchButtonArray *buttonArray);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif // __UNITTESTS_CLATCHBUTTONARRAY_CLATCHBUTTONARRAYTEST_HXX
diff --git a/NxWidgets/UnitTests/CLatchButtonArray/main.cxx b/NxWidgets/UnitTests/CLatchButtonArray/main.cxx
new file mode 100644
index 000000000..d38651ae9
--- /dev/null
+++ b/NxWidgets/UnitTests/CLatchButtonArray/main.cxx
@@ -0,0 +1,301 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CLatchButtonArray/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cnxstring.hxx"
+#include "clatchbuttonarraytest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmPrevious;
+static unsigned int g_mmPeak;
+
+static FAR const char *g_buttonLabels[BUTTONARRAY_NCOLUMNS*BUTTONARRAY_NROWS] = {
+ "=>", "A", "B", "<DEL",
+ "C", "D", "E", "F",
+ "G", "H", "I", "J",
+ "K", "L", "M", "N",
+ "O", "P", "Q", "R",
+ "S", "T", "U", "V",
+ "W", "X", "Y", "Z"
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: showButtonState
+/////////////////////////////////////////////////////////////////////////////
+
+static void showButtonState(CLatchButtonArray *buttonArray, int i, int j,
+ bool &clicked, bool &latched)
+{
+ bool nowClicked = buttonArray->isThisButtonClicked(i,j);
+ bool nowLatched = buttonArray->isThisButtonLatched(i,j);
+
+ printf(MAIN_STRING "Button(%d,%d) state: %s and %s\n",
+ i, j,
+ nowClicked ? "clicked" : "released",
+ nowLatched ? "latched" : "unlatched");
+
+ if (clicked != nowClicked || latched != nowLatched)
+ {
+ printf(MAIN_STRING "ERROR: Expected %s and %s\n",
+ clicked ? "clicked" : "released",
+ latched ? "latched" : "unlatched");
+
+ clicked = nowClicked;
+ latched = nowLatched;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("%s: Before: %8d After: %8d Change: %8d\n",
+ msg, previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmPrevious = mmcurrent.uordblks;
+ if ((unsigned int)mmcurrent.uordblks > g_mmPeak)
+ {
+ g_mmPeak = mmcurrent.uordblks;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmPrevious = mmcurrent.uordblks;
+ g_mmPeak = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the button array test
+
+ printf(MAIN_STRING "Create CLatchButtonArrayTest instance\n");
+ CLatchButtonArrayTest *test = new CLatchButtonArrayTest();
+ updateMemoryUsage(g_mmPrevious, "After creating CLatchButtonArrayTest");
+
+ // Connect the NX server
+
+ printf(MAIN_STRING "Connect the CLatchButtonArrayTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ printf(MAIN_STRING "Failed to connect the CLatchButtonArrayTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After connecting to the server");
+
+ // Create a window to draw into
+
+ printf(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ printf(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After creating a window");
+
+ // Create a CLatchButtonArray instance
+
+ CLatchButtonArray *buttonArray = test->createButtonArray();
+ if (!buttonArray)
+ {
+ printf(MAIN_STRING "Failed to create a button array\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, "After creating CLatchButtonArray");
+
+ // Add the labels to each button
+
+ FAR const char **ptr = g_buttonLabels;
+ for (int j = 0; j < BUTTONARRAY_NROWS; j++)
+ {
+ for (int i = 0; i < BUTTONARRAY_NCOLUMNS; i++)
+ {
+ printf(MAIN_STRING "Label (%d,%d): %s\n", i, j, *ptr);
+ CNxString string = *ptr++;
+ buttonArray->setText(i, j, string);
+ }
+ }
+ updateMemoryUsage(g_mmPrevious, "After adding labels to the buttons");
+
+ // Show the button array
+
+ printf(MAIN_STRING "Show the button array\n");
+ test->showButton(buttonArray);
+ sleep(1);
+
+ // Then perform a simulated mouse click on a button in the array
+
+ bool clicked = false;
+ bool latched = false;
+
+ for (int j = 0; j < BUTTONARRAY_NROWS; j++)
+ {
+ for (int i = 0; i < BUTTONARRAY_NCOLUMNS; i++)
+ {
+ // Initially, this button should be neither clicked nor latched
+
+ clicked = false;
+ latched = false;
+ showButtonState(buttonArray, i, j, clicked, latched);
+
+ printf(MAIN_STRING "Click the button (%d,%d)\n", i, j);
+ test->click(buttonArray, i, j);
+
+ // Poll for the mouse click event
+
+ test->poll(buttonArray);
+
+ // Now it should be clicked and latched
+
+ clicked = true;
+ latched = true;
+ showButtonState(buttonArray, i, j, clicked, latched);
+
+ // Wait a bit, then release the mouse button
+
+ usleep(200*1000);
+ test->release(buttonArray, i, j);
+
+ // Poll for the mouse release event (of course this can hang if something fails)
+
+ test->poll(buttonArray);
+
+ // Now it should be un-clicked and latched
+
+ clicked = false;
+ latched = true;
+ showButtonState(buttonArray, i, j, clicked, latched);
+
+ usleep(300*1000);
+ }
+ }
+ updateMemoryUsage(g_mmPrevious, "After pushing buttons");
+
+ // Clean up and exit
+
+ printf(MAIN_STRING "Clean-up and exit\n");
+ delete buttonArray;
+ updateMemoryUsage(g_mmPrevious, "After deleting the button array");
+ delete test;
+ updateMemoryUsage(g_mmPrevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ message("Peak memory usage: %8d\n", g_mmPeak - g_mmInitial);
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CListBox/Makefile b/NxWidgets/UnitTests/CListBox/Makefile
new file mode 100644
index 000000000..9f3d5721d
--- /dev/null
+++ b/NxWidgets/UnitTests/CListBox/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CListBox/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx clistboxtest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = clistbox
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CListBox/clistboxtest.cxx b/NxWidgets/UnitTests/CListBox/clistboxtest.cxx
new file mode 100644
index 000000000..cd41dacc7
--- /dev/null
+++ b/NxWidgets/UnitTests/CListBox/clistboxtest.cxx
@@ -0,0 +1,224 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CListBox/clistboxtest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "clistboxtest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CListBoxTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CListBoxTest Constructor
+
+CListBoxTest::CListBoxTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CListBoxTest Descriptor
+
+CListBoxTest::~CListBoxTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CListBoxTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CLISTBOXTEST_BGCOLOR))
+ {
+ message("CListBoxTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CListBoxTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow *)NULL;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ m_widgetControl = (CWidgetControl *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CListBoxTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CListBoxTest::createWindow: Failed to create CBgWindow instance\n");
+ disconnect();
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CListBoxTest::createWindow: Failed to open background window\n");
+ disconnect();
+ return false;
+ }
+
+ return true;
+}
+
+// Create a listbox in the center of the window
+
+CListBox *CListBoxTest::createListBox(void)
+{
+ // Get the size of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CListBoxTest::createListBox: Failed to get window size\n");
+ disconnect();
+ return false;
+ }
+
+ // Put the listbox in the center of the display
+
+ nxgl_coord_t listboxWidth = windowSize.w >> 1;
+ nxgl_coord_t listboxX = windowSize.w >> 2;
+
+ nxgl_coord_t listboxHeight = windowSize.h >> 1;
+ nxgl_coord_t listboxY = windowSize.h >> 2;
+
+ // Create the listbox
+
+ CListBox *listbox = new CListBox(m_widgetControl,
+ listboxX, listboxY,
+ listboxWidth, listboxHeight);
+ if (!listbox)
+ {
+ printf("CListBoxTest::createListBox: Failed to create CListBox\n");
+ disconnect();
+ }
+ return listbox;
+}
+
+// (Re-)draw the listbox.
+
+void CListBoxTest::showListBox(CListBox *listbox)
+{
+ listbox->enable(); // Un-necessary, the widget is enabled by default
+ listbox->enableDrawing();
+ listbox->redraw();
+}
diff --git a/NxWidgets/UnitTests/CListBox/clistboxtest.hxx b/NxWidgets/UnitTests/CListBox/clistboxtest.hxx
new file mode 100644
index 000000000..5cc356849
--- /dev/null
+++ b/NxWidgets/UnitTests/CListBox/clistboxtest.hxx
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CListBox/clistboxtest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CLISTBOX_CLISTBOXTEST_HXX
+#define __UNITTESTS_CLISTBOX_CLISTBOXTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "clistbox.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CLISTBOXTEST_BGCOLOR
+# define CONFIG_CLISTBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME clistbox_main
+# define MAIN_STRING "clistbox_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CListBoxTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CListBoxTest(void);
+ ~CListBoxTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a listbox in the center of the window
+
+ CListBox *createListBox(void);
+
+ // (Re-)draw the listbox.
+
+ void showListBox(CListBox *listbox);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CLISTBOX_CLISTBOXTEST_HXX
diff --git a/NxWidgets/UnitTests/CListBox/main.cxx b/NxWidgets/UnitTests/CListBox/main.cxx
new file mode 100644
index 000000000..5783e255d
--- /dev/null
+++ b/NxWidgets/UnitTests/CListBox/main.cxx
@@ -0,0 +1,327 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CListBox/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "clistboxtest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmPrevious;
+static unsigned int g_mmPeak;
+
+static FAR const char *g_options[] =
+{
+ "American groundnut (Apios americana)",
+ "Azuki bean (Vigna angularis)",
+ "Black-eyed pea (Vigna unguiculata subsp. unguiculata)",
+ "Chickpea (Cicer arietinum)",
+ "Common bean (Phaseolus vulgaris)",
+ "Drumstick (Moringa oleifera)",
+ "Dolichos bean (Lablab purpureus)",
+ "Fava bean (Vicia faba)",
+ "Garbanzo (Cicer arietinum)",
+ "Green bean (Phaseolus vulgaris)",
+ "Guar (Cyamopsis tetragonoloba)",
+ "Gumbo (Abelmoschus esculentus)",
+ "Horse gram (Macrotyloma uniflorum)",
+ "Indian pea (Lathyrus sativus)",
+ "Lentil (Lens culinaris)",
+ "Lima Bean (Phaseolus lunatus)",
+ "Moth bean (Vigna acontifolia)",
+ "Mung bean (Vigna radiata)",
+ "Okra (Abelmoschus esculentus)",
+ "Pea (Pisum sativum)",
+ "Peanut (Arachis hypogaea)",
+ "Pigeon pea (Cajanus cajan)",
+ "Ricebean (Vigna umbellata)",
+ "Runner bean (Phaseolus coccineus)",
+ "Soybean (Glycine max)",
+ "Tarwi (tarhui, chocho; Lupinus mutabilis)",
+ "Tepary bean (Phaseolus acutifolius)",
+ "Urad bean (Vigna mungo)",
+ "Velvet bean (Mucuna pruriens)",
+ "Winged bean (Psophocarpus tetragonolobus)",
+ "Yardlong bean (Vigna unguiculata subsp. sesquipedalis)"
+};
+#define NOPTIONS (sizeof(g_options)/sizeof(FAR const char *))
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("%s: Before: %8d After: %8d Change: %8d\n",
+ msg, previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmPrevious = mmcurrent.uordblks;
+ if ((unsigned int)mmcurrent.uordblks > g_mmPeak)
+ {
+ g_mmPeak = mmcurrent.uordblks;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmPrevious = mmcurrent.uordblks;
+ g_mmPeak = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the listbox test
+
+ message(MAIN_STRING "Create CListBoxTest instance\n");
+ CListBoxTest *test = new CListBoxTest();
+ updateMemoryUsage(g_mmPrevious, "After creating CListBoxTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CListBoxTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CListBoxTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After creating a window");
+
+ // Create a listbox
+
+ message(MAIN_STRING "Create a ListBox\n");
+ CListBox *listbox = test->createListBox();
+ if (!listbox)
+ {
+ message(MAIN_STRING "Failed to create a listbox\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After creating a listbox");
+
+ // Show the initial state of the listbox
+
+ listbox->setAllowMultipleSelections(true);
+ test->showListBox(listbox);
+ sleep(1);
+
+ // Now add items to the list box (in reverse alphabetical order)
+
+ message(MAIN_STRING "Add options to the ListBox\n");
+ for (int i = NOPTIONS - 1; i >= 0; i--)
+ {
+ listbox->addOption(g_options[i],i);
+ test->showListBox(listbox);
+ message(MAIN_STRING "%d. New option %s\n", i, g_options[i]);
+ usleep(500000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After adding the listbox items");
+ sleep(1);
+
+ // Sort the list box
+
+ message(MAIN_STRING "Sort the ListBox\n");
+ listbox->sort();
+ test->showListBox(listbox);
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After sorting the listbox");
+ sleep(1);
+
+ // Select and remove items from the listbox
+
+ srand(1978);
+ int nOptions;
+ while ((nOptions = listbox->getOptionCount()) > 0)
+ {
+ message(MAIN_STRING "Option count: %d\n", nOptions);
+ if (nOptions <= 5)
+ {
+ message(MAIN_STRING "Selecting all remaining options\n");
+ listbox->selectAllOptions();
+ test->showListBox(listbox);
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After selecting all options");
+ sleep(1);
+
+ message(MAIN_STRING "Removing all remaining options\n");
+ listbox->removeAllOptions();
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After removing all options");
+ test->showListBox(listbox);
+ }
+ else
+ {
+ int selected[5];
+
+ message(MAIN_STRING "Selecting five options\n");
+ for (int i = 0; i < 5; i++)
+ {
+ selected[i] = ((nOptions - 1) * rand()) / MAX_RAND;
+ message(MAIN_STRING "Selecting option %d\n", selected[i]);
+ listbox->removeOption(selected[i]);
+ test->showListBox(listbox);
+ usleep(500000);
+ }
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After selecting five options");
+
+ message(MAIN_STRING "De-selecting options\n");
+ int index;
+ int count = 0;
+ while ((index = listbox->getSelectedIndex()) >= 0)
+ {
+ message(MAIN_STRING "De-selecting option %d\n", index);
+ listbox->deselectOption(index);
+ test->showListBox(listbox);
+ count++;
+ usleep(500000);
+ }
+
+ message(MAIN_STRING "%s: %d options de-selected\n",
+ count == 5 ? "OK" : "ERROR", count);
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After de-selecting options");
+
+ message(MAIN_STRING "Removing the selected options\n");
+ for (int i = 0; i < 5; i++)
+ {
+ message(MAIN_STRING "Removing option %d\n", selected[i]);
+ listbox->removeOption(selected[i]);
+ test->showListBox(listbox);
+ usleep(500000);
+ }
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After removing five options");
+ }
+ sleep(1);
+ }
+ updateMemoryUsage(g_mmPrevious, MAIN_STRING "After the listbox is empty again");
+ sleep(1);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete listbox;
+ updateMemoryUsage(g_mmPrevious, "After deleting the listbox");
+ delete test;
+ updateMemoryUsage(g_mmPrevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ message("Peak memory usage: %8d\n", g_mmPeak - g_mmInitial);
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CProgressBar/Makefile b/NxWidgets/UnitTests/CProgressBar/Makefile
new file mode 100644
index 000000000..53d66fefa
--- /dev/null
+++ b/NxWidgets/UnitTests/CProgressBar/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CProgressBar/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cprogressbartest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cprogressbar
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CProgressBar/cprogressbartest.cxx b/NxWidgets/UnitTests/CProgressBar/cprogressbartest.cxx
new file mode 100644
index 000000000..60821d751
--- /dev/null
+++ b/NxWidgets/UnitTests/CProgressBar/cprogressbartest.cxx
@@ -0,0 +1,224 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/ProgressBar/cprogressbartest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "cprogressbartest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CProgressBarTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CProgressBarTest Constructor
+
+CProgressBarTest::CProgressBarTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CProgressBarTest Descriptor
+
+CProgressBarTest::~CProgressBarTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CProgressBarTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CPROGRESSBARTEST_BGCOLOR))
+ {
+ message("CProgressBarTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CProgressBarTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow *)NULL;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ m_widgetControl = (CWidgetControl *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CProgressBarTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CProgressBarTest::createWindow: Failed to create CBgWindow instance\n");
+ disconnect();
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CProgressBarTest::createWindow: Failed to open background window\n");
+ disconnect();
+ return false;
+ }
+
+ return true;
+}
+
+// Create a bar in the center of the window
+
+CProgressBar *CProgressBarTest::createProgressBar(void)
+{
+ // Get the size of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CProgressBarTest::createProgressBar: Failed to get window size\n");
+ disconnect();
+ return false;
+ }
+
+ // Put the bar in the center of the display
+
+ nxgl_coord_t barWidth = windowSize.w >> 1;
+ nxgl_coord_t barX = windowSize.w >> 2;
+
+ nxgl_coord_t barHeight = 16;
+ nxgl_coord_t barY = (windowSize.h - barHeight) >> 1;
+
+ // Create the bar
+
+ CProgressBar *bar = new CProgressBar(m_widgetControl,
+ barX, barY,
+ barWidth, barHeight);
+ if (!bar)
+ {
+ printf("CProgressBarTest::createProgressBar: Failed to create CProgressBar\n");
+ disconnect();
+ }
+ return bar;
+}
+
+// (Re-)draw the bar.
+
+void CProgressBarTest::showProgressBar(CProgressBar *bar)
+{
+ bar->enable(); // Un-necessary, the widget is enabled by default
+ bar->enableDrawing();
+ bar->redraw();
+}
diff --git a/NxWidgets/UnitTests/CProgressBar/cprogressbartest.hxx b/NxWidgets/UnitTests/CProgressBar/cprogressbartest.hxx
new file mode 100644
index 000000000..f5058a0c4
--- /dev/null
+++ b/NxWidgets/UnitTests/CProgressBar/cprogressbartest.hxx
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CProgressBar/cprogressbartest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CPROGRESSBAR_CPROGRESSBARTEST_HXX
+#define __UNITTESTS_CPROGRESSBAR_CPROGRESSBARTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cprogressbar.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CPROGRESSBARTEST_BGCOLOR
+# define CONFIG_CPROGRESSBARTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cprogressbar_main
+# define MAIN_STRING "cprogressbar_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CProgressBarTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CProgressBarTest(void);
+ ~CProgressBarTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a progress bar in the center of the window
+
+ CProgressBar *createProgressBar(void);
+
+ // (Re-)draw the progress bar.
+
+ void showProgressBar(CProgressBar *bar);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CPROGRESSBAR_CPROGRESSBARTEST_HXX
diff --git a/NxWidgets/UnitTests/CProgressBar/main.cxx b/NxWidgets/UnitTests/CProgressBar/main.cxx
new file mode 100644
index 000000000..525c509d3
--- /dev/null
+++ b/NxWidgets/UnitTests/CProgressBar/main.cxx
@@ -0,0 +1,238 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CProgressBar/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cprogressbartest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+#define MAX_PROGRESSBAR 50
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the checkbox test
+
+ message(MAIN_STRING "Create CProgressBarTest instance\n");
+ CProgressBarTest *test = new CProgressBarTest();
+ updateMemoryUsage(g_mmprevious, "After creating CProgressBarTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CProgressBarTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CProgressBarTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a window");
+
+ // Create a progress bar
+
+ message(MAIN_STRING "Create a ProgressBar\n");
+ CProgressBar *bar = test->createProgressBar();
+ if (!bar)
+ {
+ message(MAIN_STRING "Failed to create a progress bar\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a progress bar");
+
+ // Set the progress bar minimum and maximum values
+
+ bar->setMinimumValue(0);
+ bar->setMaximumValue(MAX_PROGRESSBAR);
+ bar->setValue(0);
+ bar->hidePercentageText();
+ message(MAIN_STRING "ProgressBar range %d->%d Initial value %d\n",
+ bar->getMinimumValue(), bar->getMaximumValue(),
+ bar->getValue());
+
+ // Show the initial state of the checkbox
+
+ test->showProgressBar(bar);
+ sleep(1);
+
+ // Now move the progress bar up from 0 to 100% (with percentages off)
+
+ for (int i = 0; i <= MAX_PROGRESSBAR; i++)
+ {
+ bar->setValue(i);
+ test->showProgressBar(bar);
+ message(MAIN_STRING "%d. New value %d\n", i, bar->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the progress bar up #1");
+ usleep(500*1000);
+
+ // Now move the progress bar up from 0 to 100% (with percentages off)
+
+ bar->showPercentageText();
+ bar->setValue(0);
+ test->showProgressBar(bar);
+ usleep(500*1000);
+
+ for (int i = 0; i <= MAX_PROGRESSBAR; i++)
+ {
+ bar->setValue(i);
+ test->showProgressBar(bar);
+ message(MAIN_STRING "%d. New value %d\n", i, bar->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the progress bar up #2");
+ sleep(1);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete bar;
+ updateMemoryUsage(g_mmprevious, "After deleting the progress bar");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CRadioButton/Makefile b/NxWidgets/UnitTests/CRadioButton/Makefile
new file mode 100644
index 000000000..0b4906dd8
--- /dev/null
+++ b/NxWidgets/UnitTests/CRadioButton/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CRadioButton/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cradiobuttontest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cradiobutton
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CRadioButton/cradiobuttontest.cxx b/NxWidgets/UnitTests/CRadioButton/cradiobuttontest.cxx
new file mode 100644
index 000000000..f97089ce7
--- /dev/null
+++ b/NxWidgets/UnitTests/CRadioButton/cradiobuttontest.cxx
@@ -0,0 +1,305 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CRadioButton/cradiobuttontest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "cradiobuttontest.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CRadioButtonTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CRadioButtonTest Constructor
+
+CRadioButtonTest::CRadioButtonTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+
+ // Peek at the radio button glyph to get a good estimate of the size
+
+ m_size.w = g_radioButtonOn.width;
+ m_size.h = g_radioButtonOn.height;
+}
+
+// CRadioButtonTest Descriptor
+
+CRadioButtonTest::~CRadioButtonTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CRadioButtonTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CRADIOBUTTONTEST_BGCOLOR))
+ {
+ message("CRadioButtonTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CRadioButtonTest::disconnect(void)
+{
+ // Free the radiobutton group
+
+ if (m_radioButtonGroup)
+ {
+ delete m_radioButtonGroup;
+ m_radioButtonGroup = (CRadioButtonGroup *)NULL;
+ }
+
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CRadioButtonTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CRadioButtonTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CRadioButtonTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CRadioButton instance
+
+CRadioButton *CRadioButtonTest::newRadioButton(void)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ message("CRadioButtonTest::newRadioButton: Failed to get window size\n");
+ return (CRadioButton *)NULL;
+ }
+
+ // Create the radio button group, if we have not already done so
+
+ if (!m_radioButtonGroup)
+ {
+ // Start the radio button group in the center of the upper, left
+ // quadrant. The initial size is 0,0 and the default style is used.
+
+ nxgl_coord_t groupX = windowSize.w >> 2;
+ nxgl_coord_t groupY = windowSize.h >> 2;
+
+ m_radioButtonGroup = new CRadioButtonGroup(m_widgetControl, groupX, groupY);
+ if (!m_radioButtonGroup)
+ {
+ message("CRadioButtonTest::newRadioButton: Failed to create the radio button group\n");
+ return (CRadioButton *)NULL;
+ }
+ }
+
+ // Create the new radio button at the botton of the radio button group and
+ // with the size of the ON radio button glyph (they all need to be the same
+ // size!). Note that coordinates are relative to the parent bounding box.
+
+ nxgl_coord_t buttonX = 0;
+ nxgl_coord_t buttonY = m_radioButtonGroup->getHeight();
+
+ return m_radioButtonGroup->newRadioButton(buttonX, buttonY, m_size.w, m_size.h);
+}
+
+// (Re-)draw the buttons.
+
+void CRadioButtonTest::showButtons(void)
+{
+ m_radioButtonGroup->enable(); // Un-necessary, the widget is enabled by default
+ m_radioButtonGroup->enableDrawing();
+ m_radioButtonGroup->redraw();
+}
+
+// Push the radio button
+
+void CRadioButtonTest::pushButton(CRadioButton *button)
+{
+ // Get the button center coordinates
+
+ nxgl_coord_t buttonX = button->getX() + (button->getWidth() >> 1);
+ nxgl_coord_t buttonY = button->getY() + (button->getHeight() >> 1);
+
+ // Then push the button by calling nx_mousein. nx_mousein is meant to be
+ // called by mouse handling software. Here we just inject a left-button click
+ // directly in the center of the radio button.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level mouse interface
+
+ NXHANDLE handle = getServer();
+
+ // Then inject the mouse click
+
+ (void)nx_mousein(handle, buttonX, buttonY, NX_MOUSE_LEFTBUTTON);
+
+ // Poll for mouse events
+ //
+ // Widget events are normally handled in a modal loop (by calling goModal()).
+ // However, for this case we know that we just pressed the mouse button
+ // so we don't have to poll. We can just perform a one pass poll then
+ // then check if the mouse event was processed corredly.
+
+ m_widgetControl->pollEvents(m_radioButtonGroup);
+
+ // Then inject the mouse release
+
+ (void)nx_mousein(handle, buttonX, buttonY, 0);
+
+ // And poll for more mouse events
+
+ m_widgetControl->pollEvents(m_radioButtonGroup);
+
+ // And re-draw the buttons (the mouse click event should have automatically
+ // triggered the re-draw)
+ //
+ // showButtons();
+}
+
+// Show the state of the radio button group
+
+void CRadioButtonTest::showButtonState(void)
+{
+ int index = m_radioButtonGroup->getSelectedIndex();
+ if (index < 0)
+ {
+ message("CRadioButtonTest::showButtonState No button is pressed\n");
+ }
+ else
+ {
+ message("CRadioButtonTest::showButtonState button%d is selected\n", index+1);
+ }
+}
diff --git a/NxWidgets/UnitTests/CRadioButton/cradiobuttontest.hxx b/NxWidgets/UnitTests/CRadioButton/cradiobuttontest.hxx
new file mode 100644
index 000000000..563049dcf
--- /dev/null
+++ b/NxWidgets/UnitTests/CRadioButton/cradiobuttontest.hxx
@@ -0,0 +1,162 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CRadioButton/cradiobuttontest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CRADIOBUTTON_CRADIOBUTTONTEST_HXX
+#define __UNITTESTS_CRADIOBUTTON_CRADIOBUTTONTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cradiobutton.hxx"
+#include "cradiobuttongroup.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CRADIOBUTTONTEST_BGCOLOR
+# define CONFIG_CRADIOBUTTONTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cradiobutton_main
+# define MAIN_STRING "cradiobutton_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CRadioButtonTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+ CRadioButtonGroup *m_radioButtonGroup; // The radio button group
+
+ // These are the dimensions that we will use for creating new radio buttons
+
+ struct nxgl_size_s m_size; // The size of each radio button
+
+public:
+ // Constructor/destructors
+
+ CRadioButtonTest(void);
+ ~CRadioButtonTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // (Re-)draw the buttons.
+
+ void showButtons(void);
+
+ // Create a CRadioButton instance. This method will show you how to create
+ // a CRadioButton widget
+
+ CRadioButton *newRadioButton(void);
+
+ // Simulate pushing and releasing of the radio button
+
+ void pushButton(CRadioButton *button);
+
+ // Show the state of the radio button group
+
+ void showButtonState(void);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CRADIOBUTTON_CRADIOBUTTONTEST_HXX
diff --git a/NxWidgets/UnitTests/CRadioButton/main.cxx b/NxWidgets/UnitTests/CRadioButton/main.cxx
new file mode 100644
index 000000000..d53cd4a09
--- /dev/null
+++ b/NxWidgets/UnitTests/CRadioButton/main.cxx
@@ -0,0 +1,238 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CRadioButton/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "crlepalettebitmap.hxx"
+#include "glyphs.hxx"
+#include "cradiobuttontest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the radio button test
+
+ message(MAIN_STRING "Create CRadioButtonTest instance\n");
+ CRadioButtonTest *test = new CRadioButtonTest();
+ updateMemoryUsage(g_mmprevious, "After creating CRadioButtonTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CRadioButtonTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CRadioButtonTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a window");
+
+ // Create three radio buttons
+
+ CRadioButton *button1 = test->newRadioButton();
+ if (!button1)
+ {
+ message(MAIN_STRING "Failed to create radio button 1\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating radio button 1");
+
+ CRadioButton *button2 = test->newRadioButton();
+ if (!button2)
+ {
+ message(MAIN_STRING "Failed to create radio button 2\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating radio button 2");
+
+ CRadioButton *button3 = test->newRadioButton();
+ if (!button3)
+ {
+ message(MAIN_STRING "Failed to create radio button 3\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating radio button 3");
+
+ // Show the initial state of the buttons
+
+ test->showButtons();
+ test->showButtonState();
+ sleep(1);
+
+ // Now push some buttons
+
+ message(MAIN_STRING "Pushing button 1\n");
+ test->pushButton(button1);
+ usleep(500*1000);
+ test->showButtonState();
+ updateMemoryUsage(g_mmprevious, "After pushing button 1");
+ usleep(500*1000);
+
+ message(MAIN_STRING "Pushing button 2\n");
+ test->pushButton(button2);
+ usleep(500*1000);
+ test->showButtonState();
+ updateMemoryUsage(g_mmprevious, "After pushing button 2");
+ usleep(500*1000);
+
+ message(MAIN_STRING "Pushing button 3\n");
+ test->pushButton(button3);
+ usleep(500*1000);
+ test->showButtonState();
+ updateMemoryUsage(g_mmprevious, "After pushing button 3");
+ sleep(2);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile b/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile
new file mode 100644
index 000000000..6be8f7cd6
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CScrollbarHorizontal/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cscrollbarhorizontaltest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cscrollbarhorizontal
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.cxx b/NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.cxx
new file mode 100644
index 000000000..06673f080
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.cxx
@@ -0,0 +1,225 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "cscrollbarhorizontaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CScrollbarHorizontalTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CScrollbarHorizontalTest Constructor
+
+CScrollbarHorizontalTest::CScrollbarHorizontalTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CScrollbarHorizontalTest Descriptor
+
+CScrollbarHorizontalTest::~CScrollbarHorizontalTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CScrollbarHorizontalTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CSCROLLBARHORIZONTALTEST_BGCOLOR))
+ {
+ message("CScrollbarHorizontalTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CScrollbarHorizontalTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow *)NULL;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ m_widgetControl = (CWidgetControl *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CScrollbarHorizontalTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CScrollbarHorizontalTest::createWindow: Failed to create CBgWindow instance\n");
+ disconnect();
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CScrollbarHorizontalTest::createWindow: Failed to open background window\n");
+ disconnect();
+ return false;
+ }
+
+ return true;
+}
+
+// Create a scrollbar in the center of the window
+
+CScrollbarHorizontal *CScrollbarHorizontalTest::createScrollbar(void)
+{
+ // Get the size of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CScrollbarHorizontalTest::createScrollbar: Failed to get window size\n");
+ disconnect();
+ return false;
+ }
+
+ // Put the scrollbar in the center of the display
+
+ nxgl_coord_t scrollbarWidth = windowSize.w >> 1;
+ nxgl_coord_t scrollbarX = windowSize.w >> 2;
+
+ nxgl_coord_t scrollbarHeight = 10;
+ nxgl_coord_t scrollbarY = (windowSize.h - scrollbarHeight) >> 1;
+
+ // Create the scrollbar
+
+ CScrollbarHorizontal *scrollbar =
+ new CScrollbarHorizontal(m_widgetControl,
+ scrollbarX, scrollbarY,
+ scrollbarWidth, scrollbarHeight);
+ if (!scrollbar)
+ {
+ printf("CScrollbarHorizontalTest::createScrollbar: Failed to create CScrollbarHorizontal\n");
+ disconnect();
+ }
+ return scrollbar;
+}
+
+// (Re-)draw the scrollbar.
+
+void CScrollbarHorizontalTest::showScrollbar(CScrollbarHorizontal *scrollbar)
+{
+ scrollbar->enable(); // Un-necessary, the widget is enabled by default
+ scrollbar->enableDrawing();
+ scrollbar->redraw();
+}
diff --git a/NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.hxx b/NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.hxx
new file mode 100644
index 000000000..feae319d0
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.hxx
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CScrollbarHorizontal/cscrollbarhorizontaltest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CSCROLLBARHORIZONTAL_CSCROLLBARHORIZONTALTEST_HXX
+#define __UNITTESTS_CSCROLLBARHORIZONTAL_CSCROLLBARHORIZONTALTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cscrollbarhorizontal.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CSCROLLBARHORIZONTALTEST_BGCOLOR
+# define CONFIG_CSCROLLBARHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cscrollbarhorizontal_main
+# define MAIN_STRING "cscrollbarhorizontal_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CScrollbarHorizontalTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CScrollbarHorizontalTest(void);
+ ~CScrollbarHorizontalTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a scrollbar in the center of the window
+
+ CScrollbarHorizontal *createScrollbar(void);
+
+ // (Re-)draw the scrollbar.
+
+ void showScrollbar(CScrollbarHorizontal *scrollbar);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CSCROLLBARHORIZONTAL_CSCROLLBARHORIZONTALTEST_HXX
diff --git a/NxWidgets/UnitTests/CScrollbarHorizontal/main.cxx b/NxWidgets/UnitTests/CScrollbarHorizontal/main.cxx
new file mode 100644
index 000000000..a6a08cdbd
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarHorizontal/main.cxx
@@ -0,0 +1,231 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CScrollbarHorizontal/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cscrollbarhorizontaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+#define MAX_SCROLLBAR 50
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the checkbox test
+
+ message(MAIN_STRING "Create CScrollbarHorizontalTest instance\n");
+ CScrollbarHorizontalTest *test = new CScrollbarHorizontalTest();
+ updateMemoryUsage(g_mmprevious, "After creating CScrollbarHorizontalTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CScrollbarHorizontalTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CScrollbarHorizontalTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a window");
+
+ // Create a scrollbar
+
+ message(MAIN_STRING "Create a Scrollbar\n");
+ CScrollbarHorizontal *scrollbar = test->createScrollbar();
+ if (!scrollbar)
+ {
+ message(MAIN_STRING "Failed to create a scrollbar\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a scrollbar");
+
+ // Set the scrollbar minimum and maximum values
+
+ scrollbar->setMinimumValue(0);
+ scrollbar->setMaximumValue(MAX_SCROLLBAR);
+ scrollbar->setValue(0);
+ message(MAIN_STRING "Scrollbar range %d->%d Initial value %d\n",
+ scrollbar->getMinimumValue(), scrollbar->getMaximumValue(),
+ scrollbar->getValue());
+
+ // Show the initial state of the checkbox
+
+ test->showScrollbar(scrollbar);
+ sleep(1);
+
+ // Now move the scrollbar up
+
+ for (int i = 0; i <= MAX_SCROLLBAR; i++)
+ {
+ scrollbar->setValue(i);
+ test->showScrollbar(scrollbar);
+ message(MAIN_STRING "%d. New value %d\n", i, scrollbar->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the scrollbar up");
+
+ // And move the scrollbar down
+
+ for (int i = MAX_SCROLLBAR; i >= 0; i--)
+ {
+ scrollbar->setValue(i);
+ test->showScrollbar(scrollbar);
+ message(MAIN_STRING "%d. New value %d\n", i, scrollbar->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the scrollbar down");
+ sleep(1);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete scrollbar;
+ updateMemoryUsage(g_mmprevious, "After deleting the scrollbar");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CScrollbarVertical/Makefile b/NxWidgets/UnitTests/CScrollbarVertical/Makefile
new file mode 100644
index 000000000..a2c404aad
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarVertical/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CScrollbarVertical/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx cscrollbarverticaltest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cscrollbarvertical
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.cxx b/NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.cxx
new file mode 100644
index 000000000..df317adcd
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.cxx
@@ -0,0 +1,225 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "cscrollbarverticaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CScrollbarVerticalTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CScrollbarVerticalTest Constructor
+
+CScrollbarVerticalTest::CScrollbarVerticalTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CScrollbarVerticalTest Descriptor
+
+CScrollbarVerticalTest::~CScrollbarVerticalTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CScrollbarVerticalTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CSCROLLBARVERTICALTEST_BGCOLOR))
+ {
+ message("CScrollbarVerticalTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CScrollbarVerticalTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow *)NULL;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ m_widgetControl = (CWidgetControl *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CScrollbarVerticalTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CScrollbarVerticalTest::createWindow: Failed to create CBgWindow instance\n");
+ disconnect();
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CScrollbarVerticalTest::createWindow: Failed to open background window\n");
+ disconnect();
+ return false;
+ }
+
+ return true;
+}
+
+// Create a scrollbar in the center of the window
+
+CScrollbarVertical *CScrollbarVerticalTest::createScrollbar(void)
+{
+ // Get the size of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CScrollbarVerticalTest::createScrollbar: Failed to get window size\n");
+ disconnect();
+ return false;
+ }
+
+ // Put the scrollbar in the center of the display
+
+ nxgl_coord_t scrollbarWidth = 10;
+ nxgl_coord_t scrollbarX = (windowSize.w - scrollbarWidth) >> 1;
+
+ nxgl_coord_t scrollbarHeight = windowSize.h >> 1;
+ nxgl_coord_t scrollbarY = windowSize.h >> 2;
+
+ // Create the scrollbar
+
+ CScrollbarVertical *scrollbar =
+ new CScrollbarVertical(m_widgetControl,
+ scrollbarX, scrollbarY,
+ scrollbarWidth, scrollbarHeight);
+ if (!scrollbar)
+ {
+ printf("CScrollbarVerticalTest::createScrollbar: Failed to create CScrollbarVertical\n");
+ disconnect();
+ }
+ return scrollbar;
+}
+
+// (Re-)draw the scrollbar.
+
+void CScrollbarVerticalTest::showScrollbar(CScrollbarVertical *scrollbar)
+{
+ scrollbar->enable(); // Un-necessary, the widget is enabled by default
+ scrollbar->enableDrawing();
+ scrollbar->redraw();
+}
diff --git a/NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.hxx b/NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.hxx
new file mode 100644
index 000000000..874a851fd
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.hxx
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CScrollbarVertical/cscrollbarverticaltest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CSCROLLBARVERTICAL_CSCROLLBARVERTICALTEST_HXX
+#define __UNITTESTS_CSCROLLBARVERTICAL_CSCROLLBARVERTICALTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cscrollbarvertical.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CSCROLLBARVERTICALTEST_BGCOLOR
+# define CONFIG_CSCROLLBARVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cscrollbarvertical_main
+# define MAIN_STRING "cscrollbarvertical_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CScrollbarVerticalTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CScrollbarVerticalTest(void);
+ ~CScrollbarVerticalTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a scrollbar in the center of the window
+
+ CScrollbarVertical *createScrollbar(void);
+
+ // (Re-)draw the scrollbar.
+
+ void showScrollbar(CScrollbarVertical *scrollbar);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CSCROLLBARVERTICAL_CSCROLLBARVERTICALTEST_HXX
diff --git a/NxWidgets/UnitTests/CScrollbarVertical/main.cxx b/NxWidgets/UnitTests/CScrollbarVertical/main.cxx
new file mode 100644
index 000000000..16bd9eea6
--- /dev/null
+++ b/NxWidgets/UnitTests/CScrollbarVertical/main.cxx
@@ -0,0 +1,231 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CScrollbarVertical/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cscrollbarverticaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+#define MAX_SCROLLBAR 20
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the checkbox test
+
+ message(MAIN_STRING "Create CScrollbarVerticalTest instance\n");
+ CScrollbarVerticalTest *test = new CScrollbarVerticalTest();
+ updateMemoryUsage(g_mmprevious, "After creating CScrollbarVerticalTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CScrollbarVerticalTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CScrollbarVerticalTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a window");
+
+ // Create a scrollbar
+
+ message(MAIN_STRING "Create a Scrollbar\n");
+ CScrollbarVertical *scrollbar = test->createScrollbar();
+ if (!scrollbar)
+ {
+ message(MAIN_STRING "Failed to create a scrollbar\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a scrollbar");
+
+ // Set the scrollbar minimum and maximum values
+
+ scrollbar->setMinimumValue(0);
+ scrollbar->setMaximumValue(MAX_SCROLLBAR);
+ scrollbar->setValue(0);
+ message(MAIN_STRING "Scrollbar range %d->%d Initial value %d\n",
+ scrollbar->getMinimumValue(), scrollbar->getMaximumValue(),
+ scrollbar->getValue());
+
+ // Show the initial state of the checkbox
+
+ test->showScrollbar(scrollbar);
+ sleep(1);
+
+ // Now move the scrollbar up
+
+ for (int i = 0; i <= MAX_SCROLLBAR; i++)
+ {
+ scrollbar->setValue(i);
+ test->showScrollbar(scrollbar);
+ message(MAIN_STRING "%d. New value %d\n", i, scrollbar->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the scrollbar up");
+
+ // And move the scrollbar down
+
+ for (int i = MAX_SCROLLBAR; i >= 0; i--)
+ {
+ scrollbar->setValue(i);
+ test->showScrollbar(scrollbar);
+ message(MAIN_STRING "%d. New value %d\n", i, scrollbar->getValue());
+ usleep(5000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the scrollbar down");
+ sleep(1);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete scrollbar;
+ updateMemoryUsage(g_mmprevious, "After deleting the scrollbar");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CSliderHorizonal/Makefile b/NxWidgets/UnitTests/CSliderHorizonal/Makefile
new file mode 100644
index 000000000..b496bdda7
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderHorizonal/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CSliderHorizontal/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx csliderhorizontaltest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = csliderhorizontal
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.cxx b/NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.cxx
new file mode 100644
index 000000000..1687448db
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.cxx
@@ -0,0 +1,224 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CSliderHorizontal/csliderhorizontaltest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "csliderhorizontaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CSliderHorizontalTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CSliderHorizontalTest Constructor
+
+CSliderHorizontalTest::CSliderHorizontalTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CSliderHorizontalTest Descriptor
+
+CSliderHorizontalTest::~CSliderHorizontalTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CSliderHorizontalTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CSLIDERHORIZONTALTEST_BGCOLOR))
+ {
+ message("CSliderHorizontalTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CSliderHorizontalTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow *)NULL;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ m_widgetControl = (CWidgetControl *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CSliderHorizontalTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CSliderHorizontalTest::createWindow: Failed to create CBgWindow instance\n");
+ disconnect();
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CSliderHorizontalTest::createWindow: Failed to open background window\n");
+ disconnect();
+ return false;
+ }
+
+ return true;
+}
+
+// Create a slider in the center of the window
+
+CSliderHorizontal *CSliderHorizontalTest::createSlider(void)
+{
+ // Get the size of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CSliderHorizontalTest::createSlider: Failed to get window size\n");
+ disconnect();
+ return false;
+ }
+
+ // Put the slider in the center of the display
+
+ nxgl_coord_t sliderWidth = windowSize.w >> 1;
+ nxgl_coord_t sliderX = windowSize.w >> 2;
+
+ nxgl_coord_t sliderHeight = 10;
+ nxgl_coord_t sliderY = (windowSize.h - sliderHeight) >> 1;
+
+ // Create the slider
+
+ CSliderHorizontal *slider = new CSliderHorizontal(m_widgetControl,
+ sliderX, sliderY,
+ sliderWidth, sliderHeight);
+ if (!slider)
+ {
+ printf("CSliderHorizontalTest::createSlider: Failed to create CSliderHorizontal\n");
+ disconnect();
+ }
+ return slider;
+}
+
+// (Re-)draw the slider.
+
+void CSliderHorizontalTest::showSlider(CSliderHorizontal *slider)
+{
+ slider->enable(); // Un-necessary, the widget is enabled by default
+ slider->enableDrawing();
+ slider->redraw();
+}
diff --git a/NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.hxx b/NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.hxx
new file mode 100644
index 000000000..1dde688a8
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderHorizonal/csliderhorizontaltest.hxx
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CSliderHorizontal/csliderhorizontaltest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CSLIDERHORIZONTAL_CSLIDERHORIZONTALTEST_HXX
+#define __UNITTESTS_CSLIDERHORIZONTAL_CSLIDERHORIZONTALTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "csliderhorizontal.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CSLIDERHORIZONTALTEST_BGCOLOR
+# define CONFIG_CSLIDERHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME csliderhorizontal_main
+# define MAIN_STRING "csliderhorizontal_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CSliderHorizontalTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CSliderHorizontalTest(void);
+ ~CSliderHorizontalTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a slider in the center of the window
+
+ CSliderHorizontal *createSlider(void);
+
+ // (Re-)draw the slider.
+
+ void showSlider(CSliderHorizontal *slider);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CSLIDERHORIZONTAL_CSLIDERHORIZONTALTEST_HXX
diff --git a/NxWidgets/UnitTests/CSliderHorizonal/main.cxx b/NxWidgets/UnitTests/CSliderHorizonal/main.cxx
new file mode 100644
index 000000000..b99d1c547
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderHorizonal/main.cxx
@@ -0,0 +1,231 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CSliderHorizontal/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "csliderhorizontaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+#define MAX_SLIDER 50
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the checkbox test
+
+ message(MAIN_STRING "Create CSliderHorizontalTest instance\n");
+ CSliderHorizontalTest *test = new CSliderHorizontalTest();
+ updateMemoryUsage(g_mmprevious, "After creating CSliderHorizontalTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CSliderHorizontalTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CSliderHorizontalTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a window");
+
+ // Create a slider
+
+ message(MAIN_STRING "Create a Slider\n");
+ CSliderHorizontal *slider = test->createSlider();
+ if (!slider)
+ {
+ message(MAIN_STRING "Failed to create a slider\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a slider");
+
+ // Set the slider minimum and maximum values
+
+ slider->setMinimumValue(0);
+ slider->setMaximumValue(MAX_SLIDER);
+ slider->setValue(0);
+ message(MAIN_STRING "Slider range %d->%d Initial value %d\n",
+ slider->getMinimumValue(), slider->getMaximumValue(),
+ slider->getValue());
+
+ // Show the initial state of the checkbox
+
+ test->showSlider(slider);
+ sleep(1);
+
+ // Now move the slider up
+
+ for (int i = 0; i <= MAX_SLIDER; i++)
+ {
+ slider->setValue(i);
+ test->showSlider(slider);
+ message(MAIN_STRING "%d. New value %d\n", i, slider->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the slider up");
+
+ // And move the slider down
+
+ for (int i = MAX_SLIDER; i >= 0; i--)
+ {
+ slider->setValue(i);
+ test->showSlider(slider);
+ message(MAIN_STRING "%d. New value %d\n", i, slider->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the slider down");
+ sleep(1);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete slider;
+ updateMemoryUsage(g_mmprevious, "After deleting the slider");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CSliderVertical/Makefile b/NxWidgets/UnitTests/CSliderVertical/Makefile
new file mode 100644
index 000000000..5d5e590f1
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderVertical/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CSliderVertical/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx csliderverticaltest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = cslidervertical
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.cxx b/NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.cxx
new file mode 100644
index 000000000..d0691c52d
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.cxx
@@ -0,0 +1,225 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// modify this software without notice.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cbgwindow.hxx"
+#include "csliderverticaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CSliderVerticalTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CSliderVerticalTest Constructor
+
+CSliderVerticalTest::CSliderVerticalTest()
+{
+ // Initialize state data
+
+ m_widgetControl = (CWidgetControl *)NULL;
+ m_bgWindow = (CBgWindow *)NULL;
+}
+
+// CSliderVerticalTest Descriptor
+
+CSliderVerticalTest::~CSliderVerticalTest(void)
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CSliderVerticalTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CSLIDERVERTICALTEST_BGCOLOR))
+ {
+ message("CSliderVerticalTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CSliderVerticalTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow *)NULL;
+ }
+
+ // Free the widget control instance
+
+ if (m_widgetControl)
+ {
+ delete m_widgetControl;
+ m_widgetControl = (CWidgetControl *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CSliderVerticalTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ message("CSliderVerticalTest::createWindow: Failed to create CBgWindow instance\n");
+ disconnect();
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ message("CSliderVerticalTest::createWindow: Failed to open background window\n");
+ disconnect();
+ return false;
+ }
+
+ return true;
+}
+
+// Create a slider in the center of the window
+
+CSliderVertical *CSliderVerticalTest::createSlider(void)
+{
+ // Get the size of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CSliderVerticalTest::createSlider: Failed to get window size\n");
+ disconnect();
+ return false;
+ }
+
+ // Put the slider in the center of the display
+
+ nxgl_coord_t sliderWidth = 10;
+ nxgl_coord_t sliderX = (windowSize.w - sliderWidth) >> 1;
+
+ nxgl_coord_t sliderHeight = windowSize.h >> 1;
+ nxgl_coord_t sliderY = windowSize.h >> 2;
+
+ // Create the slider
+
+ CSliderVertical *slider = new CSliderVertical(m_widgetControl,
+ sliderX, sliderY,
+ sliderWidth, sliderHeight);
+ if (!slider)
+ {
+ printf("CSliderVerticalTest::createSlider: Failed to create CSliderVertical\n");
+ disconnect();
+ }
+ return slider;
+}
+
+// (Re-)draw the slider.
+
+void CSliderVerticalTest::showSlider(CSliderVertical *slider)
+{
+ slider->enable(); // Un-necessary, the widget is enabled by default
+ slider->enableDrawing();
+ slider->redraw();
+}
diff --git a/NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.hxx b/NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.hxx
new file mode 100644
index 000000000..e8d506db9
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.hxx
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CSliderVertical/csliderverticaltest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CSLIDERVERTICAL_CSLIDERVERTICALTEST_HXX
+#define __UNITTESTS_CSLIDERVERTICAL_CSLIDERVERTICALTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cslidervertical.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CSLIDERVERTICALTEST_BGCOLOR
+# define CONFIG_CSLIDERVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME cslidervertical_main
+# define MAIN_STRING "cslidervertical_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+// If debug is enabled, use the debug function, lib_rawprintf() instead
+// of printf() so that the output is synchronized.
+
+#ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+#else
+# define message printf
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CSliderVerticalTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CBgWindow *m_bgWindow; // Background window instance
+
+public:
+ // Constructor/destructors
+
+ CSliderVerticalTest(void);
+ ~CSliderVerticalTest(void);
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a slider in the center of the window
+
+ CSliderVertical *createSlider(void);
+
+ // (Re-)draw the slider.
+
+ void showSlider(CSliderVertical *slider);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __UNITTESTS_CSLIDERVERTICAL_CSLIDERVERTICALTEST_HXX
diff --git a/NxWidgets/UnitTests/CSliderVertical/main.cxx b/NxWidgets/UnitTests/CSliderVertical/main.cxx
new file mode 100644
index 000000000..f5a53f018
--- /dev/null
+++ b/NxWidgets/UnitTests/CSliderVertical/main.cxx
@@ -0,0 +1,231 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CSliderVertical/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "csliderverticaltest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+#define MAX_SLIDER 50
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static unsigned int g_mmInitial;
+static unsigned int g_mmprevious;
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: updateMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void updateMemoryUsage(unsigned int previous,
+ FAR const char *msg)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ /* Show the change from the previous time */
+
+ message("\n%s:\n", msg);
+ message(" Before: %8d After: %8d Change: %8d\n\n",
+ previous, mmcurrent.uordblks, mmcurrent.uordblks - previous);
+
+ /* Set up for the next test */
+
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: initMemoryUsage
+/////////////////////////////////////////////////////////////////////////////
+
+static void initMemoryUsage(void)
+{
+ struct mallinfo mmcurrent;
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mmcurrent = mallinfo();
+#else
+ (void)mallinfo(&mmcurrent);
+#endif
+
+ g_mmInitial = mmcurrent.uordblks;
+ g_mmprevious = mmcurrent.uordblks;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Name: user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Initialize memory monitor logic
+
+ initMemoryUsage();
+
+ // Create an instance of the checkbox test
+
+ message(MAIN_STRING "Create CSliderVerticalTest instance\n");
+ CSliderVerticalTest *test = new CSliderVerticalTest();
+ updateMemoryUsage(g_mmprevious, "After creating CSliderVerticalTest");
+
+ // Connect the NX server
+
+ message(MAIN_STRING "Connect the CSliderVerticalTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ message(MAIN_STRING "Failed to connect the CSliderVerticalTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After connecting to the server");
+
+ // Create a window to draw into
+
+ message(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ message(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a window");
+
+ // Create a slider
+
+ message(MAIN_STRING "Create a Slider\n");
+ CSliderVertical *slider = test->createSlider();
+ if (!slider)
+ {
+ message(MAIN_STRING "Failed to create a slider\n");
+ delete test;
+ return 1;
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After creating a slider");
+
+ // Set the slider minimum and maximum values
+
+ slider->setMinimumValue(0);
+ slider->setMaximumValue(MAX_SLIDER);
+ slider->setValue(0);
+ message(MAIN_STRING "Slider range %d->%d Initial value %d\n",
+ slider->getMinimumValue(), slider->getMaximumValue(),
+ slider->getValue());
+
+ // Show the initial state of the checkbox
+
+ test->showSlider(slider);
+ sleep(1);
+
+ // Now move the slider up
+
+ for (int i = 0; i <= MAX_SLIDER; i++)
+ {
+ slider->setValue(i);
+ test->showSlider(slider);
+ message(MAIN_STRING "%d. New value %d\n", i, slider->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the slider up");
+
+ // And move the slider down
+
+ for (int i = MAX_SLIDER; i >= 0; i--)
+ {
+ slider->setValue(i);
+ test->showSlider(slider);
+ message(MAIN_STRING "%d. New value %d\n", i, slider->getValue());
+ usleep(1000); // The simulation needs this to let the X11 event loop run
+ }
+ updateMemoryUsage(g_mmprevious, MAIN_STRING "After moving the slider down");
+ sleep(1);
+
+ // Clean up and exit
+
+ message(MAIN_STRING "Clean-up and exit\n");
+ delete slider;
+ updateMemoryUsage(g_mmprevious, "After deleting the slider");
+ delete test;
+ updateMemoryUsage(g_mmprevious, "After deleting the test");
+ updateMemoryUsage(g_mmInitial, "Final memory usage");
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/CTextBox/Makefile b/NxWidgets/UnitTests/CTextBox/Makefile
new file mode 100644
index 000000000..3fe0fa43e
--- /dev/null
+++ b/NxWidgets/UnitTests/CTextBox/Makefile
@@ -0,0 +1,172 @@
+#################################################################################
+# NxWidgets/UnitTests/CTextBox/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+TESTDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Add the path to the NXWidget include directory to the CFLAGS
+
+NXWIDGETS_DIR="$(TESTDIR)/../../NXWidgets/libnxwidgets"
+NXWIDGETS_INC="$(NXWIDGETS_DIR)/include"
+NXWIDGETS_LIB="$(NXWIDGETS_DIR)/libnxwidgets$(LIBEXT)"
+
+INCDIR=$(TOPDIR)/tools/incdir.sh
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWIDGETS_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWIDGETS_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
+endif
+
+# Get the path to the archiver tool
+
+TESTTOOL_DIR="$(TESTDIR)/../tools"
+ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
+
+# Hello, World! C++ Example
+
+ASRCS =
+CSRCS =
+CXXSRCS = main.cxx ctextboxtest.cxx
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+POSIX_BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ifeq ($(WINTOOL),y)
+ BIN = "${shell cygpath -w $(POSIX_BIN)}"
+else
+ BIN = $(POSIX_BIN)
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# helloxx built-in application info
+
+APPNAME = ctextbox
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 2048
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend context disclean chkcxx chklib
+
+# Object file creation targets
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+# Verify that the NuttX configuration is setup to support C++
+
+chkcxx:
+ifneq ($(CONFIG_HAVE_CXX),y)
+ @echo ""
+ @echo "In order to use this example, you toolchain must support must"
+ @echo ""
+ @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
+ @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
+ @echo " of the configuration that you are using."
+ @echo ""
+ @exit 1
+endif
+
+# Verify that the NXWidget library has been built
+
+chklib:
+ @( \
+ if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
+ echo "$(NXWIDGETS_LIB) does not exist."; \
+ echo "Please go to $(NXWIDGETS_DIR)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
+# Library creation targets
+
+$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+
+.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $(BIN), $${obj}); \
+ done ; )
+ifeq ($(WINTOOL),y)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+else
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+endif
+ @touch .built
+
+# Standard housekeeping targets
+
+.context:
+ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+endif
+ @touch $@
+
+context: .context
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/NxWidgets/UnitTests/CTextBox/ctextboxtest.cxx b/NxWidgets/UnitTests/CTextBox/ctextboxtest.cxx
new file mode 100644
index 000000000..e54bd4e6a
--- /dev/null
+++ b/NxWidgets/UnitTests/CTextBox/ctextboxtest.cxx
@@ -0,0 +1,287 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CTextBox/ctextboxtest.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <cerrno>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "ctextboxtest.hxx"
+#include "cbgwindow.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// CTextBoxTest Method Implementations
+/////////////////////////////////////////////////////////////////////////////
+
+// CTextBoxTest Constructor
+
+CTextBoxTest::CTextBoxTest()
+{
+ m_bgWindow = (CBgWindow *)NULL;
+ m_nxFont = (CNxFont *)NULL;
+ m_text = (CNxString *)NULL;
+}
+
+// CTextBoxTest Descriptor
+
+CTextBoxTest::~CTextBoxTest()
+{
+ disconnect();
+}
+
+// Connect to the NX server
+
+bool CTextBoxTest::connect(void)
+{
+ // Connect to the server
+
+ bool nxConnected = CNxServer::connect();
+ if (nxConnected)
+ {
+ // Create the default font instance
+
+ m_nxFont = new CNxFont(NXFONT_DEFAULT,
+ CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+ if (!m_nxFont)
+ {
+ printf("CTextBoxTest::connect: Failed to create the default font\n");
+ }
+
+ // Set the background color
+
+ if (!setBackgroundColor(CONFIG_CTEXTBOXTEST_BGCOLOR))
+ {
+ printf("CTextBoxTest::connect: setBackgroundColor failed\n");
+ }
+ }
+
+ return nxConnected;
+}
+
+// Disconnect from the NX server
+
+void CTextBoxTest::disconnect(void)
+{
+ // Close the window
+
+ if (m_bgWindow)
+ {
+ delete m_bgWindow;
+ }
+
+ // Free the display string
+
+ if (m_text)
+ {
+ delete m_text;
+ m_text = (CNxString *)NULL;
+ }
+
+ // Free the default font
+
+ if (m_nxFont)
+ {
+ delete m_nxFont;
+ m_nxFont = (CNxFont *)NULL;
+ }
+
+ // And disconnect from the server
+
+ CNxServer::disconnect();
+}
+
+// Create the background window instance. This function illustrates
+// the basic steps to instantiate any window:
+//
+// 1) Create a dumb CWigetControl instance
+// 2) Pass the dumb CWidgetControl instance to the window constructor
+// that inherits from INxWindow. This will "smarten" the CWidgetControl
+// instance with some window knowlede
+// 3) Call the open() method on the window to display the window.
+// 4) After that, the fully smartened CWidgetControl instance can
+// be used to generate additional widgets by passing it to the
+// widget constructor
+
+bool CTextBoxTest::createWindow(void)
+{
+ // Initialize the widget control using the default style
+
+ m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+
+ // Get an (uninitialized) instance of the background window as a class
+ // that derives from INxWindow.
+
+ m_bgWindow = getBgWindow(m_widgetControl);
+ if (!m_bgWindow)
+ {
+ printf("CTextBoxTest::createGraphics: Failed to create CBgWindow instance\n");
+ delete m_widgetControl;
+ return false;
+ }
+
+ // Open (and initialize) the window
+
+ bool success = m_bgWindow->open();
+ if (!success)
+ {
+ printf("CTextBoxTest::createGraphics: Failed to open background window\n");
+ delete m_bgWindow;
+ m_bgWindow = (CBgWindow*)0;
+ return false;
+ }
+
+ return true;
+}
+
+// Create a CTextBox instance
+
+CTextBox *CTextBoxTest::createTextBox(void)
+{
+ // Get the width of the display
+
+ struct nxgl_size_s windowSize;
+ if (!m_bgWindow->getSize(&windowSize))
+ {
+ printf("CTextBoxTest::createGraphics: Failed to get window size\n");
+ return (CTextBox *)NULL;
+ }
+
+ // Create an empty CNxString instance to contain the C string
+
+ m_text = new CNxString();
+
+ // Get the height and width of the text display area. The width
+ // is half of the display width and the height is optimized for
+ // the font height
+
+ nxgl_coord_t textBoxWidth = windowSize.w >> 1;
+ nxgl_coord_t textBoxHeight = (nxgl_coord_t)m_nxFont->getHeight();
+
+ // The default CTextBox has borders enabled with thickness of one.
+ // Add twice the thickness of the border to the height.
+
+ textBoxHeight += 2 * 1;
+
+ // Pick an X/Y position such that the label will be centered in the display
+
+ nxgl_coord_t labelX = windowSize.w >> 2;
+ nxgl_coord_t labelY = (windowSize.h - textBoxHeight) >> 1;
+
+ // Now we have enough information to create the label
+
+ return new CTextBox(m_widgetControl, labelX, labelY, textBoxWidth, textBoxHeight, *m_text);
+}
+
+// Draw the label
+
+void CTextBoxTest::showTextBox(CTextBox *label)
+{
+ label->enable();
+ label->enableDrawing();
+ label->redraw();
+}
+
+// Inject simulated keyboard characters into NX.
+
+void CTextBoxTest::injectChars(CTextBox *textbox, int nCh, FAR const uint8_t *string)
+{
+ // nx_kbdin is meant to be called by keyboard handling software.
+ // Here we just inject the string under unit test control.
+
+ // First, get the server handle. Graphics software will never care
+ // about the server handle. Here we need it to get access to the
+ // low-level keyboard interface
+
+ NXHANDLE handle = getServer();
+
+ // The widget must have focus to receive keyboard input
+
+ m_widgetControl->setFocusedWidget(textbox);
+
+ // Inject the string one character at a time to get a more realistic
+ // simulation of keyboard behavior. Note the API nx_kbdin() could
+ // be used to inject the string in its entirety.
+
+ for (int i = 0; i < nCh; i++)
+ {
+ // Inject the next character
+
+ (void)nx_kbdchin(handle, string[i]);
+
+ // Widget events are normally handled in a modal loop (by calling goModal()).
+ // However, for this case we know when there should be keyboard events pending,
+ // events so we don't have to poll repeatedly. We can just perform a one pass
+ // poll
+
+ m_widgetControl->pollEvents(textbox);
+
+ // Sleep a bit, just for the effect (this also gives the X server loop a
+ // chance to run in the simulated environment.
+
+ usleep(500*1000);
+ }
+}
diff --git a/NxWidgets/UnitTests/CTextBox/ctextboxtest.hxx b/NxWidgets/UnitTests/CTextBox/ctextboxtest.hxx
new file mode 100644
index 000000000..2a839b06d
--- /dev/null
+++ b/NxWidgets/UnitTests/CTextBox/ctextboxtest.hxx
@@ -0,0 +1,152 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CTextBox/ctextboxtest.hxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __UNITTESTS_CTEXTBOX_CTEXTBOXTEST_HXX
+#define __UNITTESTS_CTEXTBOX_CTEXTBOXTEST_HXX
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <semaphore.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+#include "cbgwindow.hxx"
+#include "cnxserver.hxx"
+#include "cnxfont.hxx"
+#include "cnxstring.hxx"
+#include "ctextbox.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+// Configuration ////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HAVE_CXX
+# error "CONFIG_HAVE_CXX must be defined"
+#endif
+
+#ifndef CONFIG_CTEXTBOXTEST_BGCOLOR
+# define CONFIG_CTEXTBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKCOLOR
+#endif
+
+#ifndef CONFIG_CTEXTBOXTEST_FONTCOLOR
+# define CONFIG_CTEXTBOXTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+#endif
+
+// What is the entry point called?
+
+#ifdef CONFIG_NSH_BUILTIN_APPS
+# define MAIN_NAME ctextbox_main
+# define MAIN_STRING "ctextbox_main: "
+#else
+# define MAIN_NAME user_start
+# define MAIN_STRING "user_start: "
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Classes
+/////////////////////////////////////////////////////////////////////////////
+
+using namespace NXWidgets;
+
+class CTextBoxTest : public CNxServer
+{
+private:
+ CWidgetControl *m_widgetControl; // The controlling widget for the window
+ CNxFont *m_nxFont; // Default font
+ CBgWindow *m_bgWindow; // Background window instance
+ CNxString *m_text; // The label string
+
+public:
+ // Constructor/destructors
+
+ CTextBoxTest();
+ ~CTextBoxTest();
+
+ // Initializer/unitializer. These methods encapsulate the basic steps for
+ // starting and stopping the NX server
+
+ bool connect(void);
+ void disconnect(void);
+
+ // Create a window. This method provides the general operations for
+ // creating a window that you can draw within.
+ //
+ // Those general operations are:
+ // 1) Create a dumb CWigetControl instance
+ // 2) Pass the dumb CWidgetControl instance to the window constructor
+ // that inherits from INxWindow. This will "smarten" the CWidgetControl
+ // instance with some window knowlede
+ // 3) Call the open() method on the window to display the window.
+ // 4) After that, the fully smartened CWidgetControl instance can
+ // be used to generate additional widgets by passing it to the
+ // widget constructor
+
+ bool createWindow(void);
+
+ // Create a CTextBox instance. This method will show you how to create
+ // a CTextBox widget
+
+ CTextBox *createTextBox(void);
+
+ // Draw the label. This method illustrates how to draw the CTextBox widget.
+
+ void showTextBox(CTextBox *label);
+
+ // Inject simulated keyboard characters into NX.
+
+ void injectChars(CTextBox *textbox, int nCh, FAR const uint8_t *string);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Data
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif // __UNITTESTS_CTEXTBOX_CTEXTBOXTEST_HXX
diff --git a/NxWidgets/UnitTests/CTextBox/main.cxx b/NxWidgets/UnitTests/CTextBox/main.cxx
new file mode 100644
index 000000000..b5b8ec4d5
--- /dev/null
+++ b/NxWidgets/UnitTests/CTextBox/main.cxx
@@ -0,0 +1,141 @@
+/////////////////////////////////////////////////////////////////////////////
+// NxWidgets/UnitTests/CTextBox/main.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+// me be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Included Files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <nuttx/config.h>
+
+#include <nuttx/init.h>
+#include <cstdio>
+#include <unistd.h>
+#include <debug.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "ctextboxtest.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// Definitions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Classes
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// Private Data
+/////////////////////////////////////////////////////////////////////////////
+
+static const char string1[] = "Johhn ";
+static const char string2[] = "\b\b\bn Doe\r";
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Function Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+// Suppress name-mangling
+
+extern "C" int MAIN_NAME(int argc, char *argv[]);
+
+/////////////////////////////////////////////////////////////////////////////
+// Public Functions
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+// user_start/nxheaders_main
+/////////////////////////////////////////////////////////////////////////////
+
+int MAIN_NAME(int argc, char *argv[])
+{
+ // Create an instance of the font test
+
+ printf(MAIN_STRING "Create CTextBoxTest instance\n");
+ CTextBoxTest *test = new CTextBoxTest();
+
+ // Connect the NX server
+
+ printf(MAIN_STRING "Connect the CTextBoxTest instance to the NX server\n");
+ if (!test->connect())
+ {
+ printf(MAIN_STRING "Failed to connect the CTextBoxTest instance to the NX server\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a window to draw into
+
+ printf(MAIN_STRING "Create a Window\n");
+ if (!test->createWindow())
+ {
+ printf(MAIN_STRING "Failed to create a window\n");
+ delete test;
+ return 1;
+ }
+
+ // Create a CTextBox instance
+
+ CTextBox *textbox = test->createTextBox();
+ if (!textbox)
+ {
+ printf(MAIN_STRING "Failed to create a text box\n");
+ delete test;
+ return 1;
+ }
+
+ // Show the text box
+
+ test->showTextBox(textbox);
+
+ // Wait a bit, then inject a string with a typo
+
+ sleep(1);
+ test->injectChars(textbox, sizeof(string1), (FAR const uint8_t*)string1);
+
+ // Now fix the string with backspaces and finish it correctly
+
+ usleep(500*1000);
+ test->injectChars(textbox, sizeof(string2), (FAR const uint8_t*)string2);
+
+ // Clean up and exit
+
+ sleep(2);
+ printf(MAIN_STRING "Clean-up and exit\n");
+ delete textbox;
+ delete test;
+ return 0;
+}
+
diff --git a/NxWidgets/UnitTests/README.txt b/NxWidgets/UnitTests/README.txt
new file mode 100644
index 000000000..b0f3c9aab
--- /dev/null
+++ b/NxWidgets/UnitTests/README.txt
@@ -0,0 +1,394 @@
+README
+======
+
+This directory contains a collection of Unit Tests that can be used to verify
+NXWidgets.:
+
+Contents
+========
+ o Installing and Building the Unit Tests
+ 1. Setup NuttX
+ a) Configure NuttX
+ b) Enable C++ Support
+ c) Enable Debug Options
+ d) Other Possible nuttx/.config changes
+ e) Other Possible apps/.config changes
+ 2. Configure in the Selected Unit Test
+ o Work-Arounds
+ 1. Build Issues
+ 2. Stack Size Issues with the X11 Simulation
+ o Theory of Operation
+ o Unit Test Directories
+ o Example
+
+Installing and Building the Unit Tests
+======================================
+
+1. Setup NuttX
+
+ a) Configure NuttX
+
+ Configure NuttX to run one of the target configurations. For example,
+ let's assume that you are using the sim/nsh2 configuration. The sim/nsh2
+ configuration was specially created for use NXWidgets on the simulation
+ platform. A similar, special configuration stm3210e-eval/nsh2 is also
+ for the STM3210E-EVAL available. However, the unit test can be run on
+ other configurations (see steps d and e below).
+
+ We will assume the sim/nsh2 configuration in this discussion. The
+ sim/nsh2 configuration is installed as follows:
+
+ cd <nuttx-directory-path>
+ make distclean
+ cd tools
+ ./configure.sh sim/nsh2
+
+ Where:
+
+ <nuttx-directory-path> is the full, absolute path to the NuttX build directory
+
+ If you are using the sim/nsh2 or stm3210e-eval configurations, then skip
+ to step 2.
+
+ There may be certain requirements for the configuration that you select...
+ for example, certain widget tests may require touchscreen support or special
+ font selections. These test-specific requirements are addressed below under
+ "Unit Test Directories"
+
+ b) Enable C++ Support
+
+ If you are not using the sim/nsh2 or stm3210e-eval, you will need to add
+ the following definitions to the nuttx configuration at nuttx/.config to
+ enable C++ support:
+
+ CONFIG_HAVE_CXX=y
+
+ Check first, some configurations already have C++ support enabled (As of this
+ writing *ONLY* the sim/nsh2 and stm321-e-eval configurations have C++ support
+ pre-enabled).
+
+ c) Enable Debug Options
+
+ If you are running on a simulated target, then you might also want to
+ enable debug symbols:
+
+ CONFIG_DEBUG_SYMBOLS=y
+
+ Then you can run the simulation using GDB or DDD which is a very powerful
+ debugging environment!
+
+ d) Other nuttx/.config changes -- NSH configurations only.
+
+ If the configuration that you are using supports NSH and NSH built-in tasks
+ then all is well. If it is an NSH configuration, then you will have to define
+ the following in your nuttx/.config file as well (if it is not already defined):
+
+ CONFIG_NSH_BUILTIN_APPS=y
+
+ sim/nsh2 and stm3210e-eval/nsh2 already has this setting. You do not need
+ to change anything further in the nuttx/.config file if you are using either
+ of these configurations.
+
+ e) Other apps/.config changes -- NON-NSH configurations only.
+
+ For non-NSH configurations (such as the sim/touchscreen) you will have to
+ remove the CONFIGURED_APPS seting that contains the user_start function so
+ that you use the user_start in the unit test code instead. So, for example,
+ with the sim/touchscreen configuration you need to remove the following from
+ the apps/.config file:
+
+ CONFIGURED_APPS += examples/<example> ## REMOVE
+
+ The following step will then install the new, correct directory containing
+ the user_start function for the selected unit test. If you see that NSH
+ is configured:
+
+ CONFIGURED_APPS += examples/nsh ## DO NOT REMOVE
+
+ Then DO NOT REMOVE the CONFIGURED_APPS setting. Go back and re-read c)
+ above. Do either c) or d). Don't do both!
+
+ sim/nsh2 and stm3210e-eval/nsh2 both NSH configurations. You do not need
+ to change anything further in the apps/.config file for any NSH configuration.
+
+2. Configure/Install the Selected Unit Test
+
+ Then reconfigure that to use the Unit Test of your choice:
+
+ cd <raztek-nxwidgets-directory>/trunk/UnitTests/tools
+ ./install.sh <apps-directory-path> <test-sub-directory>
+
+ Where:
+
+ <apps-directory-path> is the full, absolute path to the NuttX apps/ directory
+ <test-sub-directory> is the name of a sub-directory in the UnitTests directory
+
+3. Instantiate the Configuration
+
+ Before we can make the NXWidgets Library, we have to instantiate the NuttX
+ configuration with the installed unit test:
+
+ cd <nuttx-directory-path>
+ . ./setenv.sh
+ make context
+
+ This will create auto-generated files and will setup symbolic links needed
+ in order to build the NXWidgets Library.
+
+4. Adjust the Stack Size
+
+ If using an simulation configuration (like sim/nsh2) and your unit test
+ uses X11 as its display device, then you would have to increase the size
+ of unit test stack as described below under "Stack Size Issues with the
+ X11 Simulation."
+
+5. Build the NXWidgets Library
+
+ cd <raztek-nxwidgets-directory>/trunk/NXWidgets/libnxwidgets
+ make TOPDIR=<nuttx-directory-path>
+
+6. Build NuttX including the unit test and the NXWidget library
+
+ cd <nuttx-directory-path>
+ . ./setenv.sh
+ make
+
+Work-Arounds
+============
+
+Build Issues
+------------
+1. I have seen this error on Cygwin building C++ code:
+
+ LD: nuttx.rel
+ ld: skipping incompatible /home/patacongo/projects/nuttx/nuttx/trunk/nuttx/libxx//liblibxx.a when searching for -llibxx
+ ld: cannot find -llibxx
+
+ The problem seems to be caused because gcc build code for 32-bit mode and g++ builds code for 64-bit mode. Add the -m32 option to the g++ command line seems to fix the problem. In Make.defs:
+
+ CXXFLAGS = -m32 $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+
+2. Stack Size Issues with the X11 Simulation
+
+ When you run the NuttX simulation, it uses stacks allocated by NuttX from the
+ NuttX heap. The memory management model is exactly the same in the simulation
+ as it is real, target system. This is good because this produces a higher
+ fidelity simulation.
+
+ However, when the simulation calls into Linux/Cygwin libraries, it will still
+ use these small simulation stacks. This happens, for example, when you call
+ into the system to get and put characters to the console window or when you
+ make x11 calls into the system. The programming model within those libraries
+ will assume a Linux/Cygwin environment where the stack size grows dynamically
+
+ As a consequence, those system libraries may allocate large data structures
+ on the stack and overflow the small NuttX stacks. X11, in particular,
+ requires large stacks. If you are using X11 in the simulation, make sure
+ that you set aside a "lot" of stack for the X11 system calls (maybe 8 or 16Kb).
+ The stack size for the thread that begins with user start is controlled
+ by the configuration setting CONFIG_USERMAIN_STACKSIZE; you may need to
+ increase this value to larger number to survive the X11 system calls.
+
+ If you are running X11 applications as NSH add-on programs, then the stack
+ size of the add-on program is controlled in another way. Here are the
+ steps for increasing the stack size in that case:
+
+ cd ../apps/namedapps # Go to the namedapps directory
+ vi namedapps_list.h # Edit this file and increase the stack size of the add-on
+ rm .built *.o # This will force the namedapps logic to rebuild
+
+Theory Of Operation
+===================
+
+The NuttX application Makefile at apps/Makefile has some special hooks for
+building "external" applications. In particular, it will automatically
+build in the contents any directory call "external/" that may appear in the
+apps/ directory. There is no external/ directory in the repository. Rather,
+this directory may be provided by the user (possibly as a symbolic link) to
+add libraries and applications to the standard build from the repository.
+
+The script at tools/install.sh, then, just does a lot of careful validation and
+sanity checking. Then it installs the UnitTest test sub-directory in the apps/
+directory by creating a symbolic link in the apps/ directory call "external".
+That symbolic link will refer to the selected UnitTest sub-directory.
+
+UnitTests
+=========
+
+The following provide simple unit tests for each of the NXWidgets. In
+addition, these unit tests provide examples for the use of each widget
+type.
+
+CButton
+ Exercises the CButton widget
+ Depends on CLabel
+
+CButtonArray
+ Exercises the CButtonArray widget
+
+CCheckBox
+ Exercises the CCheckBox widget
+ Depends on CLabel and CButton.
+
+CGlyphButton
+ Exercises the CGlyphButton widget.
+ Depends on CLabel and CButton.
+
+CImage
+ Exercises the CImage widget
+
+CLabel
+ Exercises the CLabel widget
+
+CProgressBar
+ Exercises the CProgressBar widget
+
+CRadioButton
+ Exercises the CRadioButton and CRadioButtonGroup widgets.
+ Depends on CLabel and CButton
+
+CScrollBarHorizontal
+ Exercises the ScrollbarHorizontal
+ Depends on CSliderHorizontal and CGlyphButton
+
+CScrollBarVertical
+ Exercises the ScrollbarHorizontal
+ Depends on CSliderVertical and CGlyphButton
+
+CSliderHorizontal
+ Exercises the CSliderHorizontal
+ Depends on CSliderHorizontalGrip
+
+CSliderVertical
+ Exercises the CSliderVertical
+ Depends on CSliderVerticalGrip
+
+CTextBox
+ Exercises the CTextBox widget
+ Depends on CLabel
+
+Example
+=======
+
+1. Configure sim/nsh2
+ Where: nuttx and nuttx/tools directory
+
+ $ cd tools/
+ $ ./configure.sh sim/nsh2
+ $ cd -
+
+2. Edit nuttx/.config to enable C++ support
+
+ Do nothing... sim/nsh2 already has C++ support enabled.
+
+3. Install the CButton C++ application (for example)
+ Where: NXWidgets/trunk/UnitTests/tool
+
+ $ ./install.sh ~/projects/nuttx/nuttx/trunk/apps/ CButton
+ /home/patacongo/projects/nuttx/nuttx/trunk/apps//external already exists...
+ Removing the old symbolic link.
+ Creating symbolic link
+ - To /home/patacongo/projects/nuttx/gui/raztek-nxwidgets/trunk/UnitTests/tools/../CButton
+ - At /home/patacongo/projects/nuttx/nuttx/trunk/apps//external
+
+4. Instantiate the Configuration
+ Where: nuttx directory
+
+ $ cd /home/patacongo/projects/nuttx/nuttx/trunk/nuttx
+ $ . ./setenv.sh
+ $ make context
+
+ This will create auto-generated files and will setup symbolic links needed
+ in order to build the NXWidgets Library.
+
+6. Adjust the Stack Size
+
+ If using an simulation configuration (like sim/nsh2) and your unit test
+ uses X11 as its display device, then you would have to increase the size
+ of unit test stack as described above under "Stack Size Issues."
+
+7. Build the NXWdigets Library
+ Where XWidgets/trunk/NXWidgets/libnxwidgets
+
+ $ cd /home/patacongo/projects/nuttx/gui/raztek-nxwidgets/trunkXWidgets/libnxwidgets
+ $ make TOPDIR=/home/patacongo/projects/nuttx/nuttx/trunk/nuttx
+
+8. Build NuttX
+ Where: nuttx directory
+
+ $ cd /home/patacongo/projects/nuttx/nuttx/trunk/nuttx
+ $ make
+ ...
+
+8. Run the "bringup" task:
+
+ a. Start NuttX
+ Where: nuttx directory
+
+ ./nuttx
+
+ NuttShell (NSH) NuttX-6.9
+ nsh>
+
+ b. Execute NuttX
+ Where: NSH command prompt
+
+ NOTE that when you run NSH as a simulation, the commands are echoed
+ twice -- once by Linux/Cygwin and once by NuttX:
+
+ nsh> help
+ help
+ ...
+ Builtin Apps:
+ nx
+ nxhello
+ tc
+ bringup
+ nsh> bringup
+ bringup
+ bringup [2:128]
+
+ c. Then do a kludgy thing
+ Where: NSH command prompt
+
+ The I/O with the Linux/Cygwin simulation is blocking. So while NSH is
+ waiting for input nothing can run (see configs/sim/README.txt for more info).
+ One way to make NSH stop asking for input is to sleep.
+
+ nsh> sleep 10
+ sleep 10
+
+ NOTE 1: This is not a problem if CONFIG_SCHED_WAITPID is defined in the
+ configuration file. If CONFIG_SCHED_WAITPID is defined, NSH will wait
+ for the unit test to complete and it will not be necessary to sleep.
+
+ NOTE 2: CONFIG_SCHED_WAITPID is defined in the sim/nsh2 configuration
+ so you can probably ignore this kludgy thing.
+
+ d. The Unit Test runs
+
+ As soon as NSH sleeps, the unit test will run:
+
+ bringup_main: Saying hello from the dynamically constructed instance
+ CHelloWorld::HelloWorld: Hello, World!!
+ bringup_main: Saying hello from the instance constructed on the stack
+ CHelloWorld::HelloWorld: Hello, World!!
+ bringup_main: Saying hello from the statically constructed instance
+ CHelloWorld::HelloWorld: Hello, World!!
+
+8. Debugging
+ Where: nuttx directory
+
+ In the simulation (only) you can use GDB or, better, the graphic
+ front-end DDD to debug the code. Most embedded targets do not
+ have good debugging capabilities.
+
+ In order to debug, you have to have build with CONFIG_DEBUG_SYMBOLS=y.
+ This setting is preselected in the sim/nsh2 configuration so that
+ you don't have to do anything.
+
+ Then under Linux or in a Cygwin X11 window, you can start the graphic
+ debugger like:
+
+ ddd nuttx &
diff --git a/NxWidgets/UnitTests/tools/addobjs.sh b/NxWidgets/UnitTests/tools/addobjs.sh
new file mode 100755
index 000000000..e998cfc64
--- /dev/null
+++ b/NxWidgets/UnitTests/tools/addobjs.sh
@@ -0,0 +1,141 @@
+#!/bin/bash
+#################################################################################
+# NxWidgets/UnitTests/tools/addobjs.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+# set -x
+
+# Get input parameters
+
+usage="Usage: $0 [OPTIONS] <lib-path> <obj-dir>"
+advice="Try '$0 -h' for more information"
+
+unset prefix
+wintool=n
+
+while [ ! -z "$1" ]; do
+ case $1 in
+ -d )
+ set -x
+ ;;
+ -p )
+ shift
+ prefix=$1
+ ;;
+ -w )
+ wintool=y
+ ;;
+ -h )
+ echo "$0 will add all object (.o) files in directory to an archive."
+ echo ""
+ echo $usage
+ echo ""
+ echo "Where:"
+ echo " <alib-path> is the full, absolute path to the library to use"
+ echo " <obj-dir> is full path to the directory containing the object files to be added"
+ echo "OPTIONS include:"
+ echo " -p Prefix to use. For example, to use arm-elf-ar, add '-p arm-elf-'"
+ echo " -w Use Windows style paths insted of POSIX paths"
+ echo " -d Enable script debug"
+ echo " -h Show this usage information"
+ exit 0
+ ;;
+ * )
+ break;
+ ;;
+ esac
+ shift
+done
+
+libpath=$1
+objdir=$2
+archiver="${prefix}"ar
+
+# Verify input parameters
+
+if [ -z "${libpath}" ]; then
+ echo "Missing required arguments"
+ echo ""
+ echo $usage
+ echo $advice
+ exit 1
+fi
+
+if [ -z "${objdir}" ]; then
+ echo "Missing required argument <obj-dir>"
+ echo ""
+ echo $usage
+ echo $advice
+ exit 1
+fi
+
+if [ ! -w ${libpath} ]; then
+ if [ -e ${libpath} ]; then
+ echo "${libpath} exists but is not a write-able file"
+ echo $advice
+ else
+ echo "${libpath} does not exist"
+ echo $advice
+ fi
+ exit 1
+fi
+
+if [ ! -d ${objdir} ]; then
+ if [ -e ${objdir} ]; then
+ echo "${objdir} exists but is not a directory"
+ echo $advice
+ else
+ echo "${objdir} does not exist"
+ echo $advice
+ fi
+ exit 1
+fi
+
+# Add each object file in <obj-dir> to the archive at <lib-path>
+
+for obj in `ls "${objdir}"/*.o`; do
+ name=`basename "${obj}"`
+ if [ "X${wintool}" = "Xy" ]; then
+ objpath=`cygpath -w "${obj}"`
+ else
+ objpath=${obj}
+ fi
+ echo "AR: ${name}"
+ ${archiver} rcs ${libpath} ${objpath} || \
+ { echo "Failed to archive the object file:"; \
+ echo " Archive: ${libpath}"; \
+ echo " Object: ${obj}"; \
+ exit 1; \
+ }
+done \ No newline at end of file
diff --git a/NxWidgets/UnitTests/tools/install.sh b/NxWidgets/UnitTests/tools/install.sh
new file mode 100755
index 000000000..3ba086aff
--- /dev/null
+++ b/NxWidgets/UnitTests/tools/install.sh
@@ -0,0 +1,152 @@
+#!/bin/bash
+#################################################################################
+# NxWidgets/UnitTests/tools/install.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+#
+# set -x
+# Functions
+
+function ShowUsage()
+{
+ echo ""
+ echo "USAGE: $0 <apps-directory-path> <test-sub-directory>"
+ echo ""
+ echo "Where:"
+ echo " <apps-directory-path> is the full, absolute path to the NuttX apps/ directory"
+ echo " <test-sub-directory> is the name of a sub-directory in the UnitTests directory"
+ echo ""
+}
+
+function ShowTests()
+{
+ for testdir in ${UNITTEST_DIRPATH}/*; do
+ subdir=`basename ${testdir}`
+ if [ -d "${UNITTEST_DIRPATH}/${subdir}" ]; then
+ if [ -f "${UNITTEST_DIRPATH}/${subdir}/Makefile" ]; then
+ echo $subdir
+ fi
+ fi
+ done
+}
+
+# Input parameters
+
+APPS_DIRPATH=$1
+TEST_SUBDIR=$2
+
+if [ -z "${APPS_DIRPATH}" ]; then
+ echo "Missing required arguments"
+ ShowUsage
+ exit 1
+fi
+
+if [ -z "${TEST_SUBDIR}" ]; then
+ echo "Missing required argument <test-sub-directory>"
+ ShowUsage
+ exit 1
+fi
+
+# Make sure that we know where we are and where we are going
+
+WD=`pwd`
+if [ -x install.sh ]; then
+ UNITTEST_DIRPATH="${WD}/.."
+ TOOLS_DIRPATH="${WD}"
+else
+ if [ -x tools/install.sh ]; then
+ UNITTEST_DIRPATH="${WD}"
+ TOOLS_DIRPATH="${WD}/tools"
+ else
+ echo "This script must be executed in the UnitTest or UnitTest/tools directory"
+ ShowUsage
+ exit 1
+ fi
+fi
+
+if [ ! -d "${APPS_DIRPATH}" ]; then
+ echo "Directory ${APPS_DIRPATH} does not exist"
+ ShowUsage
+ exit 1
+fi
+
+if [ ! -f "${APPS_DIRPATH}/Makefile" ]; then
+ echo "Directory ${APPS_DIRPATH} does not look like a NuttX apps directory"
+ ShowUsage
+ exit 1
+fi
+
+TEST_PATH="${UNITTEST_DIRPATH}/${TEST_SUBDIR}"
+if [ ! -d "${TEST_PATH}" ]; then
+ echo "Directory ${TEST_PATH} does not exist"
+ ShowUsage
+ ShowTests
+ exit 1
+fi
+
+if [ ! -f "${TEST_PATH}/Makefile" ]; then
+ echo "Directory ${TEST_PATH} does not look like a unit test directory"
+ ShowUsage
+ ShowTests
+ exit 1
+fi
+
+# Check if the symbolic link "external" exists in the NuttX apps directory
+
+if [ -e "${APPS_DIRPATH}/external" ]; then
+ echo "${APPS_DIRPATH}/external already exists..."
+ if [ -h "${APPS_DIRPATH}/external" ]; then
+ echo " Removing the old symbolic link."
+ rm "${APPS_DIRPATH}/external" || \
+ { echo " ERROR: Failed to remove old symbolic link"; \
+ exit 1;
+ }
+ else
+ echo " ERROR: But it is not a symbolic link!"
+ echo " Please remove ${APPS_DIRPATH}/external"
+ echo " and run this script again"
+ fi
+fi
+
+# Then set up the symbolic link "external" in the NuttX apps to point to the
+# UnitTest subdirectory
+
+echo "Creating symbolic link"
+echo " - To ${TEST_PATH}"
+echo " - At ${APPS_DIRPATH}/external"
+
+ln -s "${TEST_PATH}" "${APPS_DIRPATH}/external" || \
+ { echo "Failed to create symbollic link"; \
+ exit 1;
+ }
+
diff --git a/NxWidgets/libnxwidgets/COPYING b/NxWidgets/libnxwidgets/COPYING
new file mode 100644
index 000000000..5e78c2ac2
--- /dev/null
+++ b/NxWidgets/libnxwidgets/COPYING
@@ -0,0 +1,70 @@
+/********************************************************************************
+ * NxWidgets
+ * Graphical Widgets for the NuttX RTOS
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *******************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in almost all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ********************************************************************************/
+ \ No newline at end of file
diff --git a/NxWidgets/libnxwidgets/Makefile b/NxWidgets/libnxwidgets/Makefile
new file mode 100644
index 000000000..e3ff57339
--- /dev/null
+++ b/NxWidgets/libnxwidgets/Makefile
@@ -0,0 +1,135 @@
+#################################################################################
+# NxWidgets/libnxwidgets/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+# me be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+
+NXWDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+
+
+ASRCS =
+CSRCS =
+# Infrastructure
+CXXSRCS = cbitmap.cxx cbgwindow.cxx ccallback.cxx cgraphicsport.cxx
+CXXSRCS += clistdata.cxx clistdataitem.cxx cnxfont.cxx
+CXXSRCS += cnxserver.cxx cnxstring.cxx cnxtimer.cxx cnxwidget.cxx cnxwindow.cxx
+CXXSRCS += cnxtkwindow.cxx cnxtoolbar.cxx crect.cxx crectcache.cxx
+CXXSRCS += crlepalettebitmap.cxx cstringiterator.cxx ctext.cxx cwidgetcontrol.cxx
+CXXSRCS += cwidgeteventhandlerlist.cxx singletons.cxx
+# Widget APIs
+CXXSRCS += cbutton.cxx cbuttonarray.cxx ccheckbox.cxx ccyclebutton.cxx
+CXXSRCS += cglyphbutton.cxx cimage.cxx ckeypad.cxx clabel.cxx clatchbutton.cxx
+CXXSRCS += clatchbuttonarray.cxx clistbox.cxx clistboxdataitem.cxx cmultilinetextbox.cxx
+CXXSRCS += cprogressbar.cxx cradiobutton.cxx cradiobuttongroup.cxx cscrollbarhorizontal.cxx
+CXXSRCS += cscrollbarpanel.cxx cscrollbarvertical.cxx cscrollinglistbox.cxx
+CXXSRCS += cscrollingpanel.cxx cscrollingtextbox.cxx csliderhorizontal.cxx
+CXXSRCS += csliderhorizontalgrip.cxx cslidervertical.cxx csliderverticalgrip.cxx
+CXXSRCS += cstickybutton.cxx cstickybuttonarray.cxx ctextbox.cxx
+# Images
+CXXSRCS += glyph_nxlogo.cxx
+CXXSRCS += glyph_arrowdown.cxx glyph_checkboxon.cxx glyph_screendepthup.cxx
+CXXSRCS += glyph_arrowleft.cxx glyph_control.cxx glyph_screenflipdown.cxx
+CXXSRCS += glyph_arrowright.cxx glyph_cycle.cxx glyph_screenflipup.cxx
+CXXSRCS += glyph_arrowup.cxx glyph_radiobuttonoff.cxx glyph_shift.cxx
+CXXSRCS += glyph_backspace.cxx glyph_radiobuttonmu.cxx glyph_windowclose.cxx
+CXXSRCS += glyph_capslock.cxx glyph_radiobuttonon.cxx glyph_windowdepthdown.cxx
+CXXSRCS += glyph_checkboxmu.cxx glyph_return.cxx glyph_windowdepthup.cxx
+CXXSRCS += glyph_checkboxoff.cxx glyph_screendepthdown.cxx
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+BIN = libnxwidgets$(LIBEXT)
+
+CFLAGS += -I include
+CXXFLAGS += -I include
+DEPPATH = --dep-path src
+VPATH = src
+
+all: $(BIN)
+.PHONY = check_nuttx depend clean distclean export
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+check_nuttx:
+ @( \
+ if [ -z "$(TOPDIR)" ]; then \
+ echo "The path to the nuttx directory must be provided on the command line."; \
+ echo "Usage: make -C $(NXWDIR) TOPDIR=\"<nuttx directory>\""; \
+ exit 1; \
+ fi; \
+ if [ ! -d "$(TOPDIR)" ]; then \
+ echo "The nuttx directory (TOPDIR) does not exist: $(TOPDIR)"; \
+ exit 1; \
+ fi; \
+ if [ ! -f "$(TOPDIR)/.config" ]; then \
+ echo "The nuttx directory (TOPDIR) has not been configured"; \
+ echo "Please configure NuttX and try again"; \
+ exit 1; \
+ fi; \
+ )
+
+$(BIN): check_nuttx $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f $(BIN) *.a *.o *~ .*.sw*
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+export: $(BIN)
+ zip -r nxwidgets-export.zip include $(BIN) COPYING
+
+-include Make.dep
diff --git a/NxWidgets/libnxwidgets/include/cbgwindow.hxx b/NxWidgets/libnxwidgets/include/cbgwindow.hxx
new file mode 100644
index 000000000..1f8e417af
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cbgwindow.hxx
@@ -0,0 +1,314 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cbgwindow.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CBGWINDOW_HXX
+#define __INCLUDE_CBGWINDOW_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "ccallback.hxx"
+#include "inxwindow.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class INxWindow;
+ struct SBitmap;
+
+ /**
+ * This class defines operations on a the NX background window.
+ * There are three instances that represent an NX window from the
+ * perspective of NXWidgets.
+ *
+ * - There is one widget control instance per NX window,
+ * - One CCallback instance per window,
+ * - One window instance.
+ *
+ * There a various kinds of of window instances, but each inherits
+ * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
+ * that describes the common window behavior.
+ */
+
+ class CBgWindow : protected CCallback, public INxWindow
+ {
+ private:
+ NXHANDLE m_hNxServer; /**< Handle to the NX server. */
+ NXWINDOW m_hWindow; /**< Handle to the NX background window */
+ CWidgetControl *m_widgetControl; /**< The controlling widget for the window */
+
+ public:
+
+ /**
+ * Constructor. Obtains the background window from server and wraps
+ * the window as CBgWindow. Creates an uninitialized instance of the
+ * CBgWindow object. The open() method must be called to initialize
+ * the instance.
+ *
+ * The general steps to create any window include:
+ * 1) Create a dumb CWigetControl instance
+ * 2) Pass the dumb CWidgetControl instance to the window constructor
+ * that inherits from INxWindow.
+ * 3) The window constructor call CWidgetControl methods to "smarten"
+ * the CWidgetControl instance with window-specific knowledge.
+ * 4) Call the open() method on the window to display the window.
+ * 5) After that, the fully smartend CWidgetControl instance can
+ * be used to generate additional widgets.
+ * 6) After that, the fully smartened CWidgetControl instance can
+ * be used to generate additional widgets by passing it to the
+ * widget constructor
+ *
+ * @param hNxServer Handle to the NX server.
+ * @param widgetControl Controlling widget for this window.
+ */
+
+ CBgWindow(NXHANDLE hNxServer, CWidgetControl *widgetControl);
+
+ /**
+ * Destructor. Returns the background window to the server.
+ */
+
+ virtual ~CBgWindow(void);
+
+ /**
+ * Creates a the new window. Window creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the window was successfully created.
+ */
+
+ bool open(void);
+
+ /**
+ * Request the position and size information of the window. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool requestPosition(void);
+
+ /**
+ * Get the position of the window (as reported by the NX callback). NOTE:
+ * The background window is always positioned at {0,0}
+ *
+ * @return The position.
+ */
+
+ bool getPosition(FAR struct nxgl_point_s *pPos);
+
+ /**
+ * Get the size of the window (as reported by the NX callback). NOTE:
+ * The size of the background window is always the entire display.
+ *
+ * @return The size.
+ */
+
+ bool getSize(FAR struct nxgl_size_s *pSize);
+
+ /**
+ * Set the position and size of the window.
+ *
+ * @param pPos The new position of the window.
+ * @return True on success, false on any failure.
+ */
+
+ bool setPosition(FAR const struct nxgl_point_s *pPos);
+
+ /**
+ * Set the size of the selected window. NOTE: The size of the
+ * background window is always the entire display and cannot be
+ * changed.
+ *
+ * @param pSize The new size of the window.
+ * @return True on success, false on any failure.
+ */
+
+ bool setSize(FAR const struct nxgl_size_s *pSize);
+
+ /**
+ * Bring the window to the top of the display. NOTE: The background
+ * window cannot be raised.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool raise(void);
+
+ /**
+ * Lower the window to the bottom of the display. NOTE: The background
+ * window is always at the bottom of the window hierarchy.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool lower(void);
+
+ /**
+ * Set an individual pixel in the window with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified rectangle in the window with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+ void getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest);
+
+ /**
+ * Fill the specified trapezoidal region in the window with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to window (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified line in the window with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+ bool drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Move a rectangular region within the window.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset);
+
+ /**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified window.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in window coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CBGWINDOW_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cbitmap.hxx b/NxWidgets/libnxwidgets/include/cbitmap.hxx
new file mode 100644
index 000000000..473403aa8
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cbitmap.hxx
@@ -0,0 +1,204 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cbitmap.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CBITMAP_HXX
+#define __INCLUDE_CBITMAP_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "ibitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Bitmap Structure
+ */
+
+ struct SBitmap
+ {
+ uint8_t bpp; /**< Bits per pixel */
+ uint8_t fmt; /**< Color format */
+ nxgl_coord_t width; /**< Width in pixels */
+ nxgl_coord_t height; /**< Height in rows */
+ uint16_t stride; /**< Width in bytes */
+ FAR const void *data; /**< Pointer to the beginning of pixel data */
+ };
+
+ /**
+ * Class providing bitmap accessor for a bitmap represented by SBitmap.
+ */
+
+ class CBitmap : public IBitmap
+ {
+ protected:
+ const struct SBitmap *m_bitmap; /**< The bitmap that is being managed */
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CBitmap(const CBitmap &bitmap) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param bitmap The bitmap structure being wrapped.
+ */
+
+ CBitmap(const struct SBitmap *bitmap);
+
+ /**
+ * Destructor.
+ */
+
+ inline ~CBitmap(void) {}
+
+ /**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's width.
+ */
+
+ const uint8_t getColorFormat(void) const;
+
+ /**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's color format.
+ */
+
+ const uint8_t getBitsPerPixel(void) const;
+
+ /**
+ * Get the bitmap's width (in pixels/columns).
+ *
+ * @return The bitmap's pixel depth.
+ */
+
+ const nxgl_coord_t getWidth(void) const;
+
+ /**
+ * Get the bitmap's height (in rows).
+ *
+ * @return The bitmap's height.
+ */
+
+ const nxgl_coord_t getHeight(void) const;
+
+ /**
+ * Get the bitmap's width (in bytes).
+ *
+ * @return The bitmap's width.
+ */
+
+ const nxgl_coord_t getStride(void) const;
+
+ /**
+ * Get one row from the bit map image.
+ *
+ * @param x The offset into the row to get
+ * @param y The row number to get
+ * @param width The number of pixels to get from the row
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ * @param True if the run was returned successfully.
+ */
+
+ bool getRun(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ FAR void *data);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CBITMAP_HXX
diff --git a/NxWidgets/libnxwidgets/include/cbutton.hxx b/NxWidgets/libnxwidgets/include/cbutton.hxx
new file mode 100644
index 000000000..4af39f0ef
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cbutton.hxx
@@ -0,0 +1,235 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cbutton.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CBUTTON_HXX
+#define __INCLUDE_CBUTTON_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "clabel.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+
+ /**
+ * Clickable button widget. Displays text within the button.
+ */
+
+ class CButton : public CLabel
+ {
+ protected:
+
+ /**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ */
+
+ virtual void drawOutline(CGraphicsPort *port);
+
+ /**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ * @param useClicked Present outline using the 'clicked' style
+ */
+
+ void drawOutline(CGraphicsPort *port, bool useClicked);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param useClicked Present contents using the 'clicked' style
+ * @see redraw()
+ */
+
+ void drawContents(CGraphicsPort *port, bool useClicked);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param useClicked Present border using the 'clicked' style
+ * @see redraw()
+ */
+
+ void drawBorder(CGraphicsPort *port, bool useClicked);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raises an action event and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CButton(const CButton &button) : CLabel(button) { }
+
+ public:
+
+ /**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param text The text for the button to display.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CButton(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height, const CNxString &text,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * CButton Destructor.
+ */
+
+ virtual inline ~CButton() { }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CBUTTON_HXX
diff --git a/NxWidgets/libnxwidgets/include/cbuttonarray.hxx b/NxWidgets/libnxwidgets/include/cbuttonarray.hxx
new file mode 100644
index 000000000..d5f8be449
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cbuttonarray.hxx
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cbuttonarray.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CBUTTONARRAY_HXX
+#define __INCLUDE_CBUTTONARRAY_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "clabel.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ class CNxString;
+
+ /**
+ * Manages a two-dimensional array of buttons as one widget. A two-
+ * dimensional array of buttons might also be called a "keyboard".
+ */
+
+ class CButtonArray : public CNxWidget
+ {
+ protected:
+ uint8_t m_buttonColumns; /**< The number of columns in one row */
+ uint8_t m_buttonRows; /**< The number buttons in one column */
+ bool m_redrawButton; /**< True: Redraw button; False: redraw all */
+ bool m_cursorOn; /**< Cursor on; hightlighted button displayed */
+ bool m_cursorChange; /**< True: Redraw cursor button only */
+ nxgl_coord_t m_buttonWidth; /**< The width of one button in pixels */
+ nxgl_coord_t m_buttonHeight; /**< The height of one button in rows */
+ nxgl_coord_t m_clickX; /**< The X position of the last clicked button */
+ nxgl_coord_t m_clickY; /**< The Y position of the last clicked button */
+ uint8_t m_cursorColumn; /**< The column index of the highlighted button */
+ uint8_t m_cursorRow; /**< The row index of the highlighted button */
+ CNxString *m_buttonText; /**< Text for each button */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Redraw only one button
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param column The button column index
+ * @param row The button row index
+ * @param useClicked Draw the button using the 'clicked' button style,
+ * regardless of the actual button state.
+ * @see onClick() and onRelease()
+ */
+
+ virtual void drawButton(CGraphicsPort *port, int column, int row, bool useClicked);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raises an action event and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Convert an X/Y position to a button column/row index
+ *
+ * @param x The x position
+ * @param y The y position
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return false is the position is invalid
+ */
+
+ virtual bool posToButton(nxgl_coord_t x, nxgl_coord_t y, int &column, int &row);
+
+ /**
+ * Updates the GUI after the text has changed.
+ */
+
+ virtual void onTextChange(void);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CButtonArray(const CButtonArray &button) : CNxWidget(button) { }
+
+ public:
+
+ /**
+ * Constructor for an array of buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button array, relative to its parent.
+ * @param y The y coordinate of the button array, relative to its parent.
+ * @param buttonColumns The number of buttons in one row of the button array
+ * @param buttonRows The number of buttons in one column of the button array
+ * @param buttonWidth The width of one button
+ * @param buttonHeight The height of one button
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CButtonArray(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ uint8_t buttonColumns, uint8_t buttonRows,
+ nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * CButtonArray Destructor.
+ */
+
+ ~CButtonArray(void);
+
+ /**
+ * Returns the string shown in the label.
+ *
+ * @param column The column index of the button of interest
+ * @param row The row index of the button of interest
+ * @return The label's text.
+ */
+
+ virtual const CNxString &getText(int column, int row) const;
+
+ /**
+ * Set the text displayed in the label.
+ *
+ * @param column The column index of the button to set
+ * @param row The row index of the button to set
+ * @param text String to display.
+ */
+
+ virtual void setText(int column, int row, const CNxString &text);
+
+ /**
+ * Return the position of the last clicked button (0,0 will be returned
+ * the no button has every been clicked). The button at this position
+ * is currently clicked then, in addition, return true.
+ *
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return True if any button in the array is clicked
+ */
+
+ virtual bool isButtonClicked(int &column, int &row) const;
+
+ /**
+ * Check if this specific button in the array is clicked
+ *
+ * @param column The column of the button to check.
+ * @param row The row of the button to check.
+ * @return True if this button is clicked
+ */
+
+ virtual bool isThisButtonClicked(int column, int row) const;
+
+ /**
+ * Control the cursor state.
+ *
+ * @param cursorOn True(1), the current cursor position will be highlighted
+ */
+
+ virtual void cursor(bool cursorOn);
+
+ /**
+ * Return the current cursor position (button indices) and an indication
+ * if the button at the cursor is currently hightlighted.
+ *
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return True if the cursor is enabled and the button is highlighted
+ */
+
+ virtual bool getCursorPosition(int &column, int &row) const;
+
+ /**
+ * Set the cursor position (button indices). Note that the cursor
+ * does not have to be enabled to set the position.
+ *
+ * @param column The column index of the button of interest
+ * @param row The row index of the button of interest
+ * @return True if the cursor position is valid
+ */
+
+ virtual bool setCursorPosition(int column, int row);
+
+ /**
+ * Check if this specific button in the array is at the cursor position
+ * and highlighted.
+ *
+ * @param column The column of the button to check.
+ * @param row The row of the button to check.
+ * @return True if this button is at the cursor postion and highlighted.
+ */
+
+ virtual bool isCursorPosition(int column, int row) const;
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+
+ /**
+ * Sets the font.
+ *
+ * @param font A pointer to the font to use.
+ */
+
+ virtual void setFont(CNxFont *font);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CBUTTONARRAY_HXX
diff --git a/NxWidgets/libnxwidgets/include/ccallback.hxx b/NxWidgets/libnxwidgets/include/ccallback.hxx
new file mode 100644
index 000000000..0e0d5de8b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ccallback.hxx
@@ -0,0 +1,220 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ccallback.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CCALLBACK_HXX
+#define __INCLUDE_CCALLBACK_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxtk.h>
+
+#include "crect.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+
+ /**
+ * Callback function proxies. This class receives and dispatches callbacks
+ * from the NX server. This calls also manages a few lower-level details
+ * such as keeping track of the reported window handles and window positions
+ * and sizes.
+ *
+ * There are three instances that represent an NX window from the
+ * perspective of NXWidgets.
+ *
+ * - There is one widget control instance per NX window,
+ * - One CCallback instance per window,
+ * - One window instance.
+ *
+ * There a various kinds of of window instances, but each inherits
+ * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
+ * that describes the common window behavior.
+
+ */
+
+ class CCallback
+ {
+ private:
+ struct nx_callback_s m_callbacks; /**< C-callable vtable of callback function pointers */
+
+ // Methods in the callback vtable
+
+ /**
+ * Re-Draw Callback. The redraw event is handled by CWidgetControl::redrawEvent.
+ *
+ * NOTE: This method runs in the context of the NX callback which may
+ * either be the context of the owning thread or, in the case of multi-
+ * user NX, the context of the NX event listener thread.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param pRect The rectangle that needs to be re-drawn (in window
+ * relative coordinates).
+ * @param bMore true: More re-draw requests will follow.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+ static void redraw(NXHANDLE hWindow, FAR const struct nxgl_rect_s *pRect,
+ bool bMore, FAR void *pvArg);
+
+ /**
+ * Position Callback. The new positional data is handled by
+ * CWidgetControl::geometryEvent.
+ *
+ * NOTE: This method runs in the context of the NX callback which may
+ * either be the context of the owning thread or, in the case of multi-
+ * user NX, the context of the NX event listener thread.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param pSize The size of the window.
+ * @param pPos The position of the upper left hand corner of the window on
+ * the overall display.
+ * @param pBounds The bounding rectangle that describes the entire display.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+ static void position(NXHANDLE hWindow, FAR const struct nxgl_size_s *pSize,
+ FAR const struct nxgl_point_s *pPos,
+ FAR const struct nxgl_rect_s *pBounds,
+ FAR void *pvArg);
+
+ /**
+ * New mouse data is available for the window. The new mouse
+ * data is handled by CWidgetControl::newMouseEvent.
+ *
+ * NOTE: This method runs in the context of the NX callback which may
+ * either be the context of the NX event listener thread (if multi-
+ * user NX), or possibly in the connects of device driver or even a
+ * device driver interrupt.
+ *
+ * The GUI thread is probably sleeping a semaphore, waiting to be
+ * awakened by a mouse or keyboard event.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param pPos The (x,y) position of the mouse.
+ * @param buttons See NX_MOUSE_* definitions.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+#ifdef CONFIG_NX_MOUSE
+ static void newMouseEvent(NXHANDLE hWindow, FAR const struct nxgl_point_s *pPos,
+ uint8_t buttons, FAR void *pvArg);
+#endif /* CONFIG_NX_MOUSE */
+
+ /**
+ * New keyboard/keypad data is available for the window. The new
+ * keyboard data is handled by CWidgetControl::newKeyboardEvent.
+ *
+ * NOTE: This method runs in the context of the NX callback which may
+ * either be the context of the NX event listener thread (if multi-
+ * user NX), or possibly in the connects of device driver or even a
+ * device driver interrupt.
+ *
+ * The GUI thread is probably sleeping a semaphore, waiting to be
+ * awakened by a mouse or keyboard event.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param nCh The number of characters that are available in pStr[].
+ * @param pStr The array of characters.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+#ifdef CONFIG_NX_KBD
+ static void newKeyboardEvent(NXHANDLE hWindow, uint8_t nCh, FAR const uint8_t *pStr,
+ FAR void *pvArg);
+#endif // CONFIG_NX_KBD
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl Control object associated with this window
+ */
+
+ CCallback(CWidgetControl *pWidgetControl);
+
+ /**
+ * Destructor.
+ */
+
+ inline ~CCallback(void) {}
+
+ /**
+ * Get the callback vtable. This is neeed only by the window
+ * instance that inherits this class. The window instance needs the
+ * C-callable vtable in order to create the NX window. Once the
+ * window is created, this class will begin to receive callbacks via
+ * the C-callable vtable methods.
+ *
+ * @return This method returns the C-callable vtable needed for
+ * NX window creation.
+ */
+
+ inline FAR struct nx_callback_s *getCallbackVTable(void)
+ {
+ return &m_callbacks;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CCALLBACK_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/ccheckbox.hxx b/NxWidgets/libnxwidgets/include/ccheckbox.hxx
new file mode 100644
index 000000000..109e7839e
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ccheckbox.hxx
@@ -0,0 +1,210 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ccheckbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CCHECKBOX_HXX
+#define __INCLUDE_CCHECKBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbutton.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+
+ /**
+ * Class representing a checkbox. Like radio buttons, checkboxes
+ * are tri-state - off, on and "mu". The mu state cannot be enabled by
+ * a user - it can only be set by the developer.
+ */
+
+ class CCheckBox : public CButton
+ {
+ public:
+
+ /**
+ * Enum listing all possible checkbox states.
+ */
+
+ enum CheckBoxState
+ {
+ CHECK_BOX_STATE_OFF = 0, /**< Checkbox is unticked */
+ CHECK_BOX_STATE_ON = 1, /**< Checkbox is ticked */
+ CHECK_BOX_STATE_MU = 2 /**< Checkbox is in the third state */
+ };
+
+ protected:
+ CheckBoxState m_state; /**< The state of the checkbox */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Toggles the state of the checkbox.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CCheckBox(const CCheckBox &checkBox) : CButton(checkBox) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the checkbox, relative to its parent.
+ * @param y The y coordinate of the checkbox, relative to its parent.
+ * @param width The width of the checkbox.
+ * @param height The height of the checkbox.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CCheckBox(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CCheckBox(void) { }
+
+ /**
+ * Get the current state of the checkbox.
+ *
+ * @return The state of the checkbox.
+ */
+
+ virtual inline const CheckBoxState getState(void) const
+ {
+ return m_state;
+ }
+
+ /**
+ * Set the state of the checkbox.
+ *
+ * @param state The new checkbox state.
+ */
+
+ virtual void setState(CheckBoxState state);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CCHECKBOX_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/ccyclebutton.hxx b/NxWidgets/libnxwidgets/include/ccyclebutton.hxx
new file mode 100644
index 000000000..5fd9405d8
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ccyclebutton.hxx
@@ -0,0 +1,356 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ccyclebutton.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CCYLEBUTTON_HXX
+#define __INCLUDE_CCYLEBUTTON_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbutton.hxx"
+#include "ilistdataeventhandler.hxx"
+#include "clistdata.hxx"
+#include "clistdataitem.hxx"
+#include "cwidgetstyle.hxx"
+#include "cnxstring.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+
+ /**
+ * Cycle button widget. Displays text within the button. Clicking it cycles
+ * through its available options.
+ */
+
+ class CCycleButton : public CButton, public IListDataEventHandler
+ {
+ protected:
+
+ CListData m_options; /**< Option storage. */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ */
+
+ virtual void drawOutline(CGraphicsPort *port);
+
+ /**
+ * Selects the next option in the list and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Prevents the CButton onResize() method from recalculating the text
+ * positions by overriding it.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual inline void onResize(nxgl_coord_t width, nxgl_coord_t height) { }
+
+ /**
+ * Override method in Label class to prevent recalculation of text positions.
+ */
+
+ virtual inline void calculateTextPosition(void) { }
+
+ /**
+ * Destructor.
+ */
+
+ virtual ~CCycleButton(void) { }
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CCycleButton(const CCycleButton &cycleButton) : CButton(cycleButton) { }
+
+ public:
+
+ /**
+ * Constructor for cycle buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the values stored in the global
+ * g_defaultWidgetStyle object. The button will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CCycleButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Add a new option to the widget.
+ *
+ * @param text The text of the option.
+ * @param value The value of the option.
+ */
+
+ void addOption(const CNxString &text, const uint32_t value);
+
+ /**
+ * Remove an option from the widget by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+ virtual void removeOption(const int index);
+
+ /**
+ * Remove all options from the widget.
+ */
+
+ virtual void removeAllOptions(void);
+
+ /**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+ virtual void selectOption(const int index);
+
+ /**
+ * Get the selected index. Returns -1 if nothing is selected. If more than one
+ * option is selected, the index of the first selected option is returned.
+ *
+ * @return The selected index.
+ */
+
+ virtual const int getSelectedIndex(void) const;
+
+ /**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected options to deselected.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The selected index.
+ */
+
+ virtual void setSelectedIndex(const int index);
+
+ /**
+ * Get the selected option. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+ virtual const CListDataItem *getSelectedOption(void) const;
+
+ /**
+ * Get the value of the current option.
+ *
+ * @return Value of the current option.
+ */
+
+ inline const uint32_t getValue(void) const
+ {
+ return getSelectedOption()->getValue();
+ }
+
+ /**
+ * Get the specified option.
+ *
+ * @return The specified option.
+ */
+
+ virtual inline const CListDataItem *getOption(const int index)
+ {
+ return m_options.getItem(index);
+ }
+
+ /**
+ * Sort the options alphabetically by the text of the options.
+ */
+
+ virtual void sort(void);
+
+ /**
+ * Get the total number of options.
+ *
+ * @return The number of options.
+ */
+
+ virtual inline const int getOptionCount(void) const
+ {
+ return m_options.getItemCount();
+ }
+
+ /**
+ * Sets whether or not items added to the list are automatically sorted
+ * on insert or not.
+ *
+ * @param sortInsertedItems True to enable sort on insertion.
+ */
+
+ virtual inline void setSortInsertedItems(const bool sortInsertedItems)
+ {
+ m_options.setSortInsertedItems(sortInsertedItems);
+ }
+
+ /**
+ * Handles list data changed events.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleListDataChangedEvent(const CListDataEventArgs &e);
+
+ /**
+ * Handles list selection changed events.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleListDataSelectionChangedEvent(const CListDataEventArgs &e);
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent. Value is based on the length of the largest string in the
+ * set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CCYLEBUTTON_HXX
diff --git a/NxWidgets/libnxwidgets/include/cglyphbutton.hxx b/NxWidgets/libnxwidgets/include/cglyphbutton.hxx
new file mode 100644
index 000000000..aad348ca9
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cglyphbutton.hxx
@@ -0,0 +1,229 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cbutton.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CGLYPHBUTTON_HXX
+#define __INCLUDE_CGLYPHBUTTON_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ struct SBitmap;
+
+ /**
+ * Class representing a button that will display a glyph.
+ * Class representing a clickable button that contains a bitmap image
+ * instead of text. Displays two bitmaps, one when the button is clicked,
+ * and one when it isn't. The bitmaps should be the same size.
+ */
+
+ class CGlyphButton : public CNxWidget
+ {
+ protected:
+
+ FAR const struct SBitmap *m_bitmapNormal; /**< Bitmap when button is not clicked */
+ FAR const struct SBitmap *m_bitmapClicked; /**< Bitmap when button is clicked */
+ nxgl_coord_t m_bitmapX; /**< X coordinate of the bitmaps */
+ nxgl_coord_t m_bitmapY; /**< Y coordinate of the bitmaps */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ *
+ * @param port Graphics port to draw to.
+ */
+
+ virtual void drawOutline(CGraphicsPort *port);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raises an action event and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CGlyphButton(const CGlyphButton &button) : CNxWidget(button) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button.
+ * @param y The y coordinate of the button.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param normalGlyph Glyph to display when unclicked.
+ * @param clickedGlyph Glyph to display when clicked.
+ * @param bitmapX The x coordinate at which the bitmaps will be drawn.
+ * @param bitmapY The y coordinate at which the bitmaps will be drawn.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the values stored in the global
+ * g_defaultWidgetStyle object. The button will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CGlyphButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ nxgl_coord_t bitmapX, nxgl_coord_t bitmapY,
+ FAR const struct SBitmap *normalGlyph,
+ FAR const struct SBitmap *clickedGlyph,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CGlyphButton(void) { }
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent.
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CGLYPHBUTTON_HXX
diff --git a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
new file mode 100644
index 000000000..404fb1d51
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
@@ -0,0 +1,411 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cgraphicsport.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CGRAPHICSPORT_HXX
+#define __INCLUDE_CGRAPHICSPORT_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "inxwindow.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxFont;
+ class CNxString;
+ class CRect;
+ struct SBitmap;
+
+ /**
+ * CGraphicsPort is the interface between a NXwidget and NX layer.
+ */
+
+ class CGraphicsPort
+ {
+ private:
+ INxWindow *m_pNxWnd; /**< NX window interface. */
+
+ public:
+ /**
+ * Constructor.
+ *
+ * @param pNxWnd An instance of the underlying window type.
+ */
+
+ CGraphicsPort(INxWindow *pNxWnd);
+
+ /**
+ * Destructor.
+ */
+
+ virtual ~CGraphicsPort();
+
+ /**
+ * Return the absolute x coordinate of the upper left hand corner of the
+ * underlying window.
+ *
+ * @return The x coordinate of the window.
+ */
+
+ const nxgl_coord_t getX(void) const;
+
+ /**
+ * Return the absolute y coordinate of the upper left hand corner of the
+ * underlying window.
+ *
+ * @return The y coordinate of the window.
+ */
+
+ const nxgl_coord_t getY(void) const;
+
+ /**
+ * Draw a pixel into the window.
+ *
+ * @param x The window-relative x coordinate of the pixel.
+ * @param y The window-relative y coordinate of the pixel.
+ * @param color The color of the pixel.
+ */
+
+ void drawPixel(nxgl_coord_t x, nxgl_coord_t y, nxgl_mxpixel_t color);
+
+ /**
+ * Draw a horizontal line of the specified start position, width, and
+ * color.
+ *
+ * @param x The x coordinate of the line.
+ * @param y The y coordinate of the top-most end of the line.
+ * @param width The width of the line in pixels.
+ * @param color The color of the line.
+ */
+
+ void drawHorizLine(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Draw a vertical line of the specified start position, width, and
+ * color.
+ *
+ * @param x The x coordinate of the left-most end of the line.
+ * @param y The y coordinate of the line.
+ * @param height The height of the line in rows.
+ * @param color The color of the line.
+ */
+
+ void drawVertLine(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t height,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Draw a line of a fixed color in the window.
+ *
+ * @param x1 The x coordinate of the start point of the line.
+ * @param y1 The y coordinate of the start point of the line.
+ * @param x2 The x coordinate of the end point of the line.
+ * @param y2 The y coordinate of the end point of the line.
+ * @param color The color of the line.
+ */
+
+ void drawLine(nxgl_coord_t x1, nxgl_coord_t y1,
+ nxgl_coord_t x2, nxgl_coord_t y2,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Draw a filled rectangle of the specified start position, end position,
+ * width, and color.
+ *
+ * @param x The window-relative x coordinate of the rectangle.
+ * @param y The window-relative y coordinate of the rectangle.
+ * @param width The width of the rectangle in pixels.
+ * @param height The height of the rectangle in rows.
+ * @param color The color of the rectangle.
+ */
+
+ void drawFilledRect(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ nxgl_coord_t height, nxgl_mxpixel_t color);
+
+ /**
+ * Draw an unfilled rectangle to the window
+ *
+ * @param x The window-relative x coordinate of the rectangle.
+ * @param y The window-relative y coordinate of the rectangle.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ * @param color The color of the rectangle .
+ */
+
+ void drawRect(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ nxgl_coord_t height, nxgl_mxpixel_t color);
+
+ /**
+ * Draw a bevelled rectangle to the window.
+ *
+ * @param x The x coordinate of the rectangle.
+ * @param y The y coordinate of the rectangle.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ * @param shineColor The color of the top/left sides.
+ * @param shadowColor The color of the bottom/right sides.
+ */
+
+ void drawBevelledRect(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ nxgl_mxpixel_t shineColor,
+ nxgl_mxpixel_t shadowColor);
+
+ /**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+ inline void drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color)
+ {
+ (void)m_pNxWnd->drawFilledCircle(center, radius, color);
+ }
+
+ /**
+ * Draw a string to the window.
+ * @param pos The window-relative x/y coordinate of the string.
+ * @param bound The window-relative bounds of the string.
+ * @param font The font to draw with.
+ * @param string The string to output.
+ */
+
+ void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font,
+ const CNxString &string);
+
+ /**
+ * Draw a particular length of a string to the window in a secific color.
+ * @param pos The window-relative x/y coordinate of the string.
+ * @param bound The window-relative bounds of the string.
+ * @param font The font to draw with.
+ * @param string The string to output.
+ * @param startIndex The start index within the string from which
+ * drawing will commence.
+ * @param length The number of characters to draw.
+ * @param color The color of the string.
+ */
+
+ void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font,
+ const CNxString &string, int startIndex, int length,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Draw a portion of a string to the window.
+ * @param pos The window-relative x/y coordinate of the string.
+ * @param bound The window-relative bounds of the string.
+ * @param font The font to draw with.
+ * @param string The string to output.
+ * @param startIndex The start index within the string from which
+ * drawing will commence.
+ * @param length The number of characters to draw.
+ */
+
+ void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font,
+ const CNxString &string, int startIndex, int length);
+
+ /**
+ * Draw an opaque bitmap to the window.
+ *
+ * @param x The window-relative x coordinate to draw the bitmap to.
+ * @param y The window-relative y coordinate to draw the bitmap to.
+ * @param width The width of the bitmap to draw.
+ * @param height The height of the bitmap to draw.
+ * @param bitmap Pointer to the bitmap to draw.
+ * @param bitmapX The window-relative x coordinate within the supplied
+ * bitmap to use as the origin.
+ * @param bitmapY The window-relative y coordinate within the supplied
+ * bitmap to use as the origin.
+ */
+
+ void drawBitmap(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const struct SBitmap *bitmap, int bitmapX, int bitmapY);
+
+ /**
+ * Draw a bitmap to the window, using the supplied transparent
+ * color as an invisible color.
+ *
+ * @param x The window-relative x coordinate to draw the bitmap to.
+ * @param y The window-relative y coordinate to draw the bitmap to.
+ * @param width The width of the bitmap to draw.
+ * @param height The height of the bitmap to draw.
+ * @param bitmap Pointer to the bitmap to draw.
+ * @param bitmapX The window-relative x coordinate within the supplied bitmap to use as
+ * the origin.
+ * @param bitmapY The window-relative y coordinate within the supplied bitmap to use as
+ * the origin.
+ * @param transparentColor The transparent color used in the bitmap.
+ */
+
+ void drawBitmap(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const struct SBitmap *bitmap, int bitmapX, int bitmapY,
+ nxgl_mxpixel_t transparentColor);
+
+ /**
+ * Draw a bitmap to the port in greyscale.
+ *
+ * @param x The window-relative x coordinate to draw the bitmap to.
+ * @param y The window-relative y coordinate to draw the bitmap to.
+ * @param width The width of the bitmap to draw.
+ * @param height The height of the bitmap to draw.
+ * @param bitmap Pointer to the bitmap to draw.
+ * @param bitmapX The window-relative x coordinate within the supplied bitmap to use as
+ * the origin.
+ * @param bitmapY The window-relative y coordinate within the supplied bitmap to use as
+ * the origin.
+ */
+
+ void drawBitmapGreyScale(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const struct SBitmap *bitmap, int bitmapX, int bitmapY);
+
+ /**
+ * Copy a rectangular region from the source coordinateinates to the
+ * destination coordinateinates.
+ *
+ * @param sourceX Source x coordinate.
+ * @param sourceY Source y coordinate.
+ * @param destX Destination x coordinate.
+ * @param destY Destination y coordinate.
+ * @param width Width of the rectangle to copy.
+ * @param height Height of the rectangle to copy.
+ */
+
+ void copy(nxgl_coord_t sourceX, nxgl_coord_t sourceY,
+ nxgl_coord_t destX, nxgl_coord_t destY,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Move a region by a specified distance in two dimensions.
+ *
+ * @param x X coordinate of the source area to move.
+ * @param y Y coordinate of the source area to move.
+ * @param deltaX Horizontal distance to move.
+ * @param deltaY Vertical distance to move.
+ * @param width Width of the area to move.
+ * @param height Height of the area to move.
+ */
+
+ void move(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t deltaX, nxgl_coord_t deltaY,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Convert the region to greyscale.
+ *
+ * @param x X coordinate of the region to change.
+ * @param y Y coordinate of the region to change.
+ * @param width Width of the region to change.
+ * @param height Height of the region to change.
+ */
+
+ void greyScale(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Invert colors in a region. NOTE: This allocates an in-memory
+ * buffer the size of one row in graphic memory. So it may only be
+ * useful for inverting small regions and its only current use of for
+ * the inverted cursor text.
+ *
+ * @param x X coordinate of the region to change.
+ * @param y Y coordinate of the region to change.
+ * @param width Width of the region to change.
+ * @param height Height of the region to change.
+ */
+
+ void invert(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CGRAPHICSPORT_HXX
diff --git a/NxWidgets/libnxwidgets/include/cimage.hxx b/NxWidgets/libnxwidgets/include/cimage.hxx
new file mode 100644
index 000000000..fa87b3f9c
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cimage.hxx
@@ -0,0 +1,199 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cimage.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CIMAGE_HXX
+#define __INCLUDE_CIMAGE_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ class IBitmap;
+
+ /**
+ * Simple image widget for present static images in the widget framework.
+ */
+
+ class CImage : public CNxWidget
+ {
+ protected:
+ FAR IBitmap *m_bitmap; /**< Source bitmap image */
+ struct nxgl_point_s m_origin; /**< Origin for offset image display position */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CImage(const CImage &label) : CNxWidget(label) { };
+
+ public:
+
+ /**
+ * Constructor for a label containing a string.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the image box, relative to its parent.
+ * @param y The y coordinate of the image box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param bitmap The source bitmap image.
+ * @param style The style that the widget should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CImage(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height, FAR IBitmap *bitmap,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CImage() { }
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ void getPreferredDimensions(CRect &rect) const;
+
+ /**
+ * Set the horizontal position of the bitmap. Zero is the left edge
+ * of the bitmap and values >0 will move the bit map to the right.
+ * This method is useful for horizontal scrolling a large bitmap
+ * within a smaller window
+ */
+
+ void setImageLeft(nxgl_coord_t column);
+
+ /**
+ * Set the vertical position of the bitmap. Zero is the top edge
+ * of the bitmap and values >0 will move the bit map down.
+ * This method is useful for vertical scrolling a large bitmap
+ * within a smaller window
+ */
+
+ void setImageTop(nxgl_coord_t row);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CIMAGE_HXX
diff --git a/NxWidgets/libnxwidgets/include/ckeypad.hxx b/NxWidgets/libnxwidgets/include/ckeypad.hxx
new file mode 100644
index 000000000..2f2a754d4
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ckeypad.hxx
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ckeypad.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CKEYPAD_HXX
+#define __INCLUDE_CKEYPAD_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbuttonarray.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ class CWidgetStyle;
+
+ /**
+ * Extends the CButtonArray class to support a alphanumeric keypad.
+ */
+
+ class CKeypad : public CButtonArray
+ {
+ protected:
+ NXHANDLE m_hNxServer; /**< NX server handle */
+ bool m_numeric; /**< True: Numeric keypad, False: Alpha */
+
+ /**
+ * Configure the keypad for the currenly selected display mode.
+ */
+
+ void configureKeypadMode(void);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CKeypad(const CKeypad &keypad) : CButtonArray(keypad) { }
+
+ public:
+
+ /**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param hNxServer The NX server that will receive the keyboard input
+ * @param x The x coordinate of the keypad, relative to its parent.
+ * @param y The y coordinate of the keypad, relative to its parent.
+ * @param width The width of the keypad
+ * @param height The height of the keypad
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CKeypad(CWidgetControl *pWidgetControl, NXHANDLE hNxServer,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * CKeypad Destructor.
+ */
+
+ inline ~CKeypad(void) {}
+
+ /**
+ * Returns the current keypad display mode
+ *
+ * @return True: keypad is in numeric mode. False: alphanumeric.
+ */
+
+ inline const bool isNumericKeypad(void) const
+ {
+ return m_numeric;
+ }
+
+ /**
+ * Returns the current keypad display mode
+ *
+ * @param mode True: put keypad in numeric mode. False: in alphanumeric.
+ */
+
+ inline void setKeypadMode(bool numeric)
+ {
+ m_numeric = numeric;
+ configureKeypadMode();
+ }
+
+ /**
+ * Catch button clicks.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CKEYPAD_HXX
diff --git a/NxWidgets/libnxwidgets/include/clabel.hxx b/NxWidgets/libnxwidgets/include/clabel.hxx
new file mode 100644
index 000000000..62ed1cda7
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clabel.hxx
@@ -0,0 +1,355 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/clabel.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLABEL_HXX
+#define __INCLUDE_CLABEL_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgetstyle.hxx"
+#include "cnxstring.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ class CRect;
+
+ /**
+ * Single-line label widget. Can align text both vertically and
+ * horizontally in different ways.
+ */
+
+ class CLabel : public CNxWidget
+ {
+ public:
+
+ /**
+ * Enum of horizontal alignment options.
+ */
+
+ enum TextAlignmentHoriz
+ {
+ TEXT_ALIGNMENT_HORIZ_CENTER = 0, /**< Centre the text */
+ TEXT_ALIGNMENT_HORIZ_LEFT = 1, /**< Align left */
+ TEXT_ALIGNMENT_HORIZ_RIGHT = 2 /**< Align right */
+ };
+
+ /**
+ * Enum of vertical alignment options.
+ */
+
+ enum TextAlignmentVert
+ {
+ TEXT_ALIGNMENT_VERT_CENTER = 0, /**< Align to centre of textbox */
+ TEXT_ALIGNMENT_VERT_TOP = 1, /**< Align to top of textbox */
+ TEXT_ALIGNMENT_VERT_BOTTOM = 2 /**< Align to bottom of textbox */
+ };
+
+ protected:
+ CNxString m_text; /**< Text that the textbox will display */
+ struct nxgl_point_s m_align; /**< X/Y offset for text alignment */
+ TextAlignmentHoriz m_hAlignment; /**< Horizontal alignment of the text */
+ TextAlignmentVert m_vAlignment; /**< Vertical alignment of the text */
+ bool m_textChange; /**< Redraw is due to a text change */
+ bool m_highlighted; /**< Label is highlighted */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ * @param port The CGraphicsPort to draw to.
+ *
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Resize the widget to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Calculate the vertical position of the string based on the font
+ *
+ * height and the alignment options.
+ */
+
+ virtual void calculateTextPositionVertical(void);
+
+ /**
+ * Calculate the position of the string based on its length and the
+ * alignment options.
+ */
+
+ virtual void calculateTextPositionHorizontal(void);
+
+ /**
+ * Updates the GUI after the text has changed.
+ */
+
+ virtual void onTextChange(void);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CLabel(const CLabel &label) : CNxWidget(label) { };
+
+ public:
+
+ /**
+ * Constructor for a label containing a string.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CLabel(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height, const CNxString &text,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CLabel() { }
+
+ /**
+ * Set the horizontal alignment of text within the label.
+ *
+ * @param alignment The horizontal position of the text.
+ */
+
+ virtual void setTextAlignmentHoriz(TextAlignmentHoriz alignment);
+
+ /**
+ * Set the vertical alignment of text within the label.
+ *
+ * @param alignment The vertical position of the text.
+ */
+
+ virtual void setTextAlignmentVert(TextAlignmentVert alignment);
+
+ /**
+ * Set the horizontal alignment of text within the label.
+ *
+ * @param alignment The horizontal position of the text.
+ */
+
+ inline const TextAlignmentHoriz getTextAlignmentHoriz(void) const
+ {
+ return m_hAlignment;
+ }
+
+ /**
+ * Set the vertical alignment of text within the label.
+ *
+ * @param alignment The vertical position of the text.
+ */
+
+ inline const TextAlignmentVert getTextAlignmentVert(void) const
+ {
+ return m_vAlignment;
+ }
+
+ /**
+ * Returns the string shown in the label.
+ *
+ * @return The label's text.
+ */
+
+ virtual inline const CNxString &getText(void) const
+ {
+ return m_text;
+ }
+
+ /**
+ * Set the text displayed in the label.
+ *
+ * @param text String to display.
+ */
+
+ virtual void setText(const CNxString &text);
+
+ /**
+ * Append new text to the end of the current text displayed in the
+ * label.
+ *
+ * @param text String to append.
+ */
+
+ virtual void appendText(const CNxString &text);
+
+ /**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+ virtual void insertText(const CNxString &text, const int index);
+
+ /**
+ * Control the highlight state.
+ *
+ * @param highlightOn True(1), the label will be highlighted
+ */
+
+ virtual void highlight(bool highlightOn);
+
+ /**
+ * Return the current highlight state.
+ *
+ * @return True if the label is highlighted
+ */
+
+ virtual inline bool isHighlighted(void) const
+ {
+ return m_highlighted;
+ }
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+
+ /**
+ * Sets the font.
+ *
+ * @param font A pointer to the font to use.
+ */
+
+ virtual void setFont(CNxFont *font);
+
+ /**
+ * Is the redraw due to a text-only change?
+ *
+ * @return True if the redraw was caused by a text change
+ */
+
+ virtual inline bool isTextChange(void) const
+ {
+ return m_textChange;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLABEL_HXX
diff --git a/NxWidgets/libnxwidgets/include/clatchbutton.hxx b/NxWidgets/libnxwidgets/include/clatchbutton.hxx
new file mode 100644
index 000000000..c0b37d64b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clatchbutton.hxx
@@ -0,0 +1,173 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/clatchbutton.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLATCHBUTTON_HXX
+#define __INCLUDE_CLATCHBUTTON_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cstickybutton.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+
+ /**
+ * CButton that latches down when clicked and unlatches when clicked again.
+ */
+
+ class CLatchButton : public CStickyButton
+ {
+ protected:
+ /**
+ * Handles button click events
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CLatchButton(const CLatchButton &button) : CStickyButton(button) { }
+
+ public:
+
+ /**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param text The text for the button to display.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CLatchButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CLatchButton(void) { }
+
+ /**
+ * Check if the button is latched
+ *
+ * @return True if the button is latched
+ */
+
+ inline const bool isLatched(void) const
+ {
+ return isStuckDown();
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLATCHBUTTON_HXX
diff --git a/NxWidgets/libnxwidgets/include/clatchbuttonarray.hxx b/NxWidgets/libnxwidgets/include/clatchbuttonarray.hxx
new file mode 100644
index 000000000..bffeb58a1
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clatchbuttonarray.hxx
@@ -0,0 +1,170 @@
+/****************************************************************************
+ * include/clatchbuttonarray.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLATCHBUTTONARRAY_HXX
+#define __INCLUDE_CLATCHBUTTONARRAY_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cstickybuttonarray.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ class CNxString;
+
+ /**
+ * Manages a two-dimensional array of buttons as one widget. When a button
+ * is clicked is latches (i.e., it stays pushed after the press is released.
+ * The behavior is then like radio buttons: Pressing each each button in
+ * the array unlatches the previous button and latches the new button.
+ *
+ * Unlike CLatchButton, pressing the same button more than once has no
+ * effect.
+ */
+
+ class CLatchButtonArray : public CStickyButtonArray
+ {
+ protected:
+ /**
+ * Handles button click events
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CLatchButtonArray(const CLatchButtonArray &button) : CStickyButtonArray(button) { }
+
+ public:
+
+ /**
+ * Constructor for an array of latch buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button array, relative to its parent.
+ * @param y The y coordinate of the button array, relative to its parent.
+ * @param buttonColumns The number of buttons in one row of the button array
+ * @param buttonRows The number of buttons in one column of the button array
+ * @param buttonWidth The width of one button
+ * @param buttonHeight The height of one button
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CLatchButtonArray(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ uint8_t buttonColumns, uint8_t buttonRows,
+ nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * CLatchButtonArray Destructor.
+ */
+
+ virtual inline ~CLatchButtonArray(void) { }
+
+ /**
+ * Return the position of the last latched button (0,0 will be returned
+ * the no button has every been latched). The button at this position
+ * is currently latched then, in addition, return true.
+ *
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return True if a button in the array is latched
+ */
+
+ inline const bool isAnyButtonLatched(int &column, int &row) const
+ {
+ return isAnyButtonStuckDown(column, row);
+ }
+
+ /**
+ * Check if this specific button in the array is latched
+ *
+ * @param column The column of the button to check.
+ * @param row The row of the button to check.
+ * @return True if this button is clicked
+ */
+
+ inline const bool isThisButtonLatched(int column, int row) const
+ {
+ return isThisButtonStuckDown(column, row);
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLATCHBUTTONARRAY_HXX
diff --git a/NxWidgets/libnxwidgets/include/clistbox.hxx b/NxWidgets/libnxwidgets/include/clistbox.hxx
new file mode 100644
index 000000000..7afa76920
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clistbox.hxx
@@ -0,0 +1,431 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/clistbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in all NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLISTBOX_HXX
+#define __INCLUDE_CLISTBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "cscrollingpanel.hxx"
+#include "ilistdataeventhandler.hxx"
+#include "clistdata.hxx"
+#include "clistboxdataitem.hxx"
+#include "cwidgetstyle.hxx"
+#include "ilistbox.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Class providing a scrollable list of options. The CListBox can be set
+ * up to only allow one selection or multiple selections. Processes
+ * double-clicks and raises double-click events, so that a double-click
+ * on an option can be made to automatically select and close a window/etc.
+ * The options themselves have user-definable text and background colors
+ * for their selected and unselected states.
+ */
+
+ class CListBox : public IListBox, public CScrollingPanel,
+ public IListDataEventHandler
+ {
+ protected:
+ CListData m_options; /**< Option storage. */
+ uint8_t m_optionPadding; /**< Padding between options. */
+ int m_lastSelectedIndex; /**< Index of the last option selected. */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Determines which item was clicked and selects or deselects it as
+ * appropriate. Also starts the dragging system.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Selects the clicked item and deselects all others.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Select or deselect an option by its index. Does not deselect any other
+ * selected options. Set index to -1 to select nothing. Redraws the widget
+ * and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ * @param selected True to select the option, false to deselect it.
+ */
+
+ virtual void setOptionSelected(const int index, const bool selected);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CListBox(const CListBox &listBox) : CScrollingPanel(listBox) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CListBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual ~CListBox(void);
+
+ /**
+ * Add a new option to the widget using default colors.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ */
+
+ virtual void addOption(const CNxString &text, const uint32_t value);
+
+ /**
+ * Add an option to the widget.
+ *
+ * @param option The option to add.
+ */
+
+ virtual void addOption(CListBoxDataItem *option);
+
+ /**
+ * Remove an option from the widget by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+ virtual void removeOption(const int index);
+
+ /**
+ * Remove all options from the widget.
+ */
+
+ virtual void removeAllOptions(void);
+
+ /**
+ * Add a new option to the widget.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ * @param normalTextColor Color to draw the text with when not selected.
+ * @param normalBackColor Color to draw the background with when not selected.
+ * @param selectedTextColor Color to draw the text with when selected.
+ * @param selectedBackColor Color to draw the background with when selected.
+ */
+
+ virtual void addOption(const CNxString &text, const uint32_t value,
+ const nxwidget_pixel_t normalTextColor,
+ const nxwidget_pixel_t normalBackColor,
+ const nxwidget_pixel_t selectedTextColor,
+ const nxwidget_pixel_t selectedBackColor);
+
+ /**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+ virtual void selectOption(const int index);
+
+ /**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+ virtual void deselectOption(const int index);
+
+ /**
+ * Select all options. Does nothing if the listbox does not allow
+ * multiple selections. Redraws the widget and raises a value changed
+ * event.
+ */
+
+ virtual void selectAllOptions(void);
+
+ /**
+ * Deselect all options.
+ * Redraws the widget and raises a value changed event.
+ */
+
+ virtual void deselectAllOptions(void);
+
+ /**
+ * Get the selected index. Returns -1 if nothing is selected. If
+ * more than one option is selected, the index of the first selected
+ * option is returned.
+ *
+ * @return The selected index.
+ */
+
+ virtual const int getSelectedIndex(void) const;
+
+ /**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected options to deselected. Redraws the widget and raises
+ * a value changed event.
+ *
+ * @param index The selected index.
+ */
+
+ virtual void setSelectedIndex(const int index);
+
+ /**
+ * Get the selected option. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+ virtual const CListBoxDataItem *getSelectedOption(void) const;
+
+ /**
+ * Sets whether multiple selections are possible or not.
+ *
+ * @param allowMultipleSelections True to allow multiple selections.
+ */
+
+ virtual inline void
+ setAllowMultipleSelections(const bool allowMultipleSelections)
+ {
+ m_options.setAllowMultipleSelections(allowMultipleSelections);
+ }
+
+ /**
+ * Sets whether multiple selections are possible or not.
+ *
+ * @return True if multiple selections are allowed.
+ */
+
+ virtual inline const bool allowsMultipleSelections(void) const
+ {
+ return m_options.allowsMultipleSelections();
+ }
+
+ /**
+ * Resize the scrolling canvas to encompass all options.
+ */
+
+ virtual void resizeCanvas(void);
+
+ /**
+ * Get the specified option.
+ *
+ * @return The specified option.
+ */
+
+ virtual inline const CListBoxDataItem *getOption(const int index)
+ {
+ return (const CListBoxDataItem *)m_options.getItem(index);
+ }
+
+ /**
+ * Sort the options alphabetically by the text of the options.
+ */
+
+ virtual void sort(void);
+
+ /**
+ * Get the total number of options.
+ *
+ * @return The number of options.
+ */
+
+ virtual inline const int getOptionCount(void) const
+ {
+ return m_options.getItemCount();
+ }
+
+ /**
+ * Get the height of a single option.
+ *
+ * @return The height of an option.
+ */
+
+ virtual const nxgl_coord_t getOptionHeight(void) const;
+
+ /**
+ * Sets whether or not items added to the list are automatically sorted on insert or not.
+ *
+ * @param sortInsertedItems True to enable sort on insertion.
+ */
+
+ virtual inline void setSortInsertedItems(const bool sortInsertedItems)
+ {
+ m_options.setSortInsertedItems(sortInsertedItems);
+ }
+
+ /**
+ * Handles list data changed events.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleListDataChangedEvent(const CListDataEventArgs &e);
+
+ /**
+ * Handles list selection changed events.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleListDataSelectionChangedEvent(const CListDataEventArgs &e);
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent. Value is based on the length of the largest string in the
+ * set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+
+ /**
+ * Check if the click is a double-click.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click is a double-click.
+ */
+
+ virtual bool isDoubleClick(nxgl_coord_t x, nxgl_coord_t y);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLISTBOX_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/clistboxdataitem.hxx b/NxWidgets/libnxwidgets/include/clistboxdataitem.hxx
new file mode 100644
index 000000000..9a1358d39
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clistboxdataitem.hxx
@@ -0,0 +1,180 @@
+/****************************************************************************
+ * include/clistboxdataitem.hxx
+ * NxWidgets/libnxwidgets/
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLISTBOXDATAITEM_HXX
+#define __INCLUDE_CLISTBOXDATAITEM_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "clistdataitem.hxx"
+#include "cnxstring.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Class representing a data item within a ListBox.
+ */
+
+ class CListBoxDataItem : public CListDataItem
+ {
+ private:
+ nxwidget_pixel_t m_normalTextColor; /**< Color used for text when not selected. */
+ nxwidget_pixel_t m_normalBackColor; /**< Color used for background when not selected. */
+ nxwidget_pixel_t m_selectedTextColor; /**< Color used for text when selected. */
+ nxwidget_pixel_t m_selectedBackColor; /**< Color used for background when selected. */
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param text The text to display in the item.
+ * @param value The value of the item.
+ * @param normalTextColor Color to draw the text with when not selected.
+ * @param normalBackColor Color to draw the background with when not selected.
+ * @param selectedTextColor Color to draw the text with when selected.
+ * @param selectedBackColor Color to draw the background with when selected.
+ */
+
+ CListBoxDataItem(const CNxString &text, const uint32_t value,
+ const nxwidget_pixel_t normalTextColor,
+ const nxwidget_pixel_t normalBackColor,
+ const nxwidget_pixel_t selectedTextColor,
+ const nxwidget_pixel_t selectedBackColor);
+
+ /**
+ * Get the color used for text when the item is unselected.
+ *
+ * @return The text color when the item is unselected.
+ */
+
+ inline nxwidget_pixel_t getNormalTextColor(void) const
+ {
+ return m_normalTextColor;
+ }
+
+ /**
+ * Get the color used for the background when the item is unselected.
+ *
+ * @return The background color when the item is unselected.
+ */
+
+ inline nxwidget_pixel_t getNormalBackColor(void) const
+ {
+ return m_normalBackColor;
+ }
+
+ /**
+ * Get the color used for text when the item is selected.
+ *
+ * @return The text color when the item is selected.
+ */
+
+ inline nxwidget_pixel_t getSelectedTextColor(void) const
+ {
+ return m_selectedTextColor;
+ }
+
+ /**
+ * Get the color used for the background when the item is selected.
+ *
+ * @return The background color when the item is selected.
+ */
+
+ inline nxwidget_pixel_t getSelectedBackColor(void) const
+ {
+ return m_selectedBackColor;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLISTBOXDATAITEM_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/clistdata.hxx b/NxWidgets/libnxwidgets/include/clistdata.hxx
new file mode 100644
index 000000000..d88abd9fc
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clistdata.hxx
@@ -0,0 +1,351 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/clistdata.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLISTDATA_HXX
+#define __INCLUDE_CLISTDATA_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "tnxarray.hxx"
+#include "ilistdataeventhandler.hxx"
+#include "clistdataitem.hxx"
+#include "cnxstring.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Class representing a list of items. Designed to be used by the
+ * CListBox class, etc, to store its data. Fires events to notify
+ * listeners when the list changes or a new selection is made.
+ */
+
+ class CListData
+ {
+ protected:
+ TNxArray<CListDataItem*> m_items; /**< Collection of list data items. */
+ TNxArray<IListDataEventHandler*> m_listDataEventhandlers; /**< Collection of event handlers. */
+ bool m_allowMultipleSelections; /**< If true, multiple options can
+ be selected. */
+ bool m_sortInsertedItems; /**< Automatically sorts items on
+ insertion if true. */
+
+ /**
+ * Quick sort the items using their compareTo() methods.
+ *
+ * @param start The index to start sorting at.
+ * @param end The index to stop sorting at.
+ */
+
+ virtual void quickSort(const int start, const int end);
+
+ /**
+ * Swap the locations of two items in the array.
+ *
+ * @param index1 The index of the first item to swap.
+ * @param index2 The index of the second item to swap.
+ */
+
+ virtual void swapItems(const int index1, const int index2);
+
+ /**
+ * Return the index that an item should be inserted at to maintain a sorted list of data.
+ *
+ * @param item The item to insert.
+ * @return The index that the item should be imserted into at.
+ */
+
+ const int getSortedInsertionIndex(const CListDataItem *item) const;
+
+ /**
+ * Raise a data changed event.
+ */
+
+ void raiseDataChangedEvent(void);
+
+ /**
+ * Raise a selection changed event.
+ */
+
+ void raiseSelectionChangedEvent(void);
+
+ public:
+
+ /**
+ * Constructor.
+ */
+ CListData(void);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CListData(void);
+
+ /**
+ * Add a new item.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ */
+
+ virtual void addItem(const CNxString &text, const uint32_t value);
+
+ /**
+ * Add an existing item. CListData becomes the owner of the option and will delete it
+ * when the list is deleted.
+ *
+ * @param item The item to add.
+ */
+
+ virtual void addItem(CListDataItem *item);
+
+ /**
+ * Remove an item by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+ virtual void removeItem(const int index);
+
+ /**
+ * Select an item by its index.
+ *
+ * @param index The index of the item to select.
+ */
+
+ virtual void selectItem(const int index);
+
+ /**
+ * Deselect an item by its index.
+ *
+ * @param index The index of the item to select.
+ */
+
+ virtual void deselectItem(const int index);
+
+ /**
+ * Remove all items.
+ */
+
+ virtual void removeAllItems(void);
+
+ /**
+ * Get the selected index. Returns -1 if nothing is selected. If more than one
+ * item is selected, the index of the first selected item is returned.
+ *
+ * @return The selected index.
+ */
+
+ virtual const int getSelectedIndex(void) const;
+
+ /**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected items to deselected.
+ *
+ * @param index The selected index.
+ */
+
+ virtual void setSelectedIndex(const int index);
+
+ /**
+ * Get the selected item. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+ virtual const CListDataItem *getSelectedItem(void) const;
+
+ /**
+ * Sets whether multiple selections are possible or not.
+ *
+ * @param allowMultipleSelections True to allow multiple selections.
+ */
+
+ virtual inline void
+ setAllowMultipleSelections(const bool allowMultipleSelections)
+ {
+ m_allowMultipleSelections = allowMultipleSelections;
+ }
+
+ /**
+ * Get the specified item.
+ *
+ * @return The specified item.
+ */
+
+ virtual inline const CListDataItem *getItem(const int index) const
+ {
+ return m_items[index];
+ }
+
+ /**
+ * Sort the items using their compareTo() methods.
+ */
+
+ virtual void sort(void);
+
+ /**
+ * Get the total number of items.
+ *
+ * @return The number of items.
+ */
+
+ virtual inline const int getItemCount(void) const
+ {
+ return m_items.size();
+ }
+
+ /**
+ * Select all items. Does nothing if the list does not allow
+ * multiple selections.
+ */
+
+ virtual void selectAllItems(void);
+
+ /**
+ * Deselect all items.
+ */
+
+ virtual void deselectAllItems(void);
+
+ /**
+ * Select or deselect an item by its index. Does not deselect any
+ * other selected items. Set index to -1 to select nothing.
+ *
+ * @param index The index of the item to select.
+ * @param selected True to select the item, false to deselect it.
+ */
+
+ virtual void setItemSelected(const int index, const bool selected);
+
+ /**
+ * Returns whether multiple selections are possible or not.
+ *
+ * @return True if multiple selections are allowed.
+ */
+
+ virtual inline const bool allowsMultipleSelections(void) const
+ {
+ return m_allowMultipleSelections;
+ }
+
+ /**
+ * Sets whether or not items added to the list are automatically
+ * sorted on insert or not.
+ *
+ * @param sortInsertedItems True to enable sort on insertion.
+ */
+
+ virtual inline void setSortInsertedItems(const bool sortInsertedItems)
+ {
+ m_sortInsertedItems = sortInsertedItems;
+ }
+
+ /**
+ * Add an event handler.
+ *
+ * @param eventHandler The event handler to add.
+ */
+
+ inline void addListDataEventHandler(IListDataEventHandler *eventHandler)
+ {
+ m_listDataEventhandlers.push_back(eventHandler);
+ }
+
+ /**
+ * Remove an event handler.
+ *
+ * @param eventHandler The event handler to remove.
+ */
+
+ void removeListDataEventHandler(IListDataEventHandler *eventHandler);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLISTDATA_HXX
diff --git a/NxWidgets/libnxwidgets/include/clistdataeventargs.hxx b/NxWidgets/libnxwidgets/include/clistdataeventargs.hxx
new file mode 100644
index 000000000..57118e238
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clistdataeventargs.hxx
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/clistdataeventargs.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLISTDATAEVENTARGS_HXX
+#define __INCLUDE_CLISTDATAEVENTARGS_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "teventargs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CListData;
+
+ /**
+ * Event arguments passed to listeners when a CListData object raises an
+ * event.
+ */
+
+ class CListDataEventArgs : public TEventArgs<CListData*>
+ {
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param source Pointer to the CListData object that raised the event.
+ */
+
+ inline CListDataEventArgs(CListData *source) : TEventArgs<CListData*>(source)
+ {
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLISTDATAEVENTARGS_HXX
diff --git a/NxWidgets/libnxwidgets/include/clistdataitem.hxx b/NxWidgets/libnxwidgets/include/clistdataitem.hxx
new file mode 100644
index 000000000..db3bb20a2
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/clistdataitem.hxx
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/clistdataitem.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CLISTDATAITEM_HXX
+#define __INCLUDE_CLISTDATAITEM_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxstring.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Class representing a data item within a list. Intended for use within
+ * the CListData class.
+ */
+
+ class CListDataItem
+ {
+ private:
+ CNxString m_text; /**< Text to display for option. */
+ uint32_t m_value; /**< Option value. */
+ bool m_isSelected; /**< True if the option is selected. */
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param text The text to display in the item.
+ * @param value The value of the item.
+ */
+
+ CListDataItem(const CNxString &text, const uint32_t value);
+
+ /**
+ * Destructor.
+ */
+
+ virtual ~CListDataItem(void);
+
+ /**
+ * Get the item's text.
+ *
+ * @return The item's text.
+ */
+
+ inline const CNxString &getText(void) const
+ {
+ return m_text;
+ }
+
+ /**
+ * Get the item's value.
+ *
+ * @return The item's value.
+ */
+
+ inline const uint32_t getValue(void) const
+ {
+ return m_value;
+ }
+
+ /**
+ * Get the item's selection state.
+ *
+ * @return True if the item is selected; false if not.
+ */
+
+ inline const bool isSelected(void) const
+ {
+ return m_isSelected;
+ }
+
+ /**
+ * Set the item's selection state.
+ *
+ * @param selected True to select the item; false to deselect it.
+ */
+
+ inline void setSelected(bool selected)
+ {
+ m_isSelected = selected;
+ }
+
+ /**
+ * Compare the item with another. Comparison is based on the text of
+ * the item. Returns 0 if the text in the two items is the same,
+ * a value less than 0 if this item is less than the argument, and
+ * a value greater than 0 if this item is greater than the argument.
+ *
+ * @param item An item to compare this object with.
+ * @return 0 if the text in the two items is the same,
+ * a value less than 0 if this item is less than the argument, and
+ * a value greater than 0 if this item is greater than the argument.
+ */
+
+ virtual int compareTo(const CListDataItem *item) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CLISTDATAITEM_HXX
diff --git a/NxWidgets/libnxwidgets/include/cmultilinetextbox.hxx b/NxWidgets/libnxwidgets/include/cmultilinetextbox.hxx
new file mode 100644
index 000000000..5ed41740b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cmultilinetextbox.hxx
@@ -0,0 +1,621 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cmultilinetextbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CMULTILINETEXTBOX_HXX
+#define __INCLUDE_CMULTILINETEXTBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+
+#include "cscrollingpanel.hxx"
+#include "cwidgetstyle.hxx"
+#include "cnxstring.hxx"
+#include "ctext.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "itextbox.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxTimer;
+
+ /**
+ * Textbox that offers multiple lines of text. Has scrolling
+ * capability and can be dragged using the mouse. The text
+ * it contains can be changed or added to. It can remember more
+ * rows of text than it can display, and these additional
+ * rows can be scrolled through.
+ */
+
+ class CMultiLineTextBox : public ITextBox, public CScrollingPanel,
+ public CWidgetEventHandler
+ {
+ public:
+
+ /**
+ * Enum of horizontal alignment options.
+ */
+
+ enum TextAlignmentHoriz
+ {
+ TEXT_ALIGNMENT_HORIZ_CENTER = 0, /**< Centre the text */
+ TEXT_ALIGNMENT_HORIZ_LEFT = 1, /**< Align left */
+ TEXT_ALIGNMENT_HORIZ_RIGHT = 2 /**< Align right */
+ };
+
+ /**
+ * Enum of vertical alignment options.
+ */
+
+ enum TextAlignmentVert
+ {
+ TEXT_ALIGNMENT_VERT_CENTER = 0, /**< Align to centre of textbox */
+ TEXT_ALIGNMENT_VERT_TOP = 1, /**< Align to top of textbox */
+ TEXT_ALIGNMENT_VERT_BOTTOM = 2 /**< Align to bottom of textbox */
+ };
+
+ protected:
+ CText *m_text; /**< CText object that manipulates
+ and wraps the raw text string. */
+ uint8_t m_visibleRows; /**< Total number of rows that the
+ textbox can display at once. */
+ nxgl_coord_t m_maxRows; /**< Maximum number of rows that the
+ textbox should buffer. */
+ int32_t m_topRow; /**< Index of the top row of text
+ currently displayed. */
+ TextAlignmentHoriz m_hAlignment; /**< Horizontal alignment of the text. */
+ TextAlignmentVert m_vAlignment; /**< Vertical alignment of the text. */
+ int m_cursorPos; /**< Position of the cursor within
+ the string. */
+ uint8_t m_showCursor; /**< Cursor visibility. */
+ bool m_wrapCursor; /**< True wrap cursor at the ends of the text */
+
+ /**
+ * Get the coordinates of the cursor relative to the text.
+ *
+ * @param x Will be populated with the x coordinate of the cursor.
+ * @param y Will be populated with the y coordinate of the cursor.
+ */
+
+ virtual void getCursorCoordinates(nxgl_coord_t& x, nxgl_coord_t& y) const;
+
+ /**
+ * Gets the index of the character at the specified x coordinate in the
+ * specified row.
+ *
+ * @param x X coordinate of the character.
+ * @param rowIndex Index of the row containing the character.
+ * @return The index of the character at the specified coordinate.
+ */
+
+ virtual int getCharIndexAtCoordinate(nxgl_coord_t x, int rowIndex) const;
+
+ /**
+ * Get the index of the character at the specified coordinates.
+ *
+ * @param x X coordinate of the character.
+ * @param y Y coordinate of the character.
+ * @return The index of the character at the specified coordinates.
+ */
+
+ virtual unsigned int getCharIndexAtCoordinates(nxgl_coord_t x, nxgl_coord_t y) const;
+
+ /**
+ * Get the row containing the specified Y coordinate.
+ *
+ * @param y Y coordinate to locate.
+ * @return The index of the row containing the specified Y coordinate.
+ */
+
+ int getRowContainingCoordinate(nxgl_coord_t y) const;
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Move cursor one character to the left.
+ */
+
+ virtual void moveCursorLeft(void);
+
+ /**
+ * Move cursor one character to the right.
+ */
+
+ virtual void moveCursorRight(void);
+
+ /**
+ * Move cursor one row upwards.
+ */
+
+ virtual void moveCursorUp(void);
+
+ /**
+ * Move cursor one row downwards.
+ */
+
+ virtual void moveCursorDown(void);
+
+ /**
+ * Ensures that the textbox only contains the maximum allowed
+ * number of rows by culling any excess rows from the top of
+ * the text.
+ *
+ * @return True if lines were removed from the text; false if not.
+ */
+
+ virtual bool cullTopLines(void);
+
+ /**
+ * Ensures that the canvas height is the height of the widget,
+ * if the widget exceeds the size of the text, or the height of
+ * the text if the text exceeds the size of the widget.
+ */
+
+ virtual void limitCanvasHeight(void);
+
+ /**
+ * Ensures that the canvas cannot scroll beyond its height.
+ */
+
+ virtual void limitCanvasY(void);
+
+ /**
+ * Jumps to the cursor coordinates of the text.
+ */
+
+ void jumpToCursor(void);
+
+ /**
+ * Jumps to the bottom of the text.
+ */
+
+ void jumpToTextBottom(void);
+
+ /**
+ * Resize the textbox to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Starts the dragging system.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Opens the keyboard on the bottom display.
+ *
+ * @param x The x coordinates of the click.
+ * @param y The y coordinates of the click.
+ */
+
+ virtual void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Handles physical button presses. Moves the cursor
+ * in the direction pressed.
+ *
+ * @param key The key that was pressed.
+ */
+
+ void processPhysicalKey(nxwidget_char_t key);
+
+ /**
+ * Handle a keyboard press event.
+ *
+ * @param e The event data.
+ */
+
+ void handleKeyPressEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a cursor control event. Replaces CWidgetEventHandler method.
+ *
+ * @param e The event data.
+ */
+
+ void handleCursorControlEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Gets the x position of a row of text based on the width of the row and the
+ * type of horizontal alignment currently set.
+ *
+ * @param row The index of the row.
+ * @return The x coordinate of the row.
+ */
+
+ nxgl_coord_t getRowX(int row) const;
+
+ /**
+ * Gets the y position of the specified row of text based on the type of
+ * vertical alignment currently set.
+ *
+ * @param row The row number to find the y coordinate of.
+ * @return The y coordinate of the specified row of text.
+ */
+
+ nxgl_coord_t getRowY(int row) const;
+
+ /**
+ * Return true if the cursor is visible
+ */
+
+ virtual bool isCursorVisible(void) const;
+
+ /**
+ * Gets the character under the cursor.
+ *
+ * @return The character under the cursor.
+ */
+
+ nxwidget_char_t getCursorChar(void) const;
+
+ /**
+ * Works out the number of visible rows within the textbox.
+ */
+
+ void calculateVisibleRows(void);
+
+ /**
+ * Draws text.
+ *
+ * @param port The CGraphicsPort to draw to.
+ */
+
+ void drawText(CGraphicsPort *port);
+
+ /**
+ * Draws the cursor.
+ *
+ * @param port The CGraphicsPort to draw to.
+ */
+
+ void drawCursor(CGraphicsPort *port);
+
+ /**
+ * Draws a single line of text.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param row The index of the row to draw.
+ */
+
+ void drawRow(CGraphicsPort *port, int row);
+
+ /**
+ * Destructor.
+ */
+
+ inline virtual ~CMultiLineTextBox(void)
+ {
+ delete m_text;
+ m_text = (CText *)NULL;
+ }
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CMultiLineTextBox(const CMultiLineTextBox &multiLineTextBox)
+ : CScrollingPanel(multiLineTextBox) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param flags Standard widget flag options.
+ * @param maxRows The maximum number of rows the textbox can track. Adding
+ * text beyond this number will cause rows at the start of the text to be
+ * forgotten; text is essentially stored as a queue, and adding to the back
+ * of a full queue causes the front items to be popped off. Setting this to
+ * 0 will make the textbox track only the visible rows.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CMultiLineTextBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text, uint32_t flags,
+ nxgl_coord_t maxRows = 0,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Set the horizontal alignment of text within the textbox.
+ *
+ * @param alignment The horizontal position of the text.
+ */
+
+ virtual void setTextAlignmentHoriz(TextAlignmentHoriz alignment);
+
+ /**
+ * Set the vertical alignment of text within the textbox.
+ *
+ * @param alignment The vertical position of the text.
+ */
+
+ virtual void setTextAlignmentVert(TextAlignmentVert alignment);
+
+ /**
+ * Returns the number of "pages" that the text spans. A page
+ * is defined as the amount of text that can be displayed within
+ * the textbox at one time.
+ *
+ * @return The page count.
+ */
+
+ virtual const int getPageCount(void) const;
+
+ /**
+ * Returns the current page.
+ *
+ * @return The current page.
+ * @see getPageCount().
+ */
+
+ virtual const int getCurrentPage(void) const;
+
+ /**
+ * Returns a pointer to the CText object that contains the
+ * wrapped text used in the textbox. It is used as the
+ * pre-processed data source for the textbox, and should
+ * not be altered.
+ *
+ * @return Pointer to the CText object.
+ */
+
+ virtual inline const CText *getText(void) const
+ {
+ return m_text;
+ }
+
+ /**
+ * Set the text displayed in the textbox.
+ *
+ * @param text String to display.
+ */
+
+ virtual void setText(const CNxString &text);
+
+ /**
+ * Append new text to the end of the current text
+ * displayed in the textbox.
+ *
+ * @param text String to append.
+ */
+
+ virtual void appendText(const CNxString &text);
+
+ /**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+ virtual void removeText(const unsigned int startIndex);
+
+ /**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+ virtual void removeText(const unsigned int startIndex, const unsigned int count);
+
+ /**
+ * Set the font used in the textbox.
+ *
+ * @param font Pointer to the new font.
+ */
+
+ virtual void setFont(CNxFont *font);
+
+ /**
+ * Get the length of the text string.
+ *
+ * @return The length of the text string.
+ */
+
+ virtual const int getTextLength(void) const;
+
+ /**
+ * Sets the cursor display mode.
+ *
+ * @param cursorMode Determines cursor display mode
+ */
+
+ virtual void showCursor(EShowCursor cursorMode);
+
+ /**
+ * Shows the cursor in default mode (only when the TextBox has focus).
+ */
+
+ virtual inline void showCursor(void)
+ {
+ showCursor(SHOW_CURSOR_ONFOCUS);
+ }
+
+ /**
+ * Hides the cursor.
+ */
+
+ virtual inline void hideCursor(void)
+ {
+ showCursor(SHOW_CURSOR_NEVER);
+ }
+
+ /**
+ * Enables/disables cursor wrapping
+ *
+ * @param wrap True enables cursor wrapping
+ */
+
+ virtual inline void wrapCursor(bool wrap)
+ {
+ m_wrapCursor = wrap;
+ }
+
+ /**
+ * Move the cursor to the text position specified. 0 indicates the start
+ * of the string. If position is greater than the length of the string,
+ * the cursor is moved to the end of the string.
+ *
+ * @param position The new cursor position.
+ */
+
+ virtual void moveCursorToPosition(const int position);
+
+ /**
+ * Get the cursor position. This is the index within the string that
+ * the cursor is currently positioned over.
+ *
+ * @return position The cursor position.
+ */
+
+ virtual inline const int getCursorPosition(void) const
+ {
+ return m_cursorPos;
+ }
+
+ /**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+ virtual void insertText(const CNxString &text,
+ const unsigned int index);
+
+ /**
+ * Insert text at the current cursor position.
+ *
+ * @param text The text to insert.
+ */
+
+ virtual void insertTextAtCursor(const CNxString & ext);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CMULTILINETEXTBOX_HXX
diff --git a/NxWidgets/libnxwidgets/include/cnxfont.hxx b/NxWidgets/libnxwidgets/include/cnxfont.hxx
new file mode 100644
index 000000000..33e712291
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxfont.hxx
@@ -0,0 +1,238 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cnxfont.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXFONT_HXX
+#define __INCLUDE_CNXFONT_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nxfonts.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxString;
+ struct SBitmap;
+
+ /**
+ * Class defining the properties of one font.
+ */
+
+ class CNxFont
+ {
+ private:
+ enum nx_fontid_e m_fontId; /**< The font ID. */
+ NXHANDLE m_fontHandle; /**< The font handle */
+ FAR const struct nx_font_s *m_pFontSet; /** < The font set metrics */
+ nxgl_mxpixel_t m_fontColor; /**< Color to draw the font with when rendering. */
+ nxgl_mxpixel_t m_transparentColor; /**< Background color that should not be rendered. */
+
+ public:
+
+ /**
+ * CNxFont Constructor.
+ *
+ * @param fontid The font ID to use.
+ * @param fontColor The font color to use.
+ * @param transparentColor The color in the font bitmap used as the
+ * background color.
+ */
+
+ CNxFont(enum nx_fontid_e fontid, nxgl_mxpixel_t fontColor,
+ nxgl_mxpixel_t transparentColor);
+
+ /**
+ * CNxFont Destructor.
+ */
+
+ ~CNxFont() { }
+
+ /**
+ * Checks if supplied character is blank in the current font.
+ *
+ * @param letter The character to check.
+ * @return True if the glyph contains any pixels to be drawn. False if
+ * the glyph is blank.
+ */
+
+ const bool isCharBlank(const nxwidget_char_t letter) const;
+
+ /**
+ * Gets the color currently being used as the drawing color.
+ *
+ * @return The current drawing color.
+ */
+
+ inline const nxgl_mxpixel_t getColor() const
+ {
+ return m_fontColor;
+ }
+
+ /**
+ * Sets the color to use as the drawing color. If set, this overrides
+ * the colors present in a non-monochrome font.
+ * @param color The new drawing color.
+ */
+
+ inline void setColor(const nxgl_mxpixel_t color)
+ {
+ m_fontColor = color;
+ }
+
+ /**
+ * Get the color currently being used as the transparent background
+ * color.
+ * @return The transparent background color.
+ */
+
+ inline const nxgl_mxpixel_t getTransparentColor() const
+ {
+ return m_transparentColor;
+ }
+
+ /**
+ * Sets the transparent background color to a new value.
+ * @param color The new background color.
+ */
+
+ inline void setTransparentColor(const nxgl_mxpixel_t color)
+ {
+ m_transparentColor = color;
+ }
+
+ /**
+ * Draw an individual character of the font to the specified bitmap.
+ *
+ * @param bitmap The bitmap to draw to.
+ * @param letter The character to output.
+ */
+
+ void drawChar(FAR SBitmap *bitmap, nxwidget_char_t letter);
+
+ /**
+ * Get the width of a string in pixels when drawn with this font.
+ *
+ * @param text The string to check.
+ * @return The width of the string in pixels.
+ */
+
+ nxgl_coord_t getStringWidth(const CNxString &text) const;
+
+ /**
+ * Get the width of a portion of a string in pixels when drawn with this
+ * font.
+ *
+ * @param text The string to check.
+ * @param startIndex The start point of the substring within the string.
+ * @param length The length of the substring in chars.
+ * @return The width of the substring in pixels.
+ */
+
+ nxgl_coord_t getStringWidth(const CNxString& text,
+ int startIndex, int length) const;
+
+ /**
+ * Gets font metrics for a particular character
+ *
+ *
+ * @param letter The character to get the width of.
+ * @param metrics The location to return the font metrics
+ */
+
+ void getCharMetrics(nxwidget_char_t letter,
+ FAR struct nx_fontmetric_s *metrics) const;
+
+ /**
+ * Get the width of an individual character.
+ *
+ * @param letter The character to get the width of.
+ * @return The width of the character in pixels.
+ */
+
+ nxgl_coord_t getCharWidth(nxwidget_char_t letter) const;
+
+ /**
+ * Get the height of an individual character.
+ *
+ * @param letter The letter to get the height of.
+ * @return The height of the character in pixels.
+ */
+
+ inline nxgl_coord_t getCharHeight(nxwidget_char_t letter) const;
+
+ /**
+ * Gets the maximum width of the font.
+ *
+ * @return The height of the font.
+ */
+
+ inline const uint8_t getMaxWidth(void) const
+ {
+ return m_pFontSet->mxwidth;
+ }
+
+ /**
+ * Gets the height of the font.
+ *
+ * @return The height of the font.
+ */
+
+ inline const uint8_t getHeight(void) const
+ {
+ return m_pFontSet->mxheight;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXFONT_HXX
diff --git a/NxWidgets/libnxwidgets/include/cnxserver.hxx b/NxWidgets/libnxwidgets/include/cnxserver.hxx
new file mode 100644
index 000000000..2c79558a0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxserver.hxx
@@ -0,0 +1,199 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cnxserver.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXSERVER_HXX
+#define __INCLUDE_CNXSERVER_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nx.h>
+
+#include "cnxwindow.hxx"
+#include "cbgwindow.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CBgWindow;
+
+ /**
+ * This class represents the NX server. It includes methods to connect to
+ * and disconnect form the NX server, methods to manage the background, and
+ * "factory" methods to create window objects on the NX server. NXWidget
+ * objects them may be created on the window objects.
+ */
+
+ class CNxServer
+ {
+ private:
+#ifndef CONFIG_NX_MULTIUSER
+ FAR NX_DRIVERTYPE *m_hDevice; /**< LCD/Framebuffer device handle */
+#endif
+ NXHANDLE m_hNxServer; /**< NX server handle */
+#ifdef CONFIG_NX_MULTIUSER
+ voilatile bool m_running; /**< True: The listener thread is running */
+ voilatile bool m_connected; /**< True: Connected to the server */
+ volatile bool m_stop; /**< True: Waiting for the listener thread to stop */
+ sem_t m_connsem; /**< Wait for server connection */
+#endif
+ static uint8_t m_nServers; /**< The number of NX server instances */
+
+ /**
+ * This is the entry point of a thread that listeners for and dispatches
+ * events from the NX server.
+ */
+
+#ifdef CONFIG_NX_MULTIUSER
+ static FAR void *listener(FAR void *arg);
+#endif
+
+ public:
+
+ /**
+ * CNXServer constructor. The CNxServer is a normally singleton. However, that
+ * not enforced: This constructor could run more than one in the situation where
+ * there are multiple physical displays. However, that configuration has never
+ * been texted.
+ */
+
+ CNxServer(void);
+
+ /**
+ * CNXServer destructor
+ */
+
+ ~CNxServer(void);
+
+ /**
+ * Connect to the NX Server
+ */
+
+ virtual bool connect(void);
+
+ /**
+ * Disconnect from the NX Server
+ */
+
+ virtual void disconnect(void);
+
+ /**
+ * Get the NX server handle
+ *
+ * @return The NX server handler (NULL is not connected)
+ */
+
+ inline NXHANDLE getServer(void)
+ {
+ return m_hNxServer;
+ }
+
+ /**
+ * Test if we are connected to the NX server.
+ *
+ * @return True is connected; false is not connected.
+ */
+
+ inline bool connected(void)
+ {
+#ifdef CONFIG_NX_MULTIUSER
+ return m_connected;
+#else
+ return true;
+#endif
+ }
+
+ /**
+ * Set the background color
+ */
+
+ inline bool setBackgroundColor(nxgl_mxpixel_t color)
+ {
+ return nx_setbgcolor(m_hNxServer, &color) == OK;
+ }
+
+ /**
+ * Get an instance of a raw NX window.
+ */
+
+ inline CNxWindow *createRawWindow(CWidgetControl *widgetControl)
+ {
+ return new CNxWindow(m_hNxServer, widgetControl);
+ }
+
+ /**
+ * Get an instance of the framed NX window.
+ */
+
+#if 0 // Not ready for prime time
+ inline CFramedWindow *createFramedWindow(CWidgetControl *widgetControl)
+ {
+ return new CFramedWindow(m_hNxServer, widgetControl);
+ }
+#endif
+
+ /**
+ * Get an instance of the background window.
+ */
+
+ inline CBgWindow *getBgWindow(CWidgetControl *widgetControl)
+ {
+ return new CBgWindow(m_hNxServer, widgetControl);
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXSERVER_HXX
diff --git a/NxWidgets/libnxwidgets/include/cnxstring.hxx b/NxWidgets/libnxwidgets/include/cnxstring.hxx
new file mode 100644
index 000000000..91bd253c7
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxstring.hxx
@@ -0,0 +1,484 @@
+/****************************************************************************
+ * include/cnxtring.hxx
+ * NxWidgets/libnxwidgets/
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXSTRING_HXX
+#define __INCLUDE_CNXSTRING_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "nxconfig.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CStringIterator;
+
+ /**
+ * Unicode string class. Uses 16-bt wide-character encoding. For optimal
+ * performance, use the CStringIterator class to iterate over a CNxString
+ * instance.
+ *
+ * Where possible, the string avoids allocating memory each time the
+ * string grows or shrinks. This means that the string may consume more
+ * memory than the number of chars would seem to dictate if the object
+ * previously contained a large string that has subsequently been truncated.
+ * It also means that increasing the length of such a string is a cheaper
+ * operation as memory does not need to allocated and copied.
+ *
+ * Additionally, the string increases its array size by m_growAmount every
+ * time it needs to allocate extra memory, potentially reducing the number
+ * of reallocs needed.
+ *
+ * The string is not null-terminated. Instead, it uses a m_stringLength
+ * member that stores the number of characters in the string. This saves a
+ * byte and makes calls to getLength() run in O(1) time instead of O(n).
+ */
+
+ class CNxString
+ {
+ private:
+ friend class CStringIterator;
+
+ int m_stringLength; /**< Number of characters in the string */
+ int m_allocatedSize; /**< Number of bytes allocated for this string */
+ int m_growAmount; /**< Number of chars that the string grows by
+ whenever it needs to get larger */
+
+
+ protected:
+ FAR nxwidget_char_t *m_text; /**< Raw char array data */
+
+ /**
+ * Allocate memory for the string.
+ *
+ * @param chars Number of chars to allocate.
+ * @param preserve If true, the data in the existing memory will be
+ * preserved if new memory must be allocated
+ */
+
+ void allocateMemory(int chars, bool preserve);
+
+ /**
+ * Check if we've got any string data stored or not.
+ *
+ * @return True if the string contains any data; false if no data has
+ * yet been supplied.
+ */
+
+ inline bool hasData(void) const
+ {
+ return m_stringLength > 0;
+ }
+
+ /**
+ * Get the amount of allocated memory.
+ *
+ * @return The number of chars allocated in RAM.
+ */
+
+ inline int getAllocatedSize(void) const
+ {
+ return m_allocatedSize;
+ }
+
+ /**
+ * Returns a pointer to the raw char array data.
+ *
+ * @return Pointer to the char array.
+ */
+
+ inline FAR const nxwidget_char_t *getCharArray(void) const
+ {
+ return m_text;
+ }
+
+ /**
+ * Return a pointer to the specified character.
+ *
+ * @param index Index of the character to retrieve.
+ */
+
+ FAR nxwidget_char_t *getCharPointer(const int index) const;
+
+ public:
+
+ /**
+ * Constructor to create an empty string object.
+ */
+
+ CNxString();
+
+ /**
+ * Constructor to create a string from a C character array.
+ *
+ * @param text Pointer to a char array to use as the basis of the
+ * string.
+ */
+
+ CNxString(FAR const char *text);
+
+ /**
+ * Constructor to create a string from a single character.
+ *
+ * @param letter Single character to use as the basis of the string.
+ */
+
+ CNxString(const nxwidget_char_t letter);
+
+ /**
+ * Copy constructor.
+ * @param string CNxString object to create a copy of.
+ */
+
+ CNxString(const CNxString &string);
+
+ /**
+ * Destructor.
+ */
+
+ inline ~CNxString()
+ {
+ delete[] m_text;
+ m_text = (FAR nxwidget_char_t *)NULL;
+ };
+
+ /**
+ * Creates and returns a new CStringIterator object that will iterate
+ * over this string. The object must be manually deleted once it is
+ * no longer needed.
+ *
+ * @return A new CStringIterator object.
+ */
+
+ CStringIterator *newStringIterator(void) const;
+
+ /**
+ * Copy the internal array to the supplied buffer. The buffer must be
+ * large enough to contain the full text in the string. The
+ * getByteCount() method can be used to obtain the length of the string.
+ * Unlike the CNxString class, the char array is null-terminated.
+ * The buffer must be (getByteCount() + 1) bytes long, in order to
+ * accommodate the terminator.
+ *
+ * @param buffer Buffer to copy the internal char array to.
+ */
+
+ void copyToCharArray(FAR nxwidget_char_t *buffer) const;
+
+ /**
+ * Set the text in the string.
+ *
+ * @param text CNxString containing the new data for this string.
+ */
+
+ void setText(const CNxString &text);
+
+ /**
+ * Set the text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+ void setText(FAR const char *text);
+
+ /**
+ * Set the nxwidget_char_t text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+ void setText(FAR const nxwidget_char_t *text, int nchars);
+
+ /**
+ * Set the 8-bit C-string text in the string.
+ *
+ * @param text Character to to use as the new data for this string.
+ */
+
+ void setText(const nxwidget_char_t text);
+
+ /**
+ * Append text to the end of the string.
+ *
+ * @param text String to append.
+ */
+
+ void append(const CNxString &text);
+
+ /**
+ * Insert text at the specified character index.
+ *
+ * @param text The text to insert.
+ * @param index The index at which to insert the text.
+ */
+
+ void insert(const CNxString &text, const int index);
+
+ /**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+ void remove(const int startIndex);
+
+ /**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+ void remove(const int startIndex, const int count);
+
+ /**
+ * Get the of number of letters (ie. the length) of the string.
+ *
+ * @return The length of the string.
+ */
+
+ inline const int getLength(void) const
+ {
+ return m_stringLength;
+ };
+
+ /**
+ * Get the character at the specified index. This function is useful
+ * for finding the occasional character at an index, but for iterating
+ * over strings it is exceptionally slow. The newStringIterator()
+ * method should be used to retrieve an iterator object that can iterate
+ * over the string efficiently.
+ *
+ * @param index The index of the character to retrieve.
+ * @return The character at the specified index.
+ */
+
+ const nxwidget_char_t getCharAt(int index) const;
+
+ /**
+ * Returns the first index of the specified letter within the string.
+ * Will return -1 if the letter is not found.
+ *
+ * @param letter Letter to find.
+ * @return The index of the letter.
+ */
+
+ const int indexOf(nxwidget_char_t letter) const;
+
+ /**
+ * Returns the first index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * from "startIndex" until it has examined all subsequent letters.
+ * @param letter Letter to find.
+ *
+ * @param startIndex The index to start searching from.
+ * @return The index of the letter.
+ */
+
+ const int indexOf(nxwidget_char_t letter, int startIndex) const;
+
+ /**
+ * Returns the first index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * from "startIndex" until it has examined all letters within the
+ * range "count".
+ *
+ * @param letter Letter to find.
+ * @param startIndex The index to start searching from.
+ * @param count The number of characters to examine.
+ * @return The index of the letter.
+ */
+
+ const int indexOf(nxwidget_char_t letter, int startIndex, int count) const;
+
+ /**
+ * Returns the last index of the specified letter within the string.
+ * Will return -1 if the letter is not found.
+ *
+ * @param letter Letter to find.
+ * @return The index of the letter.
+ */
+
+ const int lastIndexOf(nxwidget_char_t letter) const;
+
+ /**
+ * Returns the last index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * backwards from "startIndex" until it has examined all preceding
+ * letters within the string.
+ *
+ * @param letter Letter to find.
+ * @param startIndex The index to start searching from.
+ * @return The index of the letter.
+ */
+
+ const int lastIndexOf(nxwidget_char_t letter, int startIndex) const;
+
+ /**
+ * Returns the last index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * backwards from "startIndex" until it has examined all letters within
+ * the range "count".
+ * @param letter Letter to find.
+ * @param startIndex The index to start searching from.
+ * @param count The number of characters to examine.
+ * @return The index of the letter.
+ */
+
+ const int lastIndexOf(nxwidget_char_t letter, int startIndex, int count) const;
+
+ /**
+ * Get a substring from this string. It is the responsibility of the
+ * caller to delete the substring when it is no longer required.
+ *
+ * @param startIndex The starting point of the substring.
+ * @return A pointer to a new CNxString object containing the
+ * substring.
+ */
+
+ CNxString *subString(int startIndex) const;
+
+ /**
+ * Get a substring from this string. It is the responsibility of the
+ * caller to delete the substring when it is no longer required.
+ *
+ * @param startIndex The starting point of the substring.
+ * @param length The length of the substring.
+ * @return A pointer to a new CNxString object containing the
+ * substring.
+ */
+
+ CNxString *subString(int startIndex, int length) const;
+
+ /**
+ * Overloaded assignment operator. Copies the data within the argument
+ * string to this string.
+ *
+ * @param string The string to copy.
+ * @return This string.
+ */
+
+ CNxString &operator=(const CNxString &string);
+
+ /**
+ * Overloaded assignment operator. Copies the data within the argument
+ * char array to this string.
+ *
+ * @param string The string to copy.
+ * @return This string.
+ */
+
+ CNxString &operator=(const char *string);
+
+ /**
+ * Overloaded assignment operator. Copies the data from the argument
+ * char to this string.
+ *
+ * @param letter The char to copy.
+ * @return This string.
+ */
+
+ CNxString& operator=(nxwidget_char_t letter);
+
+ /**
+ * Compares this string to the argument.
+ *
+ * @param string String to compare to.
+ * @return Zero if both strings are equal. A value greater than zero
+ * indicates that this string is greater than the argument string. A
+ * value less than zero indicates the opposite. Note that the return
+ * value indicates the *byte* that does not match, not the *character*.
+ */
+
+ int compareTo(const CNxString &string) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXSTRING_HXX
diff --git a/NxWidgets/libnxwidgets/include/cnxtimer.hxx b/NxWidgets/libnxwidgets/include/cnxtimer.hxx
new file mode 100644
index 000000000..be6038dac
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxtimer.hxx
@@ -0,0 +1,220 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cnxtimer.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXTIMER_HXX
+#define __INCLUDE_CNXTIMER_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <ctime>
+
+#include "cnxwidget.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetcontrol;
+
+ /**
+ * Timer widget. It can drive time-based events, animations, etc.
+ *
+ * Using the timer is simple:
+ * - Create an instance of the CNxTimer and add it as a child to a widget.
+ * - Call the instance's "start()" method.
+ * - Catch the timer's action event and call any code that should run.
+ */
+
+ class CNxTimer : public CNxWidget
+ {
+ protected:
+ FAR timer_t m_timerid; /**< POSIX timer */
+ uint32_t m_timeout; /**< The timeout value in milliseconds */
+ bool m_isRunning; /**< Indicates whether or not the timer is running */
+ bool m_isRepeater; /**< Indicates whether or not the timer repeats */
+
+ /**
+ * The SIGALM signal handler that will be called when the timer goes off
+ *
+ * @param signo The signal number call caused the handler to run (SIGALM)
+ */
+
+ static void signalHandler(int signo);
+
+ /**
+ * Handle an expired timer
+ */
+
+ void handleTimerExpiration(void);
+
+ /**
+ * Convert a timespec to milliseconds
+ *
+ * @param tp The pointer to the timespec to convert
+ * @return The corresponding time in milliseconds
+ */
+
+ uint32_t timespecToMilliseconds(FAR const struct timespec *tp);
+
+ /**
+ * Convert milliseconds to a timespec
+ *
+ * @param milliseconds The milliseconds to be converted
+ * @param tp The pointer to the location to store the converted timespec
+ */
+
+ void millisecondsToTimespec(uint32_t milliseconds, FAR struct timespec *tp);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CNxTimer(const CNxTimer &timer) : CNxWidget(timer) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param timeout Time, in milliseconds, before the timer fires an
+ * EVENT_ACTION event.
+ * @param repeat If true, the timer will fire multiple events. If false,
+ * the timer will fire just once and stop.
+ */
+
+ CNxTimer(CWidgetControl *pWidgetControl, uint32_t timeout, bool repeat);
+
+ /**
+ * Destructor.
+ */
+
+ ~CNxTimer(void);
+
+ /**
+ * Return the time remaining on this timer.
+ *
+ * @return The number of milliseconds that this timer runs before
+ * firing an event. Zero is returned if the timer is not running.
+ */
+
+ const uint32_t getTimeout(void);
+
+ /**
+ * Resets the (running) timer to its initial timeout value. This
+ * call does nothing if the timer is not running.
+ */
+
+ void reset(void);
+
+ /**
+ * Starts the timer. This call does nothing if the timer is already
+ * running.
+ */
+
+ void start(void);
+
+ /**
+ * Stops the timer. Does nothing if the timer is not running.
+ */
+
+ void stop(void);
+
+ /**
+ * Set the timeout of this timer. This timeout value will not
+ * take effect until start() or reset() is called.
+ *
+ * @param timeout The number of milliseconds that this timer will run
+ * before firing an event.
+ */
+
+ inline void setTimeout(uint32_t timeout)
+ {
+ m_timeout = timeout;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXTIMER_HXX
diff --git a/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx b/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx
new file mode 100644
index 000000000..ed2ecdbd2
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx
@@ -0,0 +1,327 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cnxtkwindow.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXTKWINDOW_HXX
+#define __INCLUDE_CNXTKWINDOW_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxtk.h>
+
+#include "ccallback.hxx"
+#include "inxwindow.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxToolbar;
+ struct SBitmap;
+
+ /**
+ * This class defines operations on a framed NX window.
+ * There are three instances that represent an NX window from the
+ * perspective of NXWidgets.
+ *
+ * - There is one widget control instance per NX window,
+ * - One CCallback instance per window,
+ * - One window instance.
+ *
+ * There a various kinds of of window instances, but each inherits
+ * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
+ * that describes the common window behavior.
+ */
+
+ class CNxTkWindow : protected CCallback, public INxWindow
+ {
+ protected:
+ NXHANDLE m_hNxServer; /**< Handle to the NX server. */
+ NXTKWINDOW m_hNxTkWindow; /**< Handle to the NX raw window */
+ CWidgetControl *m_widgetControl; /**< Controlling widget for the window */
+ CNxToolbar *m_toolbar; /**< Child toolbar */
+
+ public:
+
+ /**
+ * Constructor. Creates an uninitialized instance of the CNxTkWindow
+ * object. The open() method must be called to initialize the instance.
+ *
+ * The general steps to create any window include:
+ * 1) Create a dumb CWigetControl instance
+ * 2) Pass the dumb CWidgetControl instance to the window constructor
+ * that inherits from INxWindow.
+ * 3) The window constructor call CWidgetControl methods to "smarten"
+ * the CWidgetControl instance with window-specific knowledge.
+ * 4) Call the open() method on the window to display the window.
+ * 5) After that, the fully smartend CWidgetControl instance can
+ * be used to generate additional widgets.
+ * 6) After that, the fully smartened CWidgetControl instance can
+ * be used to generate additional widgets by passing it to the
+ * widget constructor
+ *
+ * @param hNxServer Handle to the NX server.
+ * @param widgetControl Controlling widget for this window.
+ */
+
+ CNxTkWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl);
+
+ /**
+ * Destructor.
+ */
+
+ ~CNxTkWindow(void);
+
+ /**
+ * Creates a new window. Window creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the window was successfully opened.
+ */
+
+ bool open(void);
+
+ /**
+ * Open a toolbar on the framed window. Toolbar creation is separate
+ * from object instantion so that errors can be reported
+ *
+ * @return True if the toolbar was successfully created.
+ */
+
+ CNxToolbar *openToolbar(nxgl_coord_t height);
+
+ /**
+ * Detach the toolbar. This should *ONLY* be called by the toolbar
+ * instance itself. If this is called by end-user logic, it will
+ * screw things up miserably.
+ */
+
+ inline void detachToolbar(void)
+ {
+ m_toolbar = (CNxToolbar *)NULL;
+ }
+
+ /**
+ * Request the position and size information of the window. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool requestPosition(void);
+
+ /**
+ * Get the position of the window (as reported by the NX callback).
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool getPosition(FAR struct nxgl_point_s *pPos);
+
+ /**
+ * Get the size of the window (as reported by the NX callback).
+ *
+ * @return The size.
+ */
+
+ bool getSize(FAR struct nxgl_size_s *pSize);
+
+ /**
+ * Set the position and size of the window.
+ *
+ * @param pPos The new position of the window.
+ * @return True on success, false on any failure.
+ */
+
+ bool setPosition(FAR const struct nxgl_point_s *pPos);
+
+ /**
+ * Set the size of the selected window.
+ *
+ * @param pSize The new size of the window.
+ * @return True on success, false on any failure.
+ */
+
+ bool setSize(FAR const struct nxgl_size_s *pSize);
+
+ /**
+ * Bring the window to the top of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool raise(void);
+
+ /**
+ * Lower the window to the bottom of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool lower(void);
+
+ /**
+ * Set an individual pixel in the window with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified rectangle in the window with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+ void getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest);
+
+ /**
+ * Fill the specified trapezoidal region in the window with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to window (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified line in the window with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+ bool drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Move a rectangular region within the window.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset);
+
+ /**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified window.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in window coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXTKWINDOW_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx b/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx
new file mode 100644
index 000000000..ff65cf1a9
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx
@@ -0,0 +1,304 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cnxtoolbar.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXTOOLBAR_HXX
+#define __INCLUDE_CNXTOOLBAR_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxtk.h>
+
+#include "ccallback.hxx"
+#include "inxwindow.hxx"
+#include "cnxtkwindow.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+ struct SBitmap;
+
+ /**
+ * This class defines operations on a the toolbar in a framed NX window.
+ * There are three instances that represent an NX window from the
+ * perspective of NXWidgets.
+ *
+ * - There is one widget control instance per NX window,
+ * - One CCallback instance per window,
+ * - One window instance.
+ *
+ * There a various kinds of of window instances, but each inherits
+ * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
+ * that describes the common window behavior.
+ */
+
+ class CNxToolbar : protected CCallback, public INxWindow
+ {
+ private:
+ CNxTkWindow *m_nxTkWindow; /**< Parent framed window instance. */
+ NXTKWINDOW m_hNxTkWindow; /**< Parent framed window handle. */
+ CWidgetControl *m_widgetControl; /**< Controlling widget for the toolbar */
+ nxgl_coord_t m_height; /**< The toolbar height */
+
+ public:
+
+ /**
+ * Constructor. Creates an uninitialized instance of the CNxToolbar
+ * object. The open() method must be called to initialize the instance.
+ *
+ * @param pNxTkWindow Parent framed window instance
+ * @param hNxTkWindow Parent framed window NX handler
+ * @param widgetControl Controlling widget for this toolbar.
+ * @param height The height of the toolbar.
+ */
+
+ CNxToolbar(CNxTkWindow *pNxTkWindow, NXTKWINDOW hNxTkWindow,
+ CWidgetControl *pWidgetControl, nxgl_coord_t height);
+
+ /**
+ * Destructor.
+ */
+
+ ~CNxToolbar(void);
+
+ /**
+ * Creates a new toolbar. Toolbar creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the toolbar was successfully created.
+ */
+
+ bool open(void);
+
+ /**
+ * Request the position and size information of the toolbar. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool requestPosition(void);
+
+ /**
+ * Get the position of the toolbar (as reported by the NX callback).
+ *
+ * @return The position.
+ */
+
+ bool getPosition(FAR struct nxgl_point_s *pPos);
+
+ /**
+ * Get the size of the toolbar (as reported by the NX callback).
+ *
+ * @return The size.
+ */
+
+ bool getSize(FAR struct nxgl_size_s *pSize);
+
+ /**
+ * Set the position and size of the toolbar. The position of
+ * the toolbar is fixed at the top of the parent framed window.
+ *
+ * @param pPos The new position of the toolbar.
+ * @return Always returns false.
+ */
+
+ bool setPosition(FAR const struct nxgl_point_s *pPos);
+
+ /**
+ * Set the position and size of the toolbar. The position of
+ * the toolbar is fixed at the top of the parent framed window.
+ *
+ * @param pPos The new position of the toolbar.
+ * @return Always returns false.
+ */
+
+ bool setSize(FAR const struct nxgl_size_s *pSize);
+
+ /**
+ * Bring the toolbar to the top of the display. The toolbar is
+ * a component of the containing, parent, framed window. It
+ * cannot be raised separately.
+ *
+ * @return Always returns false.
+ */
+
+ bool raise(void);
+
+ /**
+ * Lower the toolbar to the bottom of the display. The toolbar is
+ * a component of the containing, parent, framed window. It
+ * cannot be lowered separately.
+ *
+ * @return Always returns false.
+ */
+
+ bool lower(void);
+
+ /**
+ * Set an individual pixel in the toolbar with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified rectangle in the toolbar with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+ void getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest);
+
+ /**
+ * Fill the specified trapezoidal region in the toolbar with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to toolbar (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified line in the toolbar with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+ bool drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Move a rectangular region within the toolbar.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset);
+
+ /**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified toolbar.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in toolbar coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXTOOLBAR_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cnxwidget.hxx b/NxWidgets/libnxwidgets/include/cnxwidget.hxx
new file mode 100644
index 000000000..eb1b18710
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxwidget.hxx
@@ -0,0 +1,1627 @@
+/****************************************************************************
+ * include/cnxwidget.hxx
+ * NxWidgets/libnxwidgets/
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXWIDGET_HXX
+#define __INCLUDE_CNXWIDGET_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <ctime>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxstring.hxx"
+#include "cnxfont.hxx"
+#include "crect.hxx"
+#include "cwidgetstyle.hxx"
+#include "cwidgeteventargs.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "cwidgeteventhandlerlist.hxx"
+#include "tnxarray.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ class CGraphicsPort;
+ class CNxFont;
+ class CRectCache;
+ class CWidgetEventHandlerList;
+
+ /**
+ * Class providing all the basic functionality of a NxWidget. All other
+ * widgets must must inherit from this class.
+ */
+
+ class CNxWidget
+ {
+ public:
+
+ /**
+ * Enum describing the way other widgets should behave when they try to
+ * close this widget.
+ */
+
+ enum CloseType
+ {
+ CLOSE_TYPE_CLOSE = 0, /**< Widgets should call the close() method */
+ CLOSE_TYPE_HIDE = 1, /**< Widgets should call the hide() method */
+ CLOSE_TYPE_SHELVE = 2 /**< Widgets should call the shelve() method */
+ };
+
+ /**
+ * Enum listing flags that can be set in the constructor's "flags" parameter.
+ */
+
+ enum WidgetFlagType
+ {
+ WIDGET_BORDERLESS = 0x0001, /**< Widget has no border */
+ WIDGET_DRAGGABLE = 0x0002, /**< Widget can be dragged by the user */
+ WIDGET_PERMEABLE = 0x0004, /**< Widget's children can exceed this widget's edges */
+ WIDGET_DOUBLE_CLICKABLE = 0x0008, /**< Widget can be double-clicked */
+ WIDGET_NO_RAISE_EVENTS = 0x0010, /**< Widget does not raise events */
+ };
+
+ /**
+ * Struct describing some basic properties of a widget.
+ */
+
+ typedef struct
+ {
+ uint8_t clicked : 1; /**< True if the widget is currently clicked. */
+ uint8_t hasFocus : 1; /**< True if the widget has focus. */
+ uint8_t dragging : 1; /**< True if the widget is being dragged. */
+ uint8_t deleted : 1; /**< True if the widget has been deleted. */
+ uint8_t shelved : 1; /**< True if the widget has been shelved. */
+ uint8_t borderless : 1; /**< True if the widget is borderless. */
+ uint8_t draggable : 1; /**< True if the widget can be dragged. */
+ uint8_t drawingEnabled : 1; /**< True if the widget can be drawn. */
+ uint8_t enabled : 1; /**< True if the widget is enabled. */
+ uint8_t permeable : 1; /**< True if the widget's children can exceed its dimensions. */
+ uint8_t erased : 1; /**< True if the widget is currently erased from the frame buffer. */
+ uint8_t visibleRegionCacheInvalid : 1; /**< True if the region cache is invalid. */
+ uint8_t hidden : 1; /**< True if the widget is hidden. */
+ uint8_t doubleClickable : 1; /**< True if the widget can be double-clicked. */
+ uint8_t modal : 1; /**< True if the widget is modal. */
+ } Flags;
+
+ /**
+ * Struct describing the size of all four borders of a widget.
+ */
+
+ typedef struct
+ {
+ uint8_t top; /**< Height of the top border. */
+ uint8_t right; /**< Width of the right border. */
+ uint8_t bottom; /**< Height of the bottom border. */
+ uint8_t left; /**< Width of the left border. */
+ } WidgetBorderSize;
+
+ protected:
+ CWidgetControl *m_widgetControl; /**< The controlling widget for the display */
+ CRect m_rect; /**< Rectange bounding the widget. */
+ uint32_t m_refcon; /**< Identifying number of the widget. */
+
+ // Dragging variables
+
+ nxgl_coord_t m_grabPointX; /**< Physical space x coordinate where dragging began. */
+ nxgl_coord_t m_grabPointY; /**< Physical space y coordinate where dragging began. */
+ nxgl_coord_t m_newX; /**< Physical x coordinate where widget is being dragged to. */
+ nxgl_coord_t m_newY; /**< Physical y coordinate where widget is being dragged to. */
+
+ // Style
+
+ CWidgetStyle m_style; /**< All style information used by a widget. */
+
+ // Status
+
+ Flags m_flags; /**< Flags struct. */
+
+ // Event handling
+
+ CWidgetEventHandlerList *m_widgetEventHandlers; /**< List of event handlers. */
+
+ // Double-clicking
+
+ struct timespec m_lastClickTime; /**< System timer when last clicked. */
+ nxgl_coord_t m_lastClickX; /**< X coordinate of last click. */
+ nxgl_coord_t m_lastClickY; /**< Y coordinate of last click. */
+ int m_doubleClickBounds; /**< Area in which a click is assumed to be a double-click. */
+
+ // Hierarchy control
+
+ CNxWidget *m_parent; /**< Pointer to the widget's parent. */
+ CNxWidget *m_focusedChild; /**< Pointer to the child widget that has focus. */
+ TNxArray<CNxWidget*> m_children; /**< List of child widgets. */
+ TNxArray<CNxWidget*> m_shelvedWidgets; /**< List of shelved child widgets. */
+
+ // Visible regions
+
+ CRectCache *m_rectCache; /**< List of the widget's visible regions. */
+ CloseType m_closeType; /**< Type of close method that should be called for the widget. */
+ WidgetBorderSize m_borderSize; /**< Size of the widget borders. */
+
+ /**
+ * Use the provided widget style
+ */
+
+ void useWidgetStyle(const CWidgetStyle *style);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw().
+ */
+
+ virtual inline void drawContents(CGraphicsPort* port) { }
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw().
+ */
+
+ virtual void drawBorder(CGraphicsPort* port) { }
+
+ /**
+ * Checks if the supplied coordinates collide with a portion of this widget
+ * that is not obscured by its siblings, but that may be obscured by
+ * its children.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if a collision occurred; false if not.
+ */
+
+ bool checkCollisionWithForegroundRects(nxgl_coord_t x, nxgl_coord_t y) const;
+
+ /**
+ * Draw all visible regions of this widget's children.
+ */
+
+ void drawChildren(void);
+
+ /**
+ * Erase and remove the supplied child widget from this widget and
+ * send it to the deletion queue.
+ *
+ * @param widget The widget to close.
+ * @see close().
+ */
+
+ void closeChild(CNxWidget *widget);
+
+ /**
+ * Erase the supplied child widget and move it out of the main child
+ * list into the shelved list. The widget remains in memory and can
+ * be restored by calling "unshelve()" on the widget.
+ *
+ * @param widget The widget to hide.
+ */
+
+ void shelveChild(CNxWidget *widget);
+
+ /**
+ * Redraws all regions of child widgets that fall within the invalidRects
+ * regions.
+ *
+ * @param invalidRects List of invalid regions that need to be redrawn.
+ * @param sender Pointer to the widget that initiated the redraw.
+ */
+
+ void redrawDirtyChildren(TNxArray<CRect>* invalidRects, CNxWidget *sender);
+
+ /**
+ * Get the index of the next visible widget higher up the z-order.
+ *
+ * @param startIndex The starting index.
+ * @return The index of the next highest visible widget.
+ */
+
+ const int getHigherVisibleWidget(const int startIndex) const;
+
+ /**
+ * Get the index of the next visible widget lower down the z-order.
+ *
+ * @param startIndex The starting index.
+ * @return The index of the next lowest visible widget.
+ */
+
+ const int getLowerVisibleWidget(const int startIndex) const;
+
+ /**
+ * Notify this widget that it is being dragged, and set its drag point.
+ *
+ * @param x The x coordinate of the drag position relative to this widget.
+ * @param y The y coordinate of the drag position relative to this widget.
+ */
+
+ void startDragging(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Notify this widget that it is no longer being dragged.
+ */
+
+ void stopDragging(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CNxWidget(const CNxWidget &widget) { }
+
+ /**
+ * Called when the widget is clicked. Override this when creating new
+ * widgets if the widget should exhibit additional behaviour when it is
+ * clicked.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual inline void onClick(nxgl_coord_t x, nxgl_coord_t y) { }
+
+ /**
+ * Called when the widget is double-clicked. Override this when
+ * creating new widgets if the widget should exhibit additional
+ * behaviour when it is double-clicked. To change the conditions that
+ * apply in detecting a double-click, override the isDoubleClicked()
+ * method.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual inline void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y) { }
+
+ /**
+ * Called when the widget is released. Override this when
+ * creating new widgets if the widget should exhibit additional
+ * behaviour when it is released.
+ *
+ * @param x The x coordinate of the mouse when released.
+ * @param y The y coordinate of the mouse when released.
+ */
+
+ virtual inline void onRelease(nxgl_coord_t x, nxgl_coord_t y) { }
+
+ /**
+ * Called when the widget is released outside of its boundaries.
+ * Override this when creating new widgets if the widget should exhibit
+ * additional behaviour when it is released outside of its boundaries.
+ *
+ * @param x The x coordinate of the mouse when released.
+ * @param y The y coordinate of the mouse when released.
+ */
+
+ virtual inline void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y) { }
+
+ /**
+ * Called when the widget is dragged. Override this when creating new
+ * widgets if the widget should exhibit additional behaviour when it is
+ * dragged.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX X distance dragged.
+ * @param vY Y distance dragged.
+ */
+
+ virtual inline void onDrag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY) { }
+
+ /**
+ * Called when the widget starts being dragged. Override this when
+ * creating new widgets if the widget should exhibit additional
+ * behaviour when dragging starts.
+ */
+
+ virtual inline void onDragStart(void) { }
+
+ /**
+ * Called when the widget stops being dragged. Override this when
+ * creating new widgets if the widget should exhibit additional
+ * behaviour when dragging stops.
+ */
+
+ virtual inline void onDragStop(void) { }
+
+ /**
+ * Called when the widget gains focus. Override this when creating new
+ * widgets if the widget should exhibit additional behaviour when
+ * gaining focus.
+ */
+
+ virtual inline void onFocus(void) { }
+
+ /**
+ * Called when the widget loses focus. Override this when creating new
+ * widgets if the widget should exhibit additional behaviour when
+ * losing focus.
+ */
+
+ virtual inline void onBlur(void) { }
+
+ /**
+ * Called when the widget is enabled. Override this when creating new
+ * widgets if the widget should exhibit additional behaviour when
+ * enabled.
+ */
+
+ virtual inline void onEnable(void) { }
+
+ /**
+ * Called when the widget is disabled. Override this when creating new
+ * widgets if the widget should exhibit additional behaviour when
+ * disabled.
+ */
+
+ virtual inline void onDisable(void) { }
+
+ /**
+ * Called when the widget is resized. Override this when creating new
+ * widgets if the widget should exhibit additional behaviour when
+ * resized.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual inline void onResize(nxgl_coord_t width, nxgl_coord_t height) { }
+
+ public:
+
+ /**
+ * CNxWidget constructor.
+ *
+ * @param pWidgetControl The controllwing widget for the display
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param flags Bitmask specifying some set-up values for the widget.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ * @see WidgetFlagType.
+ */
+
+ CNxWidget(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ uint32_t flags,
+ FAR const CWidgetStyle *style = (FAR const CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual ~CNxWidget(void);
+
+ /**
+ * Get the x coordinate of the widget in "Widget space".
+ *
+ * @return Widget space x coordinate.
+ */
+
+ const nxgl_coord_t getX(void) const;
+
+ /**
+ * Get the y coordinate of the widget in "Widget space".
+ *
+ * @return Widget space y coordinate.
+ */
+
+ const nxgl_coord_t getY(void) const;
+
+ /**
+ * Get the x coordinate of the widget relative to its parent.
+ *
+ * @return Parent-space x coordinate.
+ */
+
+ const nxgl_coord_t getRelativeX(void) const;
+
+ /**
+ * Get the y coordinate of the widget relative to its parent.
+ *
+ * @return Parent-space y coordinate.
+ */
+
+ const nxgl_coord_t getRelativeY(void) const;
+
+ /**
+ * Get the reference constant for this widget.
+ * @return The reference constant.
+ */
+
+ inline const uint32_t getRefcon(void) const
+ {
+ return m_refcon;
+ }
+
+ /**
+ * Get the type of close routine that should be called by other widgets
+ * interacting with this widget.
+ *
+ * @return The close type of this widget.
+ */
+
+ inline const CloseType getCloseType(void)
+ {
+ return m_closeType;
+ }
+
+ /**
+ * Is the widget active?
+ * A value of true indicates that this widget has focus or is an ancestor
+ * of the widget with focus.
+ *
+ * @return True if active.
+ */
+
+ inline const bool hasFocus(void) const
+ {
+ return m_flags.hasFocus;
+ }
+
+ /**
+ * Has the widget been marked for deletion? This function recurses up the widget
+ * hierarchy and only returns true if all of the widgets in the ancestor
+ * chain are not deleted.
+ *
+ * Widgets marked for deletion are automatically deleted and should not be
+ * interacted with.
+ *
+ * @return True if marked for deletion.
+ */
+
+ const bool isDeleted(void) const;
+
+ /**
+ * Is the widget allowed to draw? This function recurses up the widget
+ * hierarchy and only returns true if all of the widgets in the ancestor
+ * chain are visible.
+ *
+ * @return True if drawing is enabled.
+ */
+
+ const bool isDrawingEnabled(void) const;
+
+ /**
+ * Is the widget hidden? This function recurses up the widget
+ * hierarchy and returns true if any of the widgets in the ancestor
+ * chain are hidden.
+ *
+ * @return True if hidden.
+ */
+
+ const bool isHidden(void) const;
+
+ /**
+ * Is the widget enabled? This function recurses up the widget
+ * hierarchy and only returns true if all of the widgets in the ancestor
+ * chain are enabled.
+ *
+ * @return True if enabled.
+ */
+
+ const bool isEnabled(void) const;
+
+ /**
+ * Are the widget's edges permeable or solid?
+ * Permeable widgets do not enforce their dimensions on the
+ * coordinates and dimensions of child widgets.
+ *
+ * @return True if permeable.
+ */
+
+ inline const bool isPermeable(void) const
+ {
+ return m_flags.permeable;
+ }
+
+ /**
+ * IS the widget double-clickable?
+ * @return True if the widget watches for double-clicks.
+ */
+
+ inline const bool isDoubleClickable(void) const
+ {
+ return m_flags.doubleClickable;
+ }
+
+ /**
+ * Does the widget have a border?
+ *
+ * @return True if the widget does not have a border.
+ */
+
+ inline const bool isBorderless(void) const
+ {
+ return m_flags.borderless;
+ }
+
+ /**
+ * Is the widget clicked?
+ *
+ * @return True if the widget is currently clicked.
+ */
+
+ inline const bool isClicked(void) const
+ {
+ return m_flags.clicked;
+ }
+
+ /**
+ * Is the widget being dragged?
+ *
+ * @return True if the widget is currently being dragged.
+ */
+
+ inline const bool isBeingDragged(void) const
+ {
+ return m_flags.dragging;
+ }
+
+ /**
+ * Is the widget shelved?
+ *
+ * @return True if the widget is shelved.
+ */
+
+ inline const bool isShelved(void) const
+ {
+ return m_flags.shelved;
+ }
+
+ /**
+ * Is the widget modal? Only true if the Widget singleton is also modal.
+ *
+ * @return True if the widget is modal.
+ */
+
+ const bool isModal(void) const;
+
+ /**
+ * Get the width of the widget.
+ *
+ * @return The widget width.
+ */
+
+ inline nxgl_coord_t getWidth(void) const
+ {
+ return m_rect.getWidth();
+ }
+
+ /**
+ * Get the height of the widget.
+ *
+ * @return The widget height.
+ */
+
+ inline nxgl_coord_t getHeight(void) const
+ {
+ return m_rect.getHeight();
+ }
+
+ /**
+ * Get the dimensions of the border
+ *
+ */
+
+ inline void getBorderSize(WidgetBorderSize &borderSize)
+ {
+ borderSize.top = m_borderSize.top;
+ borderSize.left = m_borderSize.left;
+ borderSize.bottom = m_borderSize.bottom;
+ borderSize.right = m_borderSize.right;
+ }
+
+ /**
+ * Get a pointer to this widget's parent.
+ *
+ * @return This widget's parent.
+ */
+
+ inline CNxWidget *getParent(void) const
+ {
+ return m_parent;
+ }
+
+ /**
+ * Get a pointer to this widget's focused child.
+ *
+ * @return This widget's focused child.
+ */
+
+ inline CNxWidget *getFocusedWidget(void)
+ {
+ return m_focusedChild;
+ }
+
+ /**
+ * Check if this widget raises events or not.
+ *
+ * @return True if events are enabled.
+ */
+
+ inline const bool raisesEvents(void) const
+ {
+ return m_widgetEventHandlers->isEnabled();
+ }
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+
+ /**
+ * Insert the properties of the space within this widget that is
+ * available for children into the rect passed in as a parameter.
+ * All coordinates are relative to this widget.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ void getClientRect(CRect &rect) const;
+
+ /**
+ * Insert the properties of the space within this widget that is
+ * available for children into the rect passed in as a parameter.
+ * Identical to getClientRect() except that all coordinates are
+ * absolute positions within the window.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ void getRect(CRect &rect) const;
+
+ /**
+ * Clips the supplied rect to the boundaries defined by this widget and
+ * this widget's parents.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ void getRectClippedToHierarchy(CRect &rect) const;
+
+ /**
+ * Gets a pointer to the vector of all of the visible regions of this widget,
+ * including any covered by children.
+ *
+ * @return A pointer to a vector of all visible regions.
+ */
+
+ TNxArray<CRect> *getForegroundRegions(void);
+
+ /**
+ * Gets a pointer to the widget's font.
+ *
+ * @return A pointer to the widget's font.
+ */
+
+ inline CNxFont *getFont(void) const
+ {
+ return m_style.font;
+ }
+
+ /**
+ * Gets the color used for the normal background fill.
+ *
+ * @return Background fill color.
+ */
+
+ inline const nxgl_mxpixel_t getBackgroundColor(void) const
+ {
+ return m_style.colors.background;
+ }
+
+ /**
+ * Gets the color used for the background fill when the widget is selected.
+ *
+ * @return Dark color.
+ */
+
+ inline const nxgl_mxpixel_t getSelectedBackgroundColor(void) const
+ {
+ return m_style.colors.selectedBackground;
+ }
+
+ /**
+ * Gets the color used as the light edge in bevelled boxes.
+ *
+ * @return Shine color.
+ */
+
+ inline const nxgl_mxpixel_t getShineEdgeColor(void) const
+ {
+ return m_style.colors.shineEdge;
+ }
+
+ /**
+ * Gets the color used as the dark edge in bevelled boxes.
+ *
+ * @return Shadow color.
+ */
+
+ inline const nxgl_mxpixel_t getShadowEdgeColor(void) const
+ {
+ return m_style.colors.shadowEdge;
+ }
+
+ /**
+ * Gets the color used as the fill in focused window borders.
+ *
+ * @return Highlight color.
+ */
+
+ inline const nxgl_mxpixel_t getHighlightColor(void) const
+ {
+ return m_style.colors.highlight;
+ }
+
+ /**
+ * Gets the color used for text in a disabled widget.
+ *
+ * @return Disabled text color.
+ */
+
+ inline const nxgl_mxpixel_t getDisabledTextColor(void) const
+ {
+ return m_style.colors.disabledText;
+ }
+
+ /**
+ * Gets the color used for text in a enabled widget.
+ *
+ * @return Enabled text color.
+ */
+
+ inline const nxgl_mxpixel_t getEnabledTextColor(void) const
+ {
+ return m_style.colors.enabledText;
+ }
+
+ /**
+ * Gets the color used for text in a clicked widget.
+ *
+ * @return Selected text color.
+ */
+
+ inline const nxgl_mxpixel_t getSelectedTextColor(void) const
+ {
+ return m_style.colors.selectedText;
+ }
+
+ /**
+ * Sets this widget's reference constant. This should be unique,
+ * at least amongst this widget's siblings.
+ *
+ * @param refcon The reference constant.
+ */
+
+ uint32_t setRefcon(uint32_t refcon);
+
+ /**
+ * Sets this widget's border state.
+ *
+ * @param isBorderless The border state.
+ */
+
+ void setBorderless(bool isBorderless);
+
+ /**
+ * Sets whether or not this widget can be dragged.
+ *
+ * @param isDraggable The draggable state.
+ */
+
+ inline void setDraggable(const bool isDraggable)
+ {
+ m_flags.draggable = isDraggable;
+ }
+
+ /**
+ * Sets whether or not child widgets can exceed this widget's dimensions.
+ *
+ * @param permeable The permeable state.
+ */
+
+ inline void setPermeable(const bool permeable)
+ {
+ m_flags.permeable = permeable;
+ }
+
+ /**
+ * Sets whether or not the widgets processes double-clicks.
+ *
+ * @param doubleClickable The double-clickable state.
+ */
+
+ inline void setDoubleClickable(const bool doubleClickable)
+ {
+ m_flags.doubleClickable = doubleClickable;
+ }
+
+ /**
+ * Adds a widget event handler. The event handler will receive
+ * all events raised by this widget.
+ *
+ * @param eventHandler A pointer to the event handler.
+ */
+
+ inline void addWidgetEventHandler(CWidgetEventHandler *eventHandler)
+ {
+ m_widgetEventHandlers->addWidgetEventHandler(eventHandler);
+ }
+
+ /**
+ * Remove a widget event handler.
+ *
+ * @param eventHandler A pointer to the event handler to remove.
+ */
+
+ inline void removeWidgetEventHandler(CWidgetEventHandler* eventHandler)
+ {
+ m_widgetEventHandlers->removeWidgetEventHandler(eventHandler);
+ }
+
+ /**
+ * Enables or disables event firing for this widget.
+ *
+ * @param raises True to enable events, false to disable.
+ */
+
+ inline void setRaisesEvents(const bool raises)
+ {
+ raises ? m_widgetEventHandlers->enable() : m_widgetEventHandlers->disable();
+ }
+
+ /**
+ * Disabled drawing of this widget. Widgets hidden using this method will still
+ * be processed.
+ */
+
+ inline void disableDrawing(void)
+ {
+ m_flags.drawingEnabled = false;
+ }
+
+ /**
+ * Enables drawing of this widget.
+ */
+
+ inline void enableDrawing(void)
+ {
+ m_flags.drawingEnabled = true;
+ }
+
+ /**
+ * Sets the normal background color.
+ *
+ * @param color The new background color.
+ */
+
+ inline void setBackgroundColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.background = color;
+ }
+
+ /**
+ * Sets the background color for a selected widget.
+ *
+ * @param color The new selected background color.
+ */
+
+ inline void setSelectedBackgroundColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.selectedBackground = color;
+ }
+
+ /**
+ * Sets the shiny edge color.
+ *
+ * @param color The new shine edge color.
+ */
+
+ inline void setShineEdgeColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.shineEdge = color;
+ }
+
+ /**
+ * Sets the shadow edge color.
+ *
+ * @param color The new shadow edge color.
+ */
+
+ inline void setShadowEdgeColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.shadowEdge = color;
+ }
+
+ /**
+ * Sets the highlight color.
+ *
+ * @param color The new highlight color.
+ */
+
+ inline void setHighlightColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.highlight = color;
+ }
+
+ /**
+ * Sets the text color to use when the widget is disabled.
+ *
+ * @param color The new text color.
+ */
+
+ inline void setDisabledTextColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.disabledText = color;
+ }
+
+ /**
+ * Sets the text color to use when the widget is enabled.
+ *
+ * @param color The new text color.
+ */
+
+ inline void setEnabledTextColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.enabledText = color;
+ }
+
+ /**
+ * Sets the text color to use when the widget is highlighted or clicked.
+ *
+ * @param color The new selected text color.
+ */
+
+ inline void setSelectedTextColor(const nxgl_mxpixel_t color)
+ {
+ m_style.colors.selectedText = color;
+ }
+
+ /**
+ * Sets the close type other widgets should use when closing this widget.
+ *
+ * @param closeType The close type to use.
+ */
+
+ inline void setCloseType(const CloseType closeType)
+ {
+ m_closeType = closeType;
+ }
+
+ /**
+ * Sets the font.
+ *
+ * @param font A pointer to the font to use.
+ */
+
+ virtual void setFont(CNxFont *font);
+
+ /**
+ * Draws the visible regions of the widget and the widget's child widgets.
+ */
+
+ void redraw(void);
+
+ /**
+ * Erases the visible regions of the widget by redrawing the widgets
+ * behind it.
+ */
+
+ void erase(void);
+
+ /**
+ * Enables the widget.
+ *
+ * @return True if the widget was enabled.
+ */
+
+ bool enable(void);
+
+ /**
+ * Disabled the widget.
+ *
+ * @return True if the widget was disabled.
+ */
+
+ bool disable(void);
+
+ /**
+ * Erases the widget, marks it as deleted, and moves it to the CNxWidget
+ * deletion queue. Widgets are automatically deleted by the framework and
+ * should not be deleted externally.
+ */
+
+ void close(void);
+
+ /**
+ * Erases the widget, removes it from the main hierarchy and sets it to
+ * invisible. Widgets hidden in this way will be partioned off from
+ * other widgets and will no longer be processed.
+ *
+ * @return True if the widget was shelved.
+ * @see unshelve()
+ */
+
+ bool shelve(void);
+
+ /**
+ * Moves the widget back into the hierarchy and redraws it. Widgets shown
+ * in this way will be unpartioned and will be processed again.
+ *
+ * @return True if the widget was unshelved.
+ * @see shelve()
+ */
+
+ bool unshelve(void);
+
+ /**
+ * Draws the widget and makes it visible.
+ * Does not steal focus from other widgets.
+ *
+ * @return True if the widget was shown.
+ * @see hide()
+ */
+
+ bool show(void);
+
+ /**
+ * Erases the widget and makes it invisible.
+ * Does not re-assign focus to another widget.
+ *
+ * @return True if the widget was hidden.
+ * @see show()
+ */
+
+ bool hide(void);
+
+ /**
+ * Click this widget at the supplied coordinates. This should only be
+ * overridden in subclasses if the default click behaviour needs to be changed.
+ * If the subclassed widget should just respond to a standard click,
+ * the onClick() method should be overridden instead.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click was successful.
+ */
+
+ bool click(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Check if the click is a double-click.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click is a double-click.
+ */
+
+ virtual bool isDoubleClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Double-click this widget at the supplied coordinates. This
+ * should only be overridden in subclasses if the default
+ * double-click behaviour needs to be changed. If the subclassed
+ * widget should just respond to a standard double-click, the
+ * onDoubleClick() method should be overridden instead.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click was successful.
+ */
+
+ bool doubleClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Release this widget at the supplied coordinates. This
+ * should only be overridden in subclasses if the default
+ * release behaviour needs to be changed. If the subclassed
+ * widget should just respond to a standard release, the
+ * onRelease() method should be overridden instead.
+ *
+ * @param x X coordinate of the release.
+ * @param y Y coordinate of the release.
+ * @return True if the release was successful.
+ */
+
+ bool release(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Drag the widget to the supplied coordinates.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal distance that the mouse was dragged.
+ * @param vY The vertical distance that the mouse was dragged.
+ * @return True if the drag was successful.
+ */
+
+ bool drag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY);
+
+ /**
+ * Send a keypress to the widget.
+ *
+ * @param key The keycode to send to the widget.
+ * @return True if the keypress was processed.
+ */
+
+ bool keyPress(nxwidget_char_t key);
+
+ /**
+ * Send a cursor control event to the widget.
+ *
+ * @param control The cursor control code to send to the widget.
+ * @return True if the cursor control was processed.
+ */
+
+ bool cursorControl(ECursorControl control);
+
+ /**
+ * Give the widget focus.
+ *
+ * @return True if the widget received focus correctly.
+ */
+
+ bool focus(void);
+
+ /**
+ * Remove focus from the widget.
+ *
+ * @return True if the widget lost focus correctly.
+ */
+
+ bool blur(void);
+
+ /**
+ * Move the widget to the new coordinates.
+ * Co-ordinates are relative to the parent widget.
+ *
+ * @param x The new x coordinate.
+ * @param y The new y coordinate.
+ * @return True if the move was successful.
+ */
+
+ bool moveTo(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Resize the widget to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ * @return True if the resize was successful.
+ */
+
+ bool resize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Resize and move the widget in one operation.
+ * Only performs one redraw so it is faster than calling the
+ * two separate functions.
+ *
+ * @param x The new x coordinate.
+ * @param y The new y coordinate.
+ * @param width The new width.
+ * @param height The new height.
+ * @return True if the widget was adjusted successfully.
+ */
+
+ bool changeDimensions(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Raises the widget to the top of its parent's widget stack.
+ *
+ * @return True if the raise was successful.
+ */
+
+ bool raiseToTop(void);
+
+ /**
+ * Lowers the widget to the bottom of its parent's widget stack.
+ *
+ * @return True if the lower was successful.
+ */
+
+ bool lowerToBottom(void);
+
+ /**
+ * Raises the supplied widget to the top of this widget's child stack.
+ * The supplied widget pointer must be a child of this widget.
+ *
+ * @param widget A pointer to the child widget to raise.
+ * @return True if the raise was successful.
+ */
+
+ bool raiseWidgetToTop(CNxWidget *widget);
+
+ /**
+ * Lowers the supplied widget to the bottom of this widget's child stack.
+ * The supplied widget pointer must be a child of this widget.
+ *
+ * @param widget A pointer to the child widget to lower.
+ * @return True if the lower was successful.
+ */
+
+ bool lowerWidgetToBottom(CNxWidget *widget);
+
+ /**
+ * Moves the supplied child widget to the deletion queue.
+ * For framework use only.
+ *
+ * @param widget A pointer to the child widget.
+ */
+
+ void moveChildToDeleteQueue(CNxWidget *widget);
+
+ /**
+ * Moves the supplied child widget to the shelved widget list.
+ * For framework use only.
+ *
+ * @param widget A pointer to the child widget.
+ * @return True if the widget was moved successfully.
+ * @see moveShelvedToChildList()
+ * @see hide()
+ */
+
+ bool moveChildToShelvedList(CNxWidget *widget);
+
+ /**
+ * Moves the supplied child widget from the shelved list back
+ * to the child widget list.
+ * For framework use only.
+ *
+ * @param widget A pointer to the shelved widget.
+ * @return True if the widget was moved successfully.
+ * @see moveChildtoShelvedList()
+ * @see show()
+ */
+
+ bool moveShelvedToChildList(CNxWidget *widget);
+
+ /**
+ * Sets the supplied widget as the focused child. The widget must
+ * be a child of this widget.
+ *
+ * @param widget A pointer to the child widget.
+ * @see getFocusedWidget()
+ */
+
+ void setFocusedWidget(CNxWidget *widget);
+
+ /**
+ * Checks if the supplied coordinates collide with this widget.
+ *
+ * @param x The x coordinate to check.
+ * @param y The y coordinate to check.
+ * @return True if a collision occurred.
+ */
+
+ bool checkCollision(nxgl_coord_t x, nxgl_coord_t y) const;
+
+ /**
+ * Checks if the supplied rectangle definition collides with this widget.
+ *
+ * @param x The x coordinate of the rectangle to check.
+ * @param y The y coordinate of the rectangle to check.
+ * @param width The width of the rectangle to check.
+ * @param height The height of the rectangle to check.
+ * @return True if a collision occurred.
+ */
+
+ bool checkCollision(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height) const;
+
+ /**
+ * Checks if the supplied widget collides with this widget.
+ *
+ * @param widget A pointer to another widget to check for collisions with.
+ * @return True if a collision occurred.
+ */
+
+ bool checkCollision(CNxWidget *widget) const;
+
+ /**
+ * Invalidate the visible region cache for all widgets below the supplied
+ * widget in this widget's child stack. This will cause those widgets to
+ *
+ * recalculate their visible regions next time they try to draw themselves.
+ * @param widget A pointer to a child widget.
+ */
+
+ void invalidateLowerWidgetsVisibleRectCache(CNxWidget *widget);
+
+ /**
+ * Adds a widget to this widget's child stack. The widget is added to the
+ * top of the stack. Note that the widget can only be added if it is not
+ * already a child of another widget.
+ *
+ * @param widget A pointer to the widget to add to the child list.
+ * @see insertWidget()
+ */
+
+ void addWidget(CNxWidget *widget);
+
+ /**
+ * Inserts a widget into this widget's child stack at the bottom of the
+ * stack. Note that the widget can only be added if it is not already
+ * a child of another widget.
+ *
+ * @param widget A pointer to the widget to add to the child list.
+ * @see addWidget()
+ */
+
+ void insertWidget(CNxWidget *widget);
+
+ /**
+ * Set the widget's parent to the widget passed in as a parameter.
+ * Called automatically when a widget is added as a child.
+ *
+ * @param parent A pointer to the parent widget.
+ */
+
+ inline void setParent(CNxWidget *parent)
+ {
+ m_parent = parent;
+ }
+
+ /**
+ * Rebuild the list of this widget's visible regions
+ */
+
+ void cacheVisibleRects(void) const;
+
+ /**
+ * Mark this widget's visible region cache as invalid, and do the same
+ * to its child widgets.
+ */
+
+ void invalidateVisibleRectCache(void);
+
+ /**
+ * Erase a child widget by drawing the widgets behind it.
+ *
+ * @param widget The child widget to erase.
+ */
+
+ void eraseWidget(CNxWidget *widget);
+
+ /**
+ * Redraw any visible regions of this widget that have become corrupted.
+ *
+ * @param invalidRects A list of corrupt regions.
+ * @param sender A pointer to the widget that corrupted the regions.
+ */
+
+ void redrawDirty(TNxArray<CRect>* invalidRects, CNxWidget *sender);
+
+ /**
+ * Clips a rectangular region to the dimensions of this widget and its ancestors.
+ *
+ * @param rect The region that needs to be clipped.
+ */
+
+ void clipRectToHierarchy(CRect &rect) const;
+
+ /**
+ * Swaps the depth of the supplied child widget.
+ *
+ * @param widget A pointer to the child widget that needs to swap depths.
+ * @return True if the swap was successful.
+ */
+
+ virtual bool swapWidgetDepth(CNxWidget *widget);
+
+ /**
+ * Swap the depth of this widget.
+ *
+ * @return True if the swap was successful.
+ */
+
+ bool swapDepth(void);
+
+ /**
+ * Delete this widget. This should never be called in user code; widget
+ * deletion is handled internally.
+ */
+
+ inline void destroy(void)
+ {
+ delete this;
+ }
+
+ /**
+ * Remove this widget from the widget hierarchy. Returns
+ * responsibility for deleting the widget back to the developer.
+ * Does not unregister the widget from the VBL system.
+ * Does not erase the widget from the display.
+ *
+ * @return True if the widget was successfully removed.
+ */
+
+ bool remove(void);
+
+ /**
+ * Remove a child widget from the widget hierarchy. Returns
+ * responsibility for deleting the widget back to the developer.
+ * Does not unregister the widget from the VBL system.
+ * Does not erase the widget from the display.
+ *
+ * @param widget Pointer to the widget to remove from the hierarchy.
+ * @return True if the widget was succesfully removed.
+ */
+
+ bool removeChild(CNxWidget *widget);
+
+ /**
+ * Run the widget modally.
+ */
+
+ void goModal(void);
+
+ /**
+ * Stop the widget running modally.
+ */
+
+ inline void stopModal(void)
+ {
+ m_flags.modal = false;
+ }
+
+ /**
+ * Get the index of the specified child widget.
+ *
+ * @param widget The widget to get the index of.
+ * @return The index of the widget. -1 if the widget is not found.
+ */
+
+ const int getWidgetIndex(const CNxWidget *widget) const;
+
+ /**
+ * Get the child widget at the specified index.
+ *
+ * @param index Index of the child to retrieve.
+ * @return Pointer to the child at the specified index.
+ */
+
+ const CNxWidget *getChild(int index) const;
+
+ /**
+ * Get the number of child widgets.
+ *
+ * @return The number of child widgets belonging to this widget.
+ */
+
+ const int getChildCount(void) const
+ {
+ return m_children.size();
+ }
+
+ /**
+ * Get a pointer to the cache of visible rects.
+ *
+ * @return A pointer to the cache of visible rects.
+ */
+
+ inline CRectCache *getCRectCache(void) const
+ {
+ return m_rectCache;
+ }
+
+ /**
+ * Sets the border size. The border cannot be drawn over in the
+ * drawContents() method.
+ *
+ * @param borderSize The new border size.
+ */
+
+ void setBorderSize(const WidgetBorderSize &borderSize);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXWIDGET_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cnxwindow.hxx b/NxWidgets/libnxwidgets/include/cnxwindow.hxx
new file mode 100644
index 000000000..4a371bb27
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cnxwindow.hxx
@@ -0,0 +1,307 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cnxwindow.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CNXWINDOW_HXX
+#define __INCLUDE_CNXWINDOW_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxtk.h>
+
+#include "ccallback.hxx"
+#include "inxwindow.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ struct SBitmap;
+
+ /**
+ * This class defines operations on a basic "raw" NX window. These windows
+ * are "raw" in the since that they are simply rectangular regions with
+ * no framing or decoration of any kind
+ *
+ * There are three instances that represent an NX window from the
+ * perspective of NXWidgets.
+ *
+ * - There is one widget control instance per NX window,
+ * - One CCallback instance per window,
+ * - One window instance.
+ *
+ * There a various kinds of of window instances, but each inherits
+ * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
+ * that describes the common window behavior.
+ */
+
+ class CNxWindow : protected CCallback, public INxWindow
+ {
+ private:
+ NXHANDLE m_hNxServer; /**< Handle to the NX server. */
+ NXWINDOW m_hNxWindow; /**< Handle to the NX raw window */
+ CWidgetControl *m_widgetControl; /**< The controlling widget for the window */
+
+ public:
+
+ /**
+ * Constructor. Creates an uninitialized instance of the CNxWindow
+ * object. The open() method must be called to initialize the instance.
+ *
+ * The general steps to create any window include:
+ * 1) Create a dumb CWigetControl instance
+ * 2) Pass the dumb CWidgetControl instance to the window constructor
+ * that inherits from INxWindow.
+ * 3) The window constructor call CWidgetControl methods to "smarten"
+ * the CWidgetControl instance with window-specific knowledge.
+ * 4) Call the open() method on the window to display the window.
+ * 5) After that, the fully smartend CWidgetControl instance can
+ * be used to generate additional widgets.
+ * 6) After that, the fully smartened CWidgetControl instance can
+ * be used to generate additional widgets by passing it to the
+ * widget constructor
+ *
+ * @param hNxServer Handle to the NX server.
+ * @param widgetControl Controlling widget for this window.
+ */
+
+ CNxWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl);
+
+ /**
+ * Destructor.
+ */
+
+ ~CNxWindow(void);
+
+ /**
+ * Creates a new window. Window creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the window was successfully opened.
+ */
+
+ bool open(void);
+
+ /**
+ * Request the position and size information of the window. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool requestPosition(void);
+
+ /**
+ * Get the position of the window (as reported by the NX callback).
+ *
+ * @return The position.
+ */
+
+ bool getPosition(FAR struct nxgl_point_s *pPos);
+
+ /**
+ * Get the size of the window (as reported by the NX callback).
+ *
+ * @return The size.
+ */
+
+ bool getSize(FAR struct nxgl_size_s *pSize);
+
+ /**
+ * Set the position and size of the window.
+ *
+ * @param pPos The new position of the window.
+ * @return True on success, false on any failure.
+ */
+
+ bool setPosition(FAR const struct nxgl_point_s *pPos);
+
+ /**
+ * Set the size of the selected window.
+ *
+ * @param pSize The new size of the window.
+ * @return True on success, false on any failure.
+ */
+
+ bool setSize(FAR const struct nxgl_size_s *pSize);
+
+ /**
+ * Bring the window to the top of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool raise(void);
+
+ /**
+ * Lower the window to the bottom of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+ bool lower(void);
+
+ /**
+ * Set an individual pixel in the window with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified rectangle in the window with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+ void getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest);
+
+ /**
+ * Fill the specified trapezoidal region in the window with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to window (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Fill the specified line in the window with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width, nxgl_mxpixel_t color);
+
+ /**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+ bool drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color);
+
+ /**
+ * Move a rectangular region within the window.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset);
+
+ /**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified window.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in window coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+ bool bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CNXWINDOW_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cprogressbar.hxx b/NxWidgets/libnxwidgets/include/cprogressbar.hxx
new file mode 100644
index 000000000..c75d1eee6
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cprogressbar.hxx
@@ -0,0 +1,251 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cprogressbar.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CPROGRESSBAR_HXX
+#define __INCLUDE_CPROGRESSBAR_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+
+ /**
+ * Widget providing a horizontal progress bar.
+ */
+
+ class CProgressBar : public CNxWidget
+ {
+ protected:
+ int16_t m_minimumValue; /**< Minimum value that the grip can represent. */
+ int16_t m_maximumValue; /**< Maximum value that the grip can represent. */
+ int16_t m_value; /**< Value of the progress bar. */
+ bool m_showPercentageText; /**< If true, completion percentage is drawn
+ over the bar. */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CProgressBar(const CProgressBar &progressBar) : CNxWidget(progressBar) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the progress bar, relative to its parent.
+ * @param y The y coordinate of the progress bar, relative to its parent.
+ * @param width The width of the progress bar.
+ * @param height The height of the progress bar.
+ */
+
+ CProgressBar(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CProgressBar(void) { }
+
+ /**
+ * Get the smallest value that the progress bar can represent.
+ *
+ * @return The smallest value.
+ */
+
+ inline const int16_t getMinimumValue(void) const
+ {
+ return m_minimumValue;
+ }
+
+ /**
+ * Get the largest value that the progress bar can represent.
+ *
+ * @return The largest value.
+ */
+
+ inline const int16_t getMaximumValue(void) const
+ {
+ return m_maximumValue;
+ }
+
+ /**
+ * Get the current value of the progress bar.
+ * return The current progress bar value.
+ */
+
+ inline const int16_t getValue(void) const
+ {
+ return m_value;
+ }
+
+ /**
+ * Set the smallest value that the progress bar can represent.
+ *
+ * @param value The smallest value.
+ */
+
+ inline void setMinimumValue(const int16_t value)
+ {
+ m_minimumValue = value;
+ }
+
+ /**
+ * Set the largest value that the progress bar can represent.
+ *
+ * @param value The largest value.
+ */
+
+ inline void setMaximumValue(const int16_t value)
+ {
+ m_maximumValue = value;
+ }
+
+ /**
+ * Set the value that of the progress bar.
+ *
+ * @param value The new value.
+ */
+
+ void setValue(const int16_t value);
+
+ /**
+ * Shows the percentage text over the bar.
+ */
+
+ inline void showPercentageText(void)
+ {
+ m_showPercentageText = true;
+ redraw();
+ }
+
+ /**
+ * Hides the percentage text over the bar.
+ */
+
+ inline void hidePercentageText(void)
+ {
+ m_showPercentageText = false;
+ redraw();
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CPROGRESSBAR_HXX
diff --git a/NxWidgets/libnxwidgets/include/cradiobutton.hxx b/NxWidgets/libnxwidgets/include/cradiobutton.hxx
new file mode 100644
index 000000000..4186b8eea
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cradiobutton.hxx
@@ -0,0 +1,207 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cradiobutton.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CRADIOBUTTON_HXX
+#define __INCLUDE_CRADIOBUTTON_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+
+#include "cbutton.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+ class CRadioButtonGroup;
+
+ /**
+ * Represents a radio button. Radio buttons can only exist as part of a
+ * CRadioButtonGroup class, and should not be instantiated individually.
+ * Radio buttons are tri-state - off, on and "mu".
+ * The mu state cannot be enabled by a user - it can only be set by the
+ * developer.
+ */
+
+ class CRadioButton : public CButton
+ {
+ public:
+
+ /**
+ * Enum listing all possible radio button states.
+ */
+
+ enum RadioButtonState
+ {
+ RADIO_BUTTON_STATE_OFF = 0, /**< Radio button is off */
+ RADIO_BUTTON_STATE_ON = 1, /**< Radio button is on */
+ RADIO_BUTTON_STATE_MU = 2 /**< Radio button is in the third state */
+ };
+
+ protected:
+
+ RadioButtonState m_state; /**< The state of the radio button */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Sets the radiobutton's state to "on".
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CRadioButton() { }
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CRadioButton(const CRadioButton &radioButton) : CButton(radioButton) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the radio button, relative to its
+ * parent.
+ * @param y The y coordinate of the radio button, relative to its
+ * parent.
+ * @param width The width of the radio button.
+ * @param height The height of the radio button.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * defaultCWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CRadioButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Get the current state of the radio button.
+ *
+ * @return The state of the radio button.
+ */
+
+ virtual inline RadioButtonState getState(void)
+ {
+ return m_state;
+ }
+
+ /**
+ * Set the state of the radio button.
+ *
+ * @param state The new radio button state.
+ */
+
+ virtual void setState(RadioButtonState state);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CRADIOBUTTON_HXX
diff --git a/NxWidgets/libnxwidgets/include/cradiobuttongroup.hxx b/NxWidgets/libnxwidgets/include/cradiobuttongroup.hxx
new file mode 100644
index 000000000..c37630c61
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cradiobuttongroup.hxx
@@ -0,0 +1,253 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cradiobuttongroup.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CRADIOBUTTONGROUP_HXX
+#define __INCLUDE_CRADIOBUTTONGROUP_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+
+#include "cnxwidget.hxx"
+#include "cbutton.hxx"
+#include "cwidgetstyle.hxx"
+#include "cwidgeteventhandler.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+ class CRadioButton;
+
+ /**
+ * Container class that holds radio button widgets and tracks their status.
+ * The group provides an easy way to determine which radio button is
+ * selected. Note that, in order to set the "mu" state for a radio button,
+ * it is necessary to set the state via the radio button, not the group.
+ */
+
+ class CRadioButtonGroup : public CNxWidget, public CWidgetEventHandler
+ {
+ protected:
+ CWidgetControl *m_pWidgetControl; /**< The controlling widget */
+ CRadioButton *m_selectedWidget; /**< Pointer to the currently selected radio button */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort* port);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CRadioButtonGroup(const CRadioButtonGroup &radioButtonGroup) : CNxWidget(radioButtonGroup) { }
+
+ public:
+
+ /**
+ * Constructor. Note that the group determines its width and height
+ * from the position and dimensions of its children.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the group.
+ * @param y The y coordinate of the group.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CRadioButtonGroup(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ ~CRadioButtonGroup(void) { }
+
+ /**
+ * Simple method for adding a new radio button to the group.
+ * This should be used in preference to the usual addWidget() method,
+ * as this method automatically resizes the group.
+ *
+ * @param x The x coordinate of the new button, relative to this
+ * widget.
+ * @param y The y coordinate of the new button, relative to this
+ * widget.
+ * @param width The width of the new button.
+ * @param height The height of the new button.
+ */
+
+ CRadioButton *newRadioButton(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Gets a pointer to the selected widget.
+ *
+ * @return Pointer to the selected widget.
+ */
+
+ virtual const CRadioButton *getSelectedWidget(void) const;
+
+ /**
+ * Gets the index of the selected widget.
+ *
+ * @return The index of the selected widget.
+ */
+
+ virtual const int getSelectedIndex(void) const;
+
+ /**
+ * Sets the selected radio button to the supplied widget.
+ *
+ * @param widget The radio button to select.
+ */
+
+ virtual void setSelectedWidget(CRadioButton *widget);
+
+ /**
+ * Selects the widget at the specified index.
+ *
+ * @param index The index of the widget to select.
+ */
+
+ virtual void setSelectedIndex(int index);
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent. Value is based on the length of the largest string
+ * in the set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+
+ /**
+ * Handle a mouse click event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleClickEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a mouse double-click event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleDoubleClickEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a mouse button release event that occurred within the bounds of
+ * the source widget.
+ * @param e The event data.
+ */
+
+ virtual void handleReleaseEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a mouse button release event that occurred outside the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleReleaseOutsideEvent(const CWidgetEventArgs &e);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CRADIOBUTTONGROUP_HXX
diff --git a/NxWidgets/libnxwidgets/include/crect.hxx b/NxWidgets/libnxwidgets/include/crect.hxx
new file mode 100644
index 000000000..e3a73a392
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/crect.hxx
@@ -0,0 +1,424 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cbgwindow.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CRECT_HXX
+#define __INCLUDE_CRECT_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Class describing a rectangle.
+ */
+
+ class CRect
+ {
+ public:
+ struct nxgl_point_s m_pos; /**< The position of the rectangle in the window */
+ struct nxgl_size_s m_size; /**< The size of the rectangle */
+
+ /**
+ * Constructor.
+ */
+
+ CRect(void);
+
+ /**
+ * Constructor.
+ *
+ * @param x The x coordinate of the rect.
+ * @param y The y coordinate of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+
+ CRect(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Constructor.
+ *
+ * @param rect Pointer to an NX rectangle
+ */
+
+ CRect(FAR const nxgl_rect_s *rect);
+
+ /**
+ * Copy constructor.
+ *
+ * @param rect CRect to copy.
+ */
+
+ CRect(const CRect& rect);
+
+ /**
+ * Create a rect object from the supplied coordinates.
+ *
+ * @param x1 The x coordinate of the rect's top-left corner.
+ * @param y1 The y coordinate of the rect's top-left corner.
+ * @param x2 The x coordinate of the rect's bottom-right corner.
+ * @param y2 The y coordinate of the rect's bottom-right corner.
+ * @return A new rect.
+ */
+
+ static CRect fromCoordinates(nxgl_coord_t x1, nxgl_coord_t y1,
+ nxgl_coord_t x2, nxgl_coord_t y2);
+
+ /**
+ * Get the rectangle's left x coordinate.
+ *
+ * @return The rectangle's x coordinate.
+ */
+
+ inline nxgl_coord_t getX(void) const
+ {
+ return m_pos.x;
+ }
+
+ /**
+ * Get the rectangle's top y coordinate.
+ * @return The rectangle's y coordinate.
+ */
+
+ inline nxgl_coord_t getY(void) const
+ {
+ return m_pos.y;
+ }
+
+ /**
+ * Get the rectangle's width.
+ *
+ * @return The rectangle's width.
+ */
+
+ inline nxgl_coord_t getWidth(void) const
+ {
+ return m_size.w;
+ }
+
+ /**
+ * Get the rectangle's height.
+ *
+ * @return The rectangle's height.
+ */
+
+ inline nxgl_coord_t getHeight(void) const
+ {
+ return m_size.h;
+ }
+
+ /**
+ * Get the NX rectangle representation
+ *
+ * @param rect Pointer to NX rectangle
+ */
+
+ inline void getNxRect(FAR struct nxgl_rect_s *rect) const
+ {
+ rect->pt1.x = m_pos.x;
+ rect->pt1.y = m_pos.y;
+ rect->pt2.x = m_pos.x + m_size.w - 1;
+ rect->pt2.y = m_pos.y + m_size.h - 1;
+ }
+
+ /**
+ * Set the rectangle's left x coordinate.
+ *
+ * @param x The new x coordinate.
+ */
+
+ inline void setX(nxgl_coord_t x)
+ {
+ m_pos.x = x;
+ }
+
+ /**
+ * Set the rectangle's top y coordinate.
+ *
+ * @param y The new y coordinate.
+ */
+
+ inline void setY(nxgl_coord_t y)
+ {
+ m_pos.y = y;
+ }
+
+ /**
+ * Set the rect's width.
+ *
+ * @param width The new width.
+ */
+ inline void setWidth(nxgl_coord_t width)
+ {
+ m_size.w = width;
+ }
+
+ /**
+ * Set the rect's height.
+ *
+ * @param height The new height.
+ */
+
+ inline void setHeight(nxgl_coord_t height)
+ {
+ m_size.h = height;
+ }
+
+ /**
+ * Get the NX rectangle representation
+ *
+ * @param rect Pointer to NX rectangle
+ */
+
+ inline void setNxRect(FAR const struct nxgl_rect_s *rect)
+ {
+ m_pos.x = rect->pt1.x;
+ m_pos.y = rect->pt1.y;
+ m_size.w = rect->pt2.x - rect->pt1.x + 1;
+ m_size.h = rect->pt2.y - rect->pt1.y + 1;
+ }
+
+ /**
+ * Set the x coordinate of the rect's bottom-right corner. If x2 is less
+ * than the rect's current x coordinate the method automatically adjusts
+ * the coordinates so that the rect's width is never negative. Changing this
+ * property will change the width of the rect.
+ *
+ * @param x2 The x coordinate of the rect's bottom-right corner.
+ */
+
+ void setX2(nxgl_coord_t x2);
+
+ /**
+ * Set the y coordinate of the rect's bottom-right corner. If y2 is less
+ * than the rect's current y coordinate the method automatically adjusts
+ * the coordinates so that the rect's height is never negative. Changing this
+ * property will change the height of the rect.
+ *
+ * @param y2 The y coordinate of the rect's bottom-right corner.
+ */
+
+ void setY2(nxgl_coord_t y2);
+
+ /**
+ * Get the x coordinate of the rectangle's right side.
+ *
+ * @return The x coordinate of the rectangle's right side.
+ */
+
+ inline nxgl_coord_t getX2(void) const
+ {
+ return m_pos.x + m_size.w - 1;
+ }
+
+ /**
+ * Get the y coordinate of the rectangle's bottom side.
+ *
+ * @return The y coordinate of the rerectangle's bottom side.
+ */
+
+ inline nxgl_coord_t getY2(void) const
+ {
+ return m_pos.y + m_size.h - 1;
+ }
+
+ /**
+ * Offset the rectangle position by the specified dx, dy values.
+ *
+ * @param dx X offset value
+ * @param dy Y offset value
+ */
+
+ inline void offset(nxgl_coord_t dx, nxgl_coord_t dy)
+ {
+ m_pos.x += dx;
+ m_pos.y += dy;
+ }
+
+ /**
+ * Determines if the rectangle has two dimensions; in other words, does it
+ * have both height and width? Negative width or height is considered not to
+ * be valid.
+ *
+ * @return True if the rect has height and width; false if not.
+ */
+
+ inline bool hasDimensions(void) const
+ {
+ return m_size.w > 0 && m_size.h > 0;
+ }
+
+ /**
+ * Populates dest with a rectangle representating the intersection
+ * of this rectangle and rect.
+ *
+ * @param rect The rectangle to intersect with this.
+ * @param dest The destination rectangle.
+ */
+
+ void getIntersect(const CRect& rect, CRect& dest) const;
+
+ /**
+ * Populates dest with a rectangle representating the smallest
+ * rectangle that contains this rectangle and rect.
+ *
+ * @param rect The rectangle to add to this.
+ * @param dest The destination rectangle.
+ */
+
+ void getAddition(const CRect &rect, CRect &dest) const;
+
+ /**
+ * Clips this rect to the region that intersects the supplied rect.
+ *
+ * @param rect CRect to intersect.
+ */
+
+ void clipToIntersect(const CRect &rect);
+
+ /**
+ * Expands this rect so that it includes the area described by the supplied
+ * rect.
+ *
+ * @param rect CRect to include.
+ */
+
+ void expandToInclude(const CRect &rect);
+
+ /**
+ * Check if the supplied rect intersects this.
+ *
+ * @param rect CRect to check for intersection with this.
+ * @return True if the rect intersects this; false if not.
+ */
+
+ bool intersects(const CRect &rect) const;
+
+ /**
+ * Check if the rect contains the supplied point.
+ *
+ * @param x X coordinate of the point.
+ * @param y Y coordinate of the point.
+ * @return True if the rect contains the point; false if not.
+ */
+
+ bool contains(nxgl_coord_t x, nxgl_coord_t y) const;
+
+ /**
+ * Copy the properties of this rect to the destination rect.
+ *
+ * @param dest Destination rect to copy to.
+ */
+
+ void copyTo(CRect &dest) const;
+
+ /**
+ * Overloaded & operator. Returns the intersect of this rectangle and the
+ * rectangle passed as the "rect" argument".
+ *
+ * @param rect The rectangle to intersect with this.
+ */
+
+ CRect operator&(const CRect &rect);
+
+ /**
+ * Overloaded + operator. Returns the smallest rectangle that can contain
+ * this rectangle and the rectangle passed as the "rect" argument".
+ *
+ * @param rect The rectangle to add to this.
+ */
+
+ CRect operator+(const CRect &rect);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CRECT_HXX
diff --git a/NxWidgets/libnxwidgets/include/crectcache.hxx b/NxWidgets/libnxwidgets/include/crectcache.hxx
new file mode 100644
index 000000000..f38c2313b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/crectcache.hxx
@@ -0,0 +1,222 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/crectcache.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CRECTCACHE_HXX
+#define __INCLUDE_CRECTCACHE_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgetstyle.hxx"
+#include "tnxarray.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Maintains a list of foreground (ie. above children) and background (with
+ * child overlapped-rects removed) rectangles representing the visible portions
+ * of a widget.
+ */
+
+ class CRectCache
+ {
+ private:
+ TNxArray<CRect> m_foregroundRegions; /**< List of the widget's visible regions */
+ TNxArray<CRect> m_backgroundRegions; /**< List of the widget's visible regions with child rects removed */
+ const CNxWidget *m_widget; /**< Owning widget */
+ bool m_foregroundInvalid; /**< True if the foreground cache needs refreshing */
+ bool m_backgroundInvalid; /**< True if the background cache needs refreshing */
+
+ /**
+ * Cache the foreground regions.
+ */
+
+ void cacheForegroundRegions(void);
+
+ /**
+ * Cache the background regions.
+ */
+
+ void cacheBackgroundRegions(void);
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param widget Widget that contains the rect cache.
+ */
+
+ CRectCache(const CNxWidget *widget);
+
+ /**
+ * Destructor.
+ */
+
+ inline ~CRectCache() { }
+
+ /**
+ * Rebuild the cache if it is invalid.
+ */
+
+ void cache(void);
+
+ /**
+ * Invalidates the cache.
+ */
+
+ inline void invalidate(void)
+ {
+ m_foregroundInvalid = true;
+ m_backgroundInvalid = true;
+ };
+
+ /**
+ * Return the list of background regions. These are regions that are not overlapped by
+ * child widgets.
+ *
+ * @return The list of background regions.
+ */
+
+ inline TNxArray<CRect> *getBackgroundRegions(void)
+ {
+ return &m_backgroundRegions;
+ }
+
+ /**
+ * Return the list of foreground regions. These are regions that represent the entire
+ * visible surface of the widget - that is, any regions not overlapped by ancestors or
+ * sublings of the widget - including any regions that are actually overlapped by
+ * child widgets.
+ *
+ * @return The list of foreground regions.
+ */
+
+ inline TNxArray<CRect> *getForegroundRegions(void)
+ {
+ return &m_foregroundRegions;
+ }
+
+ /**
+ * Works out which rectangles in the invalidRects list overlap this
+ * widget, then cuts the rectangles into smaller pieces. The overlapping
+ * pieces are pushed into validRects, and the non-overlapping pieces are
+ * pushed back into the invalidRects vector.
+ *
+ * @param invalidRects A vector of regions that need to be tested
+ * for collisions against this widget; they represent regions that need
+ * to be redrawn.
+ * @param validRects A vector of regions that represents areas of the
+ * display that do not need to be redrawn.
+ * @param sender Pointer to the widget that initiated the split.
+ */
+
+ void splitRectangles(TNxArray<CRect> *invalidRects,
+ TNxArray<CRect> *validRects,
+ FAR const CNxWidget *sender) const;
+
+ /**
+ * Move any rectangles from the visibleRects list that overlap this widget
+ * into the invisibleRects list. Used during visible region calculations.
+ *
+ * @param visibleRects A vector of regions that are not overlapped.
+ * @param invisibleRects A vector of regions that are overlapped.
+ * @param widget The widget that requested the lists.
+ * @see splitRectangles()
+ */
+
+ void removeOverlappedRects(TNxArray<CRect> *visibleRects,
+ TNxArray<CRect> *invisibleRects,
+ FAR const CNxWidget* widget) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CRECTCACHE_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx b/NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx
new file mode 100644
index 000000000..2b1e4f065
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CRLEPALETTBITMAP_HXX
+#define __INCLUDE_CRLEPALETTBITMAP_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "ibitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * One Run-Length Encoded (RLE) value
+ */
+
+ struct SRlePaletteBitmapEntry
+ {
+ uint8_t npixels; /**< Number of pixels */
+ uint8_t lookup; /**< Pixel RGB lookup index */
+ };
+
+ /**
+ * Run-Length Encoded (RLE), Paletted Bitmap Structure
+ */
+
+ struct SRlePaletteBitmap
+ {
+ uint8_t bpp; /**< Bits per pixel */
+ uint8_t fmt; /**< Color format */
+ uint8_t nlut; /**< Number of colors in the Look-Up Table (LUT) */
+ nxgl_coord_t width; /**< Width in pixels */
+ nxgl_coord_t height; /**< Height in rows */
+ FAR const void *lut; /**< Pointer to the beginning of the Look-Up Table (LUT) */
+
+ /**
+ * The pointer to the beginning of the RLE data
+ */
+
+ FAR const struct SRlePaletteBitmapEntry *data;
+ };
+
+ /**
+ * Class providing bitmap accessor for a bitmap represented by SRlePaletteBitmap.
+ */
+
+ class CRlePaletteBitmap : public IBitmap
+ {
+ protected:
+ /**
+ * The bitmap that is being managed
+ */
+
+ FAR const struct SRlePaletteBitmap *m_bitmap; /**< The bitmap that is being managed */
+
+ /**
+ * Accessor state data
+ */
+
+ nxgl_coord_t m_row; /**< Logical row number */
+ nxgl_coord_t m_col; /**< Logical column number */
+ uint8_t m_remaining; /**< Number of bytes remaining in current entry */
+ FAR const struct SRlePaletteBitmapEntry *m_rle; /**< RLE entry being processed */
+
+ /**
+ * Reset to the beginning of the image
+ */
+
+ void startOfImage(void);
+
+ /**
+ * Advance position data ahead. Called after npixels have
+ * have been consume.
+ *
+ * @param npixels The number of pixels to advance
+ * @return False if this goes beyond the end of the image
+ */
+
+ bool advancePosition(nxgl_coord_t npixels);
+
+ /**
+ * Seek ahead the specific number of pixels -- discarding
+ * and advancing.
+ *
+ * @param npixels The number of pixels to skip
+ * @return False if this goes beyond the end of the image
+ */
+
+ bool skipPixels(nxgl_coord_t npixels);
+
+ /** Seek to the beginning of the next row
+ *
+ * @return False if this was the last row of the image
+ */
+
+ bool nextRow(void);
+
+ /** Seek to the beignning specific row
+ *
+ * @param row The row number to seek to
+ * @return False if this goes beyond the end of the image
+ */
+
+ bool seekRow(nxgl_coord_t row);
+
+ /** Copy the pixels from the current RLE entry the specified number of times.
+ *
+ * @param npixels The number of pixels to copy. Must be less than or equal
+ * to m_remaining.
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ */
+
+ void copyColor(nxgl_coord_t npixels, FAR void *data);
+
+ /** Copy pixels from the current position
+ *
+ * @param npixels The number of pixels to copy
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ * @return False if this goes beyond the end of the image
+ */
+
+ bool copyPixels(nxgl_coord_t npixels, FAR void *data);
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param bitmap The bitmap structure being wrapped.
+ */
+
+ CRlePaletteBitmap(const struct SRlePaletteBitmap *bitmap);
+
+ /**
+ * Destructor.
+ */
+
+ inline ~CRlePaletteBitmap(void) {}
+
+ /**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's width.
+ */
+
+ const uint8_t getColorFormat(void) const;
+
+ /**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's color format.
+ */
+
+ const uint8_t getBitsPerPixel(void) const;
+
+ /**
+ * Get the bitmap's width (in pixels/columns).
+ *
+ * @return The bitmap's pixel depth.
+ */
+
+ const nxgl_coord_t getWidth(void) const;
+
+ /**
+ * Get the bitmap's height (in rows).
+ *
+ * @return The bitmap's height.
+ */
+
+ const nxgl_coord_t getHeight(void) const;
+
+ /**
+ * Get the bitmap's width (in bytes).
+ *
+ * @return The bitmap's width.
+ */
+
+ const nxgl_coord_t getStride(void) const;
+
+ /**
+ * Get one row from the bit map image.
+ *
+ * @param x The offset into the row to get
+ * @param y The row number to get
+ * @param width The number of pixels to get from the row
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ * @param True if the run was returned successfully.
+ */
+
+ bool getRun(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ FAR void *data);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CRLEPALETTBITMAP_HXX
diff --git a/NxWidgets/libnxwidgets/include/cscrollbarhorizontal.hxx b/NxWidgets/libnxwidgets/include/cscrollbarhorizontal.hxx
new file mode 100644
index 000000000..20ba149fa
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cscrollbarhorizontal.hxx
@@ -0,0 +1,293 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollbarhorizontal.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSCROLLBARHORIZONTAL_HXX
+#define __INCLUDE_CSCROLLBARHORIZONTAL_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "cwidgetstyle.hxx"
+#include "islider.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CSliderHorizontal;
+ class CGlyphButton;
+ class CNxTimer;
+
+ /**
+ * Container class that holds a slider widget and two arrow buttons.
+ * The interface is presents is virtually identical to the CSliderHorizontal
+ * widget, which means the two are easily interchangeable. All events
+ * raised by the internal slider widget are re-raised by this widget
+ * to this widget's event handler, meaning its events are also identical
+ * to the CSliderHorizontal's.
+ */
+
+ class CScrollbarHorizontal : public ISlider, public CNxWidget, public CWidgetEventHandler
+ {
+ protected:
+ CSliderHorizontal *m_slider; /**< Pointer to the slider widget */
+ CGlyphButton *m_leftButton; /**< Pointer to the left button */
+ CGlyphButton *m_rightButton; /**< Pointer to the right button */
+ nxgl_coord_t m_buttonWidth; /**< Width of the buttons */
+ uint8_t m_scrollTimeout; /**< Time until a button triggers
+ another grip movement */
+ CNxTimer *m_timer; /**< Controls slider button repeats */
+
+ /**
+ * Resize the scrollbar to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CScrollbarHorizontal(const CScrollbarHorizontal &scrollbarHorizontal)
+ : CNxWidget(scrollbarHorizontal) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control instance for the window.
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CScrollbarHorizontal(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CScrollbarHorizontal(void) { }
+
+ /**
+ * Get the smallest value that the slider can represent.
+ *
+ * @return The smallest value.
+ */
+
+ const nxgl_coord_t getMinimumValue(void) const;
+
+ /**
+ * Get the largest value that the slider can represent.
+ *
+ * @return The largest value.
+ */
+
+ const nxgl_coord_t getMaximumValue(void) const;
+
+ /**
+ * Get the current value of the slider.
+ *
+ * @return The current slider value.
+ */
+
+ const nxgl_coord_t getValue(void) const;
+
+ /**
+ * Get the value represented by the height of the grip.
+ * For sliders, this would typically be 1 (so each new
+ * grip position is worth 1). For scrollbars, this
+ * would be the height of the scrolling widget.
+ *
+ * @return The page size.
+ */
+
+ const nxgl_coord_t getPageSize(void) const;
+
+ /**
+ * Set the smallest value that the slider can represent.
+ *
+ * @param value The smallest value.
+ */
+
+ void setMinimumValue(const nxgl_coord_t value);
+
+ /**
+ * Set the largest value that the slider can represent.
+ *
+ * @param value The largest value.
+ */
+
+ void setMaximumValue(const nxgl_coord_t value);
+
+ /**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+ void setValue(const nxgl_coord_t value);
+
+ /**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+ void setValueWithBitshift(const int32_t value);
+
+ /**
+ * Set the page size represented by the grip.
+ *
+ * @param pageSize The page size.
+ * @see getPageSize().
+ */
+
+ void setPageSize(const nxgl_coord_t pageSize);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleActionEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleClickEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleReleaseEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleReleaseOutsideEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleValueChangeEvent(const CWidgetEventArgs &e);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSCROLLBARHORIZONTAL_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cscrollbarpanel.hxx b/NxWidgets/libnxwidgets/include/cscrollbarpanel.hxx
new file mode 100644
index 000000000..08bdb721c
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cscrollbarpanel.hxx
@@ -0,0 +1,309 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollbarpanel.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSCROLLBARPANEL_HXX
+#define __INCLUDE_CSCROLLBARPANEL_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cscrollingpanel.hxx"
+#include "cwidgetstyle.hxx"
+#include "cscrollbarvertical.hxx"
+#include "cscrollbarhorizontal.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "iscrollable.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Class containing a scrolling panel bordered by scrollbars.
+ */
+ class CScollbarPanel : public CNxWidget, public IScrollable,
+ public CWidgetEventHandler
+ {
+ protected:
+ CWidgetControl *m_widgetControl; /**< Widget control instance */
+ CScrollingPanel *m_panel; /**< Internal panel that
+ contains children. */
+ CScrollbarHorizontal *m_scrollbarHorizontal; /**< Horizontal scrollbar. */
+ CScrollbarVertical *m_scrollbarVertical; /**< Vertical scrollbar. */
+ uint8_t m_scrollbarWidth; /**< Width of the vertical
+ scrollbar. */
+ uint8_t m_scrollbarHeight; /**< Height of the horizontal
+ scrollbar. */
+ bool m_hasVerticalScrollbar; /**< Indicates the presence of
+ a vertical scrollbar. */
+ bool m_hasHorizontalScrollbar; /**< Indicates the presence of
+ a horizontal scrollbar. */
+
+ /**
+ * Creates the child widgets.
+ */
+
+ void buildUI(void);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Destructor.
+ */
+
+ virtual ~CScollbarPanel(void) { }
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CScollbarPanel(const CScollbarPanel &scrollbarPanel)
+ : CNxWidget(scrollbarPanel) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param flags The usual widget flags.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CScollbarPanel(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ uint32_t flags,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Scroll the panel by the specified amounts.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+ virtual void scroll(int32_t dx, int32_t dy);
+
+ /**
+ * Reposition the panel's scrolling region to the specified coordinates.
+ *
+ * @param x The new x coordinate of the scrolling region.
+ * @param y The new y coordinate of the scrolling region.
+ */
+
+ virtual void jump(int32_t x, int32_t y);
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ virtual void setAllowsVerticalScroll(bool allow);
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ virtual void setAllowsHorizontalScroll(bool allow);
+
+ /**
+ * Sets the width of the virtual canvas.
+ *
+ * @param width The width of the virtual canvas.
+ */
+
+ virtual void setCanvasWidth(const int32_t width);
+
+ /**
+ * Sets the height of the virtual canvas.
+ *
+ * @param height The height of the virtual canvas.
+ */
+
+ virtual void setCanvasHeight(const int32_t height);
+
+ /**
+ * Returns true if vertical scrolling is allowed.
+ *
+ * @return True if vertical scrolling is allowed.
+ */
+
+ virtual bool allowsVerticalScroll(void) const;
+
+ /**
+ * Returns true if horizontal scrolling is allowed.
+ *
+ * @return True if horizontal scrolling is allowed.
+ */
+
+ virtual bool allowsHorizontalScroll(void) const;
+
+ /**
+ * Gets the x coordinate of the virtual canvas.
+ *
+ * @return The x coordinate of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasX(void) const;
+
+ /**
+ * Gets the y coordinate of the virtual canvas.
+ *
+ * @return The y coordinate of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasY(void) const;
+
+ /**
+ * Gets the width of the virtual canvas.
+ *
+ * @return The width of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasWidth(void) const;
+
+ /**
+ * Gets the height of the virtual canvas.
+ *
+ * @return The height of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasHeight(void) const;
+
+ /**
+ * Handle a widget scroll event.
+ *
+ * @param e The event data.
+ */
+
+ void handleScrollEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a widget value change event.
+ *
+ * @param e The event data.
+ */
+
+ void handleValueChangeEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Gets a pointer to the CScrollingPanel widget contained within
+ * this widget.
+ *
+ * @return A pointer to the CScrollingPanel widget.
+ */
+
+ inline CScrollingPanel *getPanel(void)
+ {
+ return m_panel;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSCROLLBARPANEL_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cscrollbarvertical.hxx b/NxWidgets/libnxwidgets/include/cscrollbarvertical.hxx
new file mode 100644
index 000000000..974da3378
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cscrollbarvertical.hxx
@@ -0,0 +1,291 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollbarvertical.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSCROLLBARVERTICAL_HXX
+#define __INCLUDE_CSCROLLBARVERTICAL_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "cwidgetstyle.hxx"
+#include "islider.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CSliderVertical;
+ class CGlyphButton;
+ class CNxTimer;
+
+ /**
+ * Container class that holds a slider widget and two arrow buttons.
+ * The interface is presents is virtually identical to the CSliderVertical
+ * widget, which means the two are easily interchangeable. All events
+ * raised by the internal slider widget are re-raised by this widget
+ * to this widget's event handler, meaning its events are also identical
+ * to the CSliderVertical's.
+ */
+ class CScrollbarVertical : public ISlider, public CNxWidget, public CWidgetEventHandler {
+
+ protected:
+ CSliderVertical *m_slider; /**< Pointer to the slider widget */
+ CGlyphButton *m_upButton; /**< Pointer to the up button */
+ CGlyphButton *m_downButton; /**< Pointer to the down button */
+ nxgl_coord_t m_buttonHeight; /**< Height of the buttons */
+ uint8_t m_scrollTimeout; /**< Time until a button triggers another grip
+ movement */
+ CNxTimer *m_timer; /**< Controls slider button repeats */
+
+ /**
+ * Resize the scrollbar to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CScrollbarVertical(const CScrollbarVertical& scrollbarVertical)
+ : CNxWidget(scrollbarVertical) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control instance for the window.
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CScrollbarVertical(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CScrollbarVertical(void) { }
+
+ /**
+ * Get the smallest value that the slider can represent.
+ *
+ * @return The smallest value.
+ */
+
+ const nxgl_coord_t getMinimumValue(void) const;
+
+ /**
+ * Get the largest value that the slider can represent.
+ *
+ * @return The largest value.
+ */
+
+ const nxgl_coord_t getMaximumValue(void) const;
+
+ /**
+ * Get the current value of the slider.
+ *
+ * @return The current slider value.
+ */
+
+ const nxgl_coord_t getValue(void) const;
+
+ /**
+ * Get the value represented by the height of the grip.
+ * For sliders, this would typically be 1 (so each new
+ * grip position is worth 1). For scrollbars, this
+ * would be the height of the scrolling widget.
+ *
+ * @return The page size.
+ */
+
+ const nxgl_coord_t getPageSize(void) const;
+
+ /**
+ * Set the smallest value that the slider can represent.
+ *
+ * @param value The smallest value.
+ */
+
+ void setMinimumValue(const nxgl_coord_t value);
+
+ /**
+ * Set the largest value that the slider can represent.
+ *
+ * @param value The largest value.
+ */
+
+ void setMaximumValue(const nxgl_coord_t value);
+
+ /**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+ void setValue(const nxgl_coord_t value);
+
+ /**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+ void setValueWithBitshift(const int32_t value);
+
+ /**
+ * Set the page size represented by the grip.
+ *
+ * @param pageSize The page size.
+ * @see getPageSize().
+ */
+
+ void setPageSize(const nxgl_coord_t pageSize);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleActionEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleClickEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleReleaseEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleReleaseOutsideEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleValueChangeEvent(const CWidgetEventArgs &e);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSCROLLBARVERTICAL_HXX
diff --git a/NxWidgets/libnxwidgets/include/cscrollinglistbox.hxx b/NxWidgets/libnxwidgets/include/cscrollinglistbox.hxx
new file mode 100644
index 000000000..ba7090b4b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cscrollinglistbox.hxx
@@ -0,0 +1,480 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollinglistbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSCROLLINGLISTBOX_HXX
+#define __INCLUDE_CSCROLLINGLISTBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "clistbox.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "clistdata.hxx"
+#include "clistboxdataitem.hxx"
+#include "cwidgetstyle.hxx"
+#include "ilistbox.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CScrollbarVertical;
+ class CWidgetControl;
+
+ /**
+ * Widget containing a CListBox and a vertical scrollbar. Exposed
+ * methods are more or less identical to the methods exposed by the CListBox
+ * to ensure that the two are interchangeable.
+ */
+
+ class CScrollingListBox : public IListBox, public CNxWidget,
+ public CWidgetEventHandler
+ {
+ protected:
+ CListBox *m_listbox; /**< Pointer to the list box. */
+ CScrollbarVertical *m_scrollbar; /**< Pointer to the scrollbar. */
+ uint8_t m_scrollbarWidth; /**< Width of the scrollbar. */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Resize the listbox to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CScrollingListBox(void) { }
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CScrollingListBox(const CScrollingListBox &scrollingListBox)
+ : CNxWidget(scrollingListBox) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CScrollingListBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Add a new option to the widget using default colors.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ */
+
+ virtual void addOption(const CNxString &text, const uint32_t value);
+
+ /**
+ * Add an option to the widget.
+ *
+ * @param option The option to add.
+ */
+
+ virtual void addOption(CListBoxDataItem *option);
+
+ /**
+ * Add a new option to the widget.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ * @param normalTextColor Color to draw the text with when not selected.
+ * @param normalBackColor Color to draw the background with when not selected.
+ * @param selectedTextColor Color to draw the text with when selected.
+ * @param selectedBackColor Color to draw the background with when selected.
+ */
+
+ virtual void addOption(const CNxString &text, const uint32_t value,
+ const nxwidget_pixel_t normalTextColor,
+ const nxwidget_pixel_t normalBackColor,
+ const nxwidget_pixel_t selectedTextColor,
+ const nxwidget_pixel_t selectedBackColor);
+
+ /**
+ * Remove an option from the widget by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+ virtual void removeOption(const int index);
+
+ /**
+ * Remove all options from the widget.
+ */
+
+ virtual void removeAllOptions(void);
+
+ /**
+ * Select an option by its index. Does not deselect any other selected options.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+ virtual inline void selectOption(const int index)
+ {
+ m_listbox->selectOption(index);
+ }
+
+ /**
+ * Select an option by its index. Does not deselect any other selected options.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+ virtual inline void deselectOption(const int index)
+ {
+ m_listbox->deselectOption(index);
+ }
+
+ /**
+ * Select all options. Does nothing if the listbox does not allow multiple selections.
+ * Redraws the widget and raises a value changed event.
+ */
+
+ virtual inline void selectAllOptions(void)
+ {
+ m_listbox->selectAllOptions();
+ }
+
+ /**
+ * Deselect all options.
+ * Redraws the widget and raises a value changed event.
+ */
+
+ virtual inline void deselectAllOptions(void)
+ {
+ m_listbox->deselectAllOptions();
+ }
+
+ /**
+ * Get the selected index. Returns -1 if nothing is selected. If more than one
+ * option is selected, the index of the first selected option is returned.
+ *
+ * @return The selected index.
+ */
+
+ virtual inline const int getSelectedIndex(void) const
+ {
+ return m_listbox->getSelectedIndex();
+ }
+
+ /**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected items to deselected.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The selected index.
+ */
+
+ virtual inline void setSelectedIndex(const int index)
+ {
+ m_listbox->setSelectedIndex(index);
+ }
+
+ /**
+ * Get the selected option. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+ virtual inline const CListBoxDataItem *getSelectedOption(void) const
+ {
+ return m_listbox->getSelectedOption();
+ }
+
+ /**
+ * Sets whether multiple selections are possible or not.
+ *
+ * @param allowMultipleSelections True to allow multiple selections.
+ */
+
+ virtual inline
+ void setAllowMultipleSelections(const bool allowMultipleSelections)
+ {
+ m_listbox->setAllowMultipleSelections(allowMultipleSelections);
+ }
+
+ /**
+ * Sets whether multiple selections are possible or not.
+ *
+ * @return True if multiple selections are allowed.
+ */
+
+ virtual inline const bool allowsMultipleSelections(void) const
+ {
+ return m_listbox->allowsMultipleSelections();
+ }
+
+ /**
+ * Resize the scrolling canvas to encompass all options.
+ */
+
+ virtual inline void resizeCanvas(void)
+ {
+ m_listbox->resizeCanvas();
+ }
+
+ /**
+ * Get the specified option.
+ *
+ * @return The specified option.
+ */
+
+ virtual inline const CListBoxDataItem *getOption(const int index)
+ {
+ return m_listbox->getOption(index);
+ }
+
+ /**
+ * Get the selected index. Returns -1 if nothing is selected.
+ *
+ * @return The selected index.
+ */
+
+ virtual inline const CListBoxDataItem *getOption(const int index) const
+ {
+ return m_listbox->getOption(index);
+ }
+
+ /**
+ * Sort the options alphabetically by the text of the options.
+ */
+
+ virtual inline void sort(void)
+ {
+ m_listbox->sort();
+ }
+
+ /**
+ * Get the total number of options.
+ *
+ * @return The number of options.
+ */
+
+ virtual inline const int getOptionCount(void) const
+ {
+ return m_listbox->getOptionCount();
+ }
+
+ /**
+ * Get the height of a single option.
+ *
+ * @return The height of an option.
+ */
+
+ virtual inline const nxgl_coord_t getOptionHeight(void) const
+ {
+ return m_listbox->getOptionHeight();
+ }
+
+ /**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleValueChangeEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a widget action event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleActionEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleScrollEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a mouse button click event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleClickEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleDoubleClickEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a mouse button release event that occurred within the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleReleaseEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a mouse button release event that occurred outside the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleReleaseOutsideEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Set the font used in the textbox.
+ *
+ * @param font Pointer to the new font.
+ */
+
+ virtual void setFont(CNxFont *font);
+
+ /**
+ * Sets whether or not items added to the list are automatically
+ * sorted on insert or not.
+ *
+ * @param sortInsertedItems True to enable sort on insertion.
+ */
+
+ virtual inline void setSortInsertedItems(const bool sortInsertedItems)
+ {
+ m_listbox->setSortInsertedItems(sortInsertedItems);
+ }
+
+ /**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent. Value is based on the length of the largest string in the
+ * set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+ virtual void getPreferredDimensions(CRect &rect) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSCROLLINGLISTBOX_HXX
diff --git a/NxWidgets/libnxwidgets/include/cscrollingpanel.hxx b/NxWidgets/libnxwidgets/include/cscrollingpanel.hxx
new file mode 100644
index 000000000..90dcc1ac9
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cscrollingpanel.hxx
@@ -0,0 +1,372 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollingpanel.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSCROLLINGPANEL_HXX
+#define __INCLUDE_CSCROLLINGPANEL_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "iscrollable.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Class containing a scrollable region. Responds to mouse movement. Can
+ * contain sub-widgets which will also be scrolled.
+ */
+
+ class CScrollingPanel : public CNxWidget, public IScrollable
+ {
+ protected:
+ CWidgetControl *m_widgetControl; /**< Widget control instance */
+ int32_t m_canvasX; /**< X coordinate of the virtual
+ canvas. */
+ int32_t m_canvasY; /**< Y coordinate of the virtual
+ canvas. */
+ int32_t m_canvasWidth; /**< Width of the virtual canvas. */
+ int32_t m_canvasHeight; /**< Height of the virtual canvas. */
+ bool m_allowVerticalScroll; /**< True if vertical scrolling is
+ allowed. */
+ bool m_allowHorizontalScroll; /**< True if horizontal scrolling is
+ allowed. */
+ bool m_isContentScrolled; /**< True if the content drawn to the
+ panel is scrolled(ie. everything
+ drawn in the draw() method);
+ false if just child objects are scrolled. */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Scrolls the panel to match the drag.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal drag distance.
+ * @param vY The vertical drag distance.
+ */
+
+ virtual void onDrag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY);
+
+ /**
+ * Starts the dragging system.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Scroll all child widgets by the specified amounts. Actually uses
+ * the widget's moveTo() function to reposition them.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+ void scrollChildren(int32_t dx, int32_t dy);
+
+ /**
+ * Destructor.
+ */
+
+ virtual ~CScrollingPanel(void) { }
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CScrollingPanel(const CScrollingPanel &scrollingPanel)
+ : CNxWidget(scrollingPanel) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param flags The usual widget flags.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CScrollingPanel(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ uint32_t flags,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Scroll the panel by the specified amounts.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+ virtual void scroll(int32_t dx, int32_t dy);
+
+ /**
+ * Reposition the panel's scrolling region to the specified coordinates.
+ *
+ * @param x The new x coordinate of the scrolling region.
+ * @param y The new y coordinate of the scrolling region.
+ */
+
+ virtual void jump(int32_t x, int32_t y);
+
+ /**
+ * Returns true if vertical scrolling is allowed.
+ *
+ * @return True if vertical scrolling is allowed.
+ */
+
+ inline bool allowsVerticalScroll(void) const
+ {
+ return m_allowVerticalScroll;
+ }
+
+ /**
+ * Returns true if horizontal scrolling is allowed.
+ *
+ * @return True if horizontal scrolling is allowed.
+ */
+
+ inline bool allowsHorizontalScroll(void) const
+ {
+ return m_allowHorizontalScroll;
+ }
+
+ /**
+ * Gets the x coordinate of the virtual canvas.
+ *
+ * @return The x coordinate of the virtual canvas.
+ */
+
+ virtual inline const int32_t getCanvasX(void) const
+ {
+ return m_canvasX;
+ }
+
+ /**
+ * Gets the y coordinate of the virtual canvas.
+ *
+ * @return The y coordinate of the virtual canvas.
+ */
+
+ virtual inline const int32_t getCanvasY(void) const
+ {
+ return m_canvasY;
+ }
+
+ /**
+ * Gets the width of the virtual canvas.
+ *
+ * @return The width of the virtual canvas.
+ */
+
+ virtual inline const int32_t getCanvasWidth(void) const
+ {
+ return m_canvasWidth;
+ }
+
+ /**
+ * Gets the height of the virtual canvas.
+ *
+ * @return The height of the virtual canvas.
+ */
+
+ virtual inline const int32_t getCanvasHeight(void) const
+ {
+ return m_canvasHeight;
+ }
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ inline void setAllowsVerticalScroll(bool allow)
+ {
+ m_allowVerticalScroll = allow;
+ }
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ inline void setAllowsHorizontalScroll(bool allow)
+ {
+ m_allowHorizontalScroll = allow;
+ }
+
+ /**
+ * Set whether or not the content of the panel is scrolled.
+ * Content is anything drawn to the panel in the draw() method.
+ * This property is disabled by default, which will result in
+ * faster scrolling of child objects.
+ * If the panel contains no child objects, just draw() method
+ * content, consider using a SuperBitmap class instead.
+ *
+ * @param scrolled True to enable content scrolling; false to disable it.
+ */
+
+ inline void setContentScrolled(bool scrolled)
+ {
+ m_isContentScrolled = scrolled;
+ }
+
+ /**
+ * Check if the content of the panel, drawn via the draw() method,
+ * is scrolled.
+ *
+ * @return True if the content is scrolled; false if not.
+ */
+
+ inline bool IsContentScrolled(void)
+ {
+ return m_isContentScrolled;
+ }
+
+ /**
+ * Sets the width of the virtual canvas.
+ *
+ * @param width The width of the virtual canvas.
+ */
+
+ virtual inline void setCanvasWidth(const int32_t width)
+ {
+ m_canvasWidth = width;
+ }
+
+ /**
+ * Sets the height of the virtual canvas.
+ *
+ * @param height The height of the virtual canvas.
+ */
+
+ virtual inline void setCanvasHeight(const int32_t height)
+ {
+ m_canvasHeight = height;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSCROLLINGPANEL_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cscrollingtextbox.hxx b/NxWidgets/libnxwidgets/include/cscrollingtextbox.hxx
new file mode 100644
index 000000000..0d2a1a39d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cscrollingtextbox.hxx
@@ -0,0 +1,467 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollingtextbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSCROLLINGTEXTBOX_HXX
+#define __INCLUDE_CSCROLLINGTEXTBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cmultilinetextbox.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "cwidgetstyle.hxx"
+#include "cnxstring.hxx"
+#include "iscrollable.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CScrollbarVertical;
+ class CNxFont;
+
+ /**
+ * Widget containing a CMultiLineTextBox and a vertical scrollbar. Exposed
+ * methods are more or less identical to the methods exposed by the
+ * CMultiLineTextBox to ensure that the two are interchangeable.
+ */
+
+ class CScrollingTextBox : public ITextBox, public CNxWidget,
+ public IScrollable, public CWidgetEventHandler
+ {
+ protected:
+ CMultiLineTextBox *m_texbox; /**< Pointer to the textbox */
+ CScrollbarVertical *m_scrollbar; /**< Pointer to the scrollbar */
+ uint8_t m_scrollbarWidth; /**< Width of the scrollbar */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Resize the textbox to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CScrollingTextBox(void) { }
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CScrollingTextBox(const CScrollingTextBox& scrollingTextBox)
+ : CNxWidget(scrollingTextBox) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param flags Standard widget flag options.
+ * @param maxRows The maximum number of rows the textbox can track. Adding
+ * text beyond this number will cause rows at the start of the text to be
+ * forgotten; text is essentially stored as a queue, and adding to the back
+ * of a full queue causes the front items to be popped off. Setting this to
+ * 0 will make the textbox track only the visible rows.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+ CScrollingTextBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text, uint32_t flags,
+ nxgl_coord_t maxRows = 0,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Set the horizontal alignment of text within the textbox.
+ *
+ * @param alignment The horizontal position of the text.
+ */
+
+ virtual void setTextAlignmentHoriz(CMultiLineTextBox::TextAlignmentHoriz alignment);
+
+ /**
+ * Set the vertical alignment of text within the textbox.
+ *
+ * @param alignment The vertical position of the text.
+ */
+
+ virtual void setTextAlignmentVert(CMultiLineTextBox::TextAlignmentVert alignment);
+
+ /**
+ * Returns the number of "pages" that the text spans. A page
+ * is defined as the amount of text that can be displayed within
+ * the textbox at one time.
+ *
+ * @return The page count.
+ */
+
+ virtual const uint16_t getPageCount(void) const;
+
+ /**
+ * Returns the current page.
+ *
+ * @return The current page.
+ * @see getPageCount().
+ */
+
+ virtual const uint16_t getCurrentPage(void) const;
+
+ /**
+ * Returns a pointer to the Text object that contains the
+ * wrapped text used in the textbox. It is used as the
+ * pre-processed data source for the textbox, and should
+ * not be altered.
+ *
+ * @return Pointer to the Text object.
+ */
+
+ virtual const CText *getText(void) const;
+
+ /**
+ * Set the text displayed in the textbox.
+ *
+ * @param text String to display.
+ */
+
+ virtual void setText(const CNxString &text);
+
+ /**
+ * Append new text to the end of the current text
+ * displayed in the textbox.
+ *
+ * @param text String to append.
+ */
+
+ virtual void appendText(const CNxString &text);
+
+ /**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+ virtual void removeText(const unsigned int startIndex);
+
+ /**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+ virtual void removeText(const unsigned int startIndex, const unsigned int count);
+
+ /**
+ * Set the font used in the textbox.
+ *
+ * @param font Pointer to the new font.
+ */
+
+ virtual void setFont(CNxFont *font);
+
+ /**
+ * Get the length of the text string.
+ *
+ * @return The length of the text string.
+ */
+
+ virtual const unsigned int getTextLength(void) const;
+
+ /**
+ * Sets the cursor display mode.
+ *
+ * @param cursorMode Determines cursor display mode
+ */
+
+ virtual void showCursor(EShowCursor cursorMode);
+
+ /**
+ * Shows the cursor in default mode (only when the TextBox has focus).
+ */
+
+ inline void showCursor(void)
+ {
+ showCursor(SHOW_CURSOR_ONFOCUS);
+ }
+
+ /**
+ * Hides the cursor.
+ */
+
+ inline void hideCursor(void)
+ {
+ showCursor(SHOW_CURSOR_NEVER);
+ }
+
+ /**
+ * Enables/disables cursor wrapping
+ *
+ * @param wrap True enables cursor wrapping
+ */
+
+ virtual void wrapCursor(bool wrap);
+
+ /**
+ * Move the cursor to the text position specified. 0 indicates the start
+ * of the string. If position is greater than the length of the string,
+ * the cursor is moved to the end of the string.
+ *
+ * @param position The new cursor position.
+ */
+
+ virtual void moveCursorToPosition(const int32_t position);
+
+ /**
+ * Get the cursor position. This is the index within the string that
+ * the cursor is currently positioned over.
+ *
+ * @return position The cursor position.
+ */
+
+ virtual const int32_t getCursorPosition(void) const;
+
+ /**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+ virtual void insertText(const CNxString &text, const unsigned int index);
+
+ /**
+ * Insert text at the current cursor position.
+ *
+ * @param text The text to insert.
+ */
+
+ virtual void insertTextAtCursor(const CNxString &text);
+
+ /**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleValueChangeEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleScrollEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Gets the x coordinate of the virtual canvas.
+ *
+ * @return The x coordinate of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasX(void) const;
+
+ /**
+ * Gets the y coordinate of the virtual canvas.
+ *
+ * @return The y coordinate of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasY(void) const;
+
+ /**
+ * Gets the width of the virtual canvas.
+ *
+ * @return The width of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasWidth(void) const;
+
+ /**
+ * Gets the height of the virtual canvas.
+ *
+ * @return The height of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasHeight(void) const;
+
+ /**
+ * Scroll the panel by the specified amounts.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+ virtual void scroll(int32_t dx, int32_t dy);
+
+ /**
+ * Reposition the panel's scrolling region to the specified coordinates.
+ *
+ * @param x The new x coordinate of the scrolling region.
+ * @param y The new y coordinate of the scrolling region.
+ */
+
+ virtual void jump(int32_t x, int32_t y);
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ virtual void setAllowsVerticalScroll(bool allow);
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ virtual void setAllowsHorizontalScroll(bool allow);
+
+ /**
+ * Sets the width of the virtual canvas.
+ *
+ * @param width The width of the virtual canvas.
+ */
+
+ virtual void setCanvasWidth(const int32_t width);
+
+ /**
+ * Sets the height of the virtual canvas.
+ *
+ * @param height The height of the virtual canvas.
+ */
+
+ virtual void setCanvasHeight(const int32_t height);
+
+ /**
+ * Returns true if vertical scrolling is allowed.
+ *
+ * @return True if vertical scrolling is allowed.
+ */
+
+ virtual bool allowsVerticalScroll(void) const;
+
+ /**
+ * Returns true if horizontal scrolling is allowed.
+ *
+ * @return True if horizontal scrolling is allowed.
+ */
+
+ virtual bool allowsHorizontalScroll(void) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSCROLLINGTEXTBOX_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/csliderhorizontal.hxx b/NxWidgets/libnxwidgets/include/csliderhorizontal.hxx
new file mode 100644
index 000000000..f732a1731
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/csliderhorizontal.hxx
@@ -0,0 +1,344 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/csliderhorizontal.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSLIDERHORIZONTAL_HXX
+#define __INCLUDE_CSLIDERHORIZONTAL_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "islider.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CSliderHorizontalGrip;
+ class CWidgetControl;
+
+ /**
+ * Widget providing a sliding "grip" that can be moved left and
+ * right in the "gutter". Essentially a scrollbar, but more
+ * generic.
+ */
+
+ class CSliderHorizontal : public ISlider, public CNxWidget, public CWidgetEventHandler
+ {
+ protected:
+ CSliderHorizontalGrip *m_grip; /**< Pointer to the grip. */
+ nxgl_coord_t m_minimumValue; /**< Minimum value that the grip can represent. */
+ nxgl_coord_t m_maximumValue; /**< Maximum value that the grip can represent. */
+ int32_t m_value; /**< Current value of the slider. */
+ nxgl_coord_t m_minimumGripWidth; /**< Smallest width that the grip can become */
+ nxgl_coord_t m_pageSize; /**< Value of a page of data, used when clicking
+ the gutter. */
+ int32_t m_gutterWidth; /**< Width of the gutter, taking into account
+ any adjustments made to the width of the grip. */
+ uint32_t m_contentSize; /**< Number of values in the min/max range. */
+
+ /**
+ * Get the maximum possible value that the slider can represent. Useful when
+ * using the slider as a scrollbar, as the height of the grip prevents the full
+ * range of values being accessed (intentionally).
+ * The returned value is bitshfted left 16 places for more accuracy in fixed-point
+ * calculations.
+ *
+ * @return The maximum possible value that the slider can represent.
+ */
+
+ int32_t getPhysicalMaximumValueWithBitshift(void) const;
+
+ /**
+ * Get the value represented by the top of the grip.
+ * return The value represented by the top of the grip.
+ */
+
+ const int32_t getGripValue(void) const;
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Resize the slider to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Moves the grip towards the mouse.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CSliderHorizontal(const CSliderHorizontal& sliderHorizontal)
+ : CNxWidget(sliderHorizontal) { }
+
+ /**
+ * Resize and redraw the grip.
+ */
+
+ void resizeGrip(void);
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control instance for the window.
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ */
+
+ CSliderHorizontal(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ nxgl_coord_t height);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CSliderHorizontal(void) { }
+
+ /**
+ * Get the smallest value that the slider can represent.
+ *
+ * @return The smallest value.
+ */
+
+ inline const nxgl_coord_t getMinimumValue(void) const
+ {
+ return m_minimumValue;
+ }
+
+ /**
+ * Get the largest value that the slider can represent.
+ *
+ * @return The largest value.
+ */
+
+ inline const nxgl_coord_t getMaximumValue(void) const
+ {
+ return m_maximumValue;
+ }
+
+ /**
+ * Get the current value of the slider.
+ *
+ * return The current slider value.
+ */
+
+ inline const nxgl_coord_t getValue(void) const
+ {
+ return m_value >> 16;
+ }
+
+ /**
+ * Get the value represented by the height of the grip.
+ * For sliders, this would typically be 1 (so each new
+ * grip position is worth 1). For scrollbars, this
+ * would be the height of the scrolling widget.
+ *
+ * @return The page size.
+ */
+
+ inline const nxgl_coord_t getPageSize(void) const
+ {
+ return m_pageSize;
+ }
+
+ /**
+ * Set the smallest value that the slider can represent.
+ *
+ * @param value The smallest value.
+ */
+
+ inline void setMinimumValue(const nxgl_coord_t value)
+ {
+ m_minimumValue = value;
+ m_contentSize = m_maximumValue - m_minimumValue + 1;
+ resizeGrip();
+ };
+
+ /**
+ * Set the largest value that the slider can represent.
+ *
+ * @param value The largest value.
+ */
+
+ inline void setMaximumValue(const nxgl_coord_t value)
+ {
+ m_maximumValue = value;
+ m_contentSize = m_maximumValue - m_minimumValue + 1;
+ resizeGrip();
+ };
+
+ /**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+ void setValue(const nxgl_coord_t value);
+
+ /**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+ void setValueWithBitshift(const int32_t value);
+
+ /**
+ * Set the page size represented by the grip.
+ *
+ * @param pageSize The page size.
+ * @see getPageSize().
+ */
+
+ inline void setPageSize(const nxgl_coord_t pageSize)
+ {
+ m_pageSize = pageSize;
+ resizeGrip();
+ };
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleDragEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Get the smallest value that the slider can move through when
+ * dragged.
+ *
+ * @return The smallest value that the slider can move through when
+ * dragged.
+ */
+
+ nxgl_coord_t getMinimumStep(void) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSLIDERHORIZONTAL_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/csliderhorizontalgrip.hxx b/NxWidgets/libnxwidgets/include/csliderhorizontalgrip.hxx
new file mode 100644
index 000000000..71f10f62c
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/csliderhorizontalgrip.hxx
@@ -0,0 +1,203 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/csliderhorizontalgrip.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSLIDERHORIZONTALGRIP_HXX
+#define __INCLUDE_CSLIDERHORIZONTALGRIP_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+
+ /**
+ * Class representing the grip, or draggable button, with a horizontal
+ * slider.
+ */
+
+ class CSliderHorizontalGrip : public CNxWidget
+ {
+ protected:
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Starts dragging the grip and redraws it.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Moves the grip to follow the mouse.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal distance of the drag.
+ * @param vY The vertical distance of the drag.
+ */
+
+ virtual void onDrag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CSliderHorizontalGrip(const CSliderHorizontalGrip &sliderHorizontalGrip)
+ : CNxWidget(sliderHorizontalGrip) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the grip, relative to its parent.
+ * @param y The y coordinate of the grip, relative to its parent.
+ * @param width The width of the grip.
+ * @param height The height of the grip.
+ */
+
+ CSliderHorizontalGrip(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CSliderHorizontalGrip(void) { }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSLIDERHORIZONTALGRIP_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cslidervertical.hxx b/NxWidgets/libnxwidgets/include/cslidervertical.hxx
new file mode 100644
index 000000000..a1b8651f9
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cslidervertical.hxx
@@ -0,0 +1,344 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cslidervertical.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSLIDERVERTICAL_HXX
+#define __INCLUDE_CSLIDERVERTICAL_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "islider.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CSliderVerticalGrip;
+ class CWidgetControl;
+
+ /**
+ * Widget providing a sliding "grip" that can be moved up and
+ * down the "gutter". Essentially a scrollbar, but more
+ * generic.
+ */
+
+ class CSliderVertical : public ISlider, public CNxWidget, public CWidgetEventHandler
+ {
+ protected:
+ CSliderVerticalGrip* m_grip; /**< Pointer to the grip. */
+ nxgl_coord_t m_minimumValue; /**< Minimum value that the grip can represent. */
+ nxgl_coord_t m_maximumValue; /**< Maximum value that the grip can represent. */
+ int32_t m_value; /**< Current value of the slider. */
+ nxgl_coord_t m_minimumGripHeight; /**< Smallest height that the grip can become. */
+ nxgl_coord_t m_pageSize; /**< Value of a page of data, used when clicking
+ the gutter */
+ int32_t m_gutterHeight; /**< Height of the gutter, taking into account
+ any adjustments made to the height of the grip. */
+ uint32_t m_contentSize; /**< Number of values in the min/max range. */
+
+ /**
+ * Get the maximum possible value that the slider can represent. Useful when
+ * using the slider as a scrollbar, as the height of the grip prevents the full
+ * range of values being accessed (intentionally).
+ * The returned value is bitshfted left 16 places for more accuracy in fixed-point
+ * calculations.
+ *
+ * @return The maximum possible value that the slider can represent.
+ */
+
+ int32_t getPhysicalMaximumValueWithBitshift(void) const;
+
+ /**
+ * Get the value represented by the top of the grip. The value is
+ * bitshifted left 16 places for accuracy.
+ * return The value represented by the top of the grip.
+ */
+
+ const int32_t getGripValue(void) const;
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Resize the slider to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+ virtual void onResize(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Moves the grip towards the mouse.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CSliderVertical(const CSliderVertical &sliderVertical)
+ : CNxWidget(sliderVertical) { }
+
+ /**
+ * Resize and redraw the grip.
+ */
+
+ void resizeGrip();
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ */
+
+ CSliderVertical(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CSliderVertical(void) { }
+
+ /**
+ * Get the smallest value that the slider can represent.
+ *
+ * @return The smallest value.
+ */
+
+ inline const nxgl_coord_t getMinimumValue(void) const
+ {
+ return m_minimumValue;
+ }
+
+ /**
+ * Get the largest value that the slider can represent.
+ *
+ * @return The largest value.
+ */
+
+ inline const nxgl_coord_t getMaximumValue(void) const
+ {
+ return m_maximumValue;
+ }
+
+ /**
+ * Get the current value of the slider.
+ * return The current slider value.
+ */
+
+ inline const nxgl_coord_t getValue(void) const
+ {
+ return m_value >> 16;
+ }
+
+ /**
+ * Get the value represented by the height of the grip.
+ * For sliders, this would typically be 1 (so each new
+ * grip position is worth 1). For scrollbars, this
+ * would be the height of the scrolling widget.
+ *
+ * @return The page size.
+ */
+
+ inline const nxgl_coord_t getPageSize(void) const
+ {
+ return m_pageSize;
+ }
+
+ /**
+ * Set the smallest value that the slider can represent.
+ *
+ * @param value The smallest value.
+ */
+
+ inline void setMinimumValue(const nxgl_coord_t value)
+ {
+ m_minimumValue = value;
+ m_contentSize = m_maximumValue - m_minimumValue + 1;
+ resizeGrip();
+ }
+
+ /**
+ * Set the largest value that the slider can represent.
+ *
+ * @param value The largest value.
+ */
+
+ inline void setMaximumValue(const nxgl_coord_t value)
+ {
+ m_maximumValue = value;
+ m_contentSize = m_maximumValue - m_minimumValue + 1;
+ resizeGrip();
+ }
+
+ /**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+ void setValue(const nxgl_coord_t value);
+
+ /**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+ void setValueWithBitshift(const int32_t value);
+
+ /**
+ * Set the page size represented by the grip.
+ *
+ * @param pageSize The page size.
+ * @see getPageSize().
+ */
+
+ inline void setPageSize(const nxgl_coord_t pageSize)
+ {
+ m_pageSize = pageSize;
+ resizeGrip();
+ }
+
+ /**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+ virtual void handleDragEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Get the smallest value that the slider can move through when
+ * dragged.
+ *
+ * @return The smallest value that the slider can move through when
+ * dragged.
+ */
+
+ nxgl_coord_t getMinimumStep(void) const;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSLIDERVERTICAL_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/csliderverticalgrip.hxx b/NxWidgets/libnxwidgets/include/csliderverticalgrip.hxx
new file mode 100644
index 000000000..3ac7fb360
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/csliderverticalgrip.hxx
@@ -0,0 +1,202 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cslidervertical.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSLIDERVERTICALGRIP_HXX
+#define __INCLUDE_CSLIDERVERTICALGRIP_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxwidget.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+
+ /**
+ * Class representing the grip, or draggable button, with a vertical
+ * slider.
+ */
+
+ class CSliderVerticalGrip : public CNxWidget
+ {
+ protected:
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Starts dragging the grip and redraws it.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Moves the grip to follow the mouse.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal distance of the drag.
+ * @param vY The vertical distance of the drag.
+ */
+
+ virtual void onDrag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CSliderVerticalGrip(const CSliderVerticalGrip &sliderVerticalGrip)
+ : CNxWidget(sliderVerticalGrip) { }
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the grip, relative to its parent.
+ * @param y The y coordinate of the grip, relative to its parent.
+ * @param width The width of the grip.
+ * @param height The height of the grip.
+ */
+
+ CSliderVerticalGrip(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CSliderVerticalGrip(void) { }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSLIDERVERTICALGRIP_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/cstickybutton.hxx b/NxWidgets/libnxwidgets/include/cstickybutton.hxx
new file mode 100644
index 000000000..c51976ec0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cstickybutton.hxx
@@ -0,0 +1,237 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cstickybutton.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSTICKYBUTTON_HXX
+#define __INCLUDE_CSTICKYBUTTON_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbutton.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CWidgetControl;
+
+ /**
+ * CButton that sticks down when clicked.
+ */
+
+ class CStickyButton : public CButton
+ {
+ protected:
+ bool m_isStuckDown; /**< True if the key is stuck down */
+
+ /**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ */
+
+ virtual void drawOutline(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Don't redraw on button press events. The button display is
+ * completely controlled by the externally controlled stuck state.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y) {}
+
+ /**
+ * Don't redraw on button release events. The button display is
+ * completely controlled by the externally controlled stuck state.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y) { }
+
+ /**
+ * Don't redraw on button release events. The button display is
+ * completely controlled by the externally controlled stuck state.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+ virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y) { }
+
+ /**
+ * Copy constructor is protected to prevent usage. The button display is
+ * completely controlled by the externally controlled stuck state.
+ */
+
+ inline CStickyButton(const CStickyButton &button) : CButton(button) { }
+
+ public:
+
+ /**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param text The text for the button to display.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CStickyButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CStickyButton(void) { }
+
+ /**
+ * Sets the key's stuck down state. If this is true, the key has a
+ * inwards-bevelled border when drawn. If it is false, the key has
+ * an outwards-bevelled border.
+ *
+ * @param stuckDown The new stuck down state.
+ */
+
+ void setStuckDown(bool stuckDown);
+
+ /**
+ * Toggles the key's stuck down state.
+ */
+
+ inline void toggleStuckDown(void)
+ {
+ setStuckDown(!m_isStuckDown);
+ }
+
+ /**
+ * Returns the stuck down state.
+ *
+ * @return True is the button is in the stuck down state.
+ */
+
+ inline const bool isStuckDown(void) const
+ {
+ return m_isStuckDown;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSTICKYBUTTON_HXX
diff --git a/NxWidgets/libnxwidgets/include/cstickybuttonarray.hxx b/NxWidgets/libnxwidgets/include/cstickybuttonarray.hxx
new file mode 100644
index 000000000..5854c51f0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cstickybuttonarray.hxx
@@ -0,0 +1,174 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cstickybuttonarray.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSTICKYBUTTONARRAY_HXX
+#define __INCLUDE_CSTICKYBUTTONARRAY_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbuttonarray.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references
+ */
+
+ class CWidgetControl;
+ class CNxString;
+
+ /**
+ * Manages a two-dimensional array of buttons as one widget. A two-
+ * dimensional array of buttons might also be called a "keyboard".
+ */
+
+ class CStickyButtonArray : public CButtonArray
+ {
+ protected:
+ bool m_isStuckDown; /**< True if one key in the array stuck down */
+ bool m_stickDown; /**< True there is a change in a sticky button state */
+ uint8_t m_stickyRow; /**< The row index of the stuck button */
+ uint8_t m_stickyColumn; /**< The column index of the stuck button */
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CStickyButtonArray(const CStickyButtonArray &button) : CButtonArray(button) { }
+
+ public:
+
+ /**
+ * Constructor for an array of sticky buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button array, relative to its parent.
+ * @param y The y coordinate of the button array, relative to its parent.
+ * @param buttonColumns The number of buttons in one row of the button array
+ * @param buttonRows The number of buttons in one column of the button array
+ * @param buttonWidth The width of one button
+ * @param buttonHeight The height of one button
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CStickyButtonArray(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ uint8_t buttonColumns, uint8_t buttonRows,
+ nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * CStickyButtonArray Destructor.
+ */
+
+ virtual inline ~CStickyButtonArray(void) { }
+
+ /**
+ * Return the position of the last stuck down button (0,0 will be returned
+ * the no button has every been stuck down). The button at this position
+ * is currently stuck down then, in addition, return true.
+ *
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return True if a button in the array is clicked
+ */
+
+ virtual bool isAnyButtonStuckDown(int &column, int &row) const;
+
+ /**
+ * Check if this specific button in the array is stuck down
+ *
+ * @param column The column of the button to check.
+ * @param row The row of the button to check.
+ * @return True if this button is stuck down
+ */
+
+ virtual bool isThisButtonStuckDown(int column, int row) const;
+
+ /**
+ * Force the button at this position into the stuck down state
+ *
+ * @param column The column containing the button to stick down
+ * @param row The rowtcontaining the button to stick down
+ * @return False(0) is returned if the indices are out of range.
+ */
+
+ virtual bool stickDown(int column, int row);
+
+ /**
+ * Unstick all buttons
+ */
+
+ virtual void unstick(void);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSTICKYBUTTONARRAY_HXX
diff --git a/NxWidgets/libnxwidgets/include/cstringiterator.hxx b/NxWidgets/libnxwidgets/include/cstringiterator.hxx
new file mode 100644
index 000000000..648d12633
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cstringiterator.hxx
@@ -0,0 +1,192 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cstringiterator.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CSTRINGITERATOR_HXX
+#define __INCLUDE_CSTRINGITERATOR_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxString;
+
+ /**
+ * Class used to efficiently iterate over the characters in a CNxString
+ * object. The CNxString is a Unicode string that uses the fixed-width
+ * 16-bit encoding to represent its characters.
+ */
+
+ class CStringIterator
+ {
+ private:
+ const CNxString *m_pString; /**< String being iterated over. */
+ const nxwidget_char_t *m_pCurrentChar; /**< Pointer to the current position of the iterator. */
+ int m_currentIndex; /**< Iterator's current index within the string. */
+
+ public:
+
+ /**
+ * Constructor. Moves the iterator to the first character in the string.
+ *
+ * @param string Pointer to the string that will be iterated over.
+ */
+
+ CStringIterator(FAR const CNxString* string);
+
+ /**
+ * Destructor.
+ */
+
+ inline ~CStringIterator(void) { }
+
+ /**
+ * Moves the iterator to the first character in the string.
+ *
+ * @param Returns false if the string is empty
+ */
+
+ bool moveToFirst(void);
+
+ /**
+ * Moves the iterator to the last character in the string.
+ *
+ * @param Returns false if the string is empty
+ */
+
+ bool moveToLast(void);
+
+ /**
+ * Move the iterator to the next character in the string.
+ *
+ * @return True if the iterator moved; false if not (indicates end of string).
+ */
+
+ bool moveToNext(void);
+
+ /**
+ * Move the iterator to the previous character in the string.
+ *
+ * @return True if the iterator moved; false if not (indicates start of string).
+ */
+
+ bool moveToPrevious(void);
+
+ /**
+ * Move the iterator to the specified index.
+ *
+ * @param index The index to move to.
+ * @return True if the iterator moved; false if not (indicates end of string).
+ */
+
+ bool moveTo(int index);
+
+ /**
+ * Get the current position of the iterator within the string.
+ *
+ * @return The current character index of the iterator.
+ */
+
+ inline int getIndex(void) const
+ {
+ return m_currentIndex;
+ }
+
+ /**
+ * Get the letter in the string at the iterator's current point.
+ *
+ * @return The current character in the string.
+ */
+
+ inline nxwidget_char_t getChar(void) const
+ {
+ return *m_pCurrentChar;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CSTRINGITERATOR_HXX
diff --git a/NxWidgets/libnxwidgets/include/ctext.hxx b/NxWidgets/libnxwidgets/include/ctext.hxx
new file mode 100644
index 000000000..8f8ee5783
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ctext.hxx
@@ -0,0 +1,386 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ctext.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CTEXT_HXX
+#define __INCLUDE_CTEXT_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nx.h>
+
+#include "nxconfig.hxx"
+#include "cnxfont.hxx"
+#include "tnxarray.hxx"
+#include "cnxstring.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * This class functions as a wrapper around a char array offering
+ * more advanced functionality - it can wrap text, calculate its
+ * height in pixels, calculate the width of a row, etc.
+ */
+
+ class CText : public CNxString
+ {
+ private:
+
+ /**
+ * Struct defining the position and length of a longest line within
+ * the m_linePositions array.
+ */
+
+ typedef struct
+ {
+ int index;
+ uint8_t width;
+ } LongestLine;
+
+ CNxFont *m_font; /**< Font to be used for output */
+ TNxArray<int> m_linePositions; /**< Array containing start indexes
+ of each wrapped line */
+ TNxArray<LongestLine> m_longestLines; /**< Array containing data describing
+ successively longer wrapped
+ lines */
+ uint8_t m_lineSpacing; /**< Spacing between lines of text */
+ int32_t m_textPixelHeight; /**< Total height of the wrapped
+ text in pixels */
+ uint8_t m_textPixelWidth; /**< Total width of the wrapped text
+ in pixels */
+ nxgl_coord_t m_width; /**< Width in pixels available t
+ the text */
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param font The font to use for this text object.
+ * @param text A string that this text object should wrap around.
+ * @param width The pixel width at which the text should wrap.
+ */
+
+ CText(CNxFont *font, const CNxString &text, nxgl_coord_t width);
+
+ /**
+ * Set the text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+ virtual void setText(const CNxString &text);
+
+ /**
+ * Set the text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+ virtual void setText(FAR const char *text);
+
+ /**
+ * Set the text in the string.
+ *
+ * @param text Character to to use as the new data for this string.
+ */
+
+ virtual void setText(const nxwidget_char_t text);
+
+ /**
+ * Append text to the end of the string.
+ *
+ * @param text String to append.
+ */
+
+ virtual void append(const CNxString &text);
+
+ /**
+ * Insert text at the specified character index.
+ *
+ * @param text The text to insert.
+ * @param index The char index to insert at.
+ */
+
+ virtual void insert(const CNxString &text, const int index);
+
+ /**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex The char index to start removing from.
+ */
+
+ virtual void remove(const int startIndex);
+
+ /**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex The char index to start removing from.
+ * @param count The number of chars to remove.
+ */
+
+ virtual void remove(const int startIndex, const int count);
+
+ /**
+ * Set the vertical spacing between rows of text.
+ *
+ * @param lineSpacing The line spacing.
+ */
+
+ void setLineSpacing(uint8_t lineSpacing);
+
+ /**
+ * Sets the pixel width of the text; text wider than
+ * this will automatically wrap.
+ *
+ * @param width Maximum pixel width of the text.
+ */
+
+ void setWidth(nxgl_coord_t width);
+
+ /**
+ * Set the font to use.
+ *
+ * @param font Pointer to the new font.
+ */
+
+ void setFont(CNxFont *font);
+
+ /**
+ * Get the number of characters in the specified line number.
+ *
+ * @param lineNumber The line number to check.
+ * @return The number of characters in the line.
+ */
+
+ const int getLineLength(const int lineNumber) const;
+
+ /**
+ * Get the number of characters in the specified line number,
+ * ignoring any trailing blank characters.
+ *
+ * @param lineNumber The line number to check.
+ * @return The number of characters in the line.
+ */
+
+ const int getLineTrimmedLength(const int lineNumber) const;
+
+ /**
+ * Get the width in pixels of the specified line number.
+ *
+ * @param lineNumber The line number to check.
+ * @return The pixel width of the line.
+ */
+
+ const nxgl_coord_t getLinePixelLength(const int lineNumber) const;
+
+ /**
+ * Get the width in pixels of the specified line number,
+ * ignoring any trailing blank characters.
+ *
+ * @param lineNumber The line number to check.
+ * @return The pixel width of the line.
+ */
+
+ const nxgl_coord_t getLineTrimmedPixelLength(const int lineNumber) const;
+
+ /**
+ * Get the total height of the text in pixels.
+ *
+ * @return The total height of the text.
+ */
+
+ inline const int32_t getPixelHeight(void) const
+ {
+ return m_textPixelHeight;
+ }
+
+ /**
+ * Get the width of the longest line in pixels.
+ *
+ * @return The width of the longest line.
+ */
+
+ inline const uint8_t getPixelWidth(void) const
+ {
+ return m_textPixelWidth;
+ }
+
+ /**
+ * Get the pixel spacing between each line of text.
+ *
+ * @return The line spacing.
+ */
+
+ inline const uint8_t getLineSpacing(void) const
+ {
+ return m_lineSpacing;
+ }
+
+ /**
+ * Get the height in pixels of a line, given as the
+ * height of the font plus the line spacing.
+ *
+ * @return The height of a line.
+ */
+
+ inline const uint8_t getLineHeight(void) const
+ {
+ return m_font->getHeight() + m_lineSpacing;
+ }
+
+ /**
+ * Get the total number of lines in the text.
+ *
+ * @return The line count.
+ */
+
+ inline const int getLineCount(void) const
+ {
+ return m_linePositions.size() - 1;
+ }
+
+ /**
+ * Get a pointer to the CText object's font.
+ *
+ * @return Pointer to the font.
+ */
+
+ CNxFont *getFont(void) const;
+
+ /**
+ * Removes lines of text from the start of the text buffer.
+ *
+ * @param lines Number of lines to remove
+ */
+
+ void stripTopLines(const int lines);
+
+ /**
+ * Wrap all of the text.
+ */
+
+ void wrap(void);
+
+ /**
+ * Wrap the text from the line containing the specified char index onwards.
+ *
+ * @param charIndex The index of the char to start wrapping from; note
+ * that the wrapping function will re-wrap that entire line of text.
+ */
+
+ void wrap(int charIndex);
+
+ /**
+ * Get the index of the line of text that contains the specified index
+ * within the raw char array.
+ *
+ * @param index The index to locate within the wrapped lines of text.
+ * @return The number of the line of wrapped text that contains the
+ * specified index.
+ */
+
+ const int getLineContainingCharIndex(const int index) const;
+
+ /**
+ * Gets the index within the char array that represents the start of the line of
+ * text indicated by the line parameter.
+ *
+ * @param line The line number to locate within the char array.
+ * @return The index within the char array of the start of the supplied line.
+ */
+
+ const int getLineStartIndex(const int line) const
+ {
+ return m_linePositions[line];
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CTEXT_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/ctextbox.hxx b/NxWidgets/libnxwidgets/include/ctextbox.hxx
new file mode 100644
index 000000000..32a0ab69f
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ctextbox.hxx
@@ -0,0 +1,375 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ctextbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CTEXTBOX_HXX
+#define __INCLUDE_CTEXTBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "clabel.hxx"
+#include "cnxstring.hxx"
+#include "cwidgetstyle.hxx"
+#include "cwidgeteventargs.hxx"
+#include "itextbox.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward references.
+ */
+
+ class CWidgetControl;
+ class CNxTimer;
+ class CNxString;
+
+ /**
+ * Single-line textbox widget. Can align text both vertically and
+ * horizontally in different ways. The widget gains this functionality by
+ * inheriting from the CLabel class. However, if the amount of text exceeds
+ * the dimensions of the widget, the widget will ignore its horizontal
+ * alignment settings and switch to left-aligned instead. This ensures that
+ * moving the cursor over the text will scroll through it correctly.
+ */
+
+ class CTextBox : public ITextBox, public CLabel, public CWidgetEventHandler
+ {
+ protected:
+ int m_cursorPos; /**< Position of the cursor within the string. */
+ uint8_t m_showCursor; /**< Controls cursor visibility. */
+ bool m_wrapCursor; /**< True wrap cursor at the ends of the text */
+
+ /**
+ * Redraws the widget
+ */
+
+ inline void onBlur(void);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawContents(CGraphicsPort *port);
+
+ /**
+ * Moves the cursor without redrawing.
+ *
+ * @param position New cursor position.
+ * @return True if the cursor position changed
+ */
+
+ virtual bool repositionCursor(const int position);
+
+ /**
+ * Move the cursor to the specified coordinates. The coordinates
+ * are expected to be the result of a click, and therefore in
+ * world-space rather than widget-space.
+ */
+
+ void moveCursorToClickLocation(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+ virtual void drawBorder(CGraphicsPort *port);
+
+ /**
+ * Moves the cursor to the clicked coordinates.
+ *
+ * @param x The x coordinates of the click.
+ * @param y The y coordinates of the click.
+ */
+
+ virtual void onClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Does nothing.
+ *
+ * @param x The x coordinates of the click.
+ * @param y The y coordinates of the click.
+ */
+
+ virtual void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Return true if the cursor is visible
+ */
+
+ virtual bool isCursorVisible(void) const;
+
+ /**
+ * Get the x coordinate of the cursor in pixels relative
+ * to the left-hand edge of the client rect.
+ *
+ * @return The x coordinate of the cursor in pixels.
+ */
+
+ virtual const nxgl_coord_t getCursorXPos(void) const;
+
+ /**
+ * Get the width of the cursor in pixels.
+ *
+ * @return The width of the cursor in pixels.
+ */
+
+ virtual nxgl_coord_t getCursorWidth(void) const;
+
+ /**
+ * Calculate the horizontal position of the string based on its length
+ * and the alignment options. Alignment options are overridden if the
+ * width of the string exceeds the width of the textbox.
+ */
+
+ virtual void calculateTextPositionHorizontal(void);
+
+ /**
+ * Copy constructor is protected to prevent usage.
+ */
+
+ inline CTextBox(const CTextBox& textbox) : CLabel(textbox) { };
+
+ public:
+
+ /**
+ * Constructor for a textbox containing a string.
+ *
+ * @param pWidgetControl The controlling widget for the window
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+ CTextBox(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height, const CNxString &text,
+ CWidgetStyle *style = (CWidgetStyle *)NULL);
+
+ /**
+ * Sets the cursor display mode.
+ *
+ * @param cursorMode Determines cursor display mode
+ */
+
+ virtual void showCursor(EShowCursor cursorMode);
+
+ /**
+ * Shows the cursor in default mode (only when the TextBox has focus).
+ */
+
+ virtual inline void showCursor(void)
+ {
+ showCursor(SHOW_CURSOR_ONFOCUS);
+ }
+
+ /**
+ * Hides the cursor.
+ */
+
+ virtual inline void hideCursor(void)
+ {
+ showCursor(SHOW_CURSOR_NEVER);
+ }
+
+ /**
+ * Enables/disables cursor wrapping
+ *
+ * @param wrap True enables cursor wrapping
+ */
+
+ virtual inline void wrapCursor(bool wrap)
+ {
+ m_wrapCursor = wrap;
+ }
+
+ /**
+ * Set the text displayed in the label.
+ *
+ * @param text String to display.
+ */
+
+ virtual void setText(const CNxString &text);
+
+ /**
+ * Append new text to the end of the current text displayed in the
+ * label.
+ *
+ * @param text String to append.
+ */
+
+ virtual void appendText(const CNxString &text);
+
+ /**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+ virtual void removeText(const unsigned int startIndex);
+
+ /**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+ virtual void removeText(const unsigned int startIndex, const unsigned int count);
+
+ /**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+ virtual void insertText(const CNxString &text, const unsigned int index);
+
+ /**
+ * Insert text at the current cursor position.
+ *
+ * @param text The text to insert.
+ */
+
+ virtual void insertTextAtCursor(const CNxString &text);
+
+ /**
+ * Move the cursor to the text position specified. 0 indicates the
+ * start of the string. If position is greater than the length of the
+ * string, the cursor is moved to the end of the string.
+ *
+ * @param position The new cursor position.
+ */
+
+ virtual void moveCursorToPosition(const int position);
+
+ /**
+ * Get the cursor position. This is the index within the string that
+ * the cursor is currently positioned over.
+ *
+ * @return position The cursor position.
+ */
+
+ virtual inline const int getCursorPosition(void) const
+ {
+ return m_cursorPos;
+ }
+
+ /**
+ * Handle a keyboard press event. Replaces CWidgetEventHandler method.
+ *
+ * @param e The event data.
+ */
+
+ void handleKeyPressEvent(const CWidgetEventArgs &e);
+
+ /**
+ * Handle a cursor control event. Replaces CWidgetEventHandler method.
+ *
+ * @param e The event data.
+ */
+
+ void handleCursorControlEvent(const CWidgetEventArgs &e);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CTEXTBOX_HXX
diff --git a/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx b/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
new file mode 100644
index 000000000..9fedd4618
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
@@ -0,0 +1,641 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CWIDGETCONTROLT_HXX
+#define __INCLUDE_CWIDGETCONTROLT_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <semaphore.h>
+#include <time.h>
+
+#include "nxconfig.hxx"
+#include "cgraphicsport.hxx"
+#include "cnxwidget.hxx"
+#include "crect.hxx"
+#include "cwidgetstyle.hxx"
+#include "tnxarray.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class INxWindow;
+ class CNxWidget;
+
+ /**
+ * Class providing a top-level widget and an interface to the CWidgetControl
+ * widget hierarchy.
+ *
+ * There are three instances that represent an NX window from the
+ * perspective of NXWidgets.
+ *
+ * - There is one widget control instance per NX window,
+ * - One CCallback instance per window,
+ * - One window instance.
+ *
+ * There a various kinds of of window instances, but each inherits
+ * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
+ * that describes the common window behavior.
+ */
+
+ class CWidgetControl
+ {
+ protected:
+ /**
+ * Structure holding the status of the Mouse or Touchscreen. There must
+ * be one instance of this structure per window instance. The
+ * content of this structure is update by the CGraphicsPort on each
+ * NX mouse callback
+ */
+
+ struct SMouse
+ {
+#if 0 // Center and right buttons are not used
+ uint16_t leftPressed : 1; /**< Left button pressed (or
+ touchscreen contact) */
+ uint16_t centerPressed : 1; /**< Center button pressed (not
+ used with touchscreen) */
+ uint16_t rightPressed : 1; /**< Right button pressed (not
+ used with touchscreen) */
+ uint16_t leftHeld : 1; /**< Left button held down (or
+ touchscreen contact) */
+ uint16_t centerHeld : 1; /**< Center button held down
+ (not used with touchscreen) */
+ uint16_t rightHeld : 1; /**< Right button held down
+ (not used with touchscreen) */
+ uint16_t leftDrag : 1; /**< Left button held down (or
+ touchscreen contact) */
+ uint16_t centerDrag : 1; /**< Center button held down (or
+ touchscreen contact) */
+ uint16_t rightDrag : 1; /**< Right button held down (or
+ touchscreen contact) */
+ uint16_t leftReleased : 1; /**< Left button release (or
+ loss of touchscreen contact) */
+ uint16_t centerReleased : 1; /**< Center button release (or
+ loss of touchscreen contact) */
+ uint16_t rightReleased : 1; /**< Right button release (or
+ loss of touchscreen contact) */
+ uint16_t doubleClick : 1; /**< Left button double click */
+ uint16_t unused : 3; /**< Padding bits */
+#else
+ uint8_t leftPressed : 1; /**< Left button pressed (or
+ touchscreen contact) */
+ uint8_t leftHeld : 1; /**< Left button held down (or
+ touchscreen contact) */
+ uint8_t leftDrag : 1; /**< Left button held down (or
+ touchscreen contact) */
+ uint8_t leftReleased : 1; /**< Left button release (or
+ loss of touchscreen contact) */
+ uint8_t doubleClick : 1; /**< Left button double click */
+ uint8_t unused : 3; /**< Padding bits */
+#endif
+ nxgl_coord_t x; /**< Current X coordinate of
+ the mouse/touch */
+ nxgl_coord_t y; /**< Current Y coordinate of
+ the mouse/touch */
+ nxgl_coord_t lastX; /**< X coordinate of the mouse
+ at the previous poll */
+ nxgl_coord_t lastY; /**< Y coordinate of the mouse
+ at the previous poll */
+ struct timespec leftPressTime; /**< Time the left button was
+ pressed */
+ struct timespec leftReleaseTime; /**< Time the left button was
+ released */
+ };
+
+ /**
+ * State data
+ */
+
+ CGraphicsPort *m_port; /**< The graphics port
+ that is used for
+ drawing on this window */
+ TNxArray<CNxWidget*> m_deleteQueue; /**< Array of widgets
+ awaiting deletion. */
+ TNxArray<CNxWidget*> m_widgets; /**< List of controlled
+ widgets. */
+ bool m_modal; /**< True: in modal loop */
+ sem_t m_modalsem; /**< Modal loops waits for
+ events on this semaphore */
+ /**
+ * I/O
+ */
+
+ struct SMouse m_mouse; /**< Current pointer
+ device state */
+ CNxWidget *m_clickedWidget; /**< Pointer to the widget
+ that is clicked. */
+ CNxWidget *m_focusedWidget; /**< Pointer to the widget
+ that received keyboard
+ input. */
+ uint8_t m_kbdbuf[CONFIG_NXWIDGETS_KBDBUFFER_SIZE];
+ uint8_t m_nCh; /**< Number of buffered
+ keyboard characters */
+ uint8_t m_controls[CONFIG_NXWIDGETS_CURSORCONTROL_SIZE];
+ uint8_t m_nCc; /**< Number of buffered
+ cursor controls */
+ /**
+ * The following were picked off from the position callback.
+ */
+
+ NXHANDLE m_hWindow; /**< Handle to the NX window */
+ struct nxgl_size_s m_size; /**< Size of the window */
+ struct nxgl_point_s m_pos; /**< Position in display space */
+ struct nxgl_rect_s m_bounds; /**< Size of the display */
+
+ /**
+ * Style
+ */
+
+ CWidgetStyle m_style; /**< Default style used by all
+ widgets in the window. */
+
+ /**
+ * Copy a widget style
+ *
+ * @param dest The destination style
+ * @param src The source to use
+ */
+
+ void copyWidgetStyle(CWidgetStyle *dest, const CWidgetStyle *src);
+
+ /**
+ * Return the elapsed time in millisconds
+ *
+ * @param startTime A time in the past from which to compute the elapsed time.
+ * @return The elapsed time since startTime
+ */
+
+ uint32_t elapsedTime(FAR const struct timespec *startTime);
+
+ /**
+ * Pass clicks to the widget hierarchy. Closes the context menu if
+ * the clicked widget is not the context menu. If a single widget
+ * is supplied, only that widget is sent the click. That widget
+ * should be running modally.
+ *
+ * @param x Click xcoordinate.
+ * @param y Click ycoordinate.
+ * @param widget Pointer to a modally-running widget or NULL.
+ */
+
+ void handleLeftClick(nxgl_coord_t x, nxgl_coord_t y, CNxWidget* widget);
+
+ /**
+ * Get the index of the specified controlled widget.
+ *
+ * @param widget The widget to get the index of.
+ * @return The index of the widget. -1 if the widget is not found.
+ */
+
+ const int getWidgetIndex(const CNxWidget *widget) const;
+
+ /**
+ * Delete any widgets in the deletion queue.
+ */
+
+ void processDeleteQueue(void);
+
+ /**
+ * Process mouse/touchscreen events and send throughout the hierarchy.
+ *
+ * @param widget to process, used for modal widgets; omit this parameter
+ * to run the whole system.
+ * @return True means a mouse event occurred
+ */
+
+ bool pollMouseEvents(CNxWidget* widget);
+
+ /**
+ * Process keypad events and send throughout the hierarchy.
+ *
+ * @return True means a keyboard event occurred
+ */
+
+ bool pollKeyboardEvents(void);
+
+ /**
+ * Process cursor control events and send throughout the hierarchy.
+ *
+ * @return True means a cursor control event was processes
+ */
+
+ bool pollCursorControlEvents(void);
+
+ /**
+ * Wake up the modal loop
+ */
+
+ void wakeupModalLoop(void);
+
+ /**
+ * Clear all mouse events
+ */
+
+ void clearMouseEvents(void);
+
+ public:
+
+ /**
+ * Constructor
+ *
+ * @param style The default style that all widgets on this display
+ * should use. If this is not specified, the widget will use the
+ * values stored in the defaultCWidgetStyle object.
+ */
+
+ CWidgetControl(FAR const CWidgetStyle *style = (const CWidgetStyle *)NULL);
+
+ /**
+ * Destructor.
+ */
+
+ ~CWidgetControl(void);
+
+ /**
+ * Run the widget modally. This will run the CWidgetControl
+ * application until stopModal() is called.
+ */
+
+ void goModal(void);
+
+ /**
+ * Wait for an interesting modal event to occur (like a mouse or keyboard event)
+ */
+
+ void waitForModalEvent(void);
+
+ /**
+ * Is the widget modal? Only true if the Widget singleton is also modal.
+ *
+ * @return True if the widget is modal.
+ */
+
+ inline const bool isModal(void) const
+ {
+ return m_modal;
+ }
+
+ /**
+ * Stop the widget running modally.
+ */
+
+ void stopModal(void);
+
+ /**
+ * Run all code that needs to take place on a periodic basis.
+ * This is normally called from and is the main body of goModal()
+ * with widget == NULL.
+ *
+ * @param widget Sub-widget to run, used for modal widgets; omit
+ * this parameter to run the whole system.
+ * @return True means some interesting event occurred
+ */
+
+ bool pollEvents(CNxWidget *widget = (CNxWidget *)NULL);
+
+ /**
+ * Swaps the depth of the supplied widget.
+ * This function presumes that all child widgets are screens.
+ *
+ * @param widget The widget to be depth-swapped.
+ * @return True if the depth swap occurred.
+ */
+
+ bool swapWidgetDepth(CNxWidget *widget);
+
+ /**
+ * Redraws any dirty regions within the supplied region.
+ *
+ * @param rect The region to redraw
+ */
+
+ void eraseRect(CRect rect);
+
+ /**
+ * Add another widget to be managed by this control instance
+ *
+ * @param widget The widget to be controlled.
+ */
+
+ inline void addControlledWidget(CNxWidget* widget)
+ {
+ m_widgets.push_back(widget);
+ }
+
+ /**
+ * Remove a controlled widget
+ *
+ * @param widget The widget to be removed
+ */
+
+ void removeControlledWidget(CNxWidget* widget);
+
+ /**
+ * Get the number of controlled widgets.
+ *
+ * @return The number of child widgets belonging to this widget.
+ */
+
+ inline const int getControlledWidgetCount(void) const
+ {
+ return m_widgets.size();
+ }
+
+ /**
+ * Add a widget to the list of widgets to be deleted.
+ * Must never be called by anything other than the framework itself.
+ *
+ * @param widget The widget to add to the delete queue.
+ */
+
+ void addToDeleteQueue(CNxWidget *widget);
+
+ /**
+ * Set the clicked widget pointer. Note that this should not be
+ * called by code other than within the CWidgetControl library itself.
+ *
+ * @param widget The new clicked widget.
+ */
+
+ void setClickedWidget(CNxWidget *widget);
+
+ /**
+ * Get the clicked widget pointer.
+ *
+ * @return Pointer to the clicked widget.
+ */
+
+ inline CNxWidget *getClickedWidget(void)
+ {
+ return m_clickedWidget;
+ }
+
+ /**
+ * Set the focused widget that will receive keyboard input.
+ *
+ * @param widget The new focused widget.
+ */
+
+ void setFocusedWidget(CNxWidget *widget);
+
+ /**
+ * Reset the focused widget so that it will no longer receive keyboard input.
+ *
+ * @param widget The new focused widget.
+ */
+
+ void clearFocusedWidget(CNxWidget *widget)
+ {
+ if (widget == m_focusedWidget)
+ {
+ m_focusedWidget = (CNxWidget *)NULL;
+ }
+ }
+
+ /**
+ * Get the focused widget pointer.
+ *
+ * @return Pointer to the focused widget.
+ */
+
+ inline CNxWidget *getFocusedWidget(void)
+ {
+ return m_focusedWidget;
+ }
+
+ /**
+ * Check for the occurrence of a double click.
+ *
+ * @return Pointer to the clicked widget.
+ */
+
+ inline bool doubleClick(void)
+ {
+ return (bool)m_mouse.doubleClick;
+ }
+
+ /**
+ * Get the default widget style for this window.
+ *
+ * @return Pointer to the clicked widget.
+ */
+
+ inline void getWidgetStyle(CWidgetStyle *style)
+ {
+ copyWidgetStyle(style, &m_style);
+ }
+
+ /**
+ * These remaining methods are used by the CCallback instance to
+ * provide notifications of certain events.
+ */
+
+ /**
+ * This event will occur when the position or size of the underlying
+ * window occurs.
+ *
+ * @param hWindow The window handle that should be used to communicate
+ * with the window
+ * @param pos The position of the window in the physical device space.
+ * @param size The size of the window.
+ * @param bounds The size of the underlying display (pixels x rows)
+ */
+
+ void geometryEvent(NXHANDLE hWindow,
+ const struct nxgl_size_s *size,
+ const struct nxgl_point_s *pos,
+ const struct nxgl_rect_s *bounds);
+
+ /**
+ * This event will occur when the a portion of the window that was
+ * previously obscured is now exposed.
+ *
+ * @param nxRect The region in the window that must be redrawn.
+ * @param more True means that more re-draw requests will follow
+ */
+
+ void redrawEvent(FAR const struct nxgl_rect_s *nxRect, bool more);
+
+ /**
+ * This event means that new mouse data is available for the window.
+ *
+ * @param pPos The (x,y) position of the mouse.
+ * @param buttons See NX_MOUSE_* definitions.
+ */
+
+ void newMouseEvent(FAR const struct nxgl_point_s *pPos, uint8_t buttons);
+
+ /**
+ * This event means that keyboard/keypad data is available for the window.
+ *
+ * @param nCh The number of characters that are available in pStr[].
+ * @param pStr The array of characters.
+ */
+
+ void newKeyboardEvent(uint8_t nCh, FAR const uint8_t *pStr);
+
+ /**
+ * This event means that cursor control data is available for the window.
+ *
+ * @param cursorControl The cursor control code received.
+ */
+
+ void newCursorControlEvent(ECursorControl cursorControl);
+
+ /**
+ * Get the window handle reported on the first position callback.
+ *
+ * @return This function returns the window handle.
+ */
+
+ inline NXHANDLE getWindowHandle(void)
+ {
+ return m_hWindow;
+ }
+
+ /**
+ * Get the window bounding box in physical display coordinated.
+ *
+ * @return This function returns the window handle.
+ */
+
+ inline CRect getWindowBoundingBox(void)
+ {
+ return CRect(&m_bounds);
+ }
+
+ /**
+ * Get the position of the window (as reported by the last NX callback).
+ *
+ * @return The position.
+ */
+
+ inline bool getWindowPosition(FAR struct nxgl_point_s *pPos)
+ {
+ pPos->x = m_pos.x;
+ pPos->x = m_pos.y;
+ return true;
+ }
+
+ /**
+ * Get the size of the window (as reported by the last NX callback).
+ *
+ * @return The size.
+ */
+
+ inline bool getWindowSize(FAR struct nxgl_size_s *pSize)
+ {
+ pSize->h = m_size.h;
+ pSize->w = m_size.w;
+ return true;
+ }
+
+ /**
+ * Get the width of the window (as reported by the last NX callback).
+ *
+ * @return The size.
+ */
+
+ inline nxgl_coord_t getWindowWidth(void)
+ {
+ return m_size.w;
+ }
+
+ /**
+ * Get the height of the window (as reported by the last NX callback).
+ *
+ * @return The size.
+ */
+
+ inline nxgl_coord_t getWindowHeight(void)
+ {
+ return m_size.h;
+ }
+
+ /**
+ * The creation sequence is:
+ *
+ * 1) Create a dumb CWigetControl instance
+ * 2) Pass the dumb CWidgetControl instance to the window constructor
+ * that inherits from INxWindow.
+ * 3) The call this method with the static_cast to INxWindow to,
+ * finally, create the CGraphicsPort for this window.
+ * 4) After that, the fully smartend CWidgetControl instance can
+ * be used to generate additional widgets.
+ *
+ * @param window The instance of INxWindow needed to construct the
+ * CGraphicsPort instance
+ */
+
+ inline bool createGraphicsPort(INxWindow *window)
+ {
+ m_port = new CGraphicsPort(window);
+ return m_port != (CGraphicsPort *)NULL;
+ }
+
+ /**
+ * Get the CGraphicsPort instance for drawing on this window
+ */
+
+ inline CGraphicsPort *getGraphicsPort(void)
+ {
+ return m_port;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CWIDGETCONTROLT_HXX
diff --git a/NxWidgets/libnxwidgets/include/cwidgeteventargs.hxx b/NxWidgets/libnxwidgets/include/cwidgeteventargs.hxx
new file mode 100644
index 000000000..9aacafa74
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cwidgeteventargs.hxx
@@ -0,0 +1,237 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cwidgeteventargs.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CWIDGETEVENTARGS_HXX
+#define __INCLUDE_CWIDGETEVENTARGS_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "teventargs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Interesting Key events ***************************************************/
+
+#define KEY_CODE_NONE ((nxwidget_char_t)0x00) /**< No key (NUL) */
+#define KEY_CODE_BACKSPACE ((nxwidget_char_t)0x08) /**< Backspace key */
+#define KEY_CODE_DELETE ((nxwidget_char_t)0x7f) /**< Delete key */
+#define KEY_CODE_ENTER ((nxwidget_char_t)0x0d) /**< Enter key (carriage return) */
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxWidget;
+
+ /**
+ * Cursor control events
+ */
+
+ typedef enum
+ {
+ CURSOR_HOME = 1, // Set the cursor to the beginning
+ CURSOR_END, // Set the cursor to the end
+ CURSOR_UP, // Set the cursor up one row
+ CURSOR_DOWN, // Set the cursor down one row
+ CURSOR_LEFT, // Move the cursor left one column
+ CURSOR_RIGHT, // Move the cursor right one column
+ CURSOR_PAGEUP, // Move the cursor up one page
+ CURSOR_PAGEDOWN, // Move the cursor down one page
+ } ECursorControl;
+
+ /**
+ * Event arguments passed to listeners when a CNxWidget object raises an event.
+ */
+
+ class CWidgetEventArgs : public TEventArgs<CNxWidget*>
+ {
+ private:
+ nxgl_coord_t m_x; /**< X coordinateinate of the event. */
+ nxgl_coord_t m_y; /**< Y coordinateinate of the event. */
+ nxgl_coord_t m_vX; /**< X distance moved during event, for dragging. */
+ nxgl_coord_t m_vY; /**< Y distance moved during event, for dragging. */
+ nxwidget_char_t m_key; /**< The key code / cursor code that raised the event. */
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param source Pointer to the CNxWidget object that raised the event.
+ * @param x The x coordinate of the event.
+ * @param y The y coordinate of the event.
+ * @param vX The x distance of the event.
+ * @param vY The y distance of the event.
+ * @param keyCode The keycode of the event.
+ */
+
+ CWidgetEventArgs(CNxWidget *source, const nxgl_coord_t x, const nxgl_coord_t y,
+ const nxgl_coord_t vX, const nxgl_coord_t vY,
+ const nxwidget_char_t key)
+ : TEventArgs<CNxWidget*>(source)
+ {
+ m_x = x;
+ m_y = y;
+ m_vX = vX;
+ m_vY = vY;
+ m_key = key;
+ }
+
+ /**
+ * Get the x coordinate of the mouse event. Applies only to the following
+ * events: mouse click, mouse double click, mouse drag, mouse release
+ *
+ * @return The x coordinate of the event.
+ */
+
+ inline const nxgl_coord_t getX(void) const
+ {
+ return m_x;
+ }
+
+ /**
+ * Get the y coordinate of the mouse event. Applies only to the following
+ * events: mouse click, mouse double click, mouse drag, mouse release
+ *
+ * @return The y coordinate of the event.
+ */
+
+ inline const nxgl_coord_t getY(void) const
+ {
+ return m_y;
+ }
+
+ /**
+ * Get the x-axis mouse move distance of the mouse event. Applies
+ * only to the mouse drag event.
+ *
+ * @return The x-axis mouse move distance of the event.
+ */
+
+ inline const nxgl_coord_t getVX(void) const
+ {
+ return m_vX;
+ }
+
+ /**
+ * Get the y-axis mouse move distance of the event. Applies
+ * only to the mouse drag event.
+ *
+ * @return The y-axis mouse move distance of the event.
+ */
+
+ inline const nxgl_coord_t getVY(void) const
+ {
+ return m_vY;
+ }
+
+ /**
+ * Get the key press that generated the event. Applies only to
+ * the key press event.
+ *
+ * @return The key that generated the event.
+ */
+
+ inline const nxwidget_char_t getKey(void) const
+ {
+ return m_key;
+ }
+
+ /**
+ * Get the cursor control that generated the event. Applies only
+ * to the curso control event.
+ *
+ * @return The cursor control that generated the event.
+ */
+
+ inline const ECursorControl getCursorControl(void) const
+ {
+ return (ECursorControl)m_key;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CWIDGETEVENTARGS_HXX
diff --git a/NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx b/NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx
new file mode 100644
index 000000000..965b29f0f
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx
@@ -0,0 +1,316 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CWIDGETEVENTHANDLER_HXX
+#define __INCLUDE_CWIDGETEVENTHANDLER_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgeteventargs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxWidget;
+
+ /**
+ * Base CWidgetEventHandler class, intended to be subclassed. Any class that
+ * needs to listen for widget events should inherit from this class.
+ */
+
+ class CWidgetEventHandler
+ {
+ public:
+ /**
+ * Constructor.
+ */
+
+ inline CWidgetEventHandler() { }
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~CWidgetEventHandler() { }
+
+ /**
+ * Handle a mouse button click event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleClickEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a mouse button drag event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleDragEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a drop event, triggered when the widget has been dragged-and-dropped.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleDropEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a mouse button release event that occurred within the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleReleaseEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a mouse button release event that occurred outside the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleReleaseOutsideEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a key press event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleKeyPressEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a cursor control event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleCursorControlEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a key repeat event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleFocusEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget blur event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleBlurEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget close event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleCloseEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget hide event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleHideEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget show event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleShowEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget enable event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleEnableEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget disable event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleDisableEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget value change event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleValueChangeEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget resize event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleResizeEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget move event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleMoveEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget scroll event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleScrollEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget double-click event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleDoubleClickEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget shelve event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleShelveEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget unshelve event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleUnshelveEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget action event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleActionEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget move forward event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleMoveForwardEvent(const CWidgetEventArgs &e) { }
+
+ /**
+ * Handle a widget move backward event.
+ *
+ * @param e The event data.
+ */
+
+ virtual void handleMoveBackwardEvent(const CWidgetEventArgs &e) { }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CWIDGETEVENTHANDLER_HXX
diff --git a/NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx b/NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx
new file mode 100644
index 000000000..45e304554
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx
@@ -0,0 +1,382 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CWIDGETEVENTHANDLERLIST_HXX
+#define __INCLUDE_CWIDGETEVENTHANDLERLIST_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cwidgeteventhandler.hxx"
+#include "tnxarray.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxWidget;
+ class CListDataItem;
+
+ /**
+ * List of widget event handlers.
+ */
+ class CWidgetEventHandlerList
+ {
+ protected:
+ TNxArray<CWidgetEventHandler*> m_widgetEventHandlers; /**< List of event handlers */
+ CNxWidget *m_widget; /**< Owning widget */
+ bool m_isEnabled; /**< Indicates if events are active */
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @param widget The owning widget.
+ */
+
+ CWidgetEventHandlerList(CNxWidget *widget);
+
+ /**
+ * Destructor.
+ */
+
+ ~CWidgetEventHandlerList(void) { }
+
+ /**
+ * Check if the object raises events or not.
+ *
+ * @return True if events are enabled.
+ */
+
+ const bool isEnabled(void) const;
+
+ /**
+ * Get the event handler at the specified index.
+ *
+ * @param index The index of the event handler.
+ * @return The event handler at the specified index.
+ */
+
+ inline CWidgetEventHandler *at(const int index) const
+ {
+ return m_widgetEventHandlers.at(index);
+ }
+
+ /**
+ * Get the size of the array.
+ *
+ * @return The size of the array.
+ */
+
+ inline const nxgl_coord_t size(void) const
+ {
+ return m_widgetEventHandlers.size();
+ }
+
+ /**
+ * Adds a widget event handler. The event handler will receive
+ * all events raised by this object.
+ * @param eventHandler A pointer to the event handler.
+ */
+
+ void addWidgetEventHandler(CWidgetEventHandler *eventHandler);
+
+ /**
+ * Remove a widget event handler.
+ *
+ * @param eventHandler A pointer to the event handler to remove.
+ */
+
+ void removeWidgetEventHandler(CWidgetEventHandler *eventHandler);
+
+ /**
+ * Enables event raising.
+ */
+
+ inline void enable(void)
+ {
+ m_isEnabled = true;
+ }
+
+ /**
+ * Disables event raising.
+ */
+
+ inline void disable(void)
+ {
+ m_isEnabled = false;
+ }
+
+ /**
+ * Raise a click event to the event handler.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ void raiseClickEvent(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raise a double-click event to the event handler.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+ void raiseDoubleClickEvent(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raise a mouse release event to the event handler.
+ *
+ * @param x The x coordinate of the release.
+ * @param y The y coordinate of the release.
+ */
+
+ void raiseReleaseEvent(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raise a mouse release-outside event to the event handler.
+ *
+ * @param x The x coordinate of the release.
+ * @param y The y coordinate of the release.
+ */
+
+ void raiseReleaseOutsideEvent(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raise a mouse drag event to the event handler.
+ *
+ * @param x The x coordinate of the mouse when the drag started.
+ * @param y The y coordinate of the mouse when the drag started.
+ * @param vX The horizontal distance dragged.
+ * @param vY The vertical distance dragged.
+ */
+
+ void raiseDragEvent(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY);
+
+ /**
+ * Raise a widget drop event to the event handler.
+ *
+ * @param x The x coordinate of the mouse when the drop occurred.
+ * @param y The y coordinate of the mouse when the drop occurred.
+ */
+
+ void raiseDropEvent(nxgl_coord_t x, nxgl_coord_t y);
+
+ /**
+ * Raise a move forward event to the event handler.
+ */
+
+ void raiseMoveForwardEvent(void);
+
+ /**
+ * Raise a move backward event to the event handler.
+ */
+
+ void raiseMoveBackwardEvent(void);
+
+ /**
+ * Raise a key press event to the event handler.
+ *
+ * @param key The character code of the key that caused the event.
+ */
+
+ void raiseKeyPressEvent(nxwidget_char_t key);
+
+ /**
+ * Raise a cursor control event to the event handler.
+ *
+ * @param cursorControl The cursor control code that caused the event.
+ */
+
+ void raiseCursorControlEvent(ECursorControl cursorControl);
+
+ /**
+ * Raise a focus event to the event handler.
+ */
+
+ void raiseFocusEvent(void);
+
+ /**
+ * Raise a blur event to the event handler.
+ */
+
+ void raiseBlurEvent(void);
+
+ /**
+ * Raise a close event to the event handler.
+ */
+
+ void raiseCloseEvent(void);
+
+ /**
+ * Raise a hide event to the event handler.
+ */
+
+ void raiseHideEvent(void);
+
+ /**
+ * Raise a show event to the event handler.
+ */
+
+ void raiseShowEvent(void);
+
+ /**
+ * Raise a shelve event to the event handler.
+ */
+
+ void raiseShelveEvent(void);
+
+ /**
+ * Raise a unshelve event to the event handler.
+ */
+
+ void raiseUnshelveEvent(void);
+
+ /**
+ * Raise an enable event to the event handler.
+ */
+
+ void raiseEnableEvent(void);
+
+ /**
+ * Raise a disable event to the event handler.
+ */
+
+ void raiseDisableEvent(void);
+
+ /**
+ * Raise a value change event to the event handler.
+ */
+
+ void raiseValueChangeEvent(void);
+
+ /**
+ * Raise a resize event to the event handler.
+ *
+ * @param width The new width of the widget.
+ * @param height The new height of the widget.
+ */
+
+ void raiseResizeEvent(nxgl_coord_t width, nxgl_coord_t height);
+
+ /**
+ * Raise a move event to the event handler.
+ *
+ * @param x The new x coordinate of the widget.
+ * @param y The new y coordinate of the widget.
+ * @param vX The horizontal distance moved.
+ * @param vY The vertical distance moved.
+ */
+
+ void raiseMoveEvent(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY);
+
+ /**
+ * Raise an action event to the event handler. This should be called
+ * when a widget's purpose has been fulfilled. For example, in the case
+ * of a button, this event is raised when the button is released within
+ * its boundaries. The button has produced a valid click, and thus
+ * fulfilled its purpose, so it needs to raise an "action" event.
+ */
+
+ void raiseActionEvent(void);
+
+ /**
+ * Raises a scroll event. Fired when the panel scrolls.
+ *
+ * @param vX Horizontal distance scrolled.
+ * @param vY Vertical distance scrolled.
+ */
+
+ void raiseScrollEvent(nxgl_coord_t vX, nxgl_coord_t vY);
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CWIDGETEVENTHANDLERLIST_HXX
diff --git a/NxWidgets/libnxwidgets/include/cwidgetstyle.hxx b/NxWidgets/libnxwidgets/include/cwidgetstyle.hxx
new file mode 100644
index 000000000..8fe5e2c32
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/cwidgetstyle.hxx
@@ -0,0 +1,135 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cwidgetstyle.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CWIDGETSTYLE_HXX
+#define __INCLUDE_CWIDGETSTYLE_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class CNxFont;
+
+ /**
+ * Class containing all colors that a widget depends on.
+ */
+
+ class CWidgetColors
+ {
+ public:
+ nxgl_mxpixel_t background; /**< Color used for a normal background */
+ nxgl_mxpixel_t selectedBackground; /**< Color used for a selected background */
+ nxgl_mxpixel_t shineEdge; /**< Color used as light bevel edge */
+ nxgl_mxpixel_t shadowEdge; /**< Color used as dark bevel edge */
+ nxgl_mxpixel_t highlight; /**< Color used as highlighted elements */
+ nxgl_mxpixel_t disabledText; /**< Color used for text in a disabled widget */
+ nxgl_mxpixel_t enabledText; /**< Color used for text in a enabled widget */
+ nxgl_mxpixel_t selectedText; /**< Color used for text in a clicked widget */
+ };
+
+ /**
+ * Class providing the default colors and fonts for all widgets. This
+ * information is copied into the widgets when they are constructed, so you
+ * will need to change these values *before* creating any widgets if you
+ * want those widgets to use the altered colors.
+ *
+ * If the font objects are set, NXWidgets will use them in preference to the
+ * default system fonts.
+ */
+
+ class CWidgetStyle
+ {
+ public:
+ CWidgetColors colors; /**< Default widget colors */
+ CNxFont *font; /**< Default font */
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CWIDGETSTYLE_HXX
diff --git a/NxWidgets/libnxwidgets/include/glyphs.hxx b/NxWidgets/libnxwidgets/include/glyphs.hxx
new file mode 100644
index 000000000..afd6cc7a0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/glyphs.hxx
@@ -0,0 +1,131 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/glyphs.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_GLYPHS_HXX
+#define __INCLUDE_GLYPHS_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Bitmap Glyph References
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ struct SBitmap;
+
+ // Global RLE Paletted Bitmaps
+
+ extern const struct SRlePaletteBitmap g_nuttxBitmap;
+
+ // Global Simple Bitmaps
+
+ extern const struct SBitmap g_screenDepthUp;
+ extern const struct SBitmap g_screenDepthDown;
+ extern const struct SBitmap g_windowClose;
+ extern const struct SBitmap g_windowDepthUp;
+ extern const struct SBitmap g_windowDepthDown;
+ extern const struct SBitmap g_radioButtonOn;
+ extern const struct SBitmap g_radioButtonOff;
+ extern const struct SBitmap g_radioButtonMu;
+ extern const struct SBitmap g_checkBoxOff;
+ extern const struct SBitmap g_checkBoxOn;
+ extern const struct SBitmap g_checkBoxMu;
+ extern const struct SBitmap g_screenFlipUp;
+ extern const struct SBitmap g_screenFlipDown;
+ extern const struct SBitmap g_arrowUp;
+ extern const struct SBitmap g_arrowDown;
+ extern const struct SBitmap g_arrowLeft;
+ extern const struct SBitmap g_arrowRight;
+ extern const struct SBitmap g_cycle;
+ extern const struct SBitmap g_backspace;
+ extern const struct SBitmap g_return;
+ extern const struct SBitmap g_shift;
+ extern const struct SBitmap g_capslock;
+ extern const struct SBitmap g_control;
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_GLYPHS_HXX
diff --git a/NxWidgets/libnxwidgets/include/ibitmap.hxx b/NxWidgets/libnxwidgets/include/ibitmap.hxx
new file mode 100644
index 000000000..c4bb3b5ac
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ibitmap.hxx
@@ -0,0 +1,165 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ibitmap.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_IBITMAP_HXX
+#define __INCLUDE_IBITMAP_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Abstract class defining the basic properties of a source bitmap. The
+ * primary intent of this class is two support a variety of sources of
+ * bitmap data with various kinds of compression.
+ */
+
+ class IBitmap
+ {
+ public:
+ /**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's width.
+ */
+
+ virtual const uint8_t getColorFormat(void) const = 0;
+
+ /**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's color format.
+ */
+
+ virtual const uint8_t getBitsPerPixel(void) const = 0;
+
+ /**
+ * Get the bitmap's width (in pixels/columns).
+ *
+ * @return The bitmap's pixel depth.
+ */
+
+ virtual const nxgl_coord_t getWidth(void) const = 0;
+
+ /**
+ * Get the bitmap's height (in rows).
+ *
+ * @return The bitmap's height.
+ */
+
+ virtual const nxgl_coord_t getHeight(void) const = 0;
+
+ /**
+ * Get the bitmap's width (in bytes).
+ *
+ * @return The bitmap's width.
+ */
+
+ virtual const nxgl_coord_t getStride(void) const = 0;
+
+ /**
+ * Get one row from the bit map image.
+ *
+ * @param x The offset into the row to get
+ * @param y The row number to get
+ * @param width The number of pixels to get from the row
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ * @param True if the run was returned successfully.
+ */
+
+ virtual bool getRun(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ FAR void *data) = 0;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_IBITMAP_HXX
diff --git a/NxWidgets/libnxwidgets/include/ilistbox.hxx b/NxWidgets/libnxwidgets/include/ilistbox.hxx
new file mode 100644
index 000000000..9184f23c8
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ilistbox.hxx
@@ -0,0 +1,273 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ilistbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_ILISTBOX_HXX
+#define __INCLUDE_ILISTBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "clistboxdataitem.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Abstract Base Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Defines the interface for ListBox classes.
+ */
+
+ class IListBox
+ {
+ public:
+
+ /**
+ * Add a new option to the widget using default colors.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ */
+
+ virtual void addOption(const CNxString &text, const uint32_t value) = 0;
+
+ /**
+ * Add an option to the widget.
+ *
+ * @param option The option to add.
+ */
+
+ virtual void addOption(CListBoxDataItem *option) = 0;
+
+ /**
+ * Remove an option from the widget by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+ virtual void removeOption(const int index) = 0;
+
+ /**
+ * Remove all options from the widget.
+ */
+
+ virtual void removeAllOptions(void) = 0;
+
+ /**
+ * Add a new option to the widget.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ * @param normalTextColor Color to draw the text with when not selected.
+ * @param normalBackColor Color to draw the background with when not selected.
+ * @param selectedTextColor Color to draw the text with when selected.
+ * @param selectedBackColor Color to draw the background with when selected.
+ */
+
+ virtual void addOption(const CNxString &text, const uint32_t value,
+ const nxwidget_pixel_t normalTextColor,
+ const nxwidget_pixel_t normalBackColor,
+ const nxwidget_pixel_t selectedTextColor,
+ const nxwidget_pixel_t selectedBackColor) = 0;
+
+ /**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+ virtual void selectOption(const int index) = 0;
+
+ /**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+ virtual void deselectOption(const int index) = 0;
+
+ /**
+ * Select all options. Does nothing if the listbox does not allow
+ * multiple selections. Redraws the widget and raises a value
+ * changed event.
+ */
+
+ virtual void selectAllOptions(void) = 0;
+
+ /**
+ * Deselect all options.
+ * Redraws the widget and raises a value changed event.
+ */
+
+ virtual void deselectAllOptions(void) = 0;
+
+ /**
+ * Get the selected index. Returns -1 if nothing is selected. If more than one
+ * option is selected, the index of the first selected option is returned.
+ *
+ * @return The selected index.
+ */
+
+ virtual const int getSelectedIndex(void) const = 0;
+
+ /**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected options to deselected.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The selected index.
+ */
+
+ virtual void setSelectedIndex(const int index) = 0;
+
+ /**
+ * Get the selected option. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+ virtual const CListBoxDataItem *getSelectedOption(void) const = 0;
+
+ /**
+ * Sets whether multiple selections are possible or not.
+ *
+ * @param allowMultipleSelections True to allow multiple selections.
+ */
+
+ virtual void setAllowMultipleSelections(const bool allowMultipleSelections) = 0;
+
+ /**
+ * Sets whether multiple selections are possible or not.
+ *
+ * @return True if multiple selections are allowed.
+ */
+
+ virtual const bool allowsMultipleSelections(void) const = 0;
+
+ /**
+ * Get the specified option.
+ *
+ * @return The specified option.
+ */
+
+ virtual const CListBoxDataItem *getOption(const int index) = 0;
+
+ /**
+ * Sort the options alphabetically by the text of the options.
+ */
+
+ virtual void sort(void) = 0;
+
+ /**
+ * Get the total number of options.
+ *
+ * @return The number of options.
+ */
+
+ virtual const int getOptionCount(void) const = 0;
+
+ /**
+ * Get the height of a single option.
+ *
+ * @return The height of an option.
+ */
+
+ virtual const nxgl_coord_t getOptionHeight(void) const = 0;
+
+ /**
+ * Sets whether or not items added to the list are automatically sorted on insert or not.
+ *
+ * @param sortInsertedItems True to enable sort on insertion.
+ */
+
+ virtual void setSortInsertedItems(const bool sortInsertedItems) = 0;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_ILISTBOX_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx b/NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx
new file mode 100644
index 000000000..b6119a2ae
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx
@@ -0,0 +1,127 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_ILISTDATAEVENTHANDLERR_HXX
+#define __INCLUDE_ILISTDATAEVENTHANDLERR_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "clistdataeventargs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Abstract Base Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ class ListData;
+
+ /**
+ * Base IListDataEventHandler class, intended to be subclassed. Any class
+ * that needs to listen for CListData events should inherit from this class.
+ */
+
+ class IListDataEventHandler
+ {
+ public:
+ /**
+ * Handle data changes.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void handleListDataChangedEvent(const CListDataEventArgs &e) = 0;
+
+ /**
+ * Handle data changes.
+ *
+ * @param e Event arguments.
+ */
+
+ virtual void
+ handleListDataSelectionChangedEvent(const CListDataEventArgs &e) = 0;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_ILISTDATAEVENTHANDLERR_HXX
diff --git a/NxWidgets/libnxwidgets/include/inxwindow.hxx b/NxWidgets/libnxwidgets/include/inxwindow.hxx
new file mode 100644
index 000000000..0c372ee0d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/inxwindow.hxx
@@ -0,0 +1,268 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/inxwindow.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_INXWINDOW_HXX
+#define __INCLUDE_INXWINDOW_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Pure Virtual Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ struct SBitmap;
+
+ /**
+ * This class defines common operations on a any NX window.
+ * There are three instances that represent an NX window from the
+ * perspective of NXWidgets.
+ *
+ * - There is one widget control instance per NX window,
+ * - One CCallback instance per window,
+ * - One window instance.
+ *
+ * There a various kinds of of window instances, but each inherits
+ * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
+ * that describes the common window behavior.
+ */
+
+ class INxWindow
+ {
+ public:
+
+ /**
+ * Creates a new window. Window creation is separate from
+ * object instantiation so that window creation failures can
+ * be properly reported.
+ *
+ * @return True if the window was successfully created.
+ */
+
+ virtual bool open(void) = 0;
+
+ /**
+ * Request the position and size information of the window. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return OK on success; ERROR on failure with errno set appropriately.
+ */
+
+ virtual bool requestPosition(void) = 0;
+
+ /**
+ * Get the position of the window (as reported by the NX callback).
+ *
+ * @return The position.
+ */
+
+ virtual bool getPosition(FAR struct nxgl_point_s *pPos) = 0;
+
+ /**
+ * Get the size of the window (as reported by the NX callback).
+ *
+ * @return The size.
+ */
+
+ virtual bool getSize(FAR struct nxgl_size_s *pSize) = 0;
+
+ /**
+ * Set the position and size of the window.
+ *
+ * @param pPos The new position of the window.
+ * @return True on success, false on failure.
+ */
+
+ virtual bool setPosition(FAR const struct nxgl_point_s *pPos) = 0;
+
+ /**
+ * Set the size of the selected window.
+ *
+ * @param pSize The new size of the window.
+ * @return OK on success; ERROR on failure with errno set appropriately.
+ */
+
+ virtual bool setSize(FAR const struct nxgl_size_s *pSize) = 0;
+
+ /**
+ * Bring the window to the top of the display.
+ *
+ * @return OK on success; ERROR on failure with errno set appropriately.
+ */
+
+ virtual bool raise(void) = 0;
+
+ /**
+ * Lower the window to the bottom of the display.
+ *
+ * @return OK on success; ERROR on failure with errno set appropriately.
+ */
+
+ virtual bool lower(void) = 0;
+
+ /**
+ * Set an individual pixel in the window with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ virtual bool setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color) = 0;
+
+ /**
+ * Fill the specified rectangle in the window with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ virtual bool fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color) = 0;
+
+ /**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+ virtual void getRectangle(FAR const struct nxgl_rect_s *rect,
+ struct SBitmap *dest) = 0;
+
+ /**
+ * Fill the specified trapezoidal region in the window with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to window (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+ virtual bool fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color) = 0;
+
+ /**
+ * Fill the specified line in the window with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+ virtual bool drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width,
+ nxgl_mxpixel_t color) = 0;
+
+ /**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+ virtual bool drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color) = 0;
+
+ /**
+ * Move a rectangular region within the window.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+ virtual bool move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset) = 0;
+
+ /**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified window. The source image is treated as an opaque image.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in window coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+ virtual bool bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride) = 0;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_INXWINDOW_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/iscrollable.hxx b/NxWidgets/libnxwidgets/include/iscrollable.hxx
new file mode 100644
index 000000000..21a69e487
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/iscrollable.hxx
@@ -0,0 +1,208 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/iscrollable.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_ISCROLLABLE_HXX
+#define __INCLUDE_ISCROLLABLE_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Abstract class defining basic functionality of scrolling widgets.
+ * Scrolling regions are modelled as a virtual "canvas", or rectangular
+ * region, with height/width dimensions and x/y coordinates.
+ */
+
+ class IScrollable
+ {
+ public:
+ /**
+ * Gets the x coordinate of the virtual canvas.
+ *
+ * @return The x coordinate of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasX(void) const = 0;
+
+ /**
+ * Gets the y coordinate of the virtual canvas.
+ *
+ * @return The y coordinate of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasY(void) const = 0;
+
+ /**
+ * Gets the width of the virtual canvas.
+ *
+ * @return The width of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasWidth(void) const = 0;
+
+ /**
+ * Gets the height of the virtual canvas.
+ *
+ * @return The height of the virtual canvas.
+ */
+
+ virtual const int32_t getCanvasHeight(void) const = 0;
+
+ /**
+ * Scrolls the virtual canvas by the specified amounts.
+ *
+ * @param dx Distance to scroll horizontally.
+ * @param dy Distance to scroll vertically.
+ */
+
+ virtual void scroll(int32_t dx, int32_t dy) = 0;
+
+ /**
+ * Repositions the virtual canvas to the specified coordinates.
+ *
+ * @param x New x coordinate of the virtual canvas.
+ * @param y New y coordinate of the virtual canvas.
+ */
+
+ virtual void jump(int32_t x, int32_t y) = 0;
+
+ /**
+ * Returns true if vertical scrolling is allowed.
+ *
+ * @return True if vertical scrolling is allowed.
+ */
+
+ virtual bool allowsVerticalScroll(void) const = 0;
+
+ /**
+ * Returns true if horizontal scrolling is allowed.
+ *
+ * @return True if horizontal scrolling is allowed.
+ */
+
+ virtual bool allowsHorizontalScroll(void) const = 0;
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ virtual void setAllowsVerticalScroll(bool allow) = 0;
+
+ /**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+ virtual void setAllowsHorizontalScroll(bool allow) = 0;
+
+ /**
+ * Sets the width of the virtual canvas.
+ *
+ * @param width The width of the virtual canvas.
+ */
+
+ virtual void setCanvasWidth(const int32_t width) = 0;
+
+ /**
+ * Sets the height of the virtual canvas.
+ *
+ * @param height The height of the virtual canvas.
+ */
+
+ virtual void setCanvasHeight(const int32_t height) = 0;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_ISCROLLABLE_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/islider.hxx b/NxWidgets/libnxwidgets/include/islider.hxx
new file mode 100644
index 000000000..5ea821e42
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/islider.hxx
@@ -0,0 +1,188 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/islider.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_ISLIDER_HXX
+#define __INCLUDE_ISLIDER_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Abstract Base Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Defines the interface for slider widgets.
+ */
+ class ISlider
+ {
+ public:
+
+ /**
+ * Get the smallest value that the slider can represent.
+ *
+ * @return The smallest value.
+ */
+
+ virtual const nxgl_coord_t getMinimumValue(void) const = 0;
+
+ /**
+ * Get the largest value that the slider can represent.
+ *
+ * @return The largest value.
+ */
+
+ virtual const nxgl_coord_t getMaximumValue(void) const = 0;
+
+ /**
+ * Get the current value of the slider.
+ *
+ * return The current slider value.
+ */
+
+ virtual const nxgl_coord_t getValue(void) const = 0;
+
+ /**
+ * Get the value represented by the height of the grip.
+ * For sliders, this would typically be 1 (so each new
+ * grip position is worth 1). For scrollbars, this
+ * would be the height of the scrolling widget.
+ *
+ * @return The page size.
+ */
+
+ virtual const nxgl_coord_t getPageSize(void) const = 0;
+
+ /**
+ * Set the smallest value that the slider can represent.
+ *
+ * @param value The smallest value.
+ */
+
+ virtual void setMinimumValue(const nxgl_coord_t value) = 0;
+
+ /**
+ * Set the largest value that the slider can represent.
+ *
+ * @param value The largest value.
+ */
+
+ virtual void setMaximumValue(const nxgl_coord_t value) = 0;
+
+ /**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+ virtual void setValue(const nxgl_coord_t value) = 0;
+
+ /**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+ virtual void setValueWithBitshift(const int32_t value) = 0;
+
+ /**
+ * Set the page size represented by the grip.
+ *
+ * @param pageSize The page size.
+ * @see getPageSize().
+ */
+
+ virtual void setPageSize(const nxgl_coord_t pageSize) = 0;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_ISLIDER_HXX
+
diff --git a/NxWidgets/libnxwidgets/include/itextbox.hxx b/NxWidgets/libnxwidgets/include/itextbox.hxx
new file mode 100644
index 000000000..78de7e502
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/itextbox.hxx
@@ -0,0 +1,209 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/itextbox.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_ITEXTBOX_HXX
+#define __INCLUDE_ITEXTBOX_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cnxstring.hxx"
+#include "cwidgetstyle.hxx"
+#include "cwidgeteventargs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Abstract Base Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Cursor display options.
+ */
+
+ typedef enum
+ {
+ SHOW_CURSOR_ONFOCUS = 0, /**< Show the cursor only if the widget has focus */
+ SHOW_CURSOR_NEVER, /**< The cursor is never displayed */
+ SHOW_CURSOR_ALWAYS /**< Always show the cursor */
+ } EShowCursor;
+
+ /**
+ * Defines the interface that textbox-like classes should implement.
+ */
+
+ class ITextBox
+ {
+ public:
+
+ /**
+ * Sets the cursor display mode.
+ *
+ *@param cursorMode Determines cursor display mode
+ */
+
+ virtual void showCursor(EShowCursor cursorMode) = 0;
+
+ /**
+ * Enables/disables cursor wrapping
+ *
+ * @param wrap True enables cursor wrapping
+ */
+
+ virtual void wrapCursor(bool wrap) = 0;
+
+ /**
+ * Set the text displayed in the label.
+ *
+ * @param text String to display.
+ */
+
+ virtual void setText(const CNxString &text) = 0;
+
+ /**
+ * Append new text to the end of the current text displayed in the
+ * label.
+ *
+ * @param text String to append.
+ */
+
+ virtual void appendText(const CNxString &text) = 0;
+
+ /**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+ virtual void removeText(const unsigned int startIndex) = 0;
+
+ /**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+ virtual void removeText(const unsigned int startIndex, const unsigned int count) = 0;
+
+ /**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+ virtual void insertText(const CNxString &text, const unsigned int index) = 0;
+
+ /**
+ * Insert text at the current cursor position.
+ *
+ * @param text The text to insert.
+ */
+
+ virtual void insertTextAtCursor(const CNxString &text) = 0;
+
+ /**
+ * Move the cursor to the text position specified. 0 indicates the
+ * start of the string. If position is greater than the length of the
+ * string, the cursor is moved to the end of the string.
+ *
+ * @param position The new cursor position.
+ */
+
+ virtual void moveCursorToPosition(const int position) = 0;
+
+ /**
+ * Get the cursor position. This is the index within the string that
+ * the cursor is currently positioned over.
+ * @return position The cursor position.
+ */
+
+ virtual const int getCursorPosition(void) const = 0;
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_ITEXTBOX_HXX
diff --git a/NxWidgets/libnxwidgets/include/nxconfig.hxx b/NxWidgets/libnxwidgets/include/nxconfig.hxx
new file mode 100644
index 000000000..2f38c7c26
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/nxconfig.hxx
@@ -0,0 +1,444 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/nxconfig.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NXCONFIG_HXX
+#define __INCLUDE_NXCONFIG_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/rgbcolors.h>
+#include <nuttx/nx/nxfonts.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* NX Configuration *********************************************************/
+
+/**
+ * Required to enabled NX graphics support
+ */
+
+#ifndef CONFIG_NX
+# error "NX mouse/touchscreen support is required (CONFIG_NX_MOUSE)"
+#endif
+
+/**
+ * Required to enabled NX mouse/touchscreen support
+ */
+
+#ifndef CONFIG_NX_MOUSE
+# warning "NX mouse/touchscreen support is required (CONFIG_NX_MOUSE)"
+#endif
+
+/**
+ * Required to enabled NX keyboard support
+ */
+
+#ifndef CONFIG_NX_KBD
+# warning "NX keyboard support is required (CONFIG_NX_KBD)"
+#endif
+
+/**
+ * Only a single video plane is supported
+ */
+
+#ifndef CONFIG_NX_NPLANES
+# define CONFIG_NX_NPLANES 1
+#endif
+
+#if CONFIG_NX_NPLANES != 1
+# error "Only a single color plane is supported (CONFIG_NX_NPLANES)"
+#endif
+
+/* NX Server/Device Configuration *******************************************/
+
+/**
+ * LCD device number (in case there are more than one LCDs connected)
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEVNO
+# define CONFIG_NXWIDGETS_DEVNO 0
+#endif
+
+/**
+ * Only a single video plane is supported
+ */
+
+#ifndef CONFIG_NXWIDGETS_VPLANE
+# define CONFIG_NXWIDGETS_VPLANE 0
+#endif
+
+/**
+ * Priority of the NX server (in multi-user mode)
+ */
+
+#ifndef CONFIG_NXWIDGETS_SERVERPRIO
+# define CONFIG_NXWIDGETS_SERVERPRIO 50
+#endif
+
+/**
+ * Priority of the NX event listener thread (in multi-user mode)
+ */
+
+#ifndef CONFIG_NXWIDGETS_LISTENERPRIO
+# define CONFIG_NXWIDGETS_LISTENERPRIO 50
+#endif
+
+/**
+ * NX server/listener thread stack size (in multi-user mode)
+ */
+
+#ifndef CONFIG_NXWIDGETS_STACKSIZE
+# define CONFIG_NXWIDGETS_STACKSIZE 4096
+#endif
+
+/* NXWidget Configuration ***************************************************/
+/* NX Server/Device Configuration
+ *
+ * CONFIG_NXWIDGETS_DEVNO - LCD device number (in case there are more than
+ * one LCDs connected. Default: 0
+ * CONFIG_NXWIDGETS_VPLANE - Only a single video plane is supported. Default: 0
+ * CONFIG_NXWIDGETS_SERVERPRIO - Priority of the NX server (in multi-user mode).
+ * Default: 50
+ * CONFIG_NXWIDGETS_SERVERPRIO
+ * CONFIG_NXWIDGETS_LISTENERPRIO - Priority of the NX event listener thread (in
+ * multi-user mode). Default: 50
+ * CONFIG_NXWIDGETS_STACKSIZE - Priority of the NX server/listener thread
+ * stack size (in multi-user mode). Default: 4096
+ *
+ * NXWidget Configuration
+ *
+ * CONFIG_NXWIDGETS_BPP - Supported bits-per-pixel {8, 16, 24, 32}. Default:
+ * The smallest BPP configuration supported by NX.
+ * CONFIG_NXWIDGETS_SIZEOFCHAR - Size of character {1 or 2 bytes}. Default
+ * Determined by CONFIG_NXWIDGETS_SIZEOFCHAR
+ *
+ * NXWidget Default Values
+ *
+ * CONFIG_NXWIDGETS_DEFAULT_FONTID - Default font ID. Default: NXFONT_DEFAULT
+ * CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE, CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT -
+ * Default dynamic array parameters. Default: 16, 8
+ *
+ * CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
+ * MKRGB(160,160,160)
+ * CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR - Default selected background
+ * color. Default: MKRGB(120,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR - Shiny side boarder color. Default
+ * MKRGB(248,248,248)
+ * CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR - Shadowed side border color.
+ * Default: MKRGB(0,0,0)
+ * CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR - Highlight color. Default:
+ * MKRGB(192,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a disabled widget:
+ * Default: MKRGB(192,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR - Text color on a enabled widget:
+ * Default: MKRGB(248,248,248)
+ * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a selected widget:
+ * Default: MKRGB(0,0,0)
+ * CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR - Default font color: Default:
+ * MKRGB(255,255,255)
+ * CONFIG_NXWIDGETS_TRANSPARENT_COLOR - Transparent color: Default: MKRGB(0,0,0)
+ *
+ * Keypad behavior
+ *
+ * CONFIG_NXWIDGETS_FIRST_REPEAT_TIME - Time taken before a key starts
+ * repeating (in milliseconds). Default: 500
+ * CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME - Time taken before a repeating key
+ * repeats again (in milliseconds). Default: 200
+ * CONFIG_NXWIDGETS_DOUBLECLICK_TIME - Left button release-press time for
+ * double click (in milliseconds). Default: 350
+ * CONFIG_NXWIDGETS_KBDBUFFER_SIZE - Size of incoming character buffer, i.e.,
+ * the maximum number of characters that can be entered between NX polling
+ * cycles without losing data.
+ * CONFIG_NXWIDGETS_CURSORCONTROL_SIZE - Size of incoming cursor control
+ * buffer, i.e., the maximum number of cursor controls that can between
+ * entered by NX polling cycles without losing data. Default: 4
+ */
+
+/**
+ * Bits per pixel
+ */
+
+#ifndef CONFIG_NXWIDGETS_BPP
+# if !defined(CONFIG_NX_DISABLE_8BPP)
+# warning "Assuming 8-bits per pixel, RGB 3:3:2"
+# define CONFIG_NXWIDGETS_BPP 8
+# elif !defined(CONFIG_NX_DISABLE_16BPP)
+# warning "Assuming 16-bits per pixel, RGB 5:6:5"
+# define CONFIG_NXWIDGETS_BPP 16
+# elif !defined(CONFIG_NX_DISABLE_24BPP)
+# warning "Assuming 24-bits per pixel, RGB 8:8:8"
+# define CONFIG_NXWIDGETS_BPP 24
+# elif !defined(CONFIG_NX_DISABLE_32BPP)
+# warning "Assuming 32-bits per pixel, RGB 8:8:8"
+# define CONFIG_NXWIDGETS_BPP 32
+# else
+# error "No supported pixel depth is enabled"
+# endif
+#endif
+
+#if CONFIG_NXWIDGETS_BPP == 8
+# ifdef CONFIG_NX_DISABLE_8BPP
+# error "NX 8-bit support is disabled (CONFIG_NX_DISABLE_8BPP)"
+# endif
+# define CONFIG_NXWIDGETS_FMT FB_FMT_RGB8_332
+# define MKRGB RGBTO8
+# define RGB2RED RBG8RED
+# define RGB2GREEN RBG8GREEN
+# define RGB2BLUE RBG8BLUE
+# define FONT_RENDERER nxf_convert_8bpp
+#elif CONFIG_NXWIDGETS_BPP == 16
+# ifdef CONFIG_NX_DISABLE_16BPP
+# error "NX 16-bit support is disabled (CONFIG_NX_DISABLE_16BPP)"
+# endif
+# define CONFIG_NXWIDGETS_FMT FB_FMT_RGB16_565
+# define MKRGB RGBTO16
+# define RGB2RED RBG16RED
+# define RGB2GREEN RBG16GREEN
+# define RGB2BLUE RBG16BLUE
+# define FONT_RENDERER nxf_convert_16bpp
+#elif CONFIG_NXWIDGETS_BPP == 24
+# ifdef CONFIG_NX_DISABLE_24BPP
+# error "NX 24-bit support is disabled (CONFIG_NX_DISABLE_24BPP)"
+# endif
+# define CONFIG_NXWIDGETS_FMT FB_FMT_RGB24
+# define MKRGB RGBTO24
+# define RGB2RED RBG24RED
+# define RGB2GREEN RBG24GREEN
+# define RGB2BLUE RBG24BLUE
+# define FONT_RENDERER nxf_convert_24bpp
+#elif CONFIG_NXWIDGETS_BPP == 32
+# ifdef CONFIG_NX_DISABLE_32BPP
+# error "NX 32-bit support is disabled (CONFIG_NX_DISABLE_32BPP)"
+# endif
+# define CONFIG_NXWIDGETS_FMT FB_FMT_RGB32
+# define MKRGB RGBTO24
+# define RGB2RED RBG24RED
+# define RGB2GREEN RBG24GREEN
+# define RGB2BLUE RBG24BLUE
+# define FONT_RENDERER nxf_convert_32bpp
+#else
+# error "Pixel depth not supported (CONFIG_NXWIDGETS_BPP)"
+#endif
+
+/* Size of a character */
+
+#ifndef CONFIG_NXWIDGETS_SIZEOFCHAR
+# if CONFIG_NXFONTS_CHARBITS <= 8
+# define CONFIG_NXWIDGETS_SIZEOFCHAR 1
+# else
+# define CONFIG_NXWIDGETS_SIZEOFCHAR 2
+# endif
+#endif
+
+#if CONFIG_NXWIDGETS_SIZEOFCHAR != 1 && CONFIG_NXWIDGETS_SIZEOFCHAR != 2
+# error "Unsupported character width (CONFIG_NXWIDGETS_SIZEOFCHAR)"
+#endif
+
+/* NXWidget Default Values **************************************************/
+
+/**
+ * Default font ID
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_FONTID
+# define CONFIG_NXWIDGETS_DEFAULT_FONTID NXFONT_DEFAULT
+#endif
+
+/**
+ * Default dynamic array parameters
+ */
+
+#ifndef CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE
+# define CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE 16
+#endif
+
+#ifndef CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT
+# define CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT 8
+#endif
+
+/**
+ * Normal background color
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR MKRGB(160,160,160)
+#endif
+
+/**
+ * Default selected background color
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(120,192,192)
+#endif
+
+/**
+ * Shiny side border color
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR MKRGB(248,248,248)
+#endif
+
+/**
+ * Shadowed side border color
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR MKRGB(0,0,0)
+#endif
+
+/**
+ * Highlight color
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR MKRGB(192,192,192)
+#endif
+
+/* Text colors */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR MKRGB(192,192,192)
+#endif
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR MKRGB(248,248,248)
+#endif
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_SELECTEDTEXTCOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_SELECTEDTEXTCOLOR MKRGB(0,0,0)
+#endif
+
+/**
+ * Default font color
+ */
+
+#ifndef CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
+# define CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR MKRGB(255,255,255)
+#endif
+
+/**
+ * Transparent color
+ */
+
+#ifndef CONFIG_NXWIDGETS_TRANSPARENT_COLOR
+# define CONFIG_NXWIDGETS_TRANSPARENT_COLOR MKRGB(0,0,0)
+#endif
+
+/* Keypad behavior **********************************************************/
+
+/**
+ * Time taken before a key starts repeating (in milliseconds).
+ */
+
+#ifndef CONFIG_NXWIDGETS_FIRST_REPEAT_TIME
+# define CONFIG_NXWIDGETS_FIRST_REPEAT_TIME 500
+#endif
+
+/**
+ * Time taken before a repeating key repeats again (in milliseconds).
+ */
+
+#ifndef CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME
+# define CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME 200
+#endif
+
+/**
+ * Left button release-press time for double click (in milliseconds).
+ */
+
+#ifndef CONFIG_NXWIDGETS_DOUBLECLICK_TIME
+# define CONFIG_NXWIDGETS_DOUBLECLICK_TIME 350
+#endif
+
+/**
+ * Size of incoming character buffer, i.e., the maximum number of characters
+ * that can be entered between NX polling cycles without losing data.
+ */
+
+#ifndef CONFIG_NXWIDGETS_KBDBUFFER_SIZE
+# define CONFIG_NXWIDGETS_KBDBUFFER_SIZE 8
+#endif
+
+/**
+ * Size of incoming cursor control buffer, i.e., the maximum number of cursor
+ * controls that can between entered by NX polling cycles without losing data.
+ */
+
+#ifndef CONFIG_NXWIDGETS_CURSORCONTROL_SIZE
+# define CONFIG_NXWIDGETS_CURSORCONTROL_SIZE 4
+#endif
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+namespace NXWidgets
+{
+#if CONFIG_NXWIDGETS_BPP == 8
+ typedef uint8_t nxwidget_pixel_t;
+#elif CONFIG_NXWIDGETS_BPP == 16
+ typedef uint16_t nxwidget_pixel_t;
+#elif CONFIG_NXWIDGETS_BPP == 24
+ typedef uint32_t nxwidget_pixel_t;
+#elif CONFIG_NXWIDGETS_BPP == 32
+ typedef uint32_t nxwidget_pixel_t;
+#else
+# error "Pixel depth is unknown"
+#endif
+
+#if CONFIG_NXWIDGETS_SIZEOFCHAR == 2
+ typedef uint16_t nxwidget_char_t;
+#elif CONFIG_NXWIDGETS_SIZEOFCHAR == 1
+ typedef uint8_t nxwidget_char_t;
+#else
+# error "Character width is unknown"
+#endif
+}
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#endif // __INCLUDE_NXCONFIG_HXX
diff --git a/NxWidgets/libnxwidgets/include/singletons.hxx b/NxWidgets/libnxwidgets/include/singletons.hxx
new file mode 100644
index 000000000..094808939
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/singletons.hxx
@@ -0,0 +1,136 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/singletons.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_SINGLETONS_HXX
+#define __INCLUDE_SINGLETONS_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <cnxtimer.hxx>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Forward References
+ */
+
+ class CWidgetStyle;
+ class CNxString;
+
+ /**
+ * Global singleton instances
+ */
+
+ extern CWidgetStyle *g_defaultWidgetStyle; /**< The default widget style */
+ extern CNxString *g_nullString; /**< The reusable empty string */
+ extern TNxArray<CNxTimer*> *g_nxTimers; /**< An array of all timers */
+
+ /**
+ * Setup misc singleton instances.
+ *
+ * Q: Why is there here?
+ * A: Because it needs to be done one time before any widgets are created.
+ * Q: So why isn't it just the default style just a statically constructed class?
+ * A: Because not all platforms will support static class constructions.
+ * Q: Why isn't it part of CNxServer?
+ * A: Because the singletons may be needed before the server is started.
+ */
+
+ void instantiateSingletons(void);
+
+ /**
+ * Free the singleton instances when the last NX server is destroyed.
+ *
+ * Q: Why is there here is it is only called as part of the CNxServer destructor?
+ * A: Just for symmetry with instantiateSingletons().
+ */
+
+ void freeSingletons(void);
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_SINGLETONS_HXX
diff --git a/NxWidgets/libnxwidgets/include/teventargs.hxx b/NxWidgets/libnxwidgets/include/teventargs.hxx
new file mode 100644
index 000000000..c1371be92
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/teventargs.hxx
@@ -0,0 +1,136 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/teventargs.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_TEVENTARGS_HXX
+#define __INCLUDE_TEVENTARGS_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NXWidgets
+{
+ /**
+ * Base template class for all events within the NxWidgets system.
+ * All event types should inherit from this class.
+ */
+
+ template <class T>
+ class TEventArgs
+ {
+ private:
+ T m_source; /**< The object that raised the event */
+
+ public:
+
+ /**
+ * Constructor.
+ * @param source The object that raised the event.
+ */
+
+ inline TEventArgs(const T& source)
+ {
+ m_source = source;
+ }
+
+ /**
+ * Destructor.
+ */
+
+ virtual inline ~TEventArgs() { }
+
+ /**
+ * Get the source object that raised the event.
+ */
+
+ inline const T& getSource(void) const
+ {
+ return m_source;
+ }
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_TEVENTARGS_HXX
diff --git a/NxWidgets/libnxwidgets/include/tnxarray.hxx b/NxWidgets/libnxwidgets/include/tnxarray.hxx
new file mode 100644
index 000000000..44cb537ad
--- /dev/null
+++ b/NxWidgets/libnxwidgets/include/tnxarray.hxx
@@ -0,0 +1,437 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/tnxarray.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_TNXARRAY_HXX
+#define __INCLUDE_TNXARRAY_HXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "nxconfig.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+/**
+ * Class providing a dynamic array; that is, an array that will automatically
+ * grow to accommodate new data. It provides a fast way to randomly access
+ * a list of data. Essentially, it provides the most important functionality
+ * of the STL vector class without any of the overhead of including an STL
+ * class.
+ *
+ * If the data to be stored will store a lot of data that will predominantly
+ * be read sequentially, consider using the LinkedList class instead. Resizing
+ * the list is an expensive operation that will occur frequently when filling
+ * the array with large amounts of data. Adding new data to the linked list is
+ * very inexpensive.
+ */
+
+template <class T>
+class TNxArray
+{
+private:
+ T *m_data; /**< Internal array of data items */
+ int m_size; /**< Number of items in the array */
+ int m_reservedSize; /**< Total size of the array including unpopulated slots */
+
+ /**
+ * Re-allocate the array to this size;
+ */
+
+ void reallocate(const int newSize);
+
+ /**
+ * Resize the array if it is full.
+ */
+
+ void resize(void);
+
+public:
+
+ /**
+ * Constructor. Creates an un-allocated array. The array will
+ * be allocated when items are added to it or when preallocate()
+ * is called.
+ */
+
+ inline TNxArray();
+
+ /**
+ * Constructor. Creates an allocated array.
+ *
+ *@param initialSize The initial size of the array.
+ */
+
+ inline TNxArray(int initialSize);
+
+ /**
+ * Destructor.
+ */
+
+ inline ~TNxArray();
+
+ /**
+ * Set the initial size of the array. Normally, the array is
+ * unallocated until the first data is pushed into the array.
+ * That works great for stacks and lists. But if you want a
+ * array of unitialized elements, then this method will
+ * preallocate the array for you.
+ *
+ * @return The size of the array.
+ */
+
+ void preallocate(void);
+
+ /**
+ * Get the size of the array.
+ *
+ * @return The size of the array.
+ */
+
+ inline const int size(void) const;
+
+ /**
+ * Add a value to the end of the array.
+ *
+ * @param value The value to add to the array.
+ */
+
+ void push_back(const T &value);
+
+ /**
+ * Insert a value into the array.
+ *
+ * @param index The index to insert into.
+ * @param value The value to insert.
+ */
+
+ void insert(const int index, const T &value);
+
+ /**
+ * Remove the last element from the array.
+ */
+
+ void pop_back(void);
+
+ /**
+ * Erase a single value at the specified index
+ */
+
+ void erase(const int index);
+
+ /**
+ * Get a value at the specified location. Does not perform bounds checking.
+ * @param index The index of the desired value.
+ * @return The value at the specified index.
+ */
+
+ inline T &at(const int index) const;
+
+ /**
+ * Check if the array has any data.
+ * @return True if the array is empty.
+ */
+
+ inline bool empty(void) const;
+
+ /**
+ * Remove all data.
+ */
+
+ void clear();
+
+ /**
+ * Overload the [] operator to allow array-style access.
+ * @param index The index to retrieve.
+ * @return The value at the specified index.
+ */
+
+ T& operator[](const int index) const;
+};
+
+template <class T>
+TNxArray<T>::TNxArray()
+{
+ // Don't allocate anything until the first data is added to
+ // the array
+
+ m_size = 0; // Number of data items in use
+ m_reservedSize = 0; // Number of data items allocated
+ m_data = (T *)0; // Allocated memory for data items
+}
+
+template <class T>
+TNxArray<T>::TNxArray(int initialSize)
+{
+ m_size = 0; // Number of data items in use
+ m_reservedSize = 0; // Number of data items allocated
+ m_data = (T *)0; // Allocated memory for data items
+ preallocate(initialSize); // Allocate the initial array
+}
+
+template <class T>
+TNxArray<T>::~TNxArray()
+{
+ if (m_data)
+ {
+ delete [] m_data;
+ }
+}
+
+template <class T>
+const int TNxArray<T>::size(void) const
+{
+ return m_size;
+}
+
+template <class T>
+void TNxArray<T>::push_back(const T &value)
+{
+ // Ensure the array is large enough to hold one more data item
+
+ resize();
+
+ // Add data to array
+
+ m_data[m_size] = value;
+
+ // Remember we've filled a slot
+
+ m_size++;
+}
+
+template <class T>
+void TNxArray<T>::pop_back(void)
+{
+ if (m_size >= 1)
+ {
+ // We can just reduce the used size of the array, as the value
+ // will get overwritten automatically
+
+ m_size--;
+ }
+}
+
+template <class T>
+void TNxArray<T>::insert(const int index, const T &value)
+{
+ // Bounds check
+
+ if ((index >= m_size) || (m_size == 0))
+ {
+ push_back(value);
+ return;
+ }
+
+ // Ensure the array is large enough to hold one more data item
+
+ resize();
+
+ // Shift all of the data back one place to make a space for the new data
+
+ for (int i = m_size; i > index; i--)
+ {
+ m_data[i] = m_data[i - 1];
+ }
+
+ // Add data to array
+
+ m_data[index] = value;
+
+ // Remember we've filled a slot
+
+ m_size++;
+}
+
+template <class T>
+void TNxArray<T>::erase(const int index)
+{
+ // Bounds check
+
+ if (index >= m_size)
+ {
+ return;
+ }
+
+ // Shift all of the data back one place and overwrite the value
+
+ for (int i = index; i < m_size - 1; i++)
+ {
+ m_data[i] = m_data[i + 1];
+ }
+
+ // Remember we've removed a slot
+
+ m_size--;
+}
+
+template <class T>
+void TNxArray<T>::reallocate(const int newSize)
+{
+ // Do we need to redim the array?
+
+ if (m_reservedSize < newSize)
+ {
+ // Create the new array
+
+ T *newData = new T[newSize];
+
+ // Copy old array contents to new the new array
+
+ for (int i = 0; i < m_reservedSize; i++)
+ {
+ newData[i] = m_data[i];
+ }
+
+ // Delete the old array (if there was one)
+
+ if (m_data)
+ {
+ delete [] m_data;
+ }
+
+ // Update values
+
+ m_data = newData;
+ m_reservedSize = newSize;
+ }
+}
+
+template <class T>
+void TNxArray<T>::resize(void)
+{
+ // Do we need to redim the array in order to add one more entry?
+
+ if (m_reservedSize == m_size)
+ {
+ // We have filled the array, so resize it
+
+ int newSize = m_reservedSize;
+#if CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE != CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT
+ newSize += m_reservedSize ?
+ CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT :
+ CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE;
+#else
+ newSize += CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT;
+#endif
+
+ // Re-allocate the array
+
+ reallocate(newSize);
+ }
+}
+
+template <class T>
+T& TNxArray<T>::at(const int index) const
+{
+ // What if this is called with index > m_reservedSize? What if
+ // this is called before m_data is allocated? Don't do that!
+
+ return m_data[index];
+}
+
+template <class T>
+bool TNxArray<T>::empty() const
+{
+ return (m_size == 0);
+}
+
+template <class T>
+T& TNxArray<T>::operator[](const int index) const
+{
+ // What if this is called with index > m_reservedSize? What if
+ // this is called before m_data is allocated? Don't do that!
+
+ return m_data[index];
+}
+
+template <class T>
+void TNxArray<T>::clear()
+{
+ // All we need to do is reset the size value
+
+ m_size = 0;
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_TNXARRAY_HXX
diff --git a/NxWidgets/libnxwidgets/src/cbgwindow.cxx b/NxWidgets/libnxwidgets/src/cbgwindow.cxx
new file mode 100644
index 000000000..08ae584b8
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cbgwindow.cxx
@@ -0,0 +1,364 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cbgwindow.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cbgwindow.hxx"
+#include "cbitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor. Obtains the background window from server and wraps
+ * the window as CBgWindow.
+ *
+ * @param hNxServer Handle to the NX server.
+ * @param widgetControl Controlling widget for this window.
+ */
+
+CBgWindow::CBgWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl)
+ : CCallback(pWidgetControl), m_hNxServer(hNxServer), m_hWindow(0),
+ m_widgetControl(pWidgetControl)
+{
+ // Create the CGraphicsPort instance for this window
+
+ m_widgetControl->createGraphicsPort(static_cast<INxWindow*>(this));
+}
+
+/**
+ * Destructor. Returns the background window to the server.
+ */
+
+CBgWindow::~CBgWindow(void)
+{
+ // Release the background. We do not release the widget control
+ // instance. The lifetime of that instance is owned by he-who-
+ // constructed-us.
+
+ (void)nx_releasebkgd(m_hWindow);
+}
+
+/**
+ * Creates a new window. Window creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the window was successfully opened.
+ */
+
+bool CBgWindow::open(void)
+{
+ // Get the C-callable callback vtable
+
+ FAR struct nx_callback_s *vtable = getCallbackVTable();
+
+ // Request the background the window
+
+ int ret = nx_requestbkgd(m_hNxServer, vtable, (FAR void *)m_widgetControl);
+ if (ret < 0)
+ {
+ return false;
+ }
+
+ // Window handle (picked off by the callback logic)
+
+ m_hWindow = m_widgetControl->getWindowHandle();
+ return true;
+}
+
+/**
+ * Request the position and size information of the window. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return Always returns true.
+ */
+
+bool CBgWindow::requestPosition(void)
+{
+ // The background window is always at {0,0} and the size never changes.
+
+ return true;
+}
+
+/**
+ * Get the position of the window (as reported by the NX callback). NOTE:
+ * The background window is always positioned at {0,0}
+ *
+ * @return The position.
+ */
+
+bool CBgWindow::getPosition(FAR struct nxgl_point_s *pPos)
+{
+ // The background window is always at {0,0}
+
+ pPos->x = 0;
+ pPos->y = 0;
+ return true;
+}
+
+/**
+ * Get the size of the window (as reported by the NX callback). NOTE:
+ * The size of the background window is always the entire display.
+ *
+ * @return The size.
+ */
+
+bool CBgWindow::getSize(FAR struct nxgl_size_s *pSize)
+{
+ // The size is always the full size of the display
+
+ return m_widgetControl->getWindowSize(pSize);
+}
+
+/**
+ * Set the position and size of the window.
+ *
+ * @param pPos The new position of the window.
+ * @return Always returns false.
+ */
+
+bool CBgWindow::setPosition(FAR const struct nxgl_point_s *pPos)
+{
+ // The position of the background cannot be changed
+
+ return false;
+}
+
+/**
+ * Set the size of the selected window. NOTE: The size of the
+ * background window is always the entire display and cannot be
+ * changed.
+ *
+ * @param pSize The new size of the window.
+ * @return Always returns false.
+ */
+
+bool CBgWindow::setSize(FAR const struct nxgl_size_s *pSize)
+{
+ // The position of the background cannot be changed
+
+ return false;
+}
+
+/**
+ * Bring the window to the top of the display. NOTE: The background
+ * window cannot be raised.
+ *
+ * @return Always returns false.
+ */
+
+bool CBgWindow::raise(void)
+{
+ // The background cannot be raised
+
+ return false;
+}
+
+/**
+ * Lower the window to the bottom of the display. NOTE: The background
+ * window is always at the bottom of the window hierarchy.
+ *
+ * @return Always returns false.
+ */
+
+bool CBgWindow::lower(void)
+{
+ // The background cannot be lowered
+
+ return false;
+}
+
+/**
+ * Set an individual pixel in the window with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CBgWindow::setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color)
+{
+ // Set an individual pixel to the specified color
+
+ return nx_setpixel(m_hWindow, pPos, &color) == OK;
+}
+
+/**
+ * Fill the specified rectangle in the window with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CBgWindow::fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color)
+{
+ // Fill a rectangular region with a solid color
+
+ return nx_fill(m_hWindow, pRect, &color) == OK;
+}
+
+/**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+void CBgWindow::getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest)
+{
+ // Get a rectangule region from the window
+
+ (void)nx_getrectangle(m_hWindow, rect, 0, (FAR uint8_t*)dest->data, dest->stride);
+}
+
+/**
+ * Fill the specified trapezoidal region in the window with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to window (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CBgWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color)
+{
+ // Fill a trapezoidal region with a solid color
+
+ return nx_filltrapezoid(m_hWindow, pClip, pTrap, &color) == OK;
+}
+
+/**
+ * Fill the specified line in the window with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CBgWindow::drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width, nxgl_mxpixel_t color)
+{
+ // Draw a line with the specified color
+
+ return nx_drawline(m_hWindow, vector, width, &color) == OK;
+}
+
+/**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+bool CBgWindow::drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color)
+{
+ return nx_fillcircle(m_hWindow, center, radius, &color) == OK;
+}
+
+/**
+ * Move a rectangular region within the window.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CBgWindow::move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset)
+{
+ // Move a rectangular region of the display
+
+ return nx_move(m_hWindow, pRect, pOffset) == OK;
+}
+
+/**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified window. The source image is treated as an opaque image.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in window coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CBgWindow::bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride)
+{
+ // Copy a rectangular bitmap image in a region on the display
+
+ return nx_bitmap(m_hWindow, pDest, &pSrc, pOrigin, stride) == OK;
+}
diff --git a/NxWidgets/libnxwidgets/src/cbitmap.cxx b/NxWidgets/libnxwidgets/src/cbitmap.cxx
new file mode 100644
index 000000000..875e6daaa
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cbitmap.cxx
@@ -0,0 +1,197 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cbitmap.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <cstring>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param bitmap The bitmap structure being wrapped.
+ */
+
+CBitmap::CBitmap(const struct SBitmap *bitmap) : m_bitmap(bitmap) {}
+
+/**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's width.
+ */
+
+const uint8_t CBitmap::getColorFormat(void) const
+{
+ return m_bitmap->fmt;
+}
+
+/**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's color format.
+ */
+
+const uint8_t CBitmap::getBitsPerPixel(void) const
+{
+ return m_bitmap->bpp;
+}
+
+/**
+ * Get the bitmap's width (in pixels/columns).
+ *
+ * @return The bitmap's pixel depth.
+ */
+
+const nxgl_coord_t CBitmap::getWidth(void) const
+{
+ return m_bitmap->width;
+}
+
+/**
+ * Get the bitmap's height (in rows).
+ *
+ * @return The bitmap's height.
+ */
+
+const nxgl_coord_t CBitmap::getHeight(void) const
+{
+ return m_bitmap->height;
+}
+
+/**
+ * Get the bitmap's width (in bytes).
+ *
+ * @return The bitmap's width.
+ */
+
+const nxgl_coord_t CBitmap::getStride(void) const
+{
+ return m_bitmap->stride;
+}
+
+/**
+ * Get one row from the bit map image.
+ *
+ * @param x The offset into the row to get
+ * @param y The row number to get
+ * @param width The number of pixels to get from the row
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ * @param True if the run was returned successfully.
+ */
+
+bool CBitmap::getRun(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ FAR void *data)
+{
+ // Check ranges. Casts to unsigned int are ugly but permit one-sided comparisons
+
+ if (((unsigned int)x < (unsigned int)width) &&
+ ((unsigned int)(x + width) <= (unsigned int)m_bitmap->width) &&
+ ((unsigned int)y < (unsigned int)m_bitmap->height))
+ {
+ // Get starting position of the copy (this will only work if bpp
+ // is an even multiple of bytes).
+
+ FAR uint8_t *start = (FAR uint8_t*)m_bitmap->data +
+ y * m_bitmap->stride +
+ ((x * m_bitmap->bpp) >> 3);
+
+ // Get the number of bytes to copy.
+
+ unsigned int length = (width * m_bitmap->bpp) >> 3;
+
+ // And do the copy
+
+ memcpy(data, start, length);
+ return true;
+ }
+
+ return false;
+}
diff --git a/NxWidgets/libnxwidgets/src/cbutton.cxx b/NxWidgets/libnxwidgets/src/cbutton.cxx
new file mode 100644
index 000000000..66ad3f2c7
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cbutton.cxx
@@ -0,0 +1,300 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cbutton.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbutton.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param text The text for the button to display.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the values stored in the global
+ * g_defaultWidgetStyle object. The button will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CButton::CButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ nxgl_coord_t height, const CNxString &text, CWidgetStyle *style)
+: CLabel(pWidgetControl, x, y, width, height, text, style)
+{
+}
+
+/**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ */
+
+void CButton::drawOutline(CGraphicsPort *port)
+{
+ drawOutline(port, isClicked());
+}
+
+/**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ * @param useClicked Present outline using the 'clicked' style
+ */
+
+void CButton::drawOutline(CGraphicsPort *port, bool useClicked)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (isBorderless())
+ {
+ return;
+ }
+
+ // Work out which colors to use
+
+ nxgl_coord_t color1;
+ nxgl_coord_t color2;
+
+ if (useClicked)
+ {
+ // Bevelled into the screen
+
+ color1 = getShadowEdgeColor();
+ color2 = getShineEdgeColor();
+ }
+ else
+ {
+ // Bevelled out of the screen
+
+ color1 = getShineEdgeColor();
+ color2 = getShadowEdgeColor();
+ }
+
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(), color1, color2);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CButton::drawContents(CGraphicsPort *port)
+{
+ drawContents(port, isClicked());
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param useClicked Present contents using the 'clicked' style
+ * @see redraw()
+ */
+
+void CButton::drawContents(CGraphicsPort *port, bool useClicked)
+
+{
+ // Get the draw region (excluding any borders)
+
+ CRect rect;
+ getRect(rect);
+
+ // Get the X/Y position of the text within the button
+
+ struct nxgl_point_s pos;
+ pos.x = rect.getX() + m_align.x;
+ pos.y = rect.getY() + m_align.y;
+
+ // Pick the text color
+
+ nxgl_mxpixel_t textColor;
+ if (!isEnabled())
+ {
+ textColor = getDisabledTextColor();
+ }
+ else if (useClicked)
+ {
+ textColor = getSelectedTextColor();
+ }
+ else
+ {
+ textColor = getEnabledTextColor();
+ }
+
+ // And draw the button text
+
+ port->drawText(&pos, &rect, getFont(), m_text, 0, m_text.getLength(), textColor);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CButton::drawBorder(CGraphicsPort *port)
+{
+ drawBorder(port, isClicked());
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param useClicked Present border using the 'clicked' style
+ * @see redraw()
+ */
+
+void CButton::drawBorder(CGraphicsPort *port, bool useClicked)
+{
+ // Determine the background color
+
+ nxgl_mxpixel_t backColor;
+
+ if (useClicked || m_highlighted)
+ {
+ backColor = getSelectedBackgroundColor();
+ }
+ else
+ {
+ backColor = getBackgroundColor();
+ }
+
+ port->drawFilledRect(getX(), getY(), getWidth(), getHeight(), backColor);
+ drawOutline(port);
+}
+
+/**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CButton::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
+/**
+ * Raises an action event and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CButton::onRelease(nxgl_coord_t x, nxgl_coord_t y)
+{
+ m_widgetEventHandlers->raiseActionEvent();
+ redraw();
+}
+
+/**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CButton::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
diff --git a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx
new file mode 100644
index 000000000..263a16ce4
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx
@@ -0,0 +1,608 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cbuttonarray.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cbuttonarray.hxx"
+#include "cgraphicsport.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButtonArray Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for an array of buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button array, relative to its parent.
+ * @param y The y coordinate of the button array, relative to its parent.
+ * @param buttonColumns The number of buttons in one row of the button array
+ * @param buttonRows The number of buttons in one column of the button array
+ * @param buttonWidth The width of one button
+ * @param buttonHeight The height of one button
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CButtonArray::CButtonArray(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ uint8_t buttonColumns, uint8_t buttonRows,
+ nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
+ CWidgetStyle *style)
+: CNxWidget(pWidgetControl, x, y,
+ buttonColumns * buttonWidth + 2, buttonRows * buttonHeight + 2,
+ 0, style)
+{
+ // Save configuration
+
+ m_buttonRows = buttonRows;
+ m_buttonColumns = buttonColumns;
+ m_buttonWidth = buttonWidth;
+ m_buttonHeight = buttonHeight;
+
+ // Make sure the the positional data is valid.
+
+ m_clickX = x;
+ m_clickY = y;
+ m_cursorColumn = 0;
+ m_cursorRow = 0;
+
+ // Default behavior is to redraw the entire button array
+
+ m_redrawButton = false;
+
+ // No hightlighted buttons
+
+ m_cursorOn = false;
+ m_cursorChange = false;
+
+ // At present, There is no border on the array itself
+
+ m_flags.borderless = true;
+
+ // Make sure that the full size of the text array is allocated
+
+ m_buttonText = new CNxString[m_buttonRows * m_buttonColumns];
+}
+
+/**
+ * CButtonArray Destructor.
+ */
+
+CButtonArray::~CButtonArray(void)
+{
+ // Delete the array of CNxString instances
+
+ delete [] m_buttonText;
+}
+
+/**
+ * Returns the string shown in the label.
+ *
+ * @param column The column index of the button of interest
+* @param row The row index of the button of interest
+ * @return The label's text.
+ */
+
+const CNxString &CButtonArray::getText(int column, int row) const
+{
+ return m_buttonText[row * m_buttonColumns + column];
+}
+
+/**
+ * Set the text displayed in the label.
+ *
+ * @param column The column index of the button to set
+ * @param row The row index of the button to set
+ * @param text String to display.
+ */
+
+void CButtonArray::setText(int column, int row, const CNxString &text)
+{
+ m_buttonText[row * m_buttonColumns + column] = text;
+ onTextChange();
+}
+
+/**
+ * Return the position of the last clicked button (0,0 will be returned
+ * the no button has every been clicked). The button at this position
+ * is currently clicked then, in addition, return true.
+ *
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return True if a button in the array is clicked
+ */
+
+bool CButtonArray::isButtonClicked(int &column, int &row) const
+{
+ // Return the last clicked position
+
+ column = (m_clickX - getX()) / m_buttonWidth;
+
+ // Calculate and return the button row index
+
+ row = (m_clickY - getY()) / m_buttonHeight;
+
+ // Return true if the button is currently clicked
+
+ return isClicked();
+}
+
+/**
+ * Check if this specific button in the array is clicked
+ *
+ * @param column The column of the button to check.
+ * @param row The row of the button to check.
+ * @return True if this button is clicked
+ */
+
+bool CButtonArray::isThisButtonClicked(int column, int row) const
+{
+ // The upper left X/Y position of the button at these indices
+
+ nxgl_coord_t x = getX() + column * m_buttonWidth;
+ nxgl_coord_t y = getY() + row * m_buttonHeight;
+
+ // Was the last click on this button?
+
+ if ((m_clickX >= x && m_clickX < x + m_buttonWidth) &&
+ (m_clickY >= y && m_clickY < y + m_buttonHeight))
+ {
+ // Yes.. return true if the button is clicked
+
+ return isClicked();
+ }
+ else
+ {
+ // No.. then it can't be clicked
+
+ return false;
+ }
+}
+
+/**
+ * Control the cursor state.
+ *
+ * @param cursorOn True(1), the current cursor position will be highlighted
+ */
+
+void CButtonArray::cursor(bool cursorOn)
+{
+ if (cursorOn != m_cursorOn)
+ {
+ // Set the state cursor state
+
+ m_cursorOn = cursorOn;
+
+ // Update only the effected button
+
+ m_cursorChange = true;
+ redraw();
+ m_cursorChange = false;
+ }
+}
+
+/**
+ * Return the current cursor position (button indices) and an indication
+ * if the button at the cursor is currently hightlighted.
+ *
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return True if the cursor is enabled and the button is highlighted
+ */
+
+bool CButtonArray::getCursorPosition(int &column, int &row) const
+{
+ column = m_cursorColumn;
+ row = m_cursorRow;
+ return m_cursorOn;
+}
+
+/**
+ * Set the cursor position (button indices). Note that the cursor
+ * does not have to be enabled to set the position.
+ *
+ * @param column The column index of the button of interest
+ * @param row The row index of the button of interest
+ * @return True if the cursor position is valid
+ */
+
+bool CButtonArray::setCursorPosition(int column, int row)
+{
+ // Verify that the cursor position is within range
+
+ if ((unsigned)column < m_buttonColumns && (unsigned)row < m_buttonRows)
+ {
+ // Verify that the now position is different from the old position
+
+ if (column != m_cursorColumn || row != m_cursorRow)
+ {
+ m_cursorChange = true;
+
+ // Is the cursor on now?
+
+ bool redrawCursor = m_cursorOn;
+ if (redrawCursor)
+ {
+ // Yes.. clear the old cursor highlight
+
+ m_cursorOn = false;
+ redraw();
+ }
+
+ // Set the new cursor position
+
+ m_cursorColumn = column;
+ m_cursorRow = row;
+
+ // Do we need to turn the cursor back on?
+
+ if (redrawCursor)
+ {
+ // Yes.. Set the new cursor hightlight
+
+ m_cursorOn = true;
+ redraw();
+ }
+
+ m_cursorChange = false;
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Check if this specific button in the array is at the cursor position
+ * and highlighted.
+ *
+ * @param column The column of the button to check.
+ * @param row The row of the button to check.
+ * @return True if this button is at the cursor postion and highlighted.
+ */
+
+bool CButtonArray::isCursorPosition(int column, int row) const
+{
+ if (column == m_cursorColumn && row == m_cursorRow)
+ {
+ return m_cursorOn;
+ }
+
+ return false;
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CButtonArray::getPreferredDimensions(CRect &rect) const
+{
+ return getRect(rect);
+}
+
+/**
+ * Sets the font.
+ *
+ * @param font A pointer to the font to use.
+ */
+
+void CButtonArray::setFont(CNxFont *font)
+{
+ m_style.font = font;
+ redraw();
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CButtonArray::drawContents(CGraphicsPort *port)
+{
+ // Do we draw just the clicked/unclicked button?
+
+ if (m_redrawButton)
+ {
+ int column;
+ int row;
+
+ // Just one. Get the row/column indices from the last click
+
+ (void)posToButton(m_clickX, m_clickY, column, row);
+
+ // And draw that button
+
+ drawButton(port, column, row, isClicked());
+ }
+
+ // Do we just draw the hightlighted button?
+
+ else if (m_cursorChange)
+ {
+ // Do nothing if the highlighted button is also the clicked button
+
+ if (!isThisButtonClicked(m_cursorColumn, m_cursorRow))
+ {
+ drawButton(port, m_cursorColumn, m_cursorRow, false);
+ }
+ }
+
+ // Draw all buttons
+
+ else
+ {
+ // Visit each column
+
+ for (int column = 0; column < m_buttonColumns; column++)
+ {
+ // Visit each row
+
+ for (int row = 0; row < m_buttonRows; row++)
+ {
+ // Draw each button
+
+ drawButton(port, column, row, isThisButtonClicked(column, row));
+ }
+ }
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CButtonArray::drawBorder(CGraphicsPort *port)
+{
+ // This doesn't do anything anymore
+}
+
+/**
+ * Redraw only one button
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param column The button column index
+ * @param row The button row index
+ * @param useClicked Draw the button using the 'clicked' button style,
+ * regardless of the actual button state.
+ * @see onClick() and onRelease()
+ */
+
+void CButtonArray::drawButton(CGraphicsPort *port, int column, int row, bool useClicked)
+{
+ // The X/Y position of the button
+
+ nxgl_coord_t x = getX() + column * m_buttonWidth;
+ nxgl_coord_t y = getY() + row * m_buttonHeight;
+
+ // Determine which colors to use
+
+ nxwidget_pixel_t borderColor1;
+ nxwidget_pixel_t borderColor2;
+ nxwidget_pixel_t backColor;
+ nxwidget_pixel_t textColor;
+
+ // Pick the background and test colors. Should we use the 'clicked' backgound style?
+
+ if (useClicked || isCursorPosition(column, row))
+ {
+ // "Selected" text color on unique "Selected" background color
+
+ backColor = getSelectedBackgroundColor();
+ textColor = getSelectedTextColor();
+ }
+ else
+ {
+ // Normal background color and "Enabled" text color
+
+ backColor = getBackgroundColor();
+ textColor = getEnabledTextColor();
+ }
+
+ // Pick the border colors. Should we use the 'clicked' button style?
+
+ if (useClicked)
+ {
+ // Yes.. Bevelled into the screen
+
+ borderColor1 = getShadowEdgeColor();
+ borderColor2 = getShineEdgeColor();
+ }
+ else
+ {
+ // No.. Bevelled out of the screen
+
+ borderColor1 = getShineEdgeColor();
+ borderColor2 = getShadowEdgeColor();
+ }
+
+ // Use a special text color if the widget is not enabled
+
+ if (!isEnabled())
+ {
+ textColor = getDisabledTextColor();
+ }
+
+ // Draw the background
+
+ port->drawFilledRect(x, y, m_buttonWidth, m_buttonHeight, backColor);
+
+ // Draw the button outline
+
+ port->drawBevelledRect(x, y, m_buttonWidth, m_buttonHeight, borderColor1, borderColor2);
+
+ // Get the text for this button
+
+ CNxString *text = &m_buttonText[row * m_buttonColumns + column];
+
+ // Get the text drawing region
+
+ CRect rect;
+ rect.setX(x + 1);
+ rect.setY(y + 1);
+ rect.setWidth(m_buttonWidth - 2);
+ rect.setHeight(m_buttonHeight - 2);
+
+ // Get the centered text alignment
+
+ nxgl_coord_t alignY = (m_buttonHeight - getFont()->getHeight() - 2) >> 1;
+ nxgl_coord_t alignX = (m_buttonWidth - getFont()->getStringWidth(*text) - 2) >> 1;
+
+ // Get the text display position
+
+ struct nxgl_point_s pos;
+ pos.x = x + alignX;
+ pos.y = y + alignY;
+
+ // And draw the button text
+
+ port->drawText(&pos, &rect, getFont(), *text, 0, text->getLength(), textColor);
+}
+
+/**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CButtonArray::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Click X,Y is in raw window coordinates
+
+ m_clickX = x;
+ m_clickY = y;
+
+ // Redraw only the button that was clicked
+
+ m_redrawButton = true;
+ redraw();
+ m_redrawButton = false;
+}
+
+/**
+ * Raises an action event and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CButtonArray::onRelease(nxgl_coord_t x, nxgl_coord_t y)
+{
+ m_widgetEventHandlers->raiseActionEvent();
+
+ // Redraw only the button that was released
+
+ m_redrawButton = true;
+ redraw();
+ m_redrawButton = false;
+}
+
+/**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CButtonArray::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
+/**
+ * Convert an X/Y position to a button column/row index
+ *
+ * @param x The x position
+ * @param y The y position
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return false is the position is invalid
+ */
+
+bool CButtonArray::posToButton(nxgl_coord_t x, nxgl_coord_t y, int &column, int &row)
+{
+ // Get the row/column indices matching the x/y position
+
+ column = (x - getX()) / m_buttonWidth;
+ row = (y - getY()) / m_buttonHeight;
+ return ((unsigned)column < m_buttonColumns && (unsigned)row < m_buttonRows);
+}
+
+/**
+ * Updates the GUI after the text has changed.
+ */
+
+void CButtonArray::onTextChange(void)
+{
+ redraw();
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
diff --git a/NxWidgets/libnxwidgets/src/ccallback.cxx b/NxWidgets/libnxwidgets/src/ccallback.cxx
new file mode 100644
index 000000000..25cb228b3
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/ccallback.cxx
@@ -0,0 +1,195 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/ccallback.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include "cwidgetcontrol.hxx"
+#include "ccallback.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+ /**
+ * Constructor.
+ *
+ * @param pWidgetControl Control object associated with this window
+ */
+
+CCallback::CCallback(CWidgetControl *pWidgetControl)
+{
+ // Initialize the callback vtable
+
+ m_callbacks.redraw = redraw;
+ m_callbacks.position = position;
+ m_callbacks.mousein = newMouseEvent;
+ m_callbacks.kbdin = newKeyboardEvent;
+}
+
+ /**
+ * ReDraw Callback. The redraw action is handled by CWidgetControl:redrawEvent.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param pRect The rectangle that needs to be re-drawn (in window
+ * relative coordinates).
+ * @param bMore true: More re-draw requests will follow.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+void CCallback::redraw(NXHANDLE hWindow,
+ FAR const struct nxgl_rect_s *pRect,
+ bool bMore, FAR void *pvArg)
+{
+ gvdbg("hWindow=%p pRect={(%d,%d),(%d,%d)} bMore=%s\n",
+ hWindow,
+ pRect->pt1.x, pRect->pt1.y, pRect->pt2.x, pRect->pt2.y,
+ bMore ? "true" : "false");
+
+ // The argument must be the CWidgetControl instance
+
+ CWidgetControl *This = (CWidgetControl *)pvArg;
+
+ // Just forward the callback to the CWidgetControl::redrawEvent method
+
+ This->redrawEvent(pRect, bMore);
+}
+
+ /**
+ * Position Callback. The new positional data is handled by
+ * CWidgetControl::geometryEvent.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param pSize The size of the window.
+ * @param pPos The position of the upper left hand corner of the window on
+ * the overall display.
+ * @param pBounds The bounding rectangle that describes the entire display.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+void CCallback::position(NXHANDLE hWindow,
+ FAR const struct nxgl_size_s *pSize,
+ FAR const struct nxgl_point_s *pPos,
+ FAR const struct nxgl_rect_s *pBounds,
+ FAR void *pvArg)
+{
+ gvdbg("hWindow=%p pSize=(%d,%d) pPos=(%d,%d) pBounds={(%d,%d),(%d,%d)} pvArg=%p\n",
+ hWindow, pSize->w, pSize->h, pPos->x, pPos->y,
+ pBounds->pt1.x, pBounds->pt1.y, pBounds->pt2.x, pBounds->pt2.y,
+ pvArg);
+
+
+ // The argument must be the CWidgetControl instance
+
+ CWidgetControl *This = (CWidgetControl *)pvArg;
+
+ // Just forward the callback to the CWidgetControl::geometry method
+
+ This->geometryEvent(hWindow, pSize, pPos, pBounds);
+}
+
+ /**
+ * New mouse data is available for the window. The new mouse data is
+ * handled by CWidgetControl::newMouseEvent.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param pPos The (x,y) position of the mouse.
+ * @param buttons See NX_MOUSE_* definitions.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+#ifdef CONFIG_NX_MOUSE
+void CCallback::newMouseEvent(NXHANDLE hWindow,
+ FAR const struct nxgl_point_s *pPos,
+ uint8_t buttons, FAR void *pvArg)
+{
+ gvdbg("hWindow=%p pPos=(%d,%d) buttons=%02x pvArg=%p\n",
+ hWindow, pPos->x, pPos->y, buttons, pvArg);
+
+ // The argument must be the CWidgetControl instance
+
+ CWidgetControl *This = (CWidgetControl *)pvArg;
+
+ // Just forward the callback to the CWidgetControl::newMouseEvent method
+
+ This->newMouseEvent(pPos, buttons);
+}
+#endif /* CONFIG_NX_MOUSE */
+
+/**
+ * New keyboard/keypad data is available for the window. The new keyboard
+ * data is handled by CWidgetControl::newKeyboardEvent.
+ *
+ * @param hWindow Handle to a specific NX window.
+ * @param nCh The number of characters that are available in pStr[].
+ * @param pStr The array of characters.
+ * @param pvArg User provided argument (see nx_openwindow, nx_requestbg,
+ * nxtk_openwindow, or nxtk_opentoolbar).
+ */
+
+#ifdef CONFIG_NX_KBD
+void CCallback::newKeyboardEvent(NXHANDLE hWindow, uint8_t nCh,
+ FAR const uint8_t *pStr,
+ FAR void *pvArg)
+{
+ gvdbg("hWindow=%p nCh=%d pvArg=%p\n",
+ hWindow, nCh, pvArg);
+
+ // The argument must be the CWidgetControl instance
+
+ CWidgetControl *This = (CWidgetControl *)pvArg;
+
+ // Just forward the callback to the CWidgetControl::newKeyboardEvent method
+
+ This->newKeyboardEvent(nCh, pStr);
+}
+#endif // CONFIG_NX_KBD
diff --git a/NxWidgets/libnxwidgets/src/ccheckbox.cxx b/NxWidgets/libnxwidgets/src/ccheckbox.cxx
new file mode 100644
index 000000000..a6cc9400a
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/ccheckbox.cxx
@@ -0,0 +1,265 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/ccheckbox.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "ccheckbox.hxx"
+#include "cgraphicsport.hxx"
+#include "cbitmap.hxx"
+#include "singletons.hxx"
+#include "glyphs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the checkbox, relative to its parent.
+ * @param y The y coordinate of the checkbox, relative to its parent.
+ * @param width The width of the checkbox.
+ * @param height The height of the checkbox.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CCheckBox::CCheckBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style)
+: CButton(pWidgetControl, x, y, width, height, *NXWidgets::g_nullString, style)
+{
+ m_state = CHECK_BOX_STATE_OFF;
+ m_flags.borderless = false;
+
+ // Border width is one line
+
+ m_borderSize.top = 1;
+ m_borderSize.right = 1;
+ m_borderSize.bottom = 1;
+ m_borderSize.left = 1;
+}
+
+/**
+ * Set the state of the checkbox.
+ *
+ * @param state The new checkbox state.
+ */
+
+void CCheckBox::setState(CCheckBox::CheckBoxState state)
+{
+ if (m_state != state)
+ {
+ m_state = state;
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ redraw();
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CCheckBox::drawContents(CGraphicsPort *port)
+{
+ // Get the X/Y position of the drawable region within the CheckBox
+
+ nxgl_coord_t x = getX();
+ nxgl_coord_t y = getY();
+
+ nxgl_coord_t width = getWidth();
+ nxgl_coord_t height = getHeight();
+
+ // Include and offset for the border
+
+ if (!m_flags.borderless)
+ {
+ x += m_borderSize.left;
+ y += m_borderSize.top;
+
+ width -= (m_borderSize.left + m_borderSize.right);
+ height -= (m_borderSize.top + m_borderSize.bottom);
+ }
+
+ // Decide which glyph to draw
+
+ const struct SBitmap *glyph;
+
+ switch (m_state)
+ {
+ default:
+ case CHECK_BOX_STATE_ON:
+ glyph = &g_checkBoxOn;
+ break;
+
+ case CHECK_BOX_STATE_OFF:
+ glyph = &g_checkBoxOff;
+ break;
+
+ case CHECK_BOX_STATE_MU:
+ glyph = &g_checkBoxMu;
+ break;
+ }
+
+ // Don't exceed the size of the glyph
+
+ if (width > glyph->width)
+ {
+ width = glyph->width;
+ }
+
+ if (height > glyph->height)
+ {
+ height = glyph->height;
+ }
+
+ // Draw the checkbox
+
+ port->drawBitmap(x, y, width, height, glyph, 0, 0,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CCheckBox::drawBorder(CGraphicsPort *port)
+{
+ // Determine the background color
+
+ nxgl_mxpixel_t backColor;
+
+ if (m_highlighted)
+ {
+ backColor = getSelectedBackgroundColor();
+ }
+ else
+ {
+ backColor = getBackgroundColor();
+ }
+
+ // Draw the background (excluding the border)
+
+ port->drawFilledRect(getX(), getY(), getWidth(), getHeight(),
+ backColor);
+
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShineEdgeColor(), getShadowEdgeColor());
+ }
+}
+
+/**
+ * Toggles the state of the checkbox.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CCheckBox::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (m_state == CHECK_BOX_STATE_ON)
+ {
+ setState(CHECK_BOX_STATE_OFF);
+ }
+ else
+ {
+ setState(CHECK_BOX_STATE_ON);
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/ccyclebutton.cxx b/NxWidgets/libnxwidgets/src/ccyclebutton.cxx
new file mode 100644
index 000000000..b5f96683d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/ccyclebutton.cxx
@@ -0,0 +1,482 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/ccyclebutton.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "ccyclebutton.hxx"
+#include "cgraphicsport.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for cycle buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the values stored in the global
+ * g_defaultWidgetStyle object. The button will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CCycleButton::CCycleButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style)
+: CButton(pWidgetControl, x, y, width, height, "", style)
+{
+ // Force text to align left
+
+ nxgl_coord_t glyphSpace = m_borderSize.left - 1;
+
+ // Text x coordinate is width of cycle glyph plus a space plus width
+ // of the spacer line (2px) plus a space
+
+ m_align.x = g_cycle.width + 2 + (glyphSpace << 1);
+
+ m_options.addListDataEventHandler(this);
+ m_options.setAllowMultipleSelections(false);
+}
+
+/**
+ * Add a new option to the widget.
+ *
+ * @param text The text of the option.
+ * @param value The value of the option.
+ */
+
+void CCycleButton::addOption(const CNxString &text, const uint32_t value)
+{
+ m_options.addItem(new CListDataItem(text, value));
+
+ // Select the option if this is the first option added
+
+ if (m_options.getItemCount() == 1)
+ {
+ selectOption(0);
+ }
+}
+
+/**
+ * Remove an option from the widget by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+void CCycleButton::removeOption(const int index)
+{
+ m_options.removeItem(index);
+}
+
+/**
+ * Remove all options from the widget.
+ */
+
+void CCycleButton::removeAllOptions(void)
+{
+ m_options.removeAllItems();
+}
+
+/**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+void CCycleButton::selectOption(const int index)
+{
+ m_options.setItemSelected(index, true);
+}
+
+/**
+ * Get the selected index. Returns -1 if nothing is selected. If more than one
+ * option is selected, the index of the first selected option is returned.
+ *
+ * @return The selected index.
+ */
+
+const int CCycleButton::getSelectedIndex(void) const
+{
+ return m_options.getSelectedIndex();
+}
+
+/**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected options to deselected.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The selected index.
+ */
+
+void CCycleButton::setSelectedIndex(const int index)
+{
+ m_options.setItemSelected(index, true);
+}
+
+/**
+ * Get the selected option. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+const CListDataItem *CCycleButton::getSelectedOption(void) const
+{
+ return m_options.getSelectedItem();
+}
+
+/**
+ * Sort the options alphabetically by the text of the options.
+ */
+
+void CCycleButton::sort(void)
+{
+ m_options.sort();
+}
+
+/**
+ * Handles list data changed events.
+ *
+ * @param e Event arguments.
+ */
+
+void CCycleButton::handleListDataChangedEvent(const CListDataEventArgs &e)
+{
+ redraw();
+}
+
+/**
+ * Handles list selection changed events.
+ *
+ * @param e Event arguments.
+ */
+
+void CCycleButton::handleListDataSelectionChangedEvent(const CListDataEventArgs &e)
+{
+ redraw();
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent. Value is based on the length of the largest string in the
+ * set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CCycleButton::getPreferredDimensions(CRect &rect) const
+{
+ nxgl_coord_t width = 0;
+ nxgl_coord_t height = getFont()->getHeight();
+
+ // Locate longest string in options
+
+ for (int i = 0; i < m_options.getItemCount(); ++i)
+ {
+ nxgl_coord_t optionWidth =
+ getFont()->getStringWidth(m_options.getItem(i)->getText());
+
+ if (optionWidth > width)
+ {
+ width = optionWidth;
+ }
+ }
+
+ // Add the border width
+
+ if (!m_flags.borderless)
+ {
+ width += (m_borderSize.left + m_borderSize.right);
+ height += (m_borderSize.top + m_borderSize.bottom);
+ }
+
+ // Add text alignment
+
+ width += m_align.x;
+ height += m_align.y;
+
+ // And returned this preferred size
+
+ rect.setX(m_rect.getX());
+ rect.setY(m_rect.getY());
+ rect.setWidth(width);
+ rect.setHeight(height);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CCycleButton::drawContents(CGraphicsPort *port)
+{
+ // Get the drawing region (excluding any border)
+
+ CRect rect;
+ getRect(rect);
+
+ nxgl_coord_t glyphSpace = m_borderSize.left - 1;
+ nxgl_coord_t glyphYOffset = (rect.getHeight() - g_cycle.height) >> 1;
+
+ nxwidget_pixel_t textColor;
+ nxwidget_pixel_t separatorLeftColor;
+ nxwidget_pixel_t separatorRightColor;
+
+ if (!isEnabled())
+ {
+ textColor = getDisabledTextColor();
+ separatorLeftColor = getShadowEdgeColor();
+ separatorRightColor = getShineEdgeColor();
+ }
+ else if (!isClicked())
+ {
+ textColor = getEnabledTextColor();
+ separatorLeftColor = getShadowEdgeColor();
+ separatorRightColor = getShineEdgeColor();
+ }
+ else
+ {
+ textColor = getSelectedTextColor();
+ separatorLeftColor = getShineEdgeColor();
+ separatorRightColor = getShadowEdgeColor();
+ }
+
+ // Draw cycle glyph
+
+ port->drawBitmap(rect.getX(), rect.getY() + glyphYOffset,
+ g_cycle.width, g_cycle.height, &g_cycle,
+ 0, 0, CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+
+ // Draw separator
+
+ nxgl_coord_t x = getX() + glyphSpace + g_cycle.width;
+ nxgl_coord_t y = getY();
+ nxgl_coord_t w = glyphSpace + g_cycle.width;
+ nxgl_coord_t h = rect.getHeight() - 1;
+
+ port->drawLine(x, y, w, h, separatorLeftColor);
+ port->drawLine(x+1, y, w+1, h, separatorRightColor);
+
+ // Only draw text if option is selected
+
+ if (m_options.getSelectedItem() != NULL)
+ {
+ struct nxgl_point_s pos;
+ pos.x = getX() + m_align.x;
+ pos.y = getY() + m_align.y;
+
+ port->drawText(&pos, &rect, getFont(),
+ m_options.getSelectedItem()->getText(), 0,
+ m_options.getSelectedItem()->getText().getLength(),
+ textColor);
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CCycleButton::drawBorder(CGraphicsPort *port)
+{
+ // Determine the background color
+
+ nxwidget_pixel_t backColor;
+
+ if (isClicked() || m_highlighted)
+ {
+ backColor = getSelectedBackgroundColor();
+ }
+ else
+ {
+ backColor = getBackgroundColor();
+ }
+
+ // Draw the background (excluding the border)
+
+ port->drawFilledRect(getX(), getY(), getWidth(), getHeight(), backColor);
+
+ // Then add the border.
+
+ drawOutline(port);
+}
+
+/**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ */
+
+void CCycleButton::drawOutline(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (isBorderless())
+ {
+ return;
+ }
+
+ // Work out which colors to use
+
+ nxgl_coord_t color1;
+ nxgl_coord_t color2;
+
+ if (isClicked())
+ {
+ // Bevelled into the screen
+
+ color1 = getShadowEdgeColor();
+ color2 = getShineEdgeColor();
+ }
+ else
+ {
+ // Bevelled out of the screen
+
+ color1 = getShineEdgeColor();
+ color2 = getShadowEdgeColor();
+ }
+
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(), color1, color2);
+}
+
+/**
+ * Selects the next option in the list and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CCycleButton::onRelease(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Choose next option
+
+ if (m_options.getItemCount() > 1)
+ {
+ int selectedIndex = m_options.getSelectedIndex();
+
+ if (selectedIndex < m_options.getItemCount() - 1)
+ {
+ // Move to next option
+
+ selectOption(selectedIndex + 1);
+ }
+ else
+ {
+ // Wrap around as there are no more options
+
+ selectOption(0);
+ }
+ }
+
+ redraw();
+}
+
+/**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CCycleButton::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
diff --git a/NxWidgets/libnxwidgets/src/cglyphbutton.cxx b/NxWidgets/libnxwidgets/src/cglyphbutton.cxx
new file mode 100644
index 000000000..f24b5c943
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cglyphbutton.cxx
@@ -0,0 +1,297 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cglyphbutton.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "cglyphbutton.hxx"
+#include "cgraphicsport.hxx"
+#include "cbitmap.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button.
+ * @param y The y coordinate of the button.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param normalGlyph Glyph to display when unclicked.
+ * @param clickedGlyph Glyph to display when clicked.
+ * @param bitmapX The x coordinate at which the bitmaps will be drawn.
+ * @param bitmapY The y coordinate at which the bitmaps will be drawn.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the values stored in the global
+ * g_defaultWidgetStyle object. The button will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CGlyphButton::CGlyphButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ nxgl_coord_t bitmapX, nxgl_coord_t bitmapY,
+ FAR const struct SBitmap *normalGlyph,
+ FAR const struct SBitmap *clickedGlyph,
+ CWidgetStyle *style)
+: CNxWidget(pWidgetControl, x, y, width, height, 0, style)
+{
+ // The border should be set to the minimum so that the bitmap
+ // image can extend all the way to the border.
+
+ m_borderSize.top = 1;
+ m_borderSize.right = 1;
+ m_borderSize.bottom = 1;
+ m_borderSize.left = 1;
+
+ // Save the bitmap state data
+
+ m_bitmapX = bitmapX;
+ m_bitmapY = bitmapY;
+ m_bitmapNormal = normalGlyph;
+ m_bitmapClicked = clickedGlyph;
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent.
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CGlyphButton::getPreferredDimensions(CRect &rect) const
+{
+ nxgl_coord_t width = m_bitmapNormal->width;
+ nxgl_coord_t height = m_bitmapNormal->height;
+
+ if (!m_flags.borderless)
+ {
+ width = m_borderSize.left + m_borderSize.right;
+ height = m_borderSize.top + m_borderSize.bottom;
+ }
+
+ rect.setX(m_rect.getX());
+ rect.setY(m_rect.getY());
+ rect.setWidth(width);
+ rect.setHeight(height);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CGlyphButton::drawContents(CGraphicsPort *port)
+{
+ // Get the drawable region within the Label
+
+ CRect rect;
+ getRect(rect);
+
+ // Pick the glyph to show
+
+ FAR const struct SBitmap *bitmap;
+ if (m_flags.clicked)
+ {
+ bitmap = m_bitmapClicked;
+ }
+ else
+ {
+ bitmap = m_bitmapNormal;
+ }
+
+ // Then draw it -- in greyscale if not enabled
+
+ if (isEnabled())
+ {
+ port->drawBitmap(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(),
+ bitmap, m_bitmapX, m_bitmapY,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+ }
+ else
+ {
+ port->drawBitmapGreyScale(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(),
+ bitmap, m_bitmapX, m_bitmapY);
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CGlyphButton::drawBorder(CGraphicsPort *port)
+{
+ port->drawFilledRect(getX(), getY(), getWidth(),
+ getHeight(), getBackgroundColor());
+ drawOutline(port);
+}
+
+/**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ */
+
+void CGlyphButton::drawOutline(CGraphicsPort *port)
+{
+ // Don't draw if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ // Determine which colors to use
+
+ nxgl_coord_t color1;
+ nxgl_coord_t color2;
+
+ if (isClicked())
+ {
+ // Bevelled into the screen
+
+ color1 = getShadowEdgeColor();
+ color2 = getShineEdgeColor();
+ }
+ else
+ {
+ // Bevelled out of the screen
+
+ color1 = getShineEdgeColor();
+ color2 = getShadowEdgeColor();
+ }
+
+ port->drawBevelledRect(getX(), getY(),
+ getWidth(), getHeight(),
+ color1, color2);
+ }
+}
+
+/**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CGlyphButton::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
+/**
+ * Raises an action event and redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CGlyphButton::onRelease(nxgl_coord_t x, nxgl_coord_t y)
+{
+ m_widgetEventHandlers->raiseReleaseEvent(x, y);
+ redraw();
+}
+
+/**
+ * Redraws the button.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CGlyphButton::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
diff --git a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx
new file mode 100644
index 000000000..43076e240
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx
@@ -0,0 +1,988 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cgraphicsport.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <cerrno>
+#include <debug.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "inxwindow.hxx"
+#include "cnxstring.hxx"
+#include "crect.hxx"
+#include "cnxfont.hxx"
+#include "cgraphicsport.hxx"
+#include "cwidgetstyle.hxx"
+#include "cbitmap.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pNxWnd An instance of the underlying window type.
+ */
+
+CGraphicsPort::CGraphicsPort(INxWindow *pNxWnd)
+{
+ m_pNxWnd = pNxWnd;
+}
+
+/**
+ * Destructor.
+ */
+
+CGraphicsPort::~CGraphicsPort(void)
+{
+ // m_pNxWnd is not deleted. This is an abstract base class and
+ // the caller of the CGraphicsPort instance is responsible for
+ // the window destruction.
+};
+
+/**
+ * Return the absolute x coordinate of the upper left hand corner of the
+ * underlying window.
+ *
+ * @return The x coordinate of the underlying window.
+ */
+
+const nxgl_coord_t CGraphicsPort::getX(void) const
+{
+ struct nxgl_point_s pos;
+ (void)m_pNxWnd->getPosition(&pos);
+ return pos.x;
+};
+
+/**
+ * Return the absolute y coordinate of the upper left hand corner of the
+ * underlying window.
+ *
+ * @return The y coordinate of the underlying window.
+ */
+
+const nxgl_coord_t CGraphicsPort::getY(void) const
+{
+ struct nxgl_point_s pos;
+ (void)m_pNxWnd->getPosition(&pos);
+ return pos.y;
+};
+
+/**
+ * Draw a pixel into the window.
+ *
+ * @param x The window-relative x coordinate of the pixel.
+ * @param y The window-relative y coordinate of the pixel.
+ * @param color The color of the pixel.
+ */
+
+void CGraphicsPort::drawPixel(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_mxpixel_t color)
+{
+ struct nxgl_point_s pos;
+ pos.x = x;
+ pos.y = y;
+ m_pNxWnd->setPixel(&pos, color);
+}
+
+/**
+ * Draw a horizontal line of the specified start position, width, and color.
+ *
+ * @param x The x coordinate of the line.
+ * @param y The y coordinate of the top-most end of the line.
+ * @param width The width of the line in pixels.
+ * @param color The color of the line.
+ */
+
+void CGraphicsPort::drawHorizLine(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_mxpixel_t color)
+{
+ FAR struct nxgl_rect_s dest;
+ nxgl_coord_t halfwidth;
+
+ // Express the line as a rectangle
+
+ halfwidth = width >> 1;
+
+ dest.pt1.x = x;
+ dest.pt1.y = y;
+ dest.pt2.x = x + width - 1;
+ dest.pt2.y = y;
+
+ // Draw the line
+
+ if (!m_pNxWnd->fill(&dest, color))
+ {
+ gdbg("INxWindow::fill failed\n");
+ }
+}
+
+/**
+ * Draw a vertical line of the specified start position, width, and
+ * color.
+ *
+ * @param x The x coordinate of the left-most end of the line.
+ * @param y The y coordinate of the line.
+ * @param height The height of the line in rows.
+ * @param color The color of the line.
+ */
+
+void CGraphicsPort::drawVertLine(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t height, nxgl_mxpixel_t color)
+{
+ FAR struct nxgl_rect_s dest;
+
+ // Express the line as a rectangle
+
+ dest.pt1.x = x;
+ dest.pt1.y = y;
+ dest.pt2.x = x;
+ dest.pt2.y = y + height - 1;
+
+ // Draw the line
+
+ if (!m_pNxWnd->fill(&dest, color))
+ {
+ gdbg("INxWindow::fill failed\n");
+ }
+}
+
+/**
+ * Draw a line of a fixed color in the window.
+ *
+ * @param x1 The x coordinate of the start point of the line.
+ * @param y1 The y coordinate of the start point of the line.
+ * @param x2 The x coordinate of the end point of the line.
+ * @param y2 The y coordinate of the end point of the line.
+ * @param color The color of the line.
+ */
+
+void CGraphicsPort::drawLine(nxgl_coord_t x1, nxgl_coord_t y1,
+ nxgl_coord_t x2, nxgl_coord_t y2,
+ nxgl_mxpixel_t color)
+{
+ struct nxgl_vector_s vector;
+
+ vector.pt1.x = x1;
+ vector.pt1.y = y1;
+ vector.pt2.x = x2;
+ vector.pt2.y = y2;
+
+ if (!m_pNxWnd->drawLine(&vector, 1, color))
+ {
+ gdbg("INxWindow::drawLine failed\n");
+ }
+}
+
+/**
+ * Draw a filled rectangle to the bitmap.
+ *
+ * @param x The window-relative x coordinate of the rectangle.
+ * @param y The window-relative y coordinate of the rectangle.
+ * @param width The width of the rectangle in pixels.
+ * @param height The height of the rectangle in rows.
+ * @param color The color of the rectangle.
+ */
+
+void CGraphicsPort::drawFilledRect(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ nxgl_mxpixel_t color)
+{
+ struct nxgl_rect_s rect;
+ rect.pt1.x = x;
+ rect.pt1.y = y;
+ rect.pt2.x = x + width - 1;
+ rect.pt2.y = y + height - 1;
+ m_pNxWnd->fill(&rect, color);
+}
+
+/**
+ * Draw an unfilled rectangle to the window
+ *
+ * @param x The window-relative x coordinate of the rectangle.
+ * @param y The window-relative y coordinate of the rectangle.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ * @param color The color of the rectangle outline.
+ */
+
+void CGraphicsPort::drawRect(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ nxgl_mxpixel_t color)
+{
+ drawHorizLine(x, y, width, color);
+ drawHorizLine(x, y + height - 1, width, color);
+ drawVertLine(x, y, height, color);
+ drawVertLine(x + width -1, y, height, color);
+}
+
+/**
+ * Draw a bevelled rectangle to the window.
+ *
+ * @param x The x coordinate of the rectangle.
+ * @param y The y coordinate of the rectangle.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ * @param shineColor The color of the top/left sides.
+ * @param shadowColor The color of the bottom/right sides.
+ */
+
+void CGraphicsPort::drawBevelledRect(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ nxgl_mxpixel_t shineColor,
+ nxgl_mxpixel_t shadowColor)
+{
+ drawHorizLine(x, y, width, shineColor); // Top
+ drawHorizLine(x, y + height - 1, width, shadowColor); // Bottom
+ drawVertLine(x, y + 1, height - 2, shineColor); // Left
+ drawVertLine(x + width - 1, y + 1, height - 2, shadowColor); // Right
+}
+
+/**
+ * Draw an opaque bitmap to the window.
+ *
+ * @param x The window-relative x coordinate to draw the bitmap to.
+ * @param y The window-relative y coordinate to draw the bitmap to.
+ * @param width The width of the bitmap to draw.
+ * @param height The height of the bitmap to draw.
+ * @param bitmap Pointer to the bitmap to draw.
+ * @param bitmapX The window-relative x coordinate within the supplied
+ * bitmap to use as the origin.
+ * @param bitmapY The window-relative y coordinate within the supplied
+ * bitmap to use as the origin.
+ */
+
+void CGraphicsPort::drawBitmap(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const struct SBitmap *bitmap,
+ int bitmapX, int bitmapY)
+{
+ // origin - The origin of the upper, left-most corner of the full bitmap.
+ // Both dest and origin are in window coordinates, however, origin
+ // may lie outside of the display.
+
+ struct nxgl_point_s origin;
+ origin.x = x - bitmapX;
+ origin.y = y - bitmapY;
+
+ // dest - Describes the rectangular on the display that will receive the
+ // the bit map.
+
+ struct nxgl_rect_s dest;
+ dest.pt1.x = x;
+ dest.pt1.y = y;
+ dest.pt2.x = x + width - 1;
+ dest.pt2.y = y + height - 1;
+
+ // Blit the bitmap
+
+ (void)m_pNxWnd->bitmap(&dest, (FAR const void *)bitmap->data, &origin, bitmap->stride);
+}
+
+/**
+ * Draw a bitmap to the window, using the supplied transparent
+ * color as an invisible color.
+ *
+ * @param x The window-relative x coordinate to draw the bitmap to.
+ * @param y The window-relative y coordinate to draw the bitmap to.
+ * @param width The width of the bitmap to draw.
+ * @param height The height of the bitmap to draw.
+ * @param bitmap Pointer to the bitmap to draw.
+ * @param bitmapX The window-relative x coordinate within the supplied bitmap to use as
+ * the origin.
+ * @param bitmapY The window-relative y coordinate within the supplied bitmap to use as
+ * the origin.
+ * @param transparentColor The transparent color used in the bitmap.
+ */
+
+void CGraphicsPort::drawBitmap(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const struct SBitmap *bitmap,
+ int bitmapX, int bitmapY,
+ nxgl_mxpixel_t transparentColor)
+{
+ // Get the starting position in the image, offset by bitmapX and bitmapY into the image.
+
+ FAR uint8_t *srcLine = (uint8_t *)bitmap->data +
+ bitmapY * bitmap->stride +
+ ((bitmapX * bitmap->bpp + 7) >> 3);
+ FAR nxwidget_pixel_t *srcPtr = (nxwidget_pixel_t *)srcLine;
+
+ // Loop until all rows have been displayed
+
+ nxgl_coord_t firstX = x;
+ nxgl_coord_t lastX = x + width;
+ nxgl_coord_t lastY = y + height;
+
+ while (y < lastY)
+ {
+ // Search for the next non-transparent pixel in the source image
+
+ while (*srcPtr == transparentColor)
+ {
+ // The pixel is transparent. Move to the next column
+
+ if (++x >= lastX)
+ {
+ // We are at the end of the row. Reset to the next row
+
+ x = firstX;
+ y++;
+
+ // Was that the last row:
+
+ if (y >= lastY)
+ {
+ // Yes, then we are finished
+
+ return;
+ }
+
+ // Update the source data pointers to the beginning of the next
+ // row
+
+ srcLine += bitmap->stride;
+ srcPtr = (nxwidget_pixel_t *)srcLine;
+ }
+ else
+ {
+ // This is another transparent pixel on the same row
+
+ srcPtr++;
+ }
+ }
+
+ // srcPtr points to the next non-transparent color. Save this
+ // as the start of a run that has length of at least one
+
+ FAR nxwidget_pixel_t *runPtr = srcPtr;
+ nxgl_coord_t runX = x;
+ nxgl_coord_t runWidth = 0;
+
+ // Now search for the next transparent pixel on the same row.
+ // This will determine the length of the run
+
+ do
+ {
+ // This is another non-transparent pixel on the same row
+
+ runWidth++;
+ srcPtr++;
+
+ // Move to the next column
+
+ if (++x >= lastX)
+ {
+ // We are at the end of the row. Reset to the next row
+
+ x = firstX;
+ y++;
+
+ // Update the source data pointers to the beginning of the next
+ // row
+
+ srcLine += bitmap->stride;
+ srcPtr = (nxwidget_pixel_t *)srcLine;
+
+ // And break out of this loop
+
+ break;
+ }
+ }
+ while (*srcPtr != transparentColor);
+
+ // When we come out of the above loop, either (1) srcPtr points to the
+ // next transparent pixel on the same row, or (2) srcPtr points to the
+ // first pixel in the next row.
+
+ // origin - The origin of the upper, left-most corner of the full bitmap.
+ // Both dest and origin are in window coordinates, however, origin
+ // may lie outside of the display.
+
+ struct nxgl_point_s origin;
+ origin.x = runX;
+ origin.y = y;
+
+ // dest - Describes the rectangular on the display that will receive the
+ // the bit map.
+
+ struct nxgl_rect_s dest;
+ dest.pt1.x = runX;
+ dest.pt1.y = y;
+ dest.pt2.x = runX + runWidth - 1;
+ dest.pt2.y = y;
+
+ // Blit the bitmap
+
+ (void)m_pNxWnd->bitmap(&dest, (FAR const void *)runPtr, &origin, bitmap->stride);
+ }
+}
+
+/**
+ * Draw a bitmap to the port in greyscale.
+ *
+ * @param x The window-relative x coordinate to draw the bitmap to.
+ * @param y The window-relative y coordinate to draw the bitmap to.
+ * @param width The width of the bitmap to draw.
+ * @param height The height of the bitmap to draw.
+ * @param bitmap Pointer to the bitmap to draw.
+ * @param bitmapX The window-relative x coordinate within the supplied bitmap to use as
+ * the origin.
+ * @param bitmapY The window-relative y coordinate within the supplied bitmap to use as
+ * the origin.
+ */
+
+void CGraphicsPort::drawBitmapGreyScale(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const struct SBitmap *bitmap,
+ int bitmapX, int bitmapY)
+{
+ // Working buffer. Holds one converted row from the bitmap
+
+ FAR nxwidget_pixel_t *run = new nxwidget_pixel_t[width];
+
+ // Pointer to the beginning of the first source row
+
+ FAR uint8_t *src = (FAR uint8_t *)bitmap->data + bitmapY * bitmap->stride + bitmapX;
+
+ // Setup non-changing blit parameters
+
+ struct nxgl_point_s origin;
+ origin.x = 0;
+ origin.y = 0;
+
+ struct nxgl_rect_s dest;
+ dest.pt1.x = x;
+ dest.pt1.y = y;
+ dest.pt2.x = x + width - 1;
+ dest.pt2.y = y;
+
+ // Convert each row to greyscale and send it to the display
+
+ for (int row = 0; row < height; row++)
+ {
+ // Convert the next row
+
+ FAR nxwidget_pixel_t *runSrc = (FAR nxwidget_pixel_t *)src;
+ FAR nxwidget_pixel_t *runDest = run;
+
+ for (int col = 0; col < width; col++)
+ {
+ // Get the next RGB pixel and break out the individual components
+
+ nxwidget_pixel_t rgb = *runSrc++;
+ nxwidget_pixel_t r = RGB2RED(rgb);
+ nxwidget_pixel_t g = RGB2GREEN(rgb);
+ nxwidget_pixel_t b = RGB2BLUE(rgb);
+
+ // A truly accurate greyscale conversion would be complex. Let's
+ // just average.
+
+ nxwidget_pixel_t avg = (r + g + b) / 3;
+ *runDest++ = MKRGB(avg, avg, avg);
+ }
+
+ // Now blit the single row
+
+ (void)m_pNxWnd->bitmap(&dest, (FAR void *)bitmap->data, &origin, bitmap->stride);
+
+ // Setup for the next source row
+
+ y++;
+ dest.pt1.y = y;
+ dest.pt2.y = y;
+
+ src += bitmap->stride;
+ }
+
+ delete run;
+}
+
+/**
+ * Draw a string to the window.
+ *
+ * @param pos The window-relative x/y coordinate of the string.
+ * @param bound The window-relative bounds of the string.
+ * @param font The font to draw with.
+ * @param string The string to output.
+ */
+
+void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
+ CNxFont *font, const CNxString &string)
+{
+ drawText(pos, bound, font, string, 0, string.getLength());
+}
+
+/**
+ * Draw a particular length of a string to the window in a secific color.
+ *
+ * @param pos The window-relative x/y coordinate of the string.
+ * @param bound The window-relative bounds of the string.
+ * @param font The font to draw with.
+ * @param string The string to output.
+ * @param startIndex The start index within the string from which
+ * drawing will commence.
+ * @param length The number of characters to draw.
+ * @param color The color of the string.
+ */
+
+void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
+ CNxFont *font, const CNxString &string,
+ int startIndex, int length,
+ nxgl_mxpixel_t color)
+{
+ // Temporarily change the font color
+
+ nxgl_mxpixel_t savedColor = font->getColor();
+ font->setColor(color);
+
+ // Draw the string with this new color
+
+ drawText(pos, bound, font, string, startIndex, length);
+
+ // Restore the font color
+
+ font->setColor(savedColor);
+}
+
+/**
+ * Draw a portion of a string to the window.
+ * @param pos The window-relative x/y coordinate of the string.
+ * @param bound The window-relative bounds of the string.
+ * @param font The font to draw with.
+ * @param string The string to output.
+ * @param startIndex The start index within the string from which
+ * drawing will commence.
+ * @param length The number of characters to draw.
+ */
+
+void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
+ CNxFont *font, const CNxString &string,
+ int startIndex, int length)
+{
+ // Verify index and length
+
+ int stringLength = string.getLength();
+ if (startIndex >= stringLength)
+ {
+ return;
+ }
+
+ int endIndex = startIndex + length;
+ if (endIndex > stringLength)
+ {
+ endIndex = stringLength;
+ }
+
+ // Allocate a bit of memory to hold the largest rendered font
+
+ unsigned int bmWidth = ((unsigned int)font->getMaxWidth() * CONFIG_NXWIDGETS_BPP + 7) >> 3;
+ unsigned int bmHeight = (unsigned int)font->getHeight();
+
+ unsigned int glyphSize = bmWidth * bmHeight;
+ FAR uint8_t *glyph = new uint8_t[glyphSize];
+
+ // Get the bounding rectangle in NX form
+
+ struct nxgl_rect_s boundingBox;
+ bound->getNxRect(&boundingBox);
+
+ // Loop setup
+
+#if 0
+ nxwidget_pixel_t backcolor = g_defaultWidgetStyle->colors.back;
+#endif
+
+ struct SBitmap bitmap;
+ bitmap.bpp = CONFIG_NXWIDGETS_BPP;
+ bitmap.fmt = CONFIG_NXWIDGETS_FMT;
+ bitmap.data = (FAR const nxgl_mxpixel_t*)glyph;
+
+ // Loop for each letter in the sub-string
+
+ for (int i = startIndex; i < endIndex; i++)
+ {
+ // Get the next letter in the string
+
+ const nxwidget_char_t letter = string.getCharAt(i);
+
+ // Get the font metrics for this letter
+
+ struct nx_fontmetric_s metrics;
+ font->getCharMetrics(letter, &metrics);
+
+ // Get the width of the font (in pixels)
+
+ nxgl_coord_t fontWidth = (nxgl_coord_t)(metrics.width + metrics.xoffset);
+
+ // Does the letter have height? Spaces have width, but no height
+
+ if (metrics.height > 0)
+ {
+ // Get the height of the font
+
+ nxgl_coord_t fontHeight = (nxgl_coord_t)(metrics.height + metrics.yoffset);
+
+ // Set the current, effective size of the bitmap
+
+ bitmap.width = fontWidth;
+ bitmap.height = fontHeight;
+ bitmap.stride = (fontWidth * bitmap.bpp + 7) >> 3;
+
+ // Describe the destination of the font as a bounding box
+
+ struct nxgl_rect_s dest;
+ dest.pt1.x = pos->x;
+ dest.pt1.y = pos->y;
+ dest.pt2.x = pos->x + fontWidth - 1;
+ dest.pt2.y = pos->y + fontHeight - 1;
+
+ // Get the interection of the font box and the bounding box
+
+ struct nxgl_rect_s intersection;
+ nxgl_rectintersect(&intersection, &dest, &boundingBox);
+
+ // Skip to the next character if this one is completely outside
+ // the bounding box.
+
+ if (!nxgl_nullrect(&intersection))
+ {
+ // Initialize the bitmap memory by reading from the display. The
+ // font renderer always renders the fonts on a transparent background.
+ // Sometimes a solid background works, sometimes not. But reading
+ // from graphics memory always works.
+
+#if 0
+ // Set the glyph memory to the background color
+
+ nxwidget_pixel_t *bmPtr = (nxwidget_pixel_t *)bitmap.data;
+ unsigned int npixels = fontWidth * fontHeight;
+ for (unsigned int j = 0; j < npixels; j++)
+ {
+ *bmPtr++ = backcolor;
+ }
+#else
+ // Read the current contents of the destination into the glyph memory
+
+ m_pNxWnd->getRectangle(&dest, &bitmap);
+#endif
+ // Render the font into the initialized bitmap
+
+ font->drawChar(&bitmap, letter);
+
+ // Then put the font on the display
+
+ if (!m_pNxWnd->bitmap(&intersection, (FAR const void *)bitmap.data,
+ pos, bitmap.stride))
+ {
+ gvdbg("nx_bitmapwindow failed: %d\n", errno);
+ }
+ }
+ }
+
+ // Adjust the X position for the next character in the string
+
+ pos->x += fontWidth;
+ }
+
+ delete glyph;
+}
+
+/**
+ * Copy a rectangular region from the source coordinates to the
+ * destination coordinates.
+ *
+ * @param sourceX Source x coordinate.
+ * @param sourceY Source y coordinate.
+ * @param destX Destination x coordinate.
+ * @param destY Destination y coordinate.
+ * @param width Width of the rectangle to copy.
+ * @param height Height of the rectangle to copy.
+ */
+
+void CGraphicsPort::copy(nxgl_coord_t sourceX, nxgl_coord_t sourceY,
+ nxgl_coord_t destX, nxgl_coord_t destY,
+ nxgl_coord_t width, nxgl_coord_t height)
+{
+ struct nxgl_rect_s rect;
+ struct nxgl_point_s offset;
+
+ rect.pt1.x = sourceX;
+ rect.pt1.y = sourceY;
+ rect.pt1.x = sourceX + width - 1;
+ rect.pt1.y = sourceY + height - 1;
+
+ offset.x = destX - sourceX;
+ offset.y = destY - sourceY;
+
+ (void)m_pNxWnd->move(&rect, &offset);
+}
+
+/**
+ * Move a region by a specified distance in two dimensions.
+ *
+ * @param x X coordinate of the source area to move.
+ * @param y Y coordinate of the source area to move.
+ * @param deltaX Horizontal distance to move.
+ * @param deltaY Vertical distance to move.
+ * @param width Width of the area to move.
+ * @param height Height of the area to move.
+ */
+
+void CGraphicsPort::move(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t deltaX, nxgl_coord_t deltaY,
+ nxgl_coord_t width, nxgl_coord_t height)
+{
+ struct nxgl_rect_s rect;
+ rect.pt1.x = x;
+ rect.pt1.y = y;
+ rect.pt2.x = x + width - 1;
+ rect.pt2.y = y = height -1;
+
+ struct nxgl_point_s offset;
+ offset.x = deltaX;
+ offset.y = deltaY;
+
+ (void)m_pNxWnd->move(&rect, &offset);
+}
+
+/**
+ * Convert the region to greyscale.
+ *
+ * @param x X coordinate of the region to change.
+ * @param y Y coordinate of the region to change.
+ * @param width Width of the region to change.
+ * @param height Height of the region to change.
+ */
+
+void CGraphicsPort::greyScale(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Allocate memory to hold one row of graphics data
+
+ unsigned int stride = ((unsigned int)width * CONFIG_NXWIDGETS_BPP + 7) >> 3;
+ FAR uint8_t *rowBuffer = new uint8_t[height * stride];
+ if (!rowBuffer)
+ {
+ return;
+ }
+
+ // Describe the receiving bitmap memory
+
+ SBitmap rowBitmap;
+ rowBitmap.bpp = CONFIG_NXWIDGETS_BPP;
+ rowBitmap.fmt = CONFIG_NXWIDGETS_FMT;
+ rowBitmap.width = width;
+ rowBitmap.height = 1;
+ rowBitmap.stride = stride;
+ rowBitmap.data = (FAR const nxgl_mxpixel_t *)rowBuffer;
+
+ // Partially describe the source rectangle
+
+ struct nxgl_rect_s rect;
+ rect.pt1.x = x;
+ rect.pt2.x = x + width - 1;
+
+ // Partially setup the graphics origin
+
+ struct nxgl_point_s origin;
+ origin.x = x;
+
+ // Loop for each row in the region to be inverted
+
+ for (int row = 0; row < height; row++)
+ {
+ // Read the graphic memory corresponding to the row
+
+ rect.pt1.y = rect.pt2.y = y + row;
+ m_pNxWnd->getRectangle(&rect, &rowBitmap);
+
+ // Convert each bit to each bit
+
+ nxwidget_pixel_t *ptr = (nxwidget_pixel_t *)rowBuffer;
+ for (int col = 0; col < width; col++)
+ {
+ // Get the next RGB pixel and break out the individual components
+
+ nxwidget_pixel_t color = *ptr;
+ uint8_t red = RGB2RED(color);
+ uint8_t green = RGB2GREEN(color);
+ uint8_t blue = RGB2BLUE(color);
+
+ // A truly accurate greyscale conversion would be complex. Let's
+ // just average.
+
+ nxwidget_pixel_t avg = (red + green + blue) / 3;
+ *ptr++ = MKRGB(avg, avg, avg);
+ }
+
+ // Then write the row back to graphics memory
+
+ origin.y = rect.pt1.y;
+ m_pNxWnd->bitmap(&rect, (FAR const void *)rowBitmap.data,
+ &origin, rowBitmap.stride) ;
+ }
+
+ delete rowBuffer;
+}
+
+/**
+ * Invert colors in a region. NOTE: This allocates an in-memory
+ * buffer the size of one row in graphic memory. So it may only be
+ * useful for inverting small regions and its only current use of for
+ * the inverted cursor text.
+ *
+ * @param x X coordinate of the region to change.
+ * @param y Y coordinate of the region to change.
+ * @param width Width of the region to change.
+ * @param height Height of the region to change.
+ */
+
+void CGraphicsPort::invert(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Allocate memory to hold one row of graphics data
+
+ unsigned int stride = ((unsigned int)width * CONFIG_NXWIDGETS_BPP + 7) >> 3;
+ FAR uint8_t *rowBuffer = new uint8_t[height * stride];
+ if (!rowBuffer)
+ {
+ return;
+ }
+
+ // Describe the receiving bitmap memory
+
+ SBitmap rowBitmap;
+ rowBitmap.bpp = CONFIG_NXWIDGETS_BPP;
+ rowBitmap.fmt = CONFIG_NXWIDGETS_FMT;
+ rowBitmap.width = width;
+ rowBitmap.height = 1;
+ rowBitmap.stride = stride;
+ rowBitmap.data = (FAR const nxgl_mxpixel_t *)rowBuffer;
+
+ // Partially describe the source rectangle
+
+ struct nxgl_rect_s rect;
+ rect.pt1.x = x;
+ rect.pt2.x = x + width - 1;
+
+ // Partially setup the graphics origin
+
+ struct nxgl_point_s origin;
+ origin.x = x;
+
+ // Loop for each row in the region to be inverted
+
+ for (int row = 0; row < height; row++)
+ {
+ // Read the graphic memory corresponding to the row
+
+ rect.pt1.y = rect.pt2.y = y + row;
+ m_pNxWnd->getRectangle(&rect, &rowBitmap);
+
+ // Invert each bit
+
+ nxwidget_pixel_t *ptr = (nxwidget_pixel_t *)rowBuffer;
+ for (int col = 0; col < width; col++)
+ {
+ nxwidget_pixel_t color = *ptr;
+ uint8_t red = RGB2RED(color);
+ uint8_t green = RGB2GREEN(color);
+ uint8_t blue = RGB2BLUE(color);
+ *ptr++ = MKRGB(~red, ~green, ~blue);
+ }
+
+ // Then write the row back to graphics memory
+
+ origin.y = rect.pt1.y;
+ m_pNxWnd->bitmap(&rect, (FAR const void *)rowBitmap.data,
+ &origin, rowBitmap.stride) ;
+ }
+
+ delete rowBuffer;
+};
+
diff --git a/NxWidgets/libnxwidgets/src/cimage.cxx b/NxWidgets/libnxwidgets/src/cimage.cxx
new file mode 100644
index 000000000..b57857e66
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cimage.cxx
@@ -0,0 +1,343 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cimage.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "cgraphicsport.hxx"
+#include "ibitmap.hxx"
+#include "cbitmap.hxx"
+#include "cimage.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for a label containing a string.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the image box, relative to its parent.
+ * @param y The y coordinate of the image box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param bitmap The source bitmap image.
+ * @param style The style that the widget should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CImage::CImage(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height, FAR IBitmap *bitmap,
+ CWidgetStyle *style)
+ : CNxWidget(pWidgetControl, x, y, width, height, 0, style)
+{
+ // Save the IBitmap instance
+
+ m_bitmap = bitmap;
+
+ // Position the top/lef corner of the bitmap in the top/left corner of the display
+
+ m_origin.x = 0;
+ m_origin.y = 0;
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CImage::getPreferredDimensions(CRect &rect) const
+{
+ nxgl_coord_t width = m_bitmap->getWidth();
+ nxgl_coord_t height = m_bitmap->getHeight();
+
+ if (!m_flags.borderless)
+ {
+ width += (m_borderSize.left + m_borderSize.right);
+ height += (m_borderSize.top + m_borderSize.bottom);
+ }
+
+ rect.setX(m_rect.getX());
+ rect.setY(m_rect.getY());
+ rect.setWidth(width);
+ rect.setHeight(height);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CImage::drawContents(CGraphicsPort *port)
+{
+ // Get the the drawable region
+
+ CRect rect;
+ getRect(rect);
+
+ // Allocate a working buffer that will hold one row of the bitmap
+
+ FAR nxwidget_pixel_t *buffer = new nxwidget_pixel_t[rect.getWidth()];
+
+ // Set up a simple bitmap structure to describe on row
+
+ struct SBitmap bitmap;
+ bitmap.bpp = m_bitmap->getBitsPerPixel();
+ bitmap.fmt = m_bitmap->getColorFormat();
+ bitmap.width = rect.getWidth();
+ bitmap.height = 1;
+ bitmap.stride = (rect.getWidth() * m_bitmap->getBitsPerPixel()) >> 3;
+ bitmap.data = buffer;
+
+ // This is the number of rows that we can draw at the top of the display
+
+ nxgl_coord_t nTopRows = m_bitmap->getHeight() - m_origin.y;
+ if (nTopRows > rect.getHeight())
+ {
+ nTopRows = rect.getHeight();
+ }
+ else if (nTopRows < 0)
+ {
+ nTopRows = 0;
+ }
+
+ // This the starting row in the bitmap image where we will begin drawing.
+
+ nxgl_coord_t imageRow = m_origin.y;
+
+ // This the starting row in the display image where we will begin drawing.
+
+ nxgl_coord_t displayRow = rect.getY();
+
+ // Are we going to draw any rows at the top of the display?
+
+ if (nTopRows > 0)
+ {
+ // This is the number of columns that we can draw on the left side of
+ // the display
+
+ nxgl_coord_t nLeftPixels = m_bitmap->getWidth() - m_origin.x;
+
+ // This is the number of rows that we have to pad on the right if the display
+ // width is wider than the image width
+
+ nxgl_coord_t nRightPad;
+ if (nLeftPixels >= rect.getWidth())
+ {
+ nRightPad = 0;
+ }
+ else
+ {
+ nRightPad = rect.getWidth() - nLeftPixels;
+ }
+
+ // Apply the padding to the right hand side
+
+ FAR nxwidget_pixel_t *ptr = &buffer[nLeftPixels];
+ nxwidget_pixel_t backColor = getBackgroundColor();
+
+ for (int column = nLeftPixels; column < rect.getWidth(); column++)
+ {
+ *ptr++ = backColor;
+ }
+
+ // The is the row number of the first row that we cannot draw into
+
+ nxgl_coord_t lastTopRow = nTopRows + m_origin.y;
+
+ // Now draw the rows from the offset position
+
+ for (; imageRow < lastTopRow; imageRow++, displayRow++)
+ {
+ // Get the graphics data for the right hand side of this row
+
+ if (!m_bitmap->getRun(m_origin.x, imageRow, nLeftPixels, buffer))
+ {
+ gvdbg("IBitmap::getRun failed at image row\n", imageRow);
+ delete buffer;
+ return;
+ }
+
+ // Replace any transparent pixels with the background color.
+ // Then we can use the faster opaque drawBitmap() function.
+
+ ptr = buffer;
+ for (int i = 0; i < nLeftPixels; i++, ptr++)
+ {
+ if (*ptr == CONFIG_NXWIDGETS_TRANSPARENT_COLOR)
+ {
+ *ptr = backColor;
+ }
+ }
+
+ // And put these on the display
+
+ port->drawBitmap(rect.getX(), displayRow, rect.getWidth(), 1,
+ &bitmap, 0, 0);
+ }
+ }
+
+ // Are we going to draw any rows at the top of the display?
+
+ if (nTopRows < rect.getHeight())
+ {
+ // Pad the entire row
+
+ FAR nxwidget_pixel_t *ptr = buffer;
+ nxwidget_pixel_t backColor = getBackgroundColor();
+
+ for (int column = 0; column < rect.getWidth(); column++)
+ {
+ *ptr++ = backColor;
+ }
+
+ // Now draw the rows from the offset position
+
+ for (; displayRow < rect.getHeight(); displayRow++)
+ {
+ // Put the padded row on the display
+
+ port->drawBitmap(rect.getX(), displayRow, rect.getWidth(), 1,
+ &bitmap, 0, 0);
+ }
+ }
+
+ delete buffer;
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CImage::drawBorder(CGraphicsPort *port)
+{
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Set the horizontal position of the bitmap. Zero is the left edge
+ * of the bitmap and values >0 will move the bit map to the right.
+ * This method is useful for horizontal scrolling a large bitmap
+ * within a smaller window
+ */
+
+void CImage::setImageLeft(nxgl_coord_t column)
+{
+ if (column > 0 && column <= m_bitmap->getWidth())
+ {
+ m_origin.x = column;
+ }
+}
+
+/**
+ * Set the vertical position of the bitmap. Zero is the top edge
+ * of the bitmap and values >0 will move the bit map down.
+ * This method is useful for vertical scrolling a large bitmap
+ * within a smaller window
+ */
+
+void CImage::setImageTop(nxgl_coord_t row)
+{
+ if (row > 0 && row <= m_bitmap->getHeight())
+ {
+ m_origin.x = row;
+ }
+}
+
diff --git a/NxWidgets/libnxwidgets/src/ckeypad.cxx b/NxWidgets/libnxwidgets/src/ckeypad.cxx
new file mode 100644
index 000000000..898885c62
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/ckeypad.cxx
@@ -0,0 +1,214 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/ckeypad.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxglib.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cwidgetstyle.hxx"
+#include "ckeypad.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+// The geometry of the button array
+
+#define BUTTONARRAY_NCOLUMNS 4
+#define BUTTONARRAY_NROWS 7
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+static FAR const char *g_alphaLabels[BUTTONARRAY_NCOLUMNS*BUTTONARRAY_NROWS] = {
+ "=>", "A", "B", "<DEL",
+ "C", "D", "E", "F",
+ "G", "H", "I", "J",
+ "K", "L", "M", "N",
+ "O", "P", "Q", "R",
+ "S", "T", "U", "V",
+ "W", "X", "Y", "Z"
+};
+
+static FAR const char *g_numLabels[BUTTONARRAY_NCOLUMNS*BUTTONARRAY_NROWS] = {
+ "=>", "0", "1", "<DEL",
+ "2", "3", "4", "5",
+ "6", "7", "8", "9",
+ "-", "#", "*", "&",
+ "?", "!", "@", "%",
+ ":", ",", ".", "/",
+ "\"", "'", "(", ")"
+};
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+/**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param hNxServer The NX server that will receive the keyboard input
+ * @param x The x coordinate of the keypad, relative to its parent.
+ * @param y The y coordinate of the keypad, relative to its parent.
+ * @param width The width of the keypad
+ * @param height The height of the keypad
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CKeypad::CKeypad(CWidgetControl *pWidgetControl, NXHANDLE hNxServer,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style)
+: CButtonArray(pWidgetControl, x, y, 4, 7, width / BUTTONARRAY_NCOLUMNS,
+ height / BUTTONARRAY_NROWS, style)
+{
+ m_hNxServer = hNxServer;
+
+ // Force the height and width to be an exact multiple of the button height and width
+
+ resize(m_buttonWidth * m_buttonColumns, m_buttonHeight * m_buttonRows);
+
+ // Start in alphabetic mode
+
+ setKeypadMode(false);
+}
+
+/**
+ * Catch button clicks.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CKeypad::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Perform the redraw
+
+ CButtonArray::onClick(x, y);
+
+ // The button should now be clicked
+
+ int column;
+ int row;
+
+ if (isButtonClicked(column, row))
+ {
+ // The left arrow at (0,0) is a special case
+
+ char ch;
+ if (column == 0 && row == 0)
+ {
+ m_widgetControl->newCursorControlEvent(CURSOR_RIGHT);
+ return;
+ }
+
+ // The backspace at (3,0) is a special case
+
+ else if (column == 3 && row == 0)
+ {
+ ch = KEY_CODE_BACKSPACE;
+ }
+
+ // Otherwise, just grab the character for the arrays
+
+ else
+ {
+ int index = row * BUTTONARRAY_NCOLUMNS + column;
+ FAR const char *ptr;
+ if (m_numeric)
+ {
+ ptr = g_numLabels[index];
+ }
+ else
+ {
+ ptr = g_alphaLabels[index];
+ }
+
+ ch = ptr[0];
+ }
+
+ // Then inject the keyboard input into the NX server. The NX
+ // server will determine which window receives the input.
+ // The ultimate recipient will be the widget in the top window
+ // that has focus.
+
+ (void)nx_kbdchin(m_hNxServer, (uint8_t)ch);
+ }
+}
+
+/**
+ * Configure the keypad for the currenly selected display mode.
+ */
+
+void CKeypad::configureKeypadMode(void)
+{
+ // Add the labels to each button. Each call to setText would
+ // cause a text change event and, hence, redrawing of the
+
+ FAR const char **ptr = m_numeric ? g_numLabels : g_alphaLabels;
+ for (int j = 0; j < BUTTONARRAY_NROWS; j++)
+ {
+ for (int i = 0; i < BUTTONARRAY_NCOLUMNS; i++)
+ {
+ // setText does this. But each call to setText would
+ // cause a text change even and, hence, redrawing of
+ // the whole keypad. So we access the protected data
+ // directly and redraw only once.
+
+ CNxString string = *ptr++;
+ m_buttonText[j * m_buttonColumns + i] = string;
+ }
+ }
+
+ // Then redraw the display
+
+ onTextChange();
+}
+
diff --git a/NxWidgets/libnxwidgets/src/clabel.cxx b/NxWidgets/libnxwidgets/src/clabel.cxx
new file mode 100644
index 000000000..4c7ea3554
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/clabel.cxx
@@ -0,0 +1,426 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/clabel.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "clabel.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CLabel Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for a label containing a string.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CLabel::CLabel(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text, CWidgetStyle *style)
+ : CNxWidget(pWidgetControl, x, y, width, height, 0, style)
+{
+ // Default is centered text
+
+ m_hAlignment = TEXT_ALIGNMENT_HORIZ_CENTER;
+ m_vAlignment = TEXT_ALIGNMENT_VERT_CENTER;
+
+ // The border thickness is 1 pixel
+
+ m_borderSize.top = 1;
+ m_borderSize.right = 1;
+ m_borderSize.bottom = 1;
+ m_borderSize.left = 1;
+
+ m_align.x = 0;
+ m_align.y = 0;
+
+ m_textChange = false;
+ m_highlighted = false;
+ setText(text);
+
+ calculateTextPositionHorizontal();
+ calculateTextPositionVertical();
+}
+
+/**
+ * Set the horizontal alignment of text within the label.
+ *
+ * @param alignment The horizontal position of the text.
+ */
+
+void CLabel::setTextAlignmentHoriz(TextAlignmentHoriz alignment)
+{
+ m_hAlignment = alignment;
+ calculateTextPositionHorizontal();
+ redraw();
+}
+
+/**
+ * Set the vertical alignment of text within the label.
+ *
+ * @param alignment The vertical position of the text.
+ */
+
+void CLabel::setTextAlignmentVert(TextAlignmentVert alignment)
+{
+ m_vAlignment = alignment;
+ calculateTextPositionVertical();
+ redraw();
+}
+
+/**
+ * Set the text displayed in the label.
+ *
+ * @param text String to display.
+ */
+
+void CLabel::setText(const CNxString &text)
+{
+ m_text = text;
+ onTextChange();
+}
+
+/**
+ * Append new text to the end of the current text displayed in the
+ * label.
+ *
+ * @param text String to append.
+ */
+
+void CLabel::appendText(const CNxString &text)
+{
+ m_text.append(text);
+ onTextChange();
+}
+
+/**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+void CLabel::insertText(const CNxString &text, const int index)
+{
+ m_text.insert(text, index);
+ onTextChange();
+}
+
+/**
+ * Control the highlight state.
+ *
+ * @param highlightOn True(1), the label will be highlighted
+ */
+
+void CLabel::highlight(bool highlightOn)
+{
+ if (highlightOn != m_highlighted)
+ {
+ m_highlighted = highlightOn;
+ redraw();
+ }
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CLabel::getPreferredDimensions(CRect &rect) const
+{
+ nxgl_coord_t width;
+ nxgl_coord_t height;
+
+ if (!m_flags.borderless)
+ {
+ width = m_borderSize.left + m_borderSize.right;
+ height = m_borderSize.top + m_borderSize.bottom;
+ }
+ else
+ {
+ width = 0;
+ height = 0;
+ }
+
+ width += getFont()->getStringWidth(m_text);
+ height += getFont()->getHeight();
+
+ rect.setX(m_rect.getX());
+ rect.setY(m_rect.getY());
+ rect.setWidth(width);
+ rect.setHeight(height);
+}
+
+/**
+ * Sets the font.
+ *
+ * @param font A pointer to the font to use.
+ */
+
+void CLabel::setFont(CNxFont *font)
+{
+ m_style.font = font;
+
+ // Need to recalculate the text position as the font may have changed size
+
+ calculateTextPositionHorizontal();
+ calculateTextPositionVertical();
+ redraw();
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ * @param port The CGraphicsPort to draw to.
+ *
+ * @see redraw()
+ */
+
+void CLabel::drawContents(CGraphicsPort *port)
+{
+ // Get the drawing area (excluding the border)
+
+ CRect rect;
+ getRect(rect);
+
+ // Pick the text and background colors
+
+ nxgl_mxpixel_t textColor;
+ nxgl_mxpixel_t backColor;
+
+ if (!isEnabled())
+ {
+ textColor = getDisabledTextColor();
+ backColor = getBackgroundColor();
+ }
+ else if (m_highlighted)
+ {
+ textColor = getSelectedTextColor();
+ backColor = getSelectedBackgroundColor();
+ }
+ else
+ {
+ textColor = getEnabledTextColor();
+ backColor = getBackgroundColor();
+ }
+
+ // Draw the background (excluding the border)
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(), backColor);
+
+ // Get the X/Y position of the text within the Label
+
+ struct nxgl_point_s pos;
+ pos.x = rect.getX() + m_align.x;
+ pos.y = rect.getY() + m_align.y;
+
+ // Add the text using the selected color
+
+ port->drawText(&pos, &rect, getFont(), m_text, 0, m_text.getLength(),
+ textColor);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CLabel::drawBorder(CGraphicsPort *port)
+{
+ // Check if the widget indicates it should have an outline: That
+ // the outline is enabled and the this is not just a text-only
+ // redraw
+
+ if (!isBorderless() && !isTextChange())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Resize the widget to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CLabel::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ calculateTextPositionHorizontal();
+ calculateTextPositionVertical();
+}
+
+/**
+ * Calculate the vertical position of the string based on the font
+ *
+ * height and the alignment options.
+ */
+
+void CLabel::calculateTextPositionVertical(void)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ nxgl_coord_t height = rect.getHeight();
+
+ switch (m_vAlignment)
+ {
+ case TEXT_ALIGNMENT_VERT_CENTER:
+ m_align.y = (height - getFont()->getHeight()) >> 1;
+ break;
+
+ case TEXT_ALIGNMENT_VERT_TOP:
+ m_align.y = 0;
+ break;
+
+ case TEXT_ALIGNMENT_VERT_BOTTOM:
+ m_align.y = height - getFont()->getHeight();
+ break;
+ }
+}
+
+/**
+ * Calculate the position of the string based on its length and the
+ * alignment options.
+ */
+
+void CLabel::calculateTextPositionHorizontal(void)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ nxgl_coord_t width = rect.getWidth();
+
+ switch (m_hAlignment)
+ {
+ case TEXT_ALIGNMENT_HORIZ_CENTER:
+ m_align.x = (width - getFont()->getStringWidth(m_text)) >> 1;
+ break;
+
+ case TEXT_ALIGNMENT_HORIZ_LEFT:
+ m_align.x = 0;
+ break;
+
+ case TEXT_ALIGNMENT_HORIZ_RIGHT:
+ m_align.x = width - getFont()->getStringWidth(m_text);
+ break;
+ }
+}
+
+/**
+ * Updates the GUI after the text has changed.
+ */
+
+void CLabel::onTextChange(void)
+{
+ calculateTextPositionHorizontal();
+ calculateTextPositionVertical();
+ m_textChange = true;
+ redraw();
+ m_textChange = false;
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+
diff --git a/NxWidgets/libnxwidgets/src/clatchbutton.cxx b/NxWidgets/libnxwidgets/src/clatchbutton.cxx
new file mode 100644
index 000000000..673d50319
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/clatchbutton.cxx
@@ -0,0 +1,131 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/clatchbutton.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cstickybutton.hxx"
+#include "clatchbutton.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param text The text for the button to display.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CLatchButton::CLatchButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text,
+ CWidgetStyle *style)
+: CStickyButton(pWidgetControl, x, y, width, height, text, style)
+{
+}
+
+/**
+ * Handles button click events
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CLatchButton::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ /* On each press event, toggle the button stuck down state */
+
+ toggleStuckDown();
+}
diff --git a/NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx b/NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx
new file mode 100644
index 000000000..d8292941b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx
@@ -0,0 +1,116 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cstickybuttonarray.hxx"
+#include "clatchbuttonarray.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for an array of latch buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button array, relative to its parent.
+ * @param y The y coordinate of the button array, relative to its parent.
+ * @param buttonColumns The number of buttons in one row of the button array
+ * @param buttonRows The number of buttons in one column of the button array
+ * @param buttonWidth The width of one button
+ * @param buttonHeight The height of one button
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CLatchButtonArray::CLatchButtonArray(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ uint8_t buttonColumns, uint8_t buttonRows,
+ nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
+ CWidgetStyle *style)
+: CStickyButtonArray(pWidgetControl, x, y, buttonColumns, buttonRows, buttonWidth, buttonHeight, style)
+{
+}
+
+/**
+ * Handles button click events
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CLatchButtonArray::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // We need to save the button position so that when CButtonArray
+ // gets the release, it will have the correct position. This would
+ // look nicer if we just called CButtonArray::onClock() but that
+ // would cause duplicate redraw()
+
+ m_clickX = x;
+ m_clickY = y;
+
+ // Convert the new key press to row/columin indices
+
+ int column;
+ int row;
+
+ if (posToButton(x, y, column, row))
+ {
+ // Change the stuck down button on each in-range button press
+ // NOTE that normally button click events are not processed (but
+ // button release events will be processed).
+
+ stickDown(column, row);
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/clistbox.cxx b/NxWidgets/libnxwidgets/src/clistbox.cxx
new file mode 100644
index 000000000..a8d3db0a6
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/clistbox.cxx
@@ -0,0 +1,661 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/clistbox.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "clistbox.hxx"
+#include "cgraphicsport.hxx"
+#include "cnxfont.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CListBox::CListBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style)
+: CScrollingPanel(pWidgetControl, x, y, width, height, 0, style)
+{
+ m_flags.draggable = true;
+ m_flags.doubleClickable = true;
+ m_optionPadding = 2;
+ m_options.addListDataEventHandler(this);
+ m_lastSelectedIndex = -1;
+
+ // Disallow horizontal scrolling
+
+ setAllowsHorizontalScroll(false);
+}
+
+/**
+ * Destructor.
+ */
+
+CListBox::~CListBox(void)
+{
+ m_options.removeListDataEventHandler(this);
+}
+
+
+/**
+ * Add a new option to the widget using default colors.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ */
+
+void CListBox::addOption(const CNxString &text, const uint32_t value)
+{
+ addOption(text, value,
+ getShadowEdgeColor(), getBackgroundColor(),
+ getShadowEdgeColor(), getHighlightColor());
+}
+
+/**
+ * Add an option to the widget.
+ *
+ * @param option The option to add.
+ */
+
+void CListBox::addOption(CListBoxDataItem *option)
+{
+ m_options.addItem(option);
+}
+
+/**
+ * Remove an option from the widget by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+void CListBox::removeOption(const int index)
+{
+ m_options.removeItem(index);
+}
+
+/**
+ * Remove all options from the widget.
+ */
+
+void CListBox::removeAllOptions(void)
+{
+ m_options.removeAllItems();
+}
+
+/**
+ * Add a new option to the widget.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ * @param normalTextColor Color to draw the text with when not selected.
+ * @param normalBackColor Color to draw the background with when not selected.
+ * @param selectedTextColor Color to draw the text with when selected.
+ * @param selectedBackColor Color to draw the background with when selected.
+ */
+
+void CListBox::addOption(const CNxString &text, const uint32_t value,
+ const nxwidget_pixel_t normalTextColor,
+ const nxwidget_pixel_t normalBackColor,
+ const nxwidget_pixel_t selectedTextColor,
+ const nxwidget_pixel_t selectedBackColor)
+{
+ addOption(new CListBoxDataItem(text, value,
+ normalTextColor, normalBackColor,
+ selectedTextColor, selectedBackColor));
+}
+
+/**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+void CListBox::selectOption(const int index)
+{
+ setOptionSelected(index, true);
+}
+
+/**
+ * Select an option by its index.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ */
+
+void CListBox::deselectOption(const int index)
+{
+ setOptionSelected(index, false);
+}
+
+/**
+ * Select all options. Does nothing if the listbox does not allow
+ * multiple selections. Redraws the widget and raises a value changed
+ * event.
+ */
+
+void CListBox::selectAllOptions(void)
+{
+ m_options.selectAllItems();
+}
+
+/**
+ * Deselect all options.
+ * Redraws the widget and raises a value changed event.
+ */
+
+void CListBox::deselectAllOptions(void)
+{
+ m_options.deselectAllItems();
+}
+
+/**
+ * Get the selected index. Returns -1 if nothing is selected. If
+ * more than one option is selected, the index of the first selected
+ * option is returned.
+ *
+ * @return The selected index.
+ */
+
+const int CListBox::getSelectedIndex(void) const
+{
+ return m_options.getSelectedIndex();
+}
+
+/**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected options to deselected. Redraws the widget and raises
+ * a value changed event.
+ *
+ * @param index The selected index.
+ */
+
+void CListBox::setSelectedIndex(const int index)
+{
+ setOptionSelected(index, true);
+}
+
+/**
+ * Get the selected option. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+const CListBoxDataItem *CListBox::getSelectedOption(void) const
+{
+ return (const CListBoxDataItem*)m_options.getSelectedItem();
+}
+
+/**
+ * Resize the scrolling canvas to encompass all options.
+ */
+
+void CListBox::resizeCanvas(void)
+{
+ // Get client area
+
+ CRect rect;
+ getClientRect(rect);
+
+ int oldCanvasHeight = m_canvasHeight;
+
+ // Resize the canvas
+
+ m_canvasHeight = (m_options.getItemCount() * getOptionHeight());
+
+ // Ensure canvas is at least as tall as the widget
+
+ m_canvasHeight = m_canvasHeight < rect.getHeight() ? rect.getHeight() : m_canvasHeight;
+
+ // If resize has left scroll position beyond end of canvas, adjust
+ // to compensate
+
+ if (m_canvasY + (m_canvasHeight - getHeight()) < 0)
+ {
+ scroll(0, -(oldCanvasHeight - (m_canvasHeight - getHeight())));
+ }
+}
+
+/**
+ * Sort the options alphabetically by the text of the options.
+ */
+
+void CListBox::sort(void)
+{
+ m_options.sort();
+}
+
+/**
+ * Get the height of a single option.
+ *
+ * @return The height of an option.
+ */
+
+const nxgl_coord_t CListBox::getOptionHeight(void) const
+{
+ return getFont()->getHeight() + (m_optionPadding << 1);
+}
+
+/**
+ * Handles list data changed events.
+ *
+ * @param e Event arguments.
+ */
+
+void CListBox::handleListDataChangedEvent(const CListDataEventArgs &e)
+{
+ // Forget the last selected item as it may have changed
+
+ m_lastSelectedIndex = -1;
+ resizeCanvas();
+ redraw();
+}
+
+/**
+ * Handles list selection changed events.
+ *
+ * @param e Event arguments.
+ */
+
+void CListBox::handleListDataSelectionChangedEvent(const CListDataEventArgs &e)
+{
+ redraw();
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent. Value is based on the length of the largest string in the
+ * set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CListBox::getPreferredDimensions(CRect &rect) const
+{
+ nxgl_coord_t width;
+ nxgl_coord_t height;
+
+ if (!m_flags.borderless)
+ {
+ width = m_borderSize.left + m_borderSize.right;
+ height = m_borderSize.top + m_borderSize.bottom;
+ }
+ else
+ {
+ width = 0;
+ height = 0;
+ }
+
+ nxgl_coord_t maxWidth = 0;
+ nxgl_coord_t optionWidth = 0;
+
+ // Locate longest string in options
+
+ for (int i = 0; i < m_options.getItemCount(); ++i)
+ {
+ optionWidth = getFont()->getStringWidth(m_options.getItem(i)->getText());
+
+ if (optionWidth > maxWidth)
+ {
+ maxWidth = optionWidth;
+ }
+ }
+
+ rect.setX(m_rect.getX());
+ rect.setY(m_rect.getY());
+ rect.setWidth(width + (m_optionPadding << 1) + maxWidth);
+ rect.setHeight(height + getOptionHeight() * 3);
+}
+
+/**
+ * Check if the click is a double-click.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click is a double-click.
+ */
+
+bool CListBox::isDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (CNxWidget::isDoubleClick(x, y))
+ {
+ // Calculate which option was clicked
+
+ int selectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight();
+
+ // Has the same option been clicked twice? Ignore double-clicks that
+ // occur on different items
+
+ if (selectedIndex == m_lastSelectedIndex)
+ {
+ // Process click as a double-click
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CListBox::drawContents(CGraphicsPort *port)
+{
+ // Get the drawing region (excluding the borders)
+
+ CRect rect;
+ getRect(rect);
+
+ // Draw background
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(),
+ getBackgroundColor());
+
+ // Calculate clipping values
+
+ nxgl_coord_t clipX = rect.getX();
+ nxgl_coord_t clipY = rect.getY();
+ nxgl_coord_t clipHeight = rect.getHeight();
+
+ // Precalc values for option draw loop
+
+ nxgl_coord_t optionHeight = getOptionHeight();
+
+ // Ensure that we subtract 1 from topOption to ensure that the option
+ // above is drawn if it is partially visible
+
+ int topOption = ((clipY - m_canvasY) / optionHeight) - 1;
+
+ // Ensure that we add 2 to the bottom option to ensure that the option
+ // below is draw if it is partially visible - subbing 1 from topOption
+ // means we need to add an additional 1 to compensate
+
+ int bottomOption = topOption + (clipHeight / optionHeight) + 2;
+
+ // Ensure top options is not negative
+
+ if (topOption < 0)
+ {
+ topOption = 0;
+ }
+
+ // Ensure bottom option does not exceed number of options
+
+ if (bottomOption >= m_options.getItemCount())
+ {
+ bottomOption = m_options.getItemCount() - 1;
+ }
+
+ // Calculate values for loop
+
+ int y = m_canvasY + (topOption * optionHeight);
+ int i = topOption;
+
+ const CListBoxDataItem *item = (CListBoxDataItem *)NULL;
+
+ // Loop through all options drawing each ones
+
+ while (i <= bottomOption)
+ {
+ item = (const CListBoxDataItem*)m_options.getItem(i);
+
+ // Is the option selected?
+
+ if (item->isSelected())
+ {
+ // Draw background
+
+ if (item->getSelectedBackColor() != getBackgroundColor())
+ {
+ port->drawFilledRect(rect.getX(), rect.getY() + y,
+ rect.getWidth(), optionHeight,
+ item->getSelectedBackColor());
+ }
+
+ // Draw text
+
+ struct nxgl_point_s pos;
+ pos.x = rect.getX() + m_optionPadding;
+ pos.y = rect.getY() + y + m_optionPadding;
+
+ if (isEnabled())
+ {
+ port->drawText(&pos, &rect, getFont(), item->getText(), 0,
+ item->getText().getLength(),
+ item->getSelectedTextColor());
+ }
+ else
+ {
+ port->drawText(&pos, &rect, getFont(), item->getText(), 0,
+ item->getText().getLength(),
+ getDisabledTextColor());
+ }
+ }
+ else
+ {
+ // Draw background
+
+ if (item->getNormalBackColor() != getBackgroundColor())
+ {
+ port->drawFilledRect(clipX, y, getWidth(), optionHeight,
+ item->getNormalBackColor());
+ }
+
+ // Draw text
+
+ struct nxgl_point_s pos;
+ pos.x = rect.getX() + m_optionPadding;
+ pos.y = rect.getY() + y + m_optionPadding;
+
+ if (isEnabled())
+ {
+ port->drawText(&pos, &rect, getFont(), item->getText(), 0,
+ item->getText().getLength(),
+ item->getNormalTextColor());
+ }
+ else
+ {
+ port->drawText(&pos, &rect, getFont(), item->getText(), 0,
+ item->getText().getLength(),
+ getDisabledTextColor());
+ }
+ }
+
+ i++;
+ y += optionHeight;
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CListBox::drawBorder(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(0, 0, getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Determines which item was clicked and selects or deselects it as
+ * appropriate. Also starts the dragging system.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CListBox::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Calculate which option was clicked
+
+ m_lastSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight();
+
+ const CListBoxDataItem *item =
+ (const CListBoxDataItem*)m_options.getItem(m_lastSelectedIndex);
+
+ // Are we setting or unsetting?
+
+ if (item->isSelected())
+ {
+ // Deselecting
+
+ m_options.deselectItem(m_lastSelectedIndex);
+ }
+ else
+ {
+ // Selecting
+
+ m_options.selectItem(m_lastSelectedIndex);
+ }
+
+ startDragging(x, y);
+ redraw();
+}
+
+/**
+ * Selects the clicked item and deselects all others.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CListBox::onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Calculate which option was clicked
+
+ int newSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight();
+
+ // Double-click - select the item exclusively
+
+ deselectAllOptions();
+ setSelectedIndex(newSelectedIndex);
+ m_widgetEventHandlers->raiseActionEvent();
+}
+
+/**
+ * Select or deselect an option by its index. Does not deselect any other selected options.
+ * Set index to -1 to select nothing.
+ * Redraws the widget and raises a value changed event.
+ *
+ * @param index The index of the option to select.
+ * @param selected True to select the option, false to deselect it.
+ */
+
+void CListBox::setOptionSelected(const int index, bool selected)
+{
+ m_options.setItemSelected(index, selected);
+}
diff --git a/NxWidgets/libnxwidgets/src/clistboxdataitem.cxx b/NxWidgets/libnxwidgets/src/clistboxdataitem.cxx
new file mode 100644
index 000000000..0ef1b2d25
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/clistboxdataitem.cxx
@@ -0,0 +1,114 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/clistboxdataitem.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "clistboxdataitem.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param text The text to display in the item.
+ * @param value The value of the item.
+ * @param normalTextColor Color to draw the text with when not selected.
+ * @param normalBackColor Color to draw the background with when not selected.
+ * @param selectedTextColor Color to draw the text with when selected.
+ * @param selectedBackColor Color to draw the background with when selected.
+ */
+
+CListBoxDataItem::CListBoxDataItem(const CNxString& text, const uint32_t value,
+ const nxwidget_pixel_t normalTextColor,
+ const nxwidget_pixel_t normalBackColor,
+ const nxwidget_pixel_t selectedTextColor,
+ const nxwidget_pixel_t selectedBackColor)
+: CListDataItem(text, value)
+{
+ m_normalTextColor = normalTextColor;
+ m_normalBackColor = normalBackColor;
+ m_selectedTextColor = selectedTextColor;
+ m_selectedBackColor = selectedBackColor;
+}
diff --git a/NxWidgets/libnxwidgets/src/clistdata.cxx b/NxWidgets/libnxwidgets/src/clistdata.cxx
new file mode 100644
index 000000000..3b9601fc0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/clistdata.cxx
@@ -0,0 +1,462 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/clistdata.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <cstring>
+
+#include "clistdata.hxx"
+#include "ilistdataeventhandler.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ */
+
+CListData::CListData(void)
+{
+ m_allowMultipleSelections = true;
+ m_sortInsertedItems = false;
+}
+
+/**
+ * Destructor.
+ */
+
+CListData::~CListData(void)
+{
+ removeAllItems();
+}
+
+/**
+ * Add a new item.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ */
+
+void CListData::addItem(const CNxString &text, const uint32_t value)
+{
+ // Create new option
+
+ addItem(new CListDataItem(text, value));
+}
+
+/**
+ * Add an existing item. CListData becomes the owner of the option and will delete it
+ * when the list is deleted.
+ *
+ * @param item The item to add.
+ */
+
+void CListData::addItem(CListDataItem *item)
+{
+ // Determine insert type
+
+ if (m_sortInsertedItems)
+ {
+ // Sorted insert
+
+ m_items.insert(getSortedInsertionIndex(item), item);
+ }
+ else
+ {
+ // Append
+
+ m_items.push_back(item);
+ }
+
+ raiseDataChangedEvent();
+}
+
+/**
+ * Remove an item by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+void CListData::removeItem(const int index)
+{
+ // Bounds check
+
+ if (index < m_items.size())
+ {
+ // Delete the option
+
+ delete m_items[index];
+
+ // Erase the option from the list
+
+ m_items.erase(index);
+ raiseDataChangedEvent();
+ }
+}
+
+/**
+ * Select an item by its index.
+ *
+ * @param index The index of the item to select.
+ */
+
+void CListData::selectItem(const int index)
+{
+ setItemSelected(index, true);
+}
+
+/**
+ * Deselect an item by its index.
+ *
+ * @param index The index of the item to select.
+ */
+
+void CListData::deselectItem(const int index)
+{
+ setItemSelected(index, false);
+}
+
+/**
+ * Remove all items.
+ */
+
+void CListData::removeAllItems(void)
+{
+ // Delete all option data
+
+ for (int i = 0; i < m_items.size(); i++)
+ {
+ delete m_items[i];
+ }
+
+ m_items.clear();
+ raiseDataChangedEvent();
+}
+
+/**
+ * Get the selected index. Returns -1 if nothing is selected. If more than one
+ * item is selected, the index of the first selected item is returned.
+ *
+ * @return The selected index.
+ */
+
+const int CListData::getSelectedIndex(void) const
+{
+ // Get the first selected index
+
+ for (int i = 0; i < m_items.size(); i++)
+ {
+ if (m_items[i]->isSelected())
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/**
+ * Sets the selected index. Specify -1 to select nothing. Resets any
+ * other selected items to deselected.
+ *
+ * @param index The selected index.
+ */
+
+void CListData::setSelectedIndex(const int index)
+{
+ setItemSelected(index, true);
+}
+
+/**
+ * Get the selected item. Returns NULL if nothing is selected.
+ *
+ * @return The selected option.
+ */
+
+const CListDataItem *CListData::getSelectedItem(void) const
+{
+ // Get the first selected option
+
+ int index = getSelectedIndex();
+ if (index > -1)
+ {
+ return m_items[index];
+ }
+ return (CListDataItem *)NULL;
+}
+
+/**
+ * Sort the items using their compareTo() methods.
+ */
+
+void CListData::sort(void)
+{
+ quickSort(0, m_items.size() - 1);
+ raiseDataChangedEvent();
+}
+
+/**
+ * Select all items. Does nothing if the list does not allow
+ * multiple selections.
+ */
+
+void CListData::selectAllItems(void)
+{
+ if (m_allowMultipleSelections)
+ {
+ for (int i = 0; i < m_items.size(); i++)
+ {
+ m_items[i]->setSelected(true);
+ }
+
+ raiseSelectionChangedEvent();
+ }
+}
+
+/**
+ * Deselect all items.
+ */
+
+void CListData::deselectAllItems(void)
+{
+ for (int i = 0; i < m_items.size(); i++)
+ {
+ m_items[i]->setSelected(false);
+ }
+
+ raiseSelectionChangedEvent();
+}
+
+/**
+ * Select or deselect an item by its index. Does not deselect any
+ * other selected items. Set index to -1 to select nothing.
+ *
+ * @param index The index of the item to select.
+ * @param selected True to select the item, false to deselect it.
+ */
+
+void CListData::setItemSelected(const int index, bool selected)
+{
+ // Deselect old options if we're making an option selected and
+ // we're not a multiple list
+
+ if (((!m_allowMultipleSelections) || (index == -1)) && (selected))
+ {
+ for (int i = 0; i < m_items.size(); i++)
+ {
+ m_items[i]->setSelected(false);
+ }
+ }
+
+ // Select or deselect the new option
+
+ if ((index > -1) && (index < m_items.size()))
+ {
+ m_items[index]->setSelected(selected);
+ }
+
+ raiseSelectionChangedEvent();
+}
+
+/**
+ * Remove an event handler.
+ *
+ * @param eventHandler The event handler to remove.
+ */
+
+void CListData::removeListDataEventHandler(IListDataEventHandler *eventHandler)
+{
+ for (int i = 0; i < m_listDataEventhandlers.size(); ++i)
+ {
+ if (m_listDataEventhandlers.at(i) == eventHandler)
+ {
+ m_listDataEventhandlers.erase(i);
+ return;
+ }
+ }
+}
+
+/**
+ * Quick sort the items using their compareTo() methods.
+ *
+ * @param start The index to start sorting at.
+ * @param end The index to stop sorting at.
+ */
+
+void CListData::quickSort(const int start, const int end)
+{
+ if (end > start)
+ {
+ int left = start;
+ int right = end;
+
+ CListDataItem *pivot = m_items[(start + end) >> 1];
+
+ do
+ {
+ while ((pivot->compareTo(m_items[left]) > 0) && (left < end))
+ {
+ left++;
+ }
+
+ while ((pivot->compareTo(m_items[right]) < 0) && (right > start))
+ {
+ right--;
+ }
+
+ if (left > right)
+ {
+ break;
+ }
+
+ swapItems(left, right);
+ left++;
+ right--;
+ }
+ while (left <= right);
+
+ quickSort(start, right);
+ quickSort(left, end);
+ }
+}
+
+/**
+ * Swap the locations of two items in the array.
+ *
+ * @param index1 The index of the first item to swap.
+ * @param index2 The index of the second item to swap.
+ */
+
+void CListData::swapItems(const int index1, const int index2)
+{
+ CListDataItem *tmp = m_items[index1];
+ m_items[index1] = m_items[index2];
+ m_items[index2] = tmp;
+}
+
+/**
+ * Return the index that an item should be inserted at to maintain a sorted list of data.
+ *
+ * @param item The item to insert.
+ * @return The index that the item should be imserted into at.
+ */
+
+const int CListData::getSortedInsertionIndex(const CListDataItem *item) const
+{
+ int i = 0;
+
+ // Locate slot where new option should go
+
+ while ((i < m_items.size()) && (item->compareTo(m_items[i]) > 0))
+ {
+ i++;
+ }
+ return i;
+}
+
+/**
+ * Raise a data changed event.
+ */
+
+void CListData::raiseDataChangedEvent(void)
+{
+ CListDataEventArgs eventArgs(this);
+
+ for (int i = 0; i < m_listDataEventhandlers.size(); ++i)
+ {
+ m_listDataEventhandlers.at(i)->handleListDataChangedEvent(eventArgs);
+ }
+}
+
+/**
+ * Raise a selection changed event.
+ */
+
+void CListData::raiseSelectionChangedEvent(void)
+{
+ CListDataEventArgs eventArgs(this);
+
+ for (int i = 0; i < m_listDataEventhandlers.size(); ++i)
+ {
+ m_listDataEventhandlers.at(i)->handleListDataSelectionChangedEvent(eventArgs);
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/clistdataitem.cxx b/NxWidgets/libnxwidgets/src/clistdataitem.cxx
new file mode 100644
index 000000000..036cea61e
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/clistdataitem.cxx
@@ -0,0 +1,128 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/clistdataitem.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "clistdataitem.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+/**
+ * Constructor.
+ *
+ * @param text The text to display in the item.
+ * @param value The value of the item.
+ */
+
+CListDataItem::CListDataItem(const CNxString &text, const uint32_t value)
+{
+ m_text = text;
+ m_value = value;
+ m_isSelected = false;
+}
+
+/**
+ * Destructor.
+ */
+
+CListDataItem::~CListDataItem(void)
+{
+}
+
+/**
+ * Compare the item with another. Comparison is based on the text of
+ * the item. Returns 0 if the text in the two items is the same,
+ * a value less than 0 if this item is less than the argument, and
+ * a value greater than 0 if this item is greater than the argument.
+ *
+ * @param item An item to compare this object with.
+ * @return 0 if the text in the two items is the same,
+ * a value less than 0 if this item is less than the argument, and
+ * a value greater than 0 if this item is greater than the argument.
+ */
+
+int CListDataItem::compareTo(const CListDataItem *item) const
+{
+ return m_text.compareTo(item->getText());
+}
diff --git a/NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx b/NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx
new file mode 100644
index 000000000..94caac5fd
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx
@@ -0,0 +1,1284 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cnxfont.hxx"
+#include "ctext.hxx"
+#include "cgraphicsport.hxx"
+#include "singletons.hxx"
+#include "cstringiterator.hxx"
+#include "cnxtimer.hxx"
+#include "cmultilinetextbox.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param flags Standard widget flag options.
+ * @param maxRows The maximum number of rows the textbox can track. Adding
+ * text beyond this number will cause rows at the start of the text to be
+ * forgotten; text is essentially stored as a queue, and adding to the back
+ * of a full queue causes the front items to be popped off. Setting this to
+ * 0 will make the textbox track only the visible rows.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CMultiLineTextBox::CMultiLineTextBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text, uint32_t flags,
+ nxgl_coord_t maxRows, CWidgetStyle *style)
+: CScrollingPanel(pWidgetControl, x, y, width, height, flags, style)
+{
+ m_hAlignment = TEXT_ALIGNMENT_HORIZ_CENTER;
+ m_vAlignment = TEXT_ALIGNMENT_VERT_CENTER;
+ m_topRow = 0;
+
+ // The border is one line thick
+
+ m_borderSize.top = 1;
+ m_borderSize.right = 1;
+ m_borderSize.bottom = 1;
+ m_borderSize.left = 1;
+
+ CRect rect;
+ getClientRect(rect);
+ m_text = new CText(getFont(), "", rect.getWidth());
+ m_canvasWidth = rect.getWidth();
+
+ m_flags.draggable = true;
+ m_flags.doubleClickable = true;
+ m_maxRows = maxRows;
+
+ calculateVisibleRows();
+
+ // Set maximum rows if value not set
+
+ if (m_maxRows == 0)
+ {
+ m_maxRows = m_visibleRows + 1;
+ }
+
+ m_cursorPos = 0;
+ m_showCursor = SHOW_CURSOR_NEVER;
+ m_wrapCursor = false;
+
+ setText(text);
+}
+
+/**
+ * Set the horizontal alignment of text within the textbox.
+ *
+ * @param alignment The horizontal position of the text.
+ */
+
+void CMultiLineTextBox::setTextAlignmentHoriz(TextAlignmentHoriz alignment)
+{
+ m_hAlignment = alignment;
+ redraw();
+}
+
+/**
+ * Set the vertical alignment of text within the textbox.
+ *
+ * @param alignment The vertical position of the text.
+ */
+
+void CMultiLineTextBox::setTextAlignmentVert(TextAlignmentVert alignment)
+{
+ m_vAlignment = alignment;
+ redraw();
+}
+
+/**
+ * Returns the number of "pages" that the text spans. A page
+ * is defined as the amount of text that can be displayed within
+ * the textbox at one time.
+ *
+ * @return The page count.
+ */
+
+const int CMultiLineTextBox::getPageCount(void) const
+{
+ if (m_visibleRows > 0)
+ {
+ return (m_text->getLineCount() / m_visibleRows) + 1;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+/**
+ * Returns the current page.
+ *
+ * @return The current page.
+ * @see getPageCount().
+ */
+
+const int CMultiLineTextBox::getCurrentPage(void) const
+{
+ // Calculate the top line of text
+
+ int topRow = -m_canvasY / m_text->getLineHeight();
+
+ // Return the page on which the top row falls
+
+ if (m_visibleRows > 0)
+ {
+ return topRow / m_visibleRows;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+/**
+ * Set the text displayed in the textbox.
+ *
+ * @param text String to display.
+ */
+
+void CMultiLineTextBox::setText(const CNxString &text)
+{
+ bool drawingEnabled = m_flags.drawingEnabled;
+ disableDrawing();
+
+ m_text->setText(text);
+
+ cullTopLines();
+ limitCanvasHeight();
+ jumpToTextBottom();
+
+ if (drawingEnabled)
+ {
+ enableDrawing();
+ }
+ redraw();
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+/**
+ * Append new text to the end of the current text
+ * displayed in the textbox.
+ *
+ * @param text String to append.
+ */
+
+void CMultiLineTextBox::appendText(const CNxString &text)
+{
+ bool drawingEnabled = m_flags.drawingEnabled;
+ disableDrawing();
+
+ m_text->append(text);
+
+ cullTopLines();
+ limitCanvasHeight();
+ jumpToTextBottom();
+
+ if (drawingEnabled)
+ {
+ enableDrawing();
+ }
+ redraw();
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+/**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+void CMultiLineTextBox::removeText(const unsigned int startIndex)
+{
+ removeText(startIndex, m_text->getLength() - startIndex);
+}
+
+/**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+void CMultiLineTextBox::removeText(const unsigned int startIndex,
+ const unsigned int count)
+{
+ bool drawingEnabled = m_flags.drawingEnabled;
+ disableDrawing();
+
+ m_text->remove(startIndex, count);
+
+ limitCanvasHeight();
+ limitCanvasY();
+
+ moveCursorToPosition(startIndex);
+
+ if (drawingEnabled)
+ {
+ enableDrawing();
+ }
+ redraw();
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+/**
+ * Set the font used in the textbox.
+ *
+ * @param font Pointer to the new font.
+ */
+
+void CMultiLineTextBox::setFont(CNxFont *font)
+{
+ bool drawingEnabled = m_flags.drawingEnabled;
+ disableDrawing();
+
+ m_style.font = font;
+ m_text->setFont(font);
+
+ cullTopLines();
+ limitCanvasHeight();
+ limitCanvasY();
+
+ if (drawingEnabled)
+ {
+ enableDrawing();
+ }
+ redraw();
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+/**
+ * Get the length of the text string.
+ *
+ * @return The length of the text string.
+ */
+
+const int CMultiLineTextBox::getTextLength(void) const
+{
+ return m_text->getLength();
+}
+
+/**
+ * Sets the cursor display mode.
+ *
+ * @param cursorMode Determines cursor display mode
+ */
+
+void CMultiLineTextBox::showCursor(EShowCursor cursorMode)
+{
+ if (m_showCursor != cursorMode)
+ {
+ m_showCursor = (uint8_t)cursorMode;
+ redraw();
+ }
+}
+
+/**
+ * Move the cursor to the text position specified. 0 indicates the start
+ * of the string. If position is greater than the length of the string,
+ * the cursor is moved to the end of the string.
+ *
+ * @param position The new cursor position.
+ */
+
+void CMultiLineTextBox::moveCursorToPosition(const int position)
+{
+ CGraphicsPort *port = m_widgetControl->getGraphicsPort();
+
+ // Erase existing cursor
+
+ drawCursor(port);
+
+ // Force position to within confines of string
+
+ if (position < 0)
+ {
+ m_cursorPos = 0;
+ }
+ else
+ {
+ int len = (int)m_text->getLength();
+ m_cursorPos = len > position ? position : len;
+ }
+
+ // Draw cursor in new position
+
+ drawCursor(port);
+}
+
+/**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+void CMultiLineTextBox::insertText(const CNxString &text,
+ const unsigned int index)
+{
+ bool drawingEnabled = m_flags.drawingEnabled;
+ disableDrawing();
+
+ m_text->insert(text, index);
+
+ cullTopLines();
+ limitCanvasHeight();
+
+ moveCursorToPosition(index + text.getLength());
+
+ if (drawingEnabled)
+ {
+ enableDrawing();
+ }
+ redraw();
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+}
+
+/**
+ * Insert text at the current cursor position.
+ *
+ * @param text The text to insert.
+ */
+
+void CMultiLineTextBox::insertTextAtCursor(const CNxString &text)
+{
+ insertText(text, getCursorPosition());
+}
+
+/**
+ * Handle a keyboard press event.
+ *
+ * @param e The event data.
+ */
+
+void CMultiLineTextBox::handleKeyPressEvent(const CWidgetEventArgs &e)
+{
+ nxwidget_char_t key = e.getKey();
+
+ if (key == KEY_CODE_BACKSPACE)
+ {
+ // Delete character in front of cursor
+
+ if (m_cursorPos > 0)
+ {
+ removeText(m_cursorPos - 1, 1);
+ }
+ }
+ else if (key != KEY_CODE_NONE)
+ {
+ // Not modifier; append value
+
+ insertTextAtCursor(key);
+ }
+}
+
+/**
+ * Get the coordinates of the cursor relative to the text.
+ *
+ * @param x Will be populated with the x coordinate of the cursor.
+ * @param y Will be populated with the y coordinate of the cursor.
+ */
+
+void CMultiLineTextBox::getCursorCoordinates(nxgl_coord_t &x, nxgl_coord_t &y) const
+{
+ unsigned int cursorRow = 0;
+
+ x = 0;
+ y = 0;
+
+ // Only calculate the cursor position if the cursor isn't at the start
+ // of the text
+
+ if (m_cursorPos > 0)
+ {
+ // Calculate the row in which the cursor appears
+
+ cursorRow = m_text->getLineContainingCharIndex(m_cursorPos);
+
+ // Cursor line offset gives us the distance of the cursor from the
+ // start of the line
+
+ uint8_t cursorLineOffset = m_cursorPos - m_text->getLineStartIndex(cursorRow);
+
+ CStringIterator *iterator = m_text->newStringIterator();
+ iterator->moveTo(m_text->getLineStartIndex(cursorRow));
+
+ // Sum the width of each char in the row to find the x coordinate
+
+ for (int i = 0; i < cursorLineOffset; ++i)
+ {
+ x += getFont()->getCharWidth(iterator->getChar());
+ iterator->moveToNext();
+ }
+
+ delete iterator;
+ }
+
+ // Add offset of row to calculated value
+
+ x += getRowX(cursorRow);
+
+ // Calculate y coordinate of the cursor
+
+ y = getRowY(cursorRow);
+}
+
+/**
+ * Gets the index of the character at the specified x coordinate in the
+ * specified row.
+ *
+ * @param x X coordinate of the character.
+ * @param rowIndex Index of the row containing the character.
+ * @return The index of the character at the specified coordinate.
+ */
+
+int CMultiLineTextBox::getCharIndexAtCoordinate(nxgl_coord_t x, int rowIndex) const
+{
+ // Locate the character within the row
+
+ int startIndex = m_text->getLineStartIndex(rowIndex);
+ int stopIndex = m_text->getLineLength(rowIndex);
+ int width = getRowX(rowIndex);
+ int index = -1;
+
+ CStringIterator *iterator = m_text->newStringIterator();
+ iterator->moveTo(startIndex);
+
+ width += m_text->getFont()->getCharWidth(iterator->getChar());
+
+ for (int i = 0; i < stopIndex; ++i)
+ {
+ if (width > x)
+ {
+ if (i == 0)
+ {
+ // If the coordinate is on the left of the text, we add nothing
+ // to the index
+
+ index = startIndex;
+ }
+ else
+ {
+ // Character within the row.
+ // This is the character that contains the coordinate.
+
+ index = startIndex + i;
+ }
+ break;
+ }
+
+ iterator->moveToNext();
+ width += m_text->getFont()->getCharWidth(iterator->getChar());
+ }
+
+ delete iterator;
+
+ // If the coordinate is past the last character, index will still be -1.
+ // We need to set it to the last character
+
+ if (index == -1)
+ {
+ if (rowIndex == m_text->getLineCount() - 1)
+ {
+ // Index past the end point of the text, so return an index
+ // just past the text
+
+ index = startIndex + stopIndex;
+ }
+ else
+ {
+ // Index at the end of a row, so return the last index of the
+ // row
+
+ index = startIndex + stopIndex - 1;
+ }
+ }
+
+ return index;
+}
+
+/**
+ * Get the index of the character at the specified coordinates.
+ *
+ * @param x X coordinate of the character.
+ * @param y Y coordinate of the character.
+ * @return The index of the character at the specified coordinates.
+ */
+
+unsigned int
+CMultiLineTextBox::getCharIndexAtCoordinates(nxgl_coord_t x, nxgl_coord_t y) const
+{
+ int rowIndex = getRowContainingCoordinate(y);
+ return getCharIndexAtCoordinate(x, rowIndex);
+}
+
+/**
+ * Get the row containing the specified Y coordinate.
+ *
+ * @param y Y coordinate to locate.
+ * @return The index of the row containing the specified Y coordinate.
+ */
+
+int CMultiLineTextBox::getRowContainingCoordinate(nxgl_coord_t y) const
+{
+ int row = -1;
+
+ // Locate the row containing the character
+
+ for (int i = 0; i < m_text->getLineCount(); ++i)
+ {
+ // Abort search if we've found the row below the y coordinate
+
+ if (getRowY(i) > y)
+ {
+ if (i == 0)
+ {
+ // If the coordinate is above the text, we return the top
+ // row
+
+ row = 0;
+ }
+ else
+ {
+ // Row within the text, so return the previous row - this is
+ // the row that contains the coordinate.
+
+ row = i - 1;
+ }
+
+ break;
+ }
+ }
+
+ // If the coordinate is below the text, row will still be -1.
+ // We need to set it to the last row
+
+ if (row == -1)
+ {
+ row = m_text->getLineCount() - 1;
+ }
+
+ return row;
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CMultiLineTextBox::drawContents(CGraphicsPort *port)
+{
+ drawText(port);
+
+ // Draw the cursor
+
+ drawCursor(port);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CMultiLineTextBox::drawBorder(CGraphicsPort *port)
+{
+ port->drawFilledRect(0, 0, getWidth(), getHeight(), getBackgroundColor());
+
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(0, 0, getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Move cursor one character to the left.
+ */
+
+void CMultiLineTextBox::moveCursorLeft(void)
+{
+ if (m_cursorPos > 0)
+ {
+ moveCursorToPosition(m_cursorPos - 1);
+ }
+
+ jumpToCursor();
+}
+
+/**
+ * Move cursor one character to the right.
+ */
+
+void CMultiLineTextBox::moveCursorRight(void)
+{
+ if (m_cursorPos < (int)m_text->getLength())
+ {
+ moveCursorToPosition(m_cursorPos + 1);
+ }
+
+ jumpToCursor();
+}
+
+/**
+ * Move cursor one row upwards.
+ */
+
+void CMultiLineTextBox::moveCursorUp(void)
+{
+ nxgl_coord_t cursorX = 0;
+ nxgl_coord_t cursorY = 0;
+
+ getCursorCoordinates(cursorX, cursorY);
+
+ // Get the midpoint of the cursor. We use the midpoint to ensure that
+ // the cursor does not drift off to the left as it moves up the text, which
+ // is a problem when we use the left edge as the reference point when the
+ // font is proportional
+
+ cursorX += m_text->getFont()->getCharWidth(m_text->getCharAt(m_cursorPos)) >> 1;
+
+ // Locate the character above the midpoint
+
+ int index = getCharIndexAtCoordinates(cursorX, cursorY + m_text->getLineHeight());
+ moveCursorToPosition(index);
+ jumpToCursor();
+}
+
+/**
+ * Move cursor one row downwards.
+ */
+
+void CMultiLineTextBox::moveCursorDown(void)
+{
+ nxgl_coord_t cursorX = 0;
+ nxgl_coord_t cursorY = 0;
+
+ getCursorCoordinates(cursorX, cursorY);
+
+ // Get the midpoint of the cursor. We use the midpoint to ensure that
+ // the cursor does not drift off to the left as it moves up the text, which
+ // is a problem when we use the left edge as the reference point when the
+ // font is proportional
+
+ cursorX += m_text->getFont()->getCharWidth(m_text->getCharAt(m_cursorPos)) >> 1;
+
+ // Locate the character above the midpoint
+
+ int index = getCharIndexAtCoordinates(cursorX, cursorY - m_text->getLineHeight());
+ moveCursorToPosition(index);
+ jumpToCursor();
+}
+
+/**
+ * Ensures that the textbox only contains the maximum allowed
+ * number of rows by culling any excess rows from the top of
+ * the text.
+ *
+ * @return True if lines were removed from the text; false if not.
+ */
+
+bool CMultiLineTextBox::cullTopLines(void)
+{
+ // Ensure that we have the correct number of rows
+
+ if (m_text->getLineCount() > m_maxRows)
+ {
+ m_text->stripTopLines(m_text->getLineCount() - m_maxRows);
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Ensures that the canvas height is the height of the widget,
+ * if the widget exceeds the size of the text, or the height of
+ * the text if the text exceeds the size of the widget.
+ */
+
+void CMultiLineTextBox::limitCanvasHeight(void)
+{
+ m_canvasHeight = m_text->getPixelHeight();
+
+ CRect rect;
+ getClientRect(rect);
+ if (m_canvasHeight < rect.getHeight())
+ {
+ m_canvasHeight = rect.getHeight();
+ }
+}
+
+/**
+ * Ensures that the canvas cannot scroll beyond its height.
+ */
+
+void CMultiLineTextBox::limitCanvasY(void)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ // Ensure that the visible portion of the canvas is not less than the
+ // height of the viewer window
+
+ if (m_canvasY + m_canvasHeight < rect.getHeight())
+ {
+ jumpToTextBottom();
+ }
+}
+
+/**
+ * Jumps to the cursor coordinates of the text.
+ */
+
+void CMultiLineTextBox::jumpToCursor(void)
+{
+ // Get the co-odinates of the cursor
+
+ nxgl_coord_t cursorX;
+ nxgl_coord_t cursorY;
+
+ getCursorCoordinates(cursorX, cursorY);
+
+ // Work out which row the cursor falls within
+
+ int cursorRow = m_text->getLineContainingCharIndex(m_cursorPos);
+ nxgl_coord_t rowY = getRowY(cursorRow);
+
+ // If the cursor is outside the visible portion of the canvas, jump to it
+
+ CRect rect;
+ getClientRect(rect);
+
+ if (rowY + m_text->getLineHeight() + m_canvasY > rect.getHeight())
+ {
+ // Cursor is below the visible portion of the canvas, so
+ // jump down so that the cursor's row is the bottom row of
+ // text
+
+ jump(0, -(rowY + m_text->getLineHeight() - rect.getHeight()));
+ }
+ else if (rowY + m_canvasY < 0)
+ {
+ // Cursor is above the visible portion of the canvas, so
+ // jump up so that the cursor's row is the top row of text
+
+ jump(0, -cursorY);
+ }
+}
+
+/**
+ * Jumps to the bottom of the text.
+ */
+
+void CMultiLineTextBox::jumpToTextBottom(void)
+{
+ CRect rect;
+ getClientRect(rect);
+ jump(0, -(m_canvasHeight - rect.getHeight()));
+}
+
+/**
+ * Resize the textbox to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CMultiLineTextBox::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Ensure the base class resize method is called
+
+ CScrollingPanel::onResize(width, height);
+
+ // Resize the canvas' width
+
+ CRect rect;
+ getClientRect(rect);
+
+ m_canvasWidth = rect.getWidth();
+ m_canvasHeight = rect.getHeight();
+ m_canvasX = 0;
+ m_canvasY = 0;
+
+ calculateVisibleRows();
+
+ // Re-wrap the text
+
+ m_text->setWidth(getWidth());
+ m_text->wrap();
+
+ bool raiseEvent = cullTopLines();
+ limitCanvasHeight();
+ limitCanvasY();
+
+ if (raiseEvent)
+ {
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+}
+
+/**
+ * Starts the dragging system.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CMultiLineTextBox::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ startDragging(x, y);
+
+ // Move cursor to clicked coordinates
+
+ CRect rect;
+ getClientRect(rect);
+
+ // Adjust x and y from screen coordinates to canvas coordinates
+
+ nxgl_coord_t canvasRelativeX = x - getX() - rect.getX() - m_canvasX;
+ nxgl_coord_t canvasRelativeY = y - getY() - rect.getY() - m_canvasY;
+
+ moveCursorToPosition(getCharIndexAtCoordinates(canvasRelativeX, canvasRelativeY));
+}
+
+/**
+ * Opens the keyboard on the bottom display.
+ *
+ * @param x The x coordinates of the click.
+ * @param y The y coordinates of the click.
+ */
+
+void CMultiLineTextBox::onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+}
+
+/**
+ * Handles cursor control events. Moves the cursor
+ * in the direction selected.
+ *
+ * @param key The key that was pressed.
+ */
+
+void CMultiLineTextBox::handleCursorControlEvent(const CWidgetEventArgs &e)
+{
+ ECursorControl control = e.getCursorControl();
+
+ switch (control)
+ {
+ case CURSOR_LEFT:
+ moveCursorLeft();
+ break;
+
+ case CURSOR_RIGHT:
+ moveCursorRight();
+ break;
+
+ case CURSOR_UP:
+ moveCursorDown();
+ break;
+
+ case CURSOR_DOWN:
+ moveCursorUp();
+ break;
+
+ default:
+ // Not interested in other controls
+
+ break;
+ }
+}
+
+/**
+ * Handle a keyboard press event.
+ *
+ * @param e The event data.
+ */
+
+ void handleKeyPressEvent(const CWidgetEventArgs &e);
+
+/**
+ * Gets the x position of a row of text based on the width of the row and the
+ * type of horizontal alignment currently set.
+ *
+ * @param row The index of the row.
+ * @return The x coordinate of the row.
+ */
+
+nxgl_coord_t CMultiLineTextBox::getRowX(int row) const
+{
+ CRect rect;
+ getClientRect(rect);
+
+ uint8_t rowLength = m_text->getLineTrimmedLength(row);
+ uint8_t rowPixelWidth = m_text->getFont()->getStringWidth(*m_text, m_text->getLineStartIndex(row), rowLength);
+
+ // Calculate horizontal position
+
+ switch (m_hAlignment)
+ {
+ case TEXT_ALIGNMENT_HORIZ_CENTER:
+ return (rect.getWidth() - rowPixelWidth) >> 1;
+
+ case TEXT_ALIGNMENT_HORIZ_LEFT:
+ return 0;
+
+ case TEXT_ALIGNMENT_HORIZ_RIGHT:
+ return rect.getWidth() - rowPixelWidth;
+ }
+
+ // Will never be reached
+
+ return 0;
+}
+
+/**
+ * Gets the y position of the specified row of text based on the type of
+ * vertical alignment currently set.
+ *
+ * @param row The row number to find the y coordinate of.
+ * @return The y coordinate of the specified row of text.
+ */
+
+nxgl_coord_t CMultiLineTextBox::getRowY(int row) const
+{
+ // If the amount of text exceeds the size of the widget, force
+ // the text to be top-aligned
+
+ if (m_visibleRows <= m_text->getLineCount())
+ {
+ return row * m_text->getLineHeight();
+ }
+
+ // All text falls within the textbox, so obey the alignment
+ // options
+
+ nxgl_coord_t textY = 0;
+ nxgl_coord_t startPos = 0;
+
+ int canvasRows = 0;
+ int textRows = 0;
+
+ CRect rect;
+ getClientRect(rect);
+
+ // Calculate vertical position
+
+ switch (m_vAlignment)
+ {
+ case TEXT_ALIGNMENT_VERT_CENTER:
+
+ // Calculate the maximum number of rows
+
+ canvasRows = m_canvasHeight / m_text->getLineHeight();
+ textY = row * m_text->getLineHeight();
+
+ // Get the number of rows of text
+
+ textRows = m_text->getLineCount();
+
+ // Ensure there's always one row
+
+ if (textRows == 0)
+ {
+ textRows = 1;
+ }
+
+ // Calculate the start position of the block of text
+
+ startPos = ((canvasRows - textRows) * m_text->getLineHeight()) >> 1;
+
+ // Calculate the row Y coordinate
+
+ textY = startPos + textY;
+ break;
+
+ case TEXT_ALIGNMENT_VERT_TOP:
+ textY = row * m_text->getLineHeight();
+ break;
+
+ case TEXT_ALIGNMENT_VERT_BOTTOM:
+ textY = rect.getHeight() - (((m_text->getLineCount() - row) * m_text->getLineHeight()));
+ break;
+ }
+
+ return textY;
+}
+
+/**
+ * Return true if the cursor is visible
+ */
+
+bool CMultiLineTextBox::isCursorVisible(void) const
+{
+ return (m_showCursor == SHOW_CURSOR_ALWAYS ||
+ (m_showCursor == SHOW_CURSOR_ONFOCUS && hasFocus()));
+}
+
+/**
+ * Gets the character under the cursor.
+ *
+ * @return The character under the cursor.
+ */
+
+nxwidget_char_t CMultiLineTextBox::getCursorChar(void) const
+{
+ if (m_cursorPos < m_text->getLength())
+ {
+ return m_text->getCharAt(m_cursorPos);
+ }
+ else
+ {
+ return ' ';
+ }
+}
+
+/**
+ * Works out the number of visible rows within the textbox.
+ */
+
+void CMultiLineTextBox::calculateVisibleRows(void)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ m_visibleRows = rect.getHeight() / m_text->getLineHeight();
+}
+
+/**
+ * Draws text.
+ *
+ * @param port The CGraphicsPort to draw to.
+ */
+
+void CMultiLineTextBox::drawText(CGraphicsPort *port)
+{
+ // Early exit if there is no text to display
+
+ if (m_text->getLineCount() == 0)
+ {
+ return;
+ }
+
+ // Determine the top and bottom rows within the graphicsport's clip rect.
+ // We only draw these rows in order to increase the speed of the routine.
+
+ int regionY = -m_canvasY + m_rect.getY(); // Y coord of canvas visible region
+ int topRow = getRowContainingCoordinate(regionY);
+ int bottomRow = getRowContainingCoordinate(regionY + m_rect.getHeight());
+
+ // Early exit checks
+
+ if ((topRow < 0) && (bottomRow < 0))
+ {
+ return;
+ }
+
+ if ((bottomRow >= m_text->getLineCount()) && (topRow >= m_text->getLineCount()))
+ {
+ return;
+ }
+
+ // Prevent overflows
+
+ if (topRow < 0)
+ {
+ topRow = 0;
+ }
+
+ if (bottomRow >= m_text->getLineCount())
+ {
+ bottomRow = m_text->getLineCount() - 1;
+ }
+
+ // Draw lines of text
+
+ int currentRow = topRow;
+
+ // Draw all rows in this region
+
+ while (currentRow <= bottomRow)
+ {
+ drawRow(port, currentRow);
+ currentRow++;
+ }
+}
+
+/**
+ * Draws the cursor.
+ *
+ * @param port The CGraphicsPort to draw to.
+ */
+
+void CMultiLineTextBox::drawCursor(CGraphicsPort *port)
+{
+ // Get the cursor coordinates
+
+ if (isCursorVisible())
+ {
+ nxgl_coord_t cursorX = 0;
+ nxgl_coord_t cursorY = 0;
+
+ getCursorCoordinates(cursorX, cursorY);
+
+ // Adjust for canvas offsets
+
+ cursorX += m_canvasX;
+ cursorY += m_canvasY;
+
+ // Draw cursor
+
+ port->invert(cursorX, cursorY,
+ m_text->getFont()->getCharWidth( getCursorChar()),
+ m_text->getFont()->getHeight());
+ }
+}
+
+/**
+ * Draws a single line of text.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @param row The index of the row to draw.
+ */
+
+void CMultiLineTextBox::drawRow(CGraphicsPort *port, int row)
+{
+ // Get the drawing region
+
+ CRect rect;
+ getRect(rect);
+
+ uint8_t rowLength = m_text->getLineTrimmedLength(row);
+
+ struct nxgl_point_s pos;
+ pos.x = getRowX(row) + m_canvasX;
+ pos.y = getRowY(row) + m_canvasY;
+
+ // Determine the background and text color
+
+ nxgl_mxpixel_t textColor;
+
+ if (!isEnabled())
+ {
+ textColor = getDisabledTextColor();
+ }
+ else
+ {
+ textColor = getEnabledTextColor();
+ }
+
+ // And draw the text using the selected color
+
+ port->drawText(&pos, &rect, m_text->getFont(), *m_text,
+ m_text->getLineStartIndex(row), rowLength, textColor);
+}
diff --git a/NxWidgets/libnxwidgets/src/cnxfont.cxx b/NxWidgets/libnxwidgets/src/cnxfont.cxx
new file mode 100644
index 000000000..189cfb9e0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxfont.cxx
@@ -0,0 +1,276 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxfont.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <cstring>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nxfonts.h>
+
+#include "nxconfig.hxx"
+#include "cnxstring.hxx"
+#include "cstringiterator.hxx"
+#include "cnxfont.hxx"
+#include "cbitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CNxFont Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * CNxFont Constructor.
+ *
+ * @param fontid The font ID to use.
+ * @param fontColor The font color to use.
+ * @param transparentColor The color in the font bitmap used as the
+ * background color.
+ */
+
+CNxFont::CNxFont(enum nx_fontid_e fontid, nxgl_mxpixel_t fontColor,
+ nxgl_mxpixel_t transparentColor)
+{
+ m_fontId = fontid;
+ m_fontHandle = nxf_getfonthandle(fontid);
+ m_pFontSet = nxf_getfontset(m_fontHandle);
+ m_fontColor = fontColor;
+ m_transparentColor = transparentColor;
+}
+
+/**
+ * Checks if supplied character is blank in the current font.
+ *
+ * @param letter The character to check.
+ * @return True if the glyph contains any pixels to be drawn. False if
+ * the glyph is blank.
+ */
+
+const bool CNxFont::isCharBlank(const nxwidget_char_t letter) const
+{
+ FAR const struct nx_fontbitmap_s *fbm;
+
+ /* Get the bitmap associated with the character */
+
+ fbm = nxf_getbitmap(m_fontHandle, (uint16_t)letter);
+ return (fbm == NULL);
+}
+
+/**
+ * Draw an individual character of the font to the specified bitmap.
+ *
+ * @param bitmap The bitmap to draw use. The caller should use
+ * the getFontMetrics method to assure that the buffer will hold
+ * the font.
+ * @param letter The character to output.
+ *
+ * @return The width of the string in pixels.
+ */
+
+void CNxFont::drawChar(FAR SBitmap *bitmap, nxwidget_char_t letter)
+{
+ // Get the NX bitmap associated with the font
+
+ FAR const struct nx_fontbitmap_s *fbm;
+ fbm = nxf_getbitmap(m_fontHandle, letter);
+ if (fbm)
+ {
+ // Get information about the font bitmap
+
+ uint8_t fwidth = fbm->metric.width + fbm->metric.xoffset;
+ uint8_t fheight = fbm->metric.height + fbm->metric.yoffset;
+ uint8_t fstride = (fwidth * bitmap->bpp + 7) >> 3;
+
+ // Then render the glyph into the bitmap memory
+
+ (void)FONT_RENDERER((FAR nxgl_mxpixel_t*)bitmap->data, fheight,
+ fwidth, fstride, fbm, m_fontColor);
+ }
+}
+
+/**
+ * Get the width of a string in pixels when drawn with this font.
+ *
+ * @param text The string to check.
+ * @return The width of the string in pixels.
+ */
+
+nxgl_coord_t CNxFont::getStringWidth(const CNxString &text) const
+{
+ CStringIterator *iter = text.newStringIterator();
+
+ // Get the width of the string of characters
+ // Move to the first character
+
+ unsigned int width = 0;
+ if (iter->moveToFirst())
+ {
+ // moveToFirst returns true if there is at least one character
+
+ do
+ {
+ // Add the width of the font bitmap for this character and
+ // move the the next character
+
+ nxwidget_char_t ch = iter->getChar();
+
+ width += getCharWidth(ch);
+ }
+ while (iter->moveToNext());
+ }
+
+ // Return the total width
+
+ delete iter;
+ return width;
+}
+
+/**
+ * Get the width of a portion of a string in pixels when drawn with this
+ * font.
+ *
+ * @param text The string to check.
+ * @param startIndex The start point of the substring within the string.
+ * @param length The length of the substring in chars.
+ * @return The width of the substring in pixels.
+ */
+
+nxgl_coord_t CNxFont::getStringWidth(const CNxString &text,
+ int startIndex, int length) const
+{
+ CStringIterator *iter = text.newStringIterator();
+
+ // Get the width of the string of characters
+
+ iter->moveTo(startIndex);
+ unsigned int width = 0;
+
+ while (length-- > 0)
+ {
+ // Add the width of the font bitmap for this character
+
+ nxwidget_char_t ch = iter->getChar();
+ width += getCharWidth(ch);
+
+ // Position to the next character in the string
+
+ if (!iter->moveToNext())
+ {
+ break;
+ }
+ }
+
+ // Return the total width
+
+ delete iter;
+ return width;
+}
+
+/**
+ * Gets font metrics for a particular character
+ *
+ * @param letter The character to get the width of.
+ * @param metrics The location to return the font metrics
+ */
+
+void CNxFont::getCharMetrics(nxwidget_char_t letter,
+ FAR struct nx_fontmetric_s *metrics) const
+{
+ FAR const struct nx_fontbitmap_s *fbm;
+
+ // Get the font bitmap for this character
+
+ fbm = nxf_getbitmap(m_fontHandle, letter);
+ if (fbm)
+ {
+ // Return the metrics of the font
+
+ memcpy(metrics, &fbm->metric, sizeof(struct nx_fontmetric_s));
+ }
+ else
+ {
+ // Use the metrics of a space which has no width and no height
+ // but an xoffset equal to the standard width of a space.
+
+ metrics->stride = (m_pFontSet->spwidth * CONFIG_NXWIDGETS_BPP + 7) >> 3;
+ metrics->width = 0;
+ metrics->height = 0;
+ metrics->xoffset = m_pFontSet->spwidth;
+ metrics->yoffset = 0;
+ }
+}
+
+/**
+ * Get the width of an individual character.
+ *
+ * @param letter The character to get the width of.
+ * @return The width of the character in pixels.
+ */
+
+nxgl_coord_t CNxFont::getCharWidth(nxwidget_char_t letter) const
+{
+ FAR const struct nx_fontbitmap_s *fbm;
+ nxgl_coord_t width;
+
+ /* Get the font bitmap for this character */
+
+ fbm = nxf_getbitmap(m_fontHandle, letter);
+ if (fbm)
+ {
+ /* Return the width of the font -- including the X offset */
+
+ width = fbm->metric.width + fbm->metric.xoffset;
+ }
+ else
+ {
+ /* Use the width of a space */
+
+ width = m_pFontSet->spwidth;
+ }
+
+ return width;
+}
diff --git a/NxWidgets/libnxwidgets/src/cnxserver.cxx b/NxWidgets/libnxwidgets/src/cnxserver.cxx
new file mode 100644
index 000000000..2f36b0f2d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxserver.cxx
@@ -0,0 +1,386 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxserver.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <cerrno>
+#include <debug.h>
+
+#ifdef CONFIG_NX_MULTIUSER
+# include <sched.h>
+# include <pthread.h>
+#endif
+
+#include "nxconfig.hxx"
+#include "singletons.hxx"
+#include "cnxserver.hxx"
+
+/****************************************************************************
+ * Static Data Members
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+uint8_t CNxServer::m_nServers; /**< The number of NX server instances */
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+/**
+ * CNXServer constructor
+ */
+
+CNxServer::CNxServer(void)
+{
+ // Initialize server instance state data
+
+ m_hDevice = (FAR NX_DRIVERTYPE *)NULL; // LCD/Framebuffer device handle
+ m_hNxServer = (NXHANDLE)NULL; // NX server handle
+#ifdef CONFIG_NX_MULTIUSER
+ m_connected = false; // True: Connected to the server
+ sem_init(&m_connsem, 0, 0); // Wait for server connection
+#endif
+
+ // Increment the global count of NX servers. Normally there is only one
+ // but we don't want to preclude the case where there might be multiple
+ // displays, each with its own NX server instance
+
+ m_nServers++;
+
+ // Create miscellaneous singleton instances. Why is this done here?
+ // Because this needs to be done once before any widgets are created and we
+ // don't want to rely on static constructors.
+
+ instantiateSingletons();
+}
+
+/**
+ * CNXServer destructor
+ */
+
+CNxServer::~CNxServer(void)
+{
+ // Disconnect from the server
+
+ disconnect();
+
+ // Decrement the count of NX servers. When that count goes to zero,
+ // delete all of the fake static instances
+
+ if (--m_nServers == 0)
+ {
+ freeSingletons();
+ }
+}
+
+/**
+ * Connect to the NX Server -- Single user version
+ */
+
+#ifndef CONFIG_NX_MULTIUSER
+bool CNxServer::connect(void)
+{
+#if defined(SCREENS_EXTERNINIT)
+ // Use external graphics driver initialization
+
+ m_hDevice = up_nxdrvinit(CONFIG_NXWIDGETS_DEVNO);
+ if (!m_hDevice)
+ {
+ gdbg("up_nxdrvinit failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO);
+ return false;
+ }
+
+#elif defined(CONFIG_NX_LCDDRIVER)
+ int ret;
+
+ // Initialize the LCD device
+
+ ret = up_lcdinitialize();
+ if (ret < 0)
+ {
+ gdbg("up_lcdinitialize failed: %d\n", -ret);
+ return false;
+ }
+
+ // Get the device instance
+
+ m_hDevice = up_lcdgetdev(CONFIG_NXWIDGETS_DEVNO);
+ if (!m_hDevice)
+ {
+ gdbg("up_lcdgetdev failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO);
+ return false;
+ }
+
+ // Turn the LCD on at 75% power
+
+ (void)m_hDevice->setpower(m_hDevice, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
+#else
+ int ret;
+
+ // Initialize the frame buffer device
+
+ ret = up_fbinitialize();
+ if (ret < 0)
+ {
+ gdbg("up_fbinitialize failed: %d\n", -ret);
+ return false;
+ }
+
+ m_hDevice = up_fbgetvplane(CONFIG_NXWIDGETS_VPLANE);
+ if (!m_hDevice)
+ {
+ gdbg("CNxServer::connect: up_fbgetvplane failed, vplane=%d\n",
+ CONFIG_NXWIDGETS_VPLANE);
+ return false;
+ }
+#endif
+
+ // Then open NX
+
+ m_hNxServer = nx_open(m_hDevice);
+ if (!m_hNxServer)
+ {
+ gdbg("CNxServer::connect: nx_open failed: %d\n", errno);
+ return false;
+ }
+
+ return true;
+}
+#endif
+
+/**
+ * Connect to the NX Server -- Multi user version
+ */
+
+#ifdef CONFIG_NX_MULTIUSER
+bool CNxServer::connect(void)
+{
+ struct sched_param param;
+ pthread_t thread;
+ pid_t serverId;
+ int ret;
+
+ // Set the client task priority
+
+ param.sched_priority = CONFIG_NXWIDGETS_CLIENTPRIO;
+ ret = sched_setparam(0, &param);
+ if (ret < 0)
+ {
+ gdbg("CNxServer::connect: sched_setparam failed: %d\n" , ret);
+ return false;
+ }
+
+ // Start the server task
+
+ message("NxServer::connect: Starting nx_servertask task\n");
+ serverId = task_create("NX Server", CONFIG_NXWIDGETS_SERVERPRIO,
+ CONFIG_NXWIDGETS_STACKSIZE, nx_servertask, NULL);
+ if (serverId < 0)
+ {
+ message("NxServer::connect: Failed to create nx_servertask task: %d\n", errno);
+ return false;
+ }
+
+ // Wait a bit to let the server get started
+
+ sleep(1);
+
+ // Connect to the server
+
+ m_hNxServer = nx_connect();
+ if (m_hNxServer)
+ {
+ pthread_attr_t attr;
+
+ // Start a separate thread to listen for server events. This is probably
+ // the least efficient way to do this, but it makes this logic flow more
+ // smoothly.
+
+ (void)pthread_attr_init(&attr);
+ param.sched_priority = CONFIG_NXWIDGETS_LISTENERPRIO;
+ (void)pthread_attr_setschedparam(&attr, &param);
+ (void)pthread_attr_setstacksize(&attr, CONFIG_NXWIDGETS_STACKSIZE);
+
+ m_stop = false;
+ m_running = true;
+
+ ret = pthread_create(&thread, &attr, listener, (FAR void *)this);
+ if (ret != 0)
+ {
+ printf("NxServer::connect: pthread_create failed: %d\n", ret);
+ m_running = false;
+ disconnect();
+ return false;
+ }
+
+ // Don't return until we are connected to the server
+
+ while (!m_connected && m_running)
+ {
+ // Wait for the listener thread to wake us up when we really
+ // are connected.
+
+ (void)sem_wait(&m_connsem);
+ }
+
+ // In the successful case, the listener is still running (m_running)
+ // and the server is connected (m_connected). Anything else is a failure.
+
+ if (!m_connected !! !m_running)
+ {
+ disconnect();
+ return false;
+ }
+ }
+ else
+ {
+ gdbg("NxServer::connect: nx_connect failed: %d\n", errno);
+ return false;
+ }
+
+ return true;
+}
+#endif
+
+/**
+ * Disconnect to the NX Server -- Single user version
+ */
+
+#ifndef CONFIG_NX_MULTIUSER
+void CNxServer::disconnect(void)
+{
+ /* Close the server */
+
+ if (m_hNxServer)
+ {
+ nx_close(m_hNxServer);
+ m_hNxServer = NULL;
+ }
+}
+#endif
+
+/**
+ * Disconnect to the NX Server -- Single user version
+ */
+
+#ifdef CONFIG_NX_MULTIUSER
+void CNxServer::disconnect(void)
+{
+ // Is the listener running?
+ // Hmm.. won't this hang is the listener is in a blocking call?
+
+ while (m_running)
+ {
+ // Yes.. stop the listener thread
+
+ m_stop = true;
+ while (m_running)
+ {
+ // Wait for the listener thread to stop
+
+ (void)sem_wait(&m_connsem);
+ }
+ }
+
+ /* Disconnect from the server */
+
+ if (m_hNxServer)
+ {
+ nx_disconnect(m_hNxServer);
+ m_hNxServer = NULL;
+ }
+}
+#endif
+
+/**
+ * This is the entry point of a thread that listeners for and dispatches
+ * events from the NX server.
+ */
+
+#ifdef CONFIG_NX_MULTIUSER
+FAR void *CNxServer::listener(FAR void *arg)
+{
+ // The argument must be the CNxServer instance
+
+ CNxServer *This = (CNxServer*)pvArg;
+
+ // Process events forever
+
+ while (!This->m_stop)
+ {
+ // Handle the next event. If we were configured blocking, then
+ // we will stay right here until the next event is received. Since
+ // we have dedicated a while thread to servicing events, it would
+ // be most natural to also select CONFIG_NX_BLOCKING -- if not, the
+ // following would be a tight infinite loop (unless we added addition
+ // logic with nx_eventnotify and sigwait to pace it).
+
+ int ret = nx_eventhandler(This->m_hNxServer);
+ if (ret < 0)
+ {
+ // An error occurred... assume that we have lost connection with
+ // the server.
+
+ gdbg("CNxServer::listener: Lost server connection: %d\n", errno);
+ break;
+ }
+
+ /* If we received a message, we must be connected */
+
+ if (!This->m_connected)
+ {
+ This->m_connected = true;
+ sem_post(&This->m_connsem);
+ gdbg("CNxServer::listener: Connected\n");
+ }
+ }
+
+ // We fall out of the loop when either (1) the server has died or
+ // we have been requested to stop
+
+ This->m_running = false;
+ This->m_connected = false;
+ sem_post(&This->m_connsem);
+ return NULL;
+}
+#endif
diff --git a/NxWidgets/libnxwidgets/src/cnxstring.cxx b/NxWidgets/libnxwidgets/src/cnxstring.cxx
new file mode 100644
index 000000000..3ad3855b9
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxstring.cxx
@@ -0,0 +1,799 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxstring.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include "cnxstring.hxx"
+#include "cstringiterator.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CNxString Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor to create an empty string object.
+ */
+
+CNxString::CNxString()
+{
+ m_text = (FAR nxwidget_char_t *)NULL;
+ m_stringLength = 0;
+ m_allocatedSize = 0;
+ m_growAmount = 16;
+}
+
+/**
+ * Constructor to create a string from a C character array.
+ *
+ * @param text Pointer to a char array to use as the basis of the
+ * string.
+ */
+
+CNxString::CNxString(FAR const char *text)
+{
+ m_text = (FAR nxwidget_char_t *)NULL;
+ m_stringLength = 0;
+ m_allocatedSize = 0;
+ m_growAmount = 16;
+
+ setText(text);
+}
+
+/**
+ * Constructor to create a string from a single character.
+ * @param letter Single character to use as the basis of the string.
+ */
+
+CNxString::CNxString(const nxwidget_char_t text)
+{
+ m_text = (FAR nxwidget_char_t *)NULL;
+ m_stringLength = 0;
+ m_allocatedSize = 0;
+ m_growAmount = 16;
+
+ setText(text);
+}
+
+CNxString::CNxString(const CNxString &string)
+{
+ m_text = (FAR nxwidget_char_t *)NULL;
+ m_stringLength = 0;
+ m_allocatedSize = 0;
+ m_growAmount = 16;
+
+ setText(string);
+}
+
+/**
+ * Creates and returns a new CCStringIterator object that will iterate
+ * over this string. The object must be manually deleted once it is
+ * no longer needed.
+ *
+ * @return A new CCStringIterator object.
+ */
+
+CStringIterator *CNxString::newStringIterator() const
+{
+ return new CStringIterator(this);
+}
+
+/**
+ * Copy the internal array to the supplied buffer. The buffer must be
+ * large enough to contain the full text in the string. The
+ * getByteCount() method can be used to obtain the length of the string.
+ * Unlike the CNxString class, the char array is null-terminated.
+ * The buffer must be (getByteCount() + 2) bytes long, in order to
+ * accommodate the terminator.
+ *
+ * @param buffer Buffer to copy the internal char array to.
+ */
+
+void CNxString::copyToCharArray(FAR nxwidget_char_t *buffer) const
+{
+ unsigned int dataLength = sizeof(nxwidget_char_t) * m_stringLength;
+ memcpy(buffer, m_text, dataLength);
+ buffer[dataLength] = '\0';
+}
+
+/**
+ * Set the text in the string.
+ *
+ * @param text CNxString containing the new data for this string.
+ */
+
+void CNxString::setText(const CNxString &text)
+{
+ // Ensure we've got enough memory available
+
+ allocateMemory(text.getLength(), false);
+
+ // Copy the text into the internal array
+
+ memcpy(m_text, text.getCharArray(), sizeof(nxwidget_char_t) * text.getLength());
+
+ // Save size (in characters) of the string
+
+ m_stringLength = text.getLength();
+}
+
+/**
+ * Set the 8-bit C-string text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+void CNxString::setText(FAR const char *text)
+{
+ int length = strlen(text);
+
+ // Ensure we've got enough memory available
+
+ allocateMemory(length, false);
+
+ // Copy characters into m_text, converting from 8- to 16-bit characters
+ // (if necessary) and cache the length
+
+ for (int i = 0; i < length; i++)
+ {
+ m_text[i] = (nxwidget_char_t)text[i];
+ }
+
+ m_stringLength = length;
+}
+
+/**
+ * Set the text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+void CNxString::setText(FAR const nxwidget_char_t *text, int nchars)
+{
+ // Ensure we've got enough memory available
+
+ allocateMemory(nchars, false);
+
+ // Copy characters into m_text and cache the length
+
+ m_stringLength = nchars;
+ memcpy(m_text, text, sizeof(nxwidget_char_t) * nchars);
+}
+
+/**
+ * Set the text in the string.
+ *
+ * @param text Character to to use as the new data for this string.
+ */
+
+void CNxString::setText(const nxwidget_char_t letter)
+{
+ // Ensure we've got enough memory available
+
+ allocateMemory(1, false);
+
+ // Copy the valid character into m_text and cache the length
+
+ *m_text = letter;
+ m_stringLength = 1;
+}
+
+/**
+ * Append text to the end of the string.
+ *
+ * @param text String to append.
+ */
+
+void CNxString::append(const CNxString &text)
+{
+ // Ensure we've got enough memory available
+
+ allocateMemory(m_stringLength + text.getLength(), true);
+
+ // Append the new string to the end of the array
+
+ FAR nxwidget_char_t *dest = &m_text[m_stringLength];
+ FAR const nxwidget_char_t *src = text.getCharArray();
+ for (int i = 0; i < text.getLength(); i++)
+ {
+ *dest++ = *src++;
+ }
+
+ // Update the size in characters and the size in bytes
+
+ m_stringLength += text.getLength();
+}
+
+/**
+ * Insert text at the specified character index.
+ *
+ * @param text The text to insert.
+ * @param index The index at which to insert the text.
+ */
+
+void CNxString::insert(const CNxString &text, int index)
+{
+ // Early exit if the string is empty
+
+ if (!hasData())
+ {
+ CNxString::setText(text);
+ return;
+ }
+
+ // Early exit if we're just appending
+
+ if (index >= m_stringLength)
+ {
+ CNxString::append(text);
+ return;
+ }
+
+ // Get the total size of the string that we need
+
+ int newLength = m_stringLength + text.getLength();
+ int newSize = newLength * sizeof(nxwidget_char_t);
+
+ // Reallocate memory if the existing memory isn't large enough
+
+ if (m_allocatedSize < newSize)
+ {
+ int allocLength = newLength + m_growAmount;
+
+ // Allocate new string large enough to contain additional data
+
+ FAR nxwidget_char_t *newText = new nxwidget_char_t[allocLength];
+
+ // Copy the start of the existing text to the newly allocated string
+
+ FAR nxwidget_char_t *dest = newText;
+ FAR const nxwidget_char_t *src = m_text;
+ for (int i = 0; i < index; i++)
+ {
+ *dest++ = *src++;
+ }
+
+ // Insert the additional text into the new string
+
+ src = text.getCharArray();
+ for (int i = 0; i < text.getLength(); i++)
+ {
+ *dest++ = *src++;
+ }
+
+ // Copy the end of the existing text the the newly allocated string
+
+ src = &m_text[index];
+ for (int i = index; i < m_stringLength; i++)
+ {
+ *dest++ = *src++;
+ }
+
+ m_allocatedSize = allocLength * sizeof(nxwidget_char_t);
+
+ // Delete existing string
+
+ delete[] m_text;
+
+ // Swap pointers
+
+ m_stringLength = newLength;
+ m_text = newText;
+ }
+ else
+ {
+ // Existing size is large enough, so make space in string for insert
+
+ FAR nxwidget_char_t *dest = &m_text[newLength - 1];
+ FAR const nxwidget_char_t *src = &m_text[m_stringLength - 1];
+ for (int i = 0; i < m_stringLength - index; i++)
+ {
+ *dest-- = *src--;
+ }
+
+ // Insert the additional text into the new string
+
+ dest = &m_text[index];
+ src = text.getCharArray();
+ for (int i = 0; i < text.getLength(); i++)
+ {
+ *dest++ = *src++;
+ }
+
+ m_stringLength = newLength;
+ }
+}
+
+/**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+void CNxString::remove(const int startIndex)
+{
+ // Reject if requested operation makes no sense
+
+ if (!hasData() || startIndex >= m_stringLength)
+ {
+ return;
+ }
+
+ // Removing characters from the end of the string is trivial - simply
+ // decrease the length
+
+ m_stringLength = startIndex;
+}
+
+/**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+void CNxString::remove(const int startIndex, const int count)
+{
+ // Reject if requested operation makes no sense
+
+ if (!hasData() || startIndex >= m_stringLength)
+ {
+ return;
+ }
+
+ // Don't remove in this way if the count includes the end of the string
+
+ int endIndex = startIndex + count;
+ if (endIndex > m_stringLength)
+ {
+ remove(startIndex);
+ return;
+ }
+
+ // Copy characters from a point after the area to be deleted into the space created
+ // by the deletion
+
+ FAR nxwidget_char_t *dest = &m_text[startIndex];
+ FAR const nxwidget_char_t *src = &m_text[endIndex];
+ for (int i = m_stringLength - endIndex; i > 0; i--)
+ {
+ *dest++ = *src++;
+ }
+
+ // Decrease length
+
+ m_stringLength -= count;
+
+}
+
+/**
+ * Get the character at the specified index. This function is useful
+ * for finding the occasional character at an index, but for iterating
+ * over strings it is exceptionally slow. The newStringIterator()
+ * method should be used to retrieve an iterator object that can iterate
+ * over the string efficiently.
+ *
+ * @param index The index of the character to retrieve.
+ * @return The character at the specified index.
+ */
+
+const nxwidget_char_t CNxString::getCharAt(int index) const
+{
+ return *getCharPointer(index);
+}
+
+/**
+ * Returns the first index of the specified letter within the string.
+ * Will return -1 if the letter is not found.
+ *
+ * @param letter Letter to find.
+ * @return The index of the letter.
+ */
+
+const int CNxString::indexOf(nxwidget_char_t letter) const
+{
+ return indexOf(letter, 0, getLength());
+}
+
+/**
+ * Returns the first index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * from "startIndex" until it has examined all subsequent letters.
+ *
+ * @param letter Letter to find.
+ * @param startIndex The index to start searching from.
+ * @return The index of the letter.
+ */
+
+const int CNxString::indexOf(nxwidget_char_t letter, int startIndex) const
+{
+ return indexOf(letter, startIndex, getLength() - startIndex);
+}
+
+/**
+ * Returns the first index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * from "startIndex" until it has examined all letters within the
+ * range "count".
+ *
+ * @param letter Letter to find.
+ * @param startIndex The index to start searching from.
+ * @param count The number of characters to examine.
+ * @return The index of the letter.
+ */
+
+const int CNxString::indexOf(nxwidget_char_t letter, int startIndex, int count) const
+{
+ // Exit if no data available
+
+ if (!hasData())
+ {
+ return -1;
+ }
+
+ int index = -1;
+ int charsExamined = 0;
+
+ CStringIterator *iterator = new CStringIterator(this);
+ if (!iterator->moveTo(startIndex))
+ {
+ delete iterator;
+ return -1;
+ }
+
+ do
+ {
+ if (iterator->getChar() == letter)
+ {
+ index = iterator->getIndex();
+ break;
+ }
+
+ charsExamined++;
+ }
+ while (iterator->moveToNext() && (charsExamined < count));
+
+ delete iterator;
+ return index;
+}
+
+/**
+ * Returns the last index of the specified letter within the string.
+ * Will return -1 if the letter is not found.
+ *
+ * @param letter Letter to find.
+ * @return The index of the letter.
+ */
+
+const int CNxString::lastIndexOf(nxwidget_char_t letter) const
+{
+ return lastIndexOf(letter, getLength() - 1, getLength());
+}
+
+/**
+ * Returns the last index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * backwards from "startIndex" until it has examined all preceding
+ * letters within the string.
+ *
+ * @param letter Letter to find.
+ * @param startIndex The index to start searching from.
+ * @return The index of the letter.
+ */
+
+const int CNxString::lastIndexOf(nxwidget_char_t letter, int startIndex) const
+{
+ return lastIndexOf(letter, startIndex, getLength() - (getLength() - startIndex));
+}
+
+/**
+ * Returns the last index of the specified letter within the string.
+ * Will return -1 if the letter is not found. Scans through the string
+ * backwards from "startIndex" until it has examined all letters within
+ * the range "count".
+ * @param letter Letter to find.
+ * @param startIndex The index to start searching from.
+ * @param count The number of characters to examine.
+ * @return The index of the letter.
+ */
+
+const int CNxString::lastIndexOf(nxwidget_char_t letter, int startIndex, int count) const
+{
+ // Exit if no data available
+
+ if (!hasData())
+ {
+ return -1;
+ }
+
+ int index = -1;
+ int charsExamined = 0;
+
+ CStringIterator *iterator = new CStringIterator(this);
+ if (!iterator->moveTo(startIndex))
+ {
+ delete iterator;
+ return -1;
+ }
+
+ do
+ {
+ if (iterator->getChar() == letter)
+ {
+ index = iterator->getIndex();
+ break;
+ }
+
+ charsExamined++;
+ }
+ while (iterator->moveToPrevious() && (charsExamined <= count));
+
+ delete iterator;
+ return index;
+}
+
+/**
+ * Get a substring from this string. It is the responsibility of the
+ * caller to delete the substring when it is no longer required.
+ *
+ * @param startIndex The starting point of the substring.
+ * @return A pointer to a new CNxString object containing the
+ * substring.
+ */
+
+CNxString* CNxString::subString(int startIndex) const
+{
+ return subString(startIndex, getLength() - startIndex);
+}
+
+/**
+ * Get a substring from this string. It is the responsibility of the
+ * caller to delete the substring when it is no longer required.
+ *
+ * @param startIndex The starting point of the substring.
+ * @param length The length of the substring.
+ * @return A pointer to a new CNxString object containing the
+ * substring.
+*/
+
+CNxString *CNxString::subString(int startIndex, int length) const
+{
+ CNxString *newString = new CNxString();
+ CStringIterator *iterator = new CStringIterator(this);
+
+ if (!iterator->moveTo(startIndex))
+ {
+ delete iterator;
+ return (CNxString *)0;
+ }
+
+ // Build up the string character by character. We could do a memcpy
+ // here and improve performance.
+
+ int count = 0;
+ while (count < length)
+ {
+ newString->append(iterator->getChar());
+ iterator->moveToNext();
+ count++;
+ }
+
+ delete iterator;
+ return newString;
+}
+
+/**
+ * Overloaded assignment operator. Copies the data within the argument
+ * string to this string.
+ *
+ * @param string The string to copy.
+ * @return This string.
+ */
+
+CNxString& CNxString::operator=(const CNxString &string)
+{
+ if (&string != this)
+ {
+ setText(string);
+ }
+ return *this;
+}
+
+/**
+ * Overloaded assignment operator. Copies the data within the argument
+ * char array to this string.
+ *
+ * @param string The string to copy.
+ * @return This string.
+ */
+
+CNxString& CNxString::operator=(const char *string)
+{
+ setText(string);
+ return *this;
+}
+
+/**
+ * Overloaded assignment operator. Copies the data from the argument
+ * char to this string.
+ *
+ * @param letter The char to copy.
+ * @return This string.
+ */
+
+CNxString& CNxString::operator=(const nxwidget_char_t letter)
+{
+ setText(letter);
+ return *this;
+}
+
+/**
+ * Compares this string to the argument.
+ *
+ * @param string String to compare to.
+ * @return Zero if both strings are equal. A value greater than zero
+ * indicates that this string is greater than the argument string. A
+ * value less than zero indicates the opposite. Note that the return
+ * value indicates the *byte* that does not match, not the *character*.
+ */
+
+int CNxString::compareTo(const CNxString &string) const
+{
+ return memcmp((FAR const char*)m_text,
+ (FAR const char*)string.getCharArray(),
+ getLength());
+}
+
+/**
+ * Allocate memory for the string.
+ *
+ * @param chars Number nxwidget_char_t size characters to allocate.
+ * @param preserve If true, the data in the existing memory will be
+ * preserved if new memory must be allocated
+ */
+
+void CNxString::allocateMemory(int nChars, bool preserve)
+{
+ // This is the size of the allocation that we need
+
+ int nBytesNeeded = nChars * sizeof(nxwidget_char_t);
+
+ // Do we already have enough memory allocated to contain this new size?
+ // If so, we can avoid deallocating and allocating new memory by re-using the old
+
+ if (nBytesNeeded > m_allocatedSize)
+ {
+ // Not enough space in existing memory; allocate new memory
+
+ int allocChars = nChars + m_growAmount;
+ nxwidget_char_t *newText = new nxwidget_char_t[allocChars];
+
+ // Free old memory if necessary
+
+ if (m_text != NULL)
+ {
+ // Preserve existing data if required
+
+ if (preserve)
+ {
+ memcpy(newText, m_text, sizeof(nxwidget_char_t) * m_stringLength);
+ }
+
+ delete[] m_text;
+ }
+
+ // Set pointer to new memory
+
+ m_text = newText;
+
+ // Remember how much memory we've allocated.
+
+ m_allocatedSize = allocChars * sizeof(nxwidget_char_t);
+ }
+}
+
+/**
+ * Return a pointer to the specified characters.
+ *
+ * @param index Index of the character to retrieve.
+ */
+
+FAR nxwidget_char_t *CNxString::getCharPointer(const int index) const
+{
+ // Early exit if the string is empty
+
+ if (!hasData())
+ {
+ return (FAR nxwidget_char_t*)NULL;
+ }
+
+ // Early exit if the index is greater than the length of the string
+
+ if (index >= m_stringLength)
+ {
+ return (FAR nxwidget_char_t*)NULL;
+ }
+
+ return &m_text[index];
+}
diff --git a/NxWidgets/libnxwidgets/src/cnxtimer.cxx b/NxWidgets/libnxwidgets/src/cnxtimer.cxx
new file mode 100644
index 000000000..e351d2357
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxtimer.cxx
@@ -0,0 +1,382 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxtimer.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <cstring>
+#include <ctime>
+#include <csignal>
+#include <debug.h>
+
+#include "cnxtimer.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Static Data Members
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param timeout Time, in milliseconds, before the timer fires an
+ * EVENT_ACTION event.
+ * @param repeat If true, the timer will fire multiple events. If false,
+ * the timer will fire just once and stop.
+ */
+
+CNxTimer::CNxTimer(CWidgetControl *pWidgetControl, uint32_t timeout, bool repeat)
+: CNxWidget(pWidgetControl, 0, 0, 0, 0, 0, 0)
+{
+ // Remember the timer configuration
+
+ m_timeout = timeout;
+ m_isRepeater = repeat;
+ m_isRunning = false;
+
+ // Create a POSIX timer (We can't do anything about failures here)
+
+ int ret = timer_create(CLOCK_REALTIME, (FAR struct sigevent *)NULL, &m_timerid);
+ if (ret < 0)
+ {
+ gdbg("timer_create() failed\n");
+ return;
+ }
+
+ // If we are the first timer created in the whole system, then create
+ // the timer list and attach the SIGALRM timer handler.
+
+ if (!g_nxTimers)
+ {
+ if (!g_nxTimers)
+ {
+ gdbg("Failed to create the timer list\n");
+ return;
+ }
+
+ // Attach the SIGALM signal handler (no harm if this is done multiple times)
+
+ struct sigaction sigact;
+ sigact.sa_handler = signalHandler;
+ sigact.sa_flags = 0;
+ sigemptyset(&sigact.sa_mask);
+
+ ret = sigaction(SIGALRM, &sigact, (FAR struct sigaction *)NULL);
+ if (ret < 0)
+ {
+ gdbg("sigaction() failed\n");
+ return;
+ }
+ }
+
+ // Add ourself onto the array of timers
+#warning "Need to disable SIGALRM here"
+ g_nxTimers->push_back(this);
+}
+
+/**
+ * Destructor.
+ */
+
+CNxTimer::~CNxTimer(void)
+{
+ // Locate ourself in the list of timers and remove ourselves
+
+#warning "Need to disable SIGALRM here"
+ for (int i = 0; i < g_nxTimers->size(); i++)
+ {
+ CNxTimer *timer = g_nxTimers->at(i);
+ if (timer == this)
+ {
+ g_nxTimers->erase(i);
+ break;
+ }
+ }
+
+ // Destroy the timer
+
+ (void)timer_delete(m_timerid);
+}
+
+/**
+ * Return the timeout of this timer.
+ *
+ * @return The number of milliseconds that this timer will run before firing
+ * an event.
+ */
+
+const uint32_t CNxTimer::getTimeout(void)
+{
+ // If the timer is not running, then just return the timeout value
+
+ if (!m_isRunning)
+ {
+ return m_timeout;
+ }
+ else
+ {
+ // Get the time remaining on the POSIX timer. Of course, there
+ // are race conditions here.. the timer could expire at anytime
+
+ struct itimerspec remaining;
+ int ret = timer_gettime(m_timerid, &remaining);
+ if (ret < 0)
+ {
+ gdbg("timer_gettime() failed\n");
+ return 0;
+ }
+
+ return timespecToMilliseconds(&remaining.it_value);
+ }
+}
+
+/**
+ * Resets the millisecond timer.
+ */
+
+void CNxTimer::reset(void)
+{
+ // It does not make sense to reset the timer if the timer is not running
+
+ if (m_isRunning)
+ {
+ // If the specified timer was already armed when timer_settime() is
+ // called, this call will reset the time until next expiration to the
+ // value specified.
+
+ m_isRunning = false;
+ start();
+ }
+}
+
+/**
+ * Starts the timer.
+ */
+
+void CNxTimer::start(void)
+{
+ // If the timer is running, reset should be used to restart it
+
+ if (!m_isRunning)
+ {
+ // If the specified timer was already armed when timer_settime() is
+ // called, this call will reset the time until next expiration to the
+ // value specified.
+
+ struct itimerspec timerspec;
+ millisecondsToTimespec(m_timeout, &timerspec.it_value);
+ timerspec.it_interval.tv_sec = 0;
+ timerspec.it_interval.tv_nsec = 0;
+
+ int ret = timer_settime(m_timerid, 0, &timerspec,
+ (FAR struct itimerspec *)NULL);
+ if (ret < 0)
+ {
+ gdbg("timer_settime() failed\n");
+ }
+
+ // The timer is now running
+
+ m_isRunning = true;
+ }
+}
+
+/**
+ * Stops the timer
+ */
+
+void CNxTimer::stop(void)
+{
+ if (m_isRunning)
+ {
+ // If the it_value member of value is zero, the timer will be disarmed.
+ // The effect of disarming or resetting a timer with pending expiration
+ // notifications is unspecified.
+
+ struct itimerspec nullTime;
+ memset(&nullTime, 0, sizeof(struct itimerspec));
+
+ int ret = timer_settime(m_timerid, 0, &nullTime,
+ (FAR struct itimerspec *)NULL);
+ if (ret < 0)
+ {
+ gdbg("timer_settime failed\n");
+ }
+
+ // The time is no longer running
+
+ m_isRunning = false;
+ }
+}
+
+/**
+ * The SIGALM signal handler that will be called when the timer goes off
+ *
+ * @param signo The signal number call caused the handler to run (SIGALM)
+ */
+
+void CNxTimer::signalHandler(int signo)
+{
+ // Call handlerTimerExpiration on every timer instance
+
+ for (int i = 0; i < g_nxTimers->size(); i++)
+ {
+ CNxTimer *timer = g_nxTimers->at(i);
+ timer->handleTimerExpiration();
+ }
+}
+
+/**
+ * Handle an expired timer
+ */
+
+void CNxTimer::handleTimerExpiration(void)
+{
+ // Do we think our timer is running?
+
+ if (m_isRunning)
+ {
+ // Is it running? It the timer is not running, it will return an
+ // it_value of zero.
+
+ struct itimerspec status;
+ int ret = timer_gettime(m_timerid, &status);
+ if (ret < 0)
+ {
+ gdbg("timer_gettime() failed\n");
+ return;
+ }
+
+ // it_value == 0 means that timer is not running
+
+ if (status.it_value.tv_sec == 0 && status.it_value.tv_nsec == 0)
+ {
+ // It has expired
+
+ m_isRunning = false;
+
+ // Raise the action event. Hmmm.. are there any issues with
+ // doing this from a signal handler? We'll find out
+
+ m_widgetEventHandlers->raiseActionEvent();
+
+ // Restart the timer if this is a repeating timer
+
+ if (m_isRepeater)
+ {
+ start();
+ }
+ }
+ }
+}
+
+/**
+ * Convert a timespec to milliseconds
+ *
+ * @param tp The pointer to the timespec to convert
+ * @return The corresponding time in milliseconds
+ */
+
+uint32_t CNxTimer::timespecToMilliseconds(FAR const struct timespec *tp)
+{
+ return (uint32_t)tp->tv_sec * 1000 + (uint32_t)tp->tv_nsec / 10000000;
+}
+
+/**
+ * Convert milliseconds to a timespec
+ *
+ * @param milliseconds The milliseconds to be converted
+ * @param tp The pointer to the location to store the converted timespec
+ */
+
+ void CNxTimer::millisecondsToTimespec(uint32_t milliseconds,
+ FAR struct timespec *tp)
+ {
+ tp->tv_sec = milliseconds / 1000;
+ uint32_t remainder = milliseconds - (uint32_t)tp->tv_sec * 1000;
+ tp->tv_nsec = remainder * 1000000;
+ }
+
+
diff --git a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
new file mode 100644
index 000000000..36b07dce5
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
@@ -0,0 +1,387 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <cassert>
+
+#include "cwidgetcontrol.hxx"
+#include "cnxtkwindow.hxx"
+#include "cnxtoolbar.hxx"
+#include "cbitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param hNxServer Handle to the NX server.
+ * @param widgetControl Controlling widget for this window.
+ */
+
+CNxTkWindow::CNxTkWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl)
+ : CCallback(pWidgetControl), m_hNxServer(hNxServer), m_hNxTkWindow(0),
+ m_widgetControl(pWidgetControl)
+{
+ // Create the CGraphicsPort instance for this window
+
+ m_widgetControl->createGraphicsPort(static_cast<INxWindow*>(this));
+}
+
+/**
+ * Destructor.
+ */
+
+CNxTkWindow::~CNxTkWindow(void)
+{
+ // It would be a disaster if toolbar instance persists beyond
+ // the window!
+
+ DEBUGASSERT(!m_toolbar);
+
+ // Release the window. We do not release the widget control
+ // instance. The lifetime of that instance is owned by he-who-
+ // constructed-us.
+
+ (void)nxtk_closewindow(m_hNxTkWindow);
+}
+
+/**
+ * Creates a new framed window. Window creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the framed window was successfully created.
+ */
+
+bool CNxTkWindow::open(void)
+{
+ // Get the C-callable callback vtable
+
+ FAR struct nx_callback_s *vtable = getCallbackVTable();
+
+ // Create the window
+
+ m_hNxTkWindow = nxtk_openwindow(m_hNxServer, vtable, (FAR void *)m_widgetControl);
+ return m_hNxTkWindow != NULL;
+}
+
+/**
+ * Open a toolbar on the framed window
+ *
+ * @param height Height of the toolbar
+ */
+
+CNxToolbar *CNxTkWindow::openToolbar(nxgl_coord_t height)
+{
+ if (m_hNxTkWindow && !m_toolbar)
+ {
+ // Get current window style from the widget control
+
+ CWidgetStyle style;
+ m_widgetControl->getWidgetStyle(&style);
+
+ // Create a new controlling widget for the window
+
+ CWidgetControl *widgetControl = new CWidgetControl(&style);
+
+ // And create the toolcar
+
+ m_toolbar = new CNxToolbar(this, m_hNxTkWindow,
+ widgetControl, height);
+ if (!m_toolbar)
+ {
+ delete widgetControl;
+ }
+ }
+ return m_toolbar;
+}
+
+/**
+ * Request the position and size information of the window. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return True on success, false on any failure.
+ */
+
+bool CNxTkWindow::requestPosition(void)
+{
+ // Request the window position
+
+ return nxtk_getposition(m_hNxTkWindow) == OK;
+}
+
+/**
+ * Get the position of the window in the physical display coordinates
+ * (as reported by the NX callback).
+ *
+ * @return The position.
+ */
+
+bool CNxTkWindow::getPosition(FAR struct nxgl_point_s *pPos)
+{
+ return m_widgetControl->getWindowPosition(pPos);
+}
+
+/**
+ * Get the size of the window (as reported by the NX callback).
+ *
+ * @return The size.
+ */
+
+bool CNxTkWindow::getSize(FAR struct nxgl_size_s *pSize)
+{
+ return m_widgetControl->getWindowSize(pSize);
+}
+
+/**
+ * Set the position and size of the window.
+ *
+ * @param pPos The new position of the window.
+ * @return True on success, false on any failure.
+ */
+
+bool CNxTkWindow::setPosition(FAR const struct nxgl_point_s *pPos)
+{
+ // Set the window size and position
+
+ return nxtk_setposition(m_hNxTkWindow, pPos) == OK;
+}
+
+/**
+ * Set the size of the selected window.
+ *
+ * @param pSize The new size of the window.
+ * @return True on success, false on any failure.
+ */
+
+bool CNxTkWindow::setSize(FAR const struct nxgl_size_s *pSize)
+{
+ // Set the window size
+
+ return nxtk_setsize(m_hNxTkWindow, pSize) == OK;
+}
+
+/**
+ * Bring the window to the top of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+bool CNxTkWindow::raise(void)
+{
+ // Raise the window to the top of the display
+
+ return nxtk_raise(m_hNxTkWindow) == OK;
+}
+
+/**
+ * Lower the window to the bottom of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+bool CNxTkWindow::lower(void)
+{
+ // Lower the window to the bottom of the display
+
+ return nxtk_lower(m_hNxTkWindow) == OK;
+}
+
+/**
+ * Set an individual pixel in the window with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxTkWindow::setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color)
+{
+#if 0
+ // Set an individual pixel to the specified color
+
+ return nxtk_setpixel(m_hNxTkWindow, pPos, &color) == OK;
+#else
+# warning "Revisit"
+ return false;
+#endif
+}
+
+/**
+ * Fill the specified rectangle in the window with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxTkWindow::fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color)
+{
+ // Fill a rectangular region with a solid color
+
+ return nxtk_fillwindow(m_hNxTkWindow, pRect, &color) == OK;
+}
+
+/**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+void CNxTkWindow::getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest)
+{
+ // Get a rectangule region from the window
+
+ (void)nxtk_getwindow(m_hNxTkWindow, rect, 0, (FAR uint8_t*)dest->data, dest->stride);
+}
+
+/**
+ * Fill the specified trapezoidal region in the window with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to window (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxTkWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color)
+{
+ // Fill a trapezoidal region with a solid color
+
+ return nxtk_filltrapwindow(m_hNxTkWindow, pTrap, &color) == OK;
+}
+
+/**
+ * Fill the specified line in the window with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxTkWindow::drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width, nxgl_mxpixel_t color)
+{
+ // Draw a line with the specified color
+
+ return nxtk_drawlinewindow(m_hNxTkWindow, vector, width, &color) == OK;
+}
+
+/**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+bool CNxTkWindow::drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color)
+{
+ return nxtk_fillcirclewindow(m_hNxTkWindow, center, radius, &color) == OK;
+}
+
+/**
+ * Move a rectangular region within the window.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxTkWindow::move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset)
+{
+ // Move a rectangular region of the display
+
+ return nxtk_movewindow(m_hNxTkWindow, pRect, pOffset) == OK;
+}
+
+/**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified window. The source image is treated as an opaque image.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in window coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxTkWindow::bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride)
+{
+ // Copy a rectangular bitmap image in a region on the display
+
+ return nxtk_bitmapwindow(m_hNxTkWindow, pDest, &pSrc, pOrigin, stride) == OK;
+}
diff --git a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx
new file mode 100644
index 000000000..5911c731d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx
@@ -0,0 +1,364 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxtoolbar.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cnxtoolbar.hxx"
+#include "cbitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pNxTkWindow Parent framed window instance
+ * @param hNxTkWindow Parent framed window NX handler
+ * @param widgetControl Controlling widget for this toolbar.
+ * @param height The height of the toolbar.
+ */
+
+CNxToolbar::CNxToolbar(CNxTkWindow *pNxTkWindow, NXTKWINDOW hNxTkWindow,
+ CWidgetControl *pWidgetControl, nxgl_coord_t height)
+ : CCallback(pWidgetControl)
+{
+ m_nxTkWindow = pNxTkWindow;
+ m_hNxTkWindow = hNxTkWindow;
+ m_widgetControl = pWidgetControl;
+ m_height = height;
+}
+
+/**
+ * Destructor.
+ */
+
+CNxToolbar::~CNxToolbar(void)
+{
+ // Inform the parent window instance that the toolbar is gone
+
+ m_nxTkWindow->detachToolbar();
+
+ // Release the widget control instance. Normally the lifetime
+ // of the widget control instance is managed by logic outside
+ // of the window instance. But here, as in the real world,
+ // our parent expects us to clean up after ourselves.
+
+ delete m_widgetControl;
+
+ // Release the toolbar.
+
+ (void)nxtk_closetoolbar(m_hNxTkWindow);
+}
+
+/**
+ * Creates a new toolbar. Toolbar creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the toolbar was successfully created.
+ */
+
+bool CNxToolbar::open(void)
+{
+ // Get the C-callable callback vtable
+
+ FAR struct nx_callback_s *vtable = getCallbackVTable();
+
+ // Create the toolbar
+
+ int ret = nxtk_opentoolbar(m_hNxTkWindow, m_height, vtable,
+ (FAR void *)m_widgetControl);
+ return ret == OK;
+}
+
+/**
+ * Request the position and size information of the toolbar. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return True on success, false on any failure.
+ */
+
+bool CNxToolbar::requestPosition(void)
+{
+ // Request the position of the entire framed window containing the
+ // toolbar. The NXTK callback will route toolbar specific
+ // information back to us.
+
+ nxtk_getposition(m_hNxTkWindow);
+ return false;
+}
+
+/**
+ * Get the position of the toolbar in the physical display coordinates
+ * (as reported by the NX callback).
+ *
+ * @return The position.
+ */
+
+bool CNxToolbar::getPosition(FAR struct nxgl_point_s *pPos)
+{
+ return m_widgetControl->getWindowPosition(pPos);
+}
+
+/**
+ * Get the size of the toolbar (as reported by the NX callback).
+ *
+ * @return The size.
+ */
+
+bool CNxToolbar::getSize(FAR struct nxgl_size_s *pSize)
+{
+ return m_widgetControl->getWindowSize(pSize);
+}
+
+/**
+ * Set the position and size of the toolbar. The position of
+ * the toolbar is fixed at the top of the parent framed window.
+ *
+ * @param pPos The new position of the toolbar.
+ * @return Always returns false.
+ */
+
+bool CNxToolbar::setPosition(FAR const struct nxgl_point_s *pPos)
+{
+ return false;
+}
+
+/**
+ * Set the size of the selected toolbar. The only variable dimension
+ * is the height of the toolbar, but that cannot be changed once
+ * it is created.
+ *
+ * @param pSize The new size of the toolbar.
+ * @return Always returns false.
+ */
+
+bool CNxToolbar::setSize(FAR const struct nxgl_size_s *pSize)
+{
+ return false;
+}
+
+/**
+ * Bring the toolbar to the top of the display. The toolbar is
+ * a component of the containing, parent, framed window. It
+ * cannot be raised separately.
+ *
+ * @return Always returns false.
+ */
+
+bool CNxToolbar::raise(void)
+{
+ return false;
+}
+
+/**
+ * Lower the toolbar to the bottom of the display. The toolbar is
+ * a component of the containing, parent, framed window. It
+ * cannot be raised separately.
+ *
+ * @return Always returns false.
+ */
+
+bool CNxToolbar::lower(void)
+{
+ return false;
+}
+
+/**
+ * Set an individual pixel in the toolbar with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxToolbar::setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color)
+{
+#if 0
+ // Set an individual pixel to the specified color
+
+ return nxtk_setpixel(m_hNxTkWindow, pPos, &color) == OK;
+#else
+# warning "Revisit"
+ return false;
+#endif
+}
+
+/**
+ * Fill the specified rectangle in the toolbar with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxToolbar::fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color)
+{
+ // Fill a rectangular region with a solid color
+
+ return nxtk_filltoolbar(m_hNxTkWindow, pRect, &color) == OK;
+}
+
+/**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+void CNxToolbar::getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest)
+{
+ // Get a rectangule region from the toolbar
+
+ (void)nxtk_gettoolbar(m_hNxTkWindow, rect, 0, (FAR uint8_t*)dest->data, dest->stride);
+}
+
+/**
+ * Fill the specified trapezoidal region in the toolbar with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to toolbar (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxToolbar::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color)
+{
+ // Fill a trapezoidal region with a solid color
+
+ return nxtk_filltraptoolbar(m_hNxTkWindow, pTrap, &color) == OK;
+}
+
+/**
+ * Fill the specified line in the toolbar with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxToolbar::drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width, nxgl_mxpixel_t color)
+{
+ // Draw a line with the specified color
+
+ return nxtk_drawlinetoolbar(m_hNxTkWindow, vector, width, &color) == OK;
+}
+
+/**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+bool CNxToolbar::drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color)
+{
+ return nxtk_fillcircletoolbar(m_hNxTkWindow, center, radius, &color) == OK;
+}
+
+/**
+ * Move a rectangular region within the toolbar.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxToolbar::move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset)
+{
+ // Move a rectangular region of the display
+
+ return nxtk_movetoolbar(m_hNxTkWindow, pRect, pOffset) == OK;
+}
+
+/**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified toolbar. The source image is treated as an opaque image.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in toolbar coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxToolbar::bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride)
+{
+ // Copy a rectangular bitmap image in a region on the display
+
+ return nxtk_bitmaptoolbar(m_hNxTkWindow, pDest, &pSrc, pOrigin, stride) == OK;
+}
diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx
new file mode 100644
index 000000000..de84f1393
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx
@@ -0,0 +1,2424 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxwidget.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cnxwidget.hxx"
+#include "cgraphicsport.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "cnxfont.hxx"
+#include "cwidgetstyle.hxx"
+#include "cwidgeteventargs.hxx"
+#include "crectcache.hxx"
+#include "cwidgetcontrol.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+#define DOUBLE_CLICK_BOUNDS 10
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controllwing widget for the display
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param flags Bitmask specifying some set-up values for the widget.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ * @see WidgetFlagType.
+ */
+
+CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ uint32_t flags, const CWidgetStyle *style)
+{
+ // Save the controlling widget
+
+ m_widgetControl = pWidgetControl;
+
+ // Set properties from parameters. If this is a child widget, then
+ // this coordinates are relative to the parent widget.
+
+ m_rect.setX(x);
+ m_rect.setY(y);
+ m_rect.setWidth(width);
+ m_rect.setHeight(height);
+
+ // Do we need to fetch the default style?
+
+ if (style == (CWidgetStyle *)NULL)
+ {
+ // Get the style from the controlling widget. This allows different
+ // widgets within a window to have the same style, unique to the window.
+
+ pWidgetControl->getWidgetStyle(&m_style);
+ }
+ else
+ {
+ // Use specified style
+
+ useWidgetStyle(style);
+ }
+
+ // Add ourself to the list of controlled widgets
+
+ pWidgetControl->addControlledWidget(this);
+
+ // Mask flags against bitmasks and logical NOT twice to obtain boolean values
+
+ m_flags.borderless = (!(!(flags & WIDGET_BORDERLESS)));
+ m_flags.draggable = (!(!(flags & WIDGET_DRAGGABLE)));
+ m_flags.permeable = (!(!(flags & WIDGET_PERMEABLE)));
+ m_flags.doubleClickable = (!(!(flags & WIDGET_DOUBLE_CLICKABLE)));
+
+ // Dragging values
+
+ m_grabPointX = 0;
+ m_grabPointY = 0;
+ m_newX = 0;
+ m_newY = 0;
+
+ // Set initial flag values
+
+ m_flags.clicked = false;
+ m_flags.dragging = false;
+ m_flags.hasFocus = false;
+ m_flags.deleted = false;
+ m_flags.drawingEnabled = false;
+ m_flags.enabled = true;
+ m_flags.erased = true;
+ m_flags.shelved = false;
+ m_flags.visibleRegionCacheInvalid = true;
+ m_flags.hidden = false;
+ m_flags.modal = false;
+
+ // Set hierarchy pointers
+
+ m_parent = (CNxWidget *)NULL;
+ m_focusedChild = (CNxWidget *)NULL;
+
+ // Double-click
+
+ clock_gettime(CLOCK_REALTIME, &m_lastClickTime);
+ m_lastClickX = 0;
+ m_lastClickY = 0;
+ m_doubleClickBounds = DOUBLE_CLICK_BOUNDS;
+
+ // Set other default values
+
+ m_refcon = 0;
+
+ // Set border size to 1 line
+
+ m_borderSize.top = 1;
+ m_borderSize.right = 1;
+ m_borderSize.bottom = 1;
+ m_borderSize.left = 1;
+
+ m_closeType = CLOSE_TYPE_CLOSE;
+ m_rectCache = new CRectCache(this);
+ m_widgetEventHandlers = new CWidgetEventHandlerList(this);
+}
+
+/**
+ * Destructor.
+ */
+
+CNxWidget::~CNxWidget(void)
+{
+ if (!m_flags.deleted)
+ {
+ m_flags.deleted = true;
+
+ // Unset the clicked pointer if necessary
+
+ if (m_widgetControl->getClickedWidget() == this)
+ {
+ m_widgetControl->setClickedWidget((CNxWidget *)NULL);
+ }
+ }
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ m_parent->removeChild(this);
+ }
+
+ // Delete children
+
+ while (m_children.size() > 0)
+ {
+ m_children[0]->destroy();
+ }
+
+ // Delete shelved children
+
+ while (m_shelvedWidgets.size() > 0)
+ {
+ m_shelvedWidgets[0]->destroy();
+ }
+
+ // Remove ourselve from the controlled widget list
+
+ m_widgetControl->removeControlledWidget(this);
+
+ // Delete instances. NOTE that we do not delete the controlling
+ // widget. It persists until the window is closed.
+
+ delete m_rectCache;
+ delete m_widgetEventHandlers;
+}
+
+/**
+ * Get the x coordinate of the widget in "Widget space".
+ *
+ * @return Widget space x coordinate.
+ */
+
+const nxgl_coord_t CNxWidget::getX(void) const
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ return m_parent->getX() + m_rect.getX();
+ }
+
+ return m_rect.getX();
+}
+
+/**
+ * Get the y coordinate of the widget in "Widget space".
+ *
+ * @return Widget space y coordinate.
+ */
+
+const nxgl_coord_t CNxWidget::getY(void) const
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ return m_parent->getY() + m_rect.getY();
+ }
+
+ return m_rect.getY();
+}
+
+/**
+ * Get the x coordinate of the widget relative to its parent.
+ *
+ * @return Parent-space x coordinate.
+ */
+
+const nxgl_coord_t CNxWidget::getRelativeX(void) const
+{
+ return m_rect.getX();
+}
+
+/**
+ * Get the y coordinate of the widget relative to its parent.
+ *
+ * @return Parent-space y coordinate.
+ */
+
+const nxgl_coord_t CNxWidget::getRelativeY(void) const
+{
+ return m_rect.getY();
+}
+
+/**
+ * Has the widget been marked for deletion? This function recurses up the widget
+ * hierarchy and only returns true if all of the widgets in the ancestor
+ * chain are not deleted.
+ *
+ * Widgets marked for deletion are automatically deleted and should not be
+ * interacted with.
+ *
+ * @return True if marked for deletion.
+ */
+
+const bool CNxWidget::isDeleted(void) const
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (m_parent->isDeleted())
+ {
+ return true;
+ }
+ }
+
+ return m_flags.deleted;
+}
+
+/**
+ * Is the widget allowed to draw? This function recurses up the widget
+ * hierarchy and only returns true if all of the widgets in the ancestor
+ * chain are visible.
+ *
+ * @return True if drawing is enabled.
+ */
+
+const bool CNxWidget::isDrawingEnabled(void) const
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (m_parent->isDrawingEnabled())
+ {
+ // Drawing is enabled if the widget is drawable, not deleted, and not shelved
+
+ return (m_flags.drawingEnabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden));
+ }
+ }
+ else
+ {
+ return (m_flags.drawingEnabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden));
+ }
+
+ return false;
+}
+
+/**
+ * Is the widget hidden? This function recurses up the widget
+ * hierarchy and returns true if any of the widgets in the ancestor
+ * chain are hidden.
+ *
+ * @return True if hidden.
+ */
+
+const bool CNxWidget::isHidden(void) const
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (!m_parent->isHidden())
+ {
+ // Hidden if the widget is deleted, shelved or hidden
+
+ return (m_flags.deleted || m_flags.shelved || m_flags.hidden);
+ }
+ }
+ else
+ {
+ return (m_flags.deleted || m_flags.shelved || m_flags.hidden);
+ }
+
+ return true;
+}
+
+/**
+ * Is the widget enabled? This function recurses up the widget
+ * hierarchy and only returns true if all of the widgets in the ancestor
+ * chain are enabled.
+ *
+ * @return True if enabled.
+ */
+
+const bool CNxWidget::isEnabled() const
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (m_parent->isEnabled())
+ {
+ // Enabled if the widget is enabled, not deleted, not shelved and not hidden
+
+ return (m_flags.enabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden));
+ }
+ }
+ else
+ {
+ return (m_flags.enabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden));
+ }
+
+ return false;
+}
+
+/**
+ * Is the widget modal? Only true if the Widget singleton is also modal.
+ *
+ * @return True if the widget is modal.
+ */
+
+const bool CNxWidget::isModal(void) const
+{
+ return m_widgetControl->isModal() & m_flags.modal;
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CNxWidget::getPreferredDimensions(CRect &rect) const
+{
+ rect = m_rect;
+}
+
+/**
+ * Insert the properties of the space within this widget that is available
+ * for children into the rect passed in as a parameter.
+ * All coordinates are relative to this widget.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CNxWidget::getClientRect(CRect &rect) const
+{
+ if (m_flags.borderless)
+ {
+ rect.setX(0);
+ rect.setY(0);
+ rect.setWidth(getWidth());
+ rect.setHeight(getHeight());
+ }
+ else
+ {
+ rect.setX(m_borderSize.left);
+ rect.setY(m_borderSize.top);
+ rect.setWidth(getWidth() - (m_borderSize.left + m_borderSize.right));
+ rect.setHeight(getHeight() - (m_borderSize.top + m_borderSize.bottom));
+ }
+}
+
+/**
+ * Insert the properties of the space within this widget that is
+ * available for children into the rect passed in as a parameter.
+ * Identical to getClientRect() except that all coordinates are
+ * absolute positions within the window.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CNxWidget::getRect(CRect &rect) const
+{
+ getClientRect(rect);
+ rect.setX(rect.getX() + getX());
+ rect.setY(rect.getY() + getY());
+}
+
+/**
+ * Clips the supplied rect to the boundaries defined by this widget and
+ * this widget's parents.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CNxWidget::getRectClippedToHierarchy(CRect &rect) const
+{
+ // Copy the widget's properties into the rect. NOTE that if this is
+ // a child widget, getX() and getY() will return the actual X and Y
+ // positions (and not the parent-relative X and Y positions).
+
+ rect.setX(getX());
+ rect.setY(getY());
+ rect.setWidth(getWidth());
+ rect.setHeight(getHeight());
+
+ // And clip it
+
+ clipRectToHierarchy(rect);
+}
+
+/**
+ * Gets a pointer to the vector of all of the visible regions of this widget,
+ * including any covered by children.
+ *
+ * @return A pointer to a vector of all visible regions.
+ */
+
+TNxArray<CRect> *CNxWidget::getForegroundRegions(void)
+{
+ return m_rectCache->getForegroundRegions();
+}
+
+/**
+ * Sets this widget's reference constant. This should be unique,
+ * at least amongst this widget's siblings.
+ *
+ * @param refcon The reference constant.
+ */
+
+uint32_t CNxWidget::setRefcon(uint32_t refcon)
+{
+ uint32_t old = m_refcon;
+ m_refcon = refcon;
+ return old;
+}
+
+/**
+ * Sets this widget's border state.
+ *
+ * @param isBorderless The border state.
+ */
+
+void CNxWidget::setBorderless(bool borderless)
+{
+ m_flags.borderless = borderless;
+ invalidateVisibleRectCache();
+}
+
+/**
+ * Sets the font.
+ *
+ * @param font A pointer to the font to use.
+ */
+
+void CNxWidget::setFont(CNxFont *font)
+{
+ m_style.font = font;
+}
+
+/**
+ * Draws the visible regions of the widget and the widget's child widgets.
+ */
+
+void CNxWidget::redraw(void)
+{
+ if (isDrawingEnabled())
+ {
+ cacheVisibleRects();
+
+ if (m_rectCache->getBackgroundRegions()->size() > 0)
+ {
+ // Get the graphics port for drawing in this window
+
+ CGraphicsPort *port = m_widgetControl->getGraphicsPort();
+
+ // Draw all visible rectangles
+
+ for (int i = 0; i < m_rectCache->getBackgroundRegions()->size(); i++)
+ {
+ drawBorder(port);
+ drawContents(port);
+ }
+ }
+
+ // Remember that the widget is no longer erased
+
+ m_flags.erased = false;
+ drawChildren();
+ }
+}
+
+/**
+ * Erases the visible regions of the widget by redrawing the widgets
+ * behind it.
+ */
+
+void CNxWidget::erase(void)
+{
+ if (!m_flags.erased)
+ {
+ cacheVisibleRects();
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ m_parent->eraseWidget(this);
+ }
+
+ // Remember that the widget has been erased
+
+ m_flags.erased = true;
+ invalidateVisibleRectCache();
+ }
+}
+
+/**
+ * Enables the widget.
+ *
+ * @return True if the widget was enabled.
+ */
+
+bool CNxWidget::enable(void)
+{
+ if (!m_flags.enabled)
+ {
+ m_flags.enabled = true;
+ onEnable();
+ redraw();
+ m_widgetEventHandlers->raiseEnableEvent();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Disabled the widget.
+ *
+ * @return True if the widget was disabled.
+ */
+
+bool CNxWidget::disable(void)
+{
+ if (m_flags.enabled)
+ {
+ m_flags.enabled = false;
+ onDisable();
+ redraw();
+ m_widgetEventHandlers->raiseDisableEvent();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Erases the widget, marks it as deleted, and moves it to the CNxWidget
+ * deletion queue. Widgets are automatically deleted by the framework and
+ * should not be deleted externally.
+ */
+
+void CNxWidget::close(void)
+{
+ if (!m_flags.deleted)
+ {
+ m_widgetEventHandlers->raiseCloseEvent();
+ m_widgetEventHandlers->disable();
+
+ m_flags.deleted = true;
+ m_flags.drawingEnabled = false;
+
+ // Unset clicked widget if necessary
+
+ CNxWidget *clickedWidget = m_widgetControl->getClickedWidget();
+ if (clickedWidget == this)
+ {
+ release(clickedWidget->getX(), clickedWidget->getY());
+ }
+
+ // Ensure the widget isn't running modally
+
+ stopModal();
+ erase();
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ m_parent->closeChild(this);
+ }
+ }
+}
+
+/**
+ * Erases the widget, removes it from the main hierarchy and sets it to
+ * invisible. Widgets hidden in this way will be partioned off from
+ * other widgets and will no longer be processed.
+ *
+ * @return True if the widget was shelved.
+ * @see unshelve()
+ */
+
+bool CNxWidget::shelve(void)
+{
+ if (!m_flags.shelved)
+ {
+ m_widgetEventHandlers->raiseShelveEvent();
+ m_widgetEventHandlers->disable();
+
+ m_flags.shelved = true;
+ m_flags.drawingEnabled = false;
+
+ // Unset clicked widget if necessary
+
+ CNxWidget *clickedWidget = m_widgetControl->getClickedWidget();
+ if (clickedWidget == this)
+ {
+ release(clickedWidget->getX(), clickedWidget->getY());
+ }
+
+ // Ensure the widget isn't running modally
+
+ stopModal();
+ erase();
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ m_parent->shelveChild(this);
+ }
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Moves the widget back into the hierarchy and redraws it. Widgets shown
+ * in this way will be unpartioned and will be processed again.
+ *
+ * @return True if the widget was unshelved.
+ * @see shelve()
+ */
+
+bool CNxWidget::unshelve(void)
+{
+ if (m_flags.shelved)
+ {
+ m_widgetEventHandlers->enable();
+ m_widgetEventHandlers->raiseUnshelveEvent();
+
+ m_flags.drawingEnabled = true;
+ m_flags.shelved = false;
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ m_parent->moveShelvedToChildList(this);
+ m_parent->invalidateVisibleRectCache();
+ }
+
+ redraw();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Draws the widget and makes it visible.
+ * Does not steal focus from other widgets.
+ *
+ * @return True if the widget was shown.
+ * @see hide()
+ */
+
+bool CNxWidget::show(void)
+{
+ if (m_flags.hidden)
+ {
+ m_flags.hidden = false;
+
+ // Ensure that widgets behind this do not draw over the
+ // top of the newly-visible widget
+
+ m_parent->invalidateLowerWidgetsVisibleRectCache(this);
+ m_widgetEventHandlers->raiseShowEvent();
+ redraw();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Erases the widget and makes it invisible.
+ * Does not re-assign focus to another widget.
+ *
+ * @return True if the widget was hidden.
+ * @see show()
+ */
+
+bool CNxWidget::hide(void)
+{
+ if (!m_flags.hidden)
+ {
+ m_flags.hidden = true;
+
+ // Ensure the widget isn't running modally
+
+ stopModal();
+ m_widgetEventHandlers->raiseHideEvent();
+ erase();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Click this widget at the supplied coordinates. This should only be
+ * overridden in subclasses if the default click behaviour needs to be changed.
+ * If the subclassed widget should just respond to a standard click,
+ * the onClick() method should be overridden instead.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click was successful.
+ */
+
+bool CNxWidget::click(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (!isEnabled() || !checkCollision(x, y))
+ {
+ return false;
+ }
+
+ // Check for a double-click
+
+ if (isDoubleClick(x, y))
+ {
+ return doubleClick(x, y);
+ }
+
+ // Work out which child was clicked
+
+ for (int i = m_children.size() - 1; i > -1; i--)
+ {
+ if (m_children[i]->click(x, y))
+ {
+ return true;
+ }
+ }
+
+ // Ensure that the click has occurred on a region of this widget
+ // not obscured by its siblings
+
+ if (!checkCollisionWithForegroundRects(x, y))
+ {
+ return false;
+ }
+
+ // Handle clicks on this
+
+ m_flags.clicked = true;
+
+ // Record data for double-click
+
+ clock_gettime(CLOCK_REALTIME, &m_lastClickTime);
+ m_lastClickX = x;
+ m_lastClickY = y;
+
+ // Take focus away from child widgets
+
+ setFocusedWidget((CNxWidget *)NULL);
+
+ // Tell controlling widget that the clicked widget has changed
+
+ m_widgetControl->setClickedWidget(this);
+
+ // Run any code in the inherited class
+
+ onClick(x, y);
+ m_widgetEventHandlers->raiseClickEvent(x, y);
+ return true;
+}
+
+/**
+ * Check if the click is a double-click.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click is a double-click.
+ */
+
+bool CNxWidget::isDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Check for a double-click
+
+ if (m_flags.doubleClickable && hasFocus() && m_widgetControl->doubleClick())
+ {
+ // Within the allowed region?
+
+ if ((m_lastClickX > x - m_doubleClickBounds) && (m_lastClickX < x + m_doubleClickBounds))
+ {
+ if ((m_lastClickY > y - m_doubleClickBounds) && (m_lastClickY < y + m_doubleClickBounds))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Double-click this widget at the supplied coordinates. This
+ * should only be overridden in subclasses if the default
+ * double-click behaviour needs to be changed. If the subclassed
+ * widget should just respond to a standard double-click, the
+ * onDoubleClick() method should be overridden instead.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if the click was successful.
+ */
+
+bool CNxWidget::doubleClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (!isEnabled() || !checkCollision(x, y))
+ {
+ return false;
+ }
+
+ // Work out which child was clicked. Allow the
+ // child to determine if it has been double-clicked or not
+ // in case the second click has fallen on a different
+ // child to the first.
+
+ for (int i = m_children.size() - 1; i > -1; i--)
+ {
+ if (m_children[i]->click(x, y))
+ {
+ return true;
+ }
+ }
+
+ // Ensure that the click has occurred on a region of this widget
+ // not obscured by its siblings
+
+ if (!checkCollisionWithForegroundRects(x, y))
+ {
+ return false;
+ }
+
+ m_flags.clicked = true;
+
+ // Record data for double-click
+
+ clock_gettime(CLOCK_REALTIME, &m_lastClickTime);
+ m_lastClickX = x;
+ m_lastClickY = y;
+
+ // Take focus away from child widgets
+
+ setFocusedWidget((CNxWidget *)NULL);
+
+ // Tell controlling widget that the clicked widget has changed
+
+ m_widgetControl->setClickedWidget(this);
+
+ onDoubleClick(x, y);
+ m_widgetEventHandlers->raiseDoubleClickEvent(x, y);
+ return true;
+}
+
+/**
+ * Release this widget at the supplied coordinates. This should only be
+ * overridden in subclasses if the default release behaviour needs to be
+ * changed. If the subclassed widget should just respond to a standard
+ * release, the onRelease() method should be overridden instead.
+ *
+ * @param x X coordinate of the release.
+ * @param y Y coordinate of the release.
+ * @return True if the release was successful.
+ */
+
+bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (!m_flags.clicked)
+ {
+ return false;
+ }
+
+ m_flags.clicked = false;
+ stopDragging(x, y);
+
+ if (m_widgetControl->getClickedWidget() == this)
+ {
+ m_widgetControl->setClickedWidget((CNxWidget *)NULL);
+ }
+
+ // Determine which release event to fire
+
+ if (checkCollision(x, y))
+ {
+ onRelease(x, y);
+
+ // Release occurred within widget; raise release
+
+ m_widgetEventHandlers->raiseReleaseEvent(x, y);
+ }
+ else
+ {
+ onReleaseOutside(x, y);
+
+ // Release occurred outside widget; raise release
+
+ m_widgetEventHandlers->raiseReleaseOutsideEvent(x, y);
+ }
+
+ return true;
+}
+
+/**
+ * Drag the widget to the supplied coordinates.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal distance that the mouse was dragged.
+ * @param vY The vertical distance that the mouse was dragged.
+ * @return True if the drag was successful.
+ */
+
+bool CNxWidget::drag(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t vX, nxgl_coord_t vY)
+{
+ if ((isEnabled()) && (m_flags.dragging))
+ {
+ if ((vX != 0) || (vY != 0))
+ {
+ onDrag(x, y, vX, vY);
+ m_widgetEventHandlers->raiseDragEvent(x, y, vX, vY);
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Send a keypress to the widget.
+ *
+ * @param key The keycode to send to the widget.
+ * @return True if the keypress was processed.
+ */
+
+bool CNxWidget::keyPress(nxwidget_char_t key)
+{
+ if (!isEnabled())
+ {
+ return false;
+ }
+
+ // Raise keypress for this widget
+
+ m_widgetEventHandlers->raiseKeyPressEvent(key);
+
+ // Handle active child
+
+ if (m_focusedChild != NULL)
+ {
+ m_focusedChild->keyPress(key);
+ }
+
+ return true;
+}
+
+/**
+ * Send a cursor control event to the widget.
+ *
+ * @param cursorControl The cursor control code o send to the widget.
+ * @return True if the cursor control was processed.
+ */
+
+bool CNxWidget::cursorControl(ECursorControl control)
+{
+ if (!isEnabled())
+ {
+ return false;
+ }
+
+ // Raise cursor control for this widget
+
+ m_widgetEventHandlers->raiseCursorControlEvent(control);
+
+ // Handle active child
+
+ if (m_focusedChild != NULL)
+ {
+ m_focusedChild->cursorControl(control);
+ }
+
+ return true;
+}
+
+/**
+ * Give the widget focus.
+ *
+ * @return True if the widget received focus correctly.
+ */
+
+bool CNxWidget::focus(void)
+{
+ if (!isEnabled())
+ {
+ return false;
+ }
+
+ // Remember if the widget has focus
+
+ bool hadFocus = m_flags.hasFocus;
+ m_flags.hasFocus = true;
+
+ // Notify parent that this widget has focus
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ m_parent->setFocusedWidget(this);
+ }
+
+ // Raise an event only if the widget did not have focus
+
+ if (!hadFocus)
+ {
+ onFocus();
+
+ m_widgetEventHandlers->raiseFocusEvent();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Remove focus from the widget.
+ *
+ * @return True if the widget lost focus correctly.
+ */
+
+bool CNxWidget::blur(void)
+{
+ // Remember if the widget had focus
+
+ bool hadFocus = m_flags.hasFocus;
+
+ m_flags.hasFocus = false;
+
+ // Take focus away from child widgets
+
+ if (m_focusedChild != (CNxWidget *)NULL)
+ {
+ m_focusedChild->blur();
+ m_focusedChild = (CNxWidget *)NULL;
+ m_widgetControl->clearFocusedWidget(this);
+ }
+
+ // Raise an event only if the widget had focus
+
+ if (hadFocus)
+ {
+ onBlur();
+
+ m_widgetEventHandlers->raiseBlurEvent();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Move the widget to the new coordinates.
+ * Co-ordinates are relative to the parent widget.
+ *
+ * @param x The new x coordinate.
+ * @param y The new y coordinate.
+ * @return True if the move was successful.
+ */
+
+bool CNxWidget::moveTo(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Enforce widget to stay within parent confines if necessary
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (!m_parent->isPermeable())
+ {
+ CRect parentRect;
+ m_parent->getClientRect(parentRect);
+
+ // Check x coordinate
+
+ if (x < parentRect.getX())
+ {
+ x = parentRect.getX();
+
+ // Check width against new value
+
+ if (x + getWidth() > parentRect.getX2() + 1)
+ {
+ return false;
+ }
+ }
+ else if (x + getWidth() > parentRect.getX2() + 1)
+ {
+ x = (parentRect.getX() + parentRect.getX()) - getWidth();
+
+ // Check new x value
+
+ if (x < parentRect.getX())
+ {
+ return false;
+ }
+ }
+
+ // Check y coordinate
+
+ if (y < parentRect.getY())
+ {
+ y = parentRect.getY();
+
+ // Check height against new value
+
+ if (y + getHeight() > parentRect.getY2() + 1)
+ {
+ return false;
+ }
+ }
+ else if (y + getHeight() > parentRect.getY2() + 1)
+ {
+ y = (parentRect.getY() + parentRect.getY()) - getHeight();
+
+ // Check new y value
+
+ if (y < parentRect.getY())
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+ // Perform move if necessary
+
+ if ((m_rect.getX() != x) || (m_rect.getY() != y))
+ {
+ erase();
+
+ nxgl_coord_t oldX = m_rect.getX();
+ nxgl_coord_t oldY = m_rect.getY();
+
+ m_rect.setX(x);
+ m_rect.setY(y);
+
+ redraw();
+ m_widgetEventHandlers->raiseMoveEvent(x, y, x - oldX, y - oldY);
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Resize the widget to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ * @return True if the resize was successful.
+ */
+
+bool CNxWidget::resize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Enforce widget to stay within parent confines if necessary
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (!m_parent->isPermeable())
+ {
+ CRect parentRect;
+ m_parent->getClientRect(parentRect);
+
+ // Check width
+
+ if (m_rect.getX() + width > parentRect.getX2() + 1)
+ {
+ width = parentRect.getX2() + 1 - m_rect.getX();
+ }
+
+ // Check height
+
+ if (m_rect.getY() + height > parentRect.getY2() + 1)
+ {
+ height = parentRect.getY2() + 1 - m_rect.getY();
+ }
+ }
+ }
+
+ if (getWidth() != width || getHeight() != height)
+ {
+ // Remember if the widget is permeable
+
+ bool wasPermeable = m_flags.permeable;
+
+ // Remember if widget was drawing
+
+ bool wasDrawEnabled = m_flags.drawingEnabled;
+
+ m_flags.permeable = true;
+ erase();
+ disableDrawing();
+
+ m_rect.setWidth(width);
+ m_rect.setHeight(height);
+
+ // Handle visible region caching
+
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ m_parent->invalidateLowerWidgetsVisibleRectCache(this);
+ }
+
+ onResize(width, height);
+
+ // Reset the permeable value
+
+ m_flags.permeable = wasPermeable;
+
+ // Reset drawing value
+
+ m_flags.drawingEnabled = wasDrawEnabled;
+ redraw();
+ m_widgetEventHandlers->raiseResizeEvent(width, height);
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Resize and move the widget in one operation.
+ * Only performs one redraw so it is faster than calling the
+ * two separate functions.
+ *
+ * @param x The new x coordinate.
+ * @param y The new y coordinate.
+ * @param width The new width.
+ * @param height The new height.
+ * @return True if the widget was adjusted successfully.
+ */
+
+bool CNxWidget::changeDimensions(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+{
+ bool wasDrawing = m_flags.drawingEnabled;
+ m_flags.drawingEnabled = false;
+ bool moved = moveTo(x, y);
+ m_flags.drawingEnabled = wasDrawing;
+ return (resize(width, height) | moved);
+}
+
+/**
+ * Raises the widget to the top of its parent's widget stack.
+ *
+ * @return True if the raise was successful.
+ */
+
+bool CNxWidget::raiseToTop(void)
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (m_parent->raiseWidgetToTop(this))
+ {
+ m_widgetEventHandlers->raiseMoveForwardEvent();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Lowers the widget to the bottom of its parent's widget stack.
+ *
+ * @return True if the lower was successful.
+ */
+
+bool CNxWidget::lowerToBottom(void)
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ if (m_parent->lowerWidgetToBottom(this))
+ {
+ m_widgetEventHandlers->raiseMoveBackwardEvent();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Raises the supplied widget to the top of this widget's child stack.
+ * The supplied widget pointer must be a child of this widget.
+ *
+ * @param widget A pointer to the child widget to raise.
+ * @return True if the raise was successful.
+ */
+
+bool CNxWidget::raiseWidgetToTop(CNxWidget *widget)
+{
+ // Locate widget in the stack
+
+ int index = getWidgetIndex(widget);
+
+ if ((index > -1) && (index < m_children.size() - 1))
+ {
+ m_children.erase(index);
+ m_children.push_back(widget);
+
+ widget->invalidateVisibleRectCache();
+
+ // Invalidate all widgets that collide with the depth-swapped widget
+
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ if (m_children[i]->checkCollision(widget))
+ {
+ m_children[i]->invalidateVisibleRectCache();
+ }
+ }
+
+ widget->redraw();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Lowers the supplied widget to the bottom of this widget's child stack.
+ * The supplied widget pointer must be a child of this widget.
+ *
+ * @param widget A pointer to the child widget to lower.
+ * @return True if the lower was successful.
+ */
+
+bool CNxWidget::lowerWidgetToBottom(CNxWidget *widget)
+{
+ // Locate widget in the stack
+
+ int index = getWidgetIndex(widget);
+
+ if (index > 0)
+ {
+ widget->erase();
+
+ // Handle visible region caching
+
+ widget->invalidateVisibleRectCache();
+ invalidateLowerWidgetsVisibleRectCache(widget);
+
+ m_children.erase(index);
+ m_children.insert(0, widget);
+
+ widget->redraw();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Moves the supplied child widget to the deletion queue.
+ * For framework use only.
+ *
+ * @param widget A pointer to the child widget.
+ */
+
+void CNxWidget::moveChildToDeleteQueue(CNxWidget *widget)
+{
+ // Locate widget in main vector
+
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ if (m_children[i] == widget)
+ {
+ // Add widget to controlling widget's delete vector
+
+ m_widgetControl->addToDeleteQueue(widget);
+
+ // Remove widget from main vector
+
+ m_children.erase(i);
+ break;
+ }
+ }
+}
+
+/**
+ * Moves the supplied child widget to the shelved widget list.
+ * For framework use only.
+ *
+ * @param widget A pointer to the child widget.
+ * @return True if the widget was moved successfully.
+ * @see moveShelvedToChildList()
+ * @see hide()
+ */
+
+bool CNxWidget::moveChildToShelvedList(CNxWidget *widget)
+{
+ // Locate widget in main vector
+
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ if (m_children[i] == widget)
+ {
+ // Add widget to shelved vector
+
+ m_shelvedWidgets.push_back(widget);
+
+ // Remove widget from main vector
+
+ m_children.erase(i);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Moves the supplied child widget from the shelved list back
+ * to the child widget list.
+ * For framework use only.
+ *
+ * @param widget A pointer to the shelved widget.
+ * @return True if the widget was moved successfully.
+ * @see moveChildtoShelvedList()
+ * @see show()
+ */
+
+bool CNxWidget::moveShelvedToChildList(CNxWidget *widget)
+{
+ // Locate widget in shelved vector
+
+ for (int i = 0; i < m_shelvedWidgets.size(); i++)
+ {
+ if (m_shelvedWidgets[i] == widget)
+ {
+ // Add widget to end of main vector
+
+ m_children.push_back(widget);
+
+ // Remove widget from shelved vector
+
+ m_shelvedWidgets.erase(i);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Sets the supplied widget as the focused child. The widget must
+ * be a child of this widget.
+ *
+ * @param widget A pointer to the child widget.
+ * @see getFocusedWidget()
+ */
+
+void CNxWidget::setFocusedWidget(CNxWidget *widget)
+{
+ if (m_focusedChild != widget)
+ {
+ if (m_focusedChild != NULL)
+ {
+ // Blur the current active widget
+
+ m_focusedChild->blur();
+ }
+ }
+
+ // Remember the new active widget
+
+ m_focusedChild = widget;
+
+ // Make this widget active too
+
+ focus();
+
+ // Route keyboard input to the focused widget
+
+ m_widgetControl->setFocusedWidget(this);
+}
+
+/**
+ * Checks if the supplied coordinates collide with this widget.
+ *
+ * @param x The x coordinate to check.
+ * @param y The y coordinate to check.
+ * @return True if a collision occurred.
+ */
+
+bool CNxWidget::checkCollision(nxgl_coord_t x, nxgl_coord_t y) const
+{
+ if (isHidden())
+ {
+ return false;
+ }
+
+ // Get the clipped rect
+
+ CRect rect;
+ getRectClippedToHierarchy(rect);
+ return rect.contains(x, y);
+}
+
+/**
+ * Checks if the supplied rectangle definition collides with this widget.
+ *
+ * @param x The x coordinate of the rectangle to check.
+ * @param y The y coordinate of the rectangle to check.
+ * @param width The width of the rectangle to check.
+ * @param height The height of the rectangle to check.
+ * @return True if a collision occurred.
+ */
+
+bool CNxWidget::checkCollision(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height) const
+{
+ if (isHidden())
+ {
+ return false;
+ }
+
+ // Get the clipped rect
+
+ CRect rect;
+ getRectClippedToHierarchy(rect);
+ return rect.intersects(CRect(x, y, width, height));
+}
+
+/**
+ * Checks if the supplied widget collides with this widget.
+ *
+ * @param widget A pointer to another widget to check for collisions with.
+ * @return True if a collision occurred.
+ */
+
+bool CNxWidget::checkCollision(CNxWidget *widget) const
+{
+ // Get the clipped rect
+
+ CRect rect;
+ widget->getRectClippedToHierarchy(rect);
+ return rect.intersects(m_rect);
+}
+
+/**
+ * Invalidate the visible region cache for all widgets below the supplied
+ * widget in this widget's child stack. This will cause those widgets to
+ *
+ * recalculate their visible regions next time they try to draw themselves.
+ * @param widget A pointer to a child widget.
+ */
+
+void CNxWidget::invalidateLowerWidgetsVisibleRectCache(CNxWidget *widget)
+{
+ // Find the widget
+
+ int widgetIndex = getWidgetIndex(widget);
+
+ // Invalidate lower widgets
+
+ for (int i = widgetIndex - 1; i > -1; i--)
+ {
+ if (m_children[i]->checkCollision(widget))
+ {
+ m_children[i]->invalidateVisibleRectCache();
+ }
+ }
+}
+
+/**
+ * Adds a widget to this widget's child stack. The widget is added to the
+ * top of the stack. Note that the widget can only be added if it is not
+ * already a child of another widget.
+ *
+ * @param widget A pointer to the widget to add to the child list.
+ * @see insertWidget()
+ */
+
+void CNxWidget::addWidget(CNxWidget *widget)
+{
+ if (widget->getParent() == NULL)
+ {
+ widget->setParent(this);
+ m_children.push_back(widget);
+
+ // Should the widget steal the focus?
+
+ if (widget->hasFocus())
+ {
+ setFocusedWidget(widget);
+ }
+
+ widget->enableDrawing();
+ invalidateVisibleRectCache();
+ widget->redraw();
+ }
+}
+
+/**
+ * Inserts a widget into this widget's child stack at the bottom of the
+ * stack. Note that the widget can only be added if it is not already
+ * a child of another widget.
+ *
+ * @param widget A pointer to the widget to add to the child list.
+ * @see addWidget()
+ */
+
+void CNxWidget::insertWidget(CNxWidget *widget)
+{
+ if (widget->getParent() == NULL)
+ {
+ widget->setParent(this);
+ m_children.insert(0, widget);
+
+ widget->enableDrawing();
+ invalidateVisibleRectCache();
+ widget->redraw();
+ }
+}
+
+/**
+ * Rebuild the list of this widget's visible regions
+ */
+
+void CNxWidget::cacheVisibleRects(void) const
+{
+ m_rectCache->cache();
+}
+
+/**
+ * Mark this widget's visible region cache as invalid, and do the same
+ * to its child widgets.
+ */
+
+void CNxWidget::invalidateVisibleRectCache(void)
+{
+ m_rectCache->invalidate();
+
+ // Invalidate child cache
+
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ m_children[i]->invalidateVisibleRectCache();
+ }
+}
+
+/**
+ * Erase a child widget by drawing the widgets behind it.
+ *
+ * @param widget The child widget to erase.
+ */
+
+void CNxWidget::eraseWidget(CNxWidget *widget)
+{
+ // Locate the widget
+
+ int widgetIndex = getWidgetIndex(widget);
+
+ // Ensure rect cache is up to date
+
+ widget->cacheVisibleRects();
+
+ // Order all lower widgets to redraw themselves based on the erased widget's
+ // visible rect cache
+
+ for (int i = widgetIndex - 1; i > -1; i--)
+ {
+ m_children[i]->redrawDirty(widget->getForegroundRegions(), widget);
+ }
+
+ // Order this widget to redraw itself based on any remaining rectangles
+ // in the erased widget's rect cache
+
+ redrawDirty(widget->getForegroundRegions(), widget);
+ invalidateVisibleRectCache();
+}
+
+/**
+ * Redraw any visible regions of this widget that have become corrupted.
+ *
+ * @param invalidRects A list of corrupt regions.
+ * @param sender A pointer to the widget that corrupted the regions.
+ */
+
+void CNxWidget::redrawDirty(TNxArray<CRect> *invalidRects, CNxWidget *sender)
+{
+ if (isDrawingEnabled())
+ {
+ // Draw any children first
+
+ redrawDirtyChildren(invalidRects, sender);
+
+ // Create an array that will contain all of the rects from the
+ // original array that overlap this widget
+
+ TNxArray<CRect> *overlappingRects = new TNxArray<CRect>();
+
+ // Remove any non-overlapping rectangles from dirty vector and add to
+ // overlapping vector
+
+ m_rectCache->splitRectangles(invalidRects, overlappingRects, sender);
+
+ // Create an array that will contain all of the rects that overlap this
+ // widget clipped to its parent
+
+ TNxArray<CRect> *rectsToDraw = new TNxArray<CRect>();
+
+ // Split from overlappingRects into rectsToDraw, giving us an array
+ // of rects that overlap only the visible portions of this widget
+
+ m_rectCache->splitRectangles(overlappingRects, rectsToDraw, sender);
+
+ // Get the graphics port for drawing in this window
+
+ CGraphicsPort *port = m_widgetControl->getGraphicsPort();
+
+ // Draw the dirty rects
+
+ if (rectsToDraw->size() > 0)
+ {
+ for (int i = 0; i < rectsToDraw->size(); i++)
+ {
+ drawBorder(port);
+ drawContents(port);
+ }
+ }
+
+ // Copy all of the overlapping rects we didn't draw back to the main
+ // array of rects that need to be drawn by another widget
+
+ for (int i = 0; i < overlappingRects->size(); i++)
+ {
+ invalidRects->push_back(overlappingRects->at(i));
+ }
+
+ // Clean up
+
+ delete overlappingRects;
+ delete rectsToDraw;
+ }
+}
+
+/**
+ * Clips a rectangular region to the dimensions of this widget and its ancestors.
+ *
+ * @param rect The region that needs to be clipped.
+ */
+
+void CNxWidget::clipRectToHierarchy(CRect &rect) const {
+
+ const CNxWidget *parent = m_parent;
+ const CNxWidget *widget = this;
+ CRect thisRect;
+
+ while (parent != NULL)
+ {
+ // Standard widgets can draw into client space
+
+ parent->getClientRect(thisRect);
+
+ // Adjust rect to screen space
+
+ thisRect.offset(parent->getX(), parent->getY());
+ rect.clipToIntersect(thisRect);
+
+ // Send up to parent
+
+ widget = parent;
+ parent = parent->getParent();
+ }
+}
+
+ /**
+ * Swaps the depth of the supplied child widget.
+ *
+ * @param widget A pointer to the child widget that needs to swap depths.
+ * @return True if the swap was successful.
+ */
+
+bool CNxWidget::swapWidgetDepth(CNxWidget *widget)
+{
+ // Can we swap?
+
+ if (m_children.size() > 1)
+ {
+ int widgetSource = 0;
+ int widgetDest = 0;
+
+ // Locate the widget in the vector
+
+ widgetSource = getWidgetIndex(widget);
+
+ // Attempt to raise up
+
+ int i = getHigherVisibleWidget(widgetSource);
+ if (i > -1)
+ {
+ // Raise
+
+ widgetDest = i;
+ }
+ else
+ {
+ // Lower to bottom of stack
+
+ widgetDest = 0;
+ }
+
+ // Erase the widget from the screen
+
+ eraseWidget(widget);
+
+ // Swap
+
+ CNxWidget *tmp = m_children[widgetSource];
+ m_children[widgetSource] = m_children[widgetDest];
+ m_children[widgetDest] = tmp;
+
+ // Invalidate the widgets below the top affected widget
+
+ if (widgetSource < widgetDest)
+ {
+ // Source lower; invalidate from dest down
+
+ m_children[widgetDest]->invalidateVisibleRectCache();
+ invalidateLowerWidgetsVisibleRectCache(m_children[widgetDest]);
+ }
+ else
+ {
+ // Dest lower; invalidate from source down
+
+ m_children[widgetSource]->invalidateVisibleRectCache();
+ invalidateLowerWidgetsVisibleRectCache(m_children[widgetSource]);
+ }
+
+ // Redraw the widget
+
+ widget->redraw();
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Swap the depth of this widget.
+ *
+ * @return True if the swap was successful.
+ */
+
+bool CNxWidget::swapDepth(void)
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ return m_parent->swapWidgetDepth(this);
+ }
+
+ return false;
+}
+
+/**
+ * Remove this widget from the widget hierarchy. Returns
+ * responsibility for deleting the widget back to the developer.
+ * Does not unregister the widget from the VBL system.
+ * Does not erase the widget from the display.
+ *
+ * @return True if the widget was successfully removed.
+ */
+
+bool CNxWidget::remove(void)
+{
+ if (m_parent != (CNxWidget *)NULL)
+ {
+ return m_parent->removeChild(this);
+ }
+
+ return false;
+}
+
+/**
+ * Remove a child widget from the widget hierarchy. Returns
+ * responsibility for deleting the widget back to the developer.
+ * Does not unregister the widget from the VBL system.
+ * Does not erase the widget from the display.
+ *
+ * @param widget Pointer to the widget to remove from the hierarchy.
+ * @return True if the widget was succesfully removed.
+ */
+
+bool CNxWidget::removeChild(CNxWidget *widget)
+{
+ // Do we need to make another widget active?
+
+ if (m_focusedChild == widget)
+ {
+ m_focusedChild = (CNxWidget *)NULL;
+ m_widgetControl->clearFocusedWidget(this);
+ }
+
+ // Unset clicked widget if necessary
+
+ CNxWidget *clickedWidget = m_widgetControl->getClickedWidget();
+ if (clickedWidget == widget)
+ {
+ clickedWidget->release(clickedWidget->getX(), clickedWidget->getY());
+ }
+
+ // Divorce child from parent
+
+ widget->setParent((CNxWidget *)NULL);
+ widget->disableDrawing();
+
+ // Locate widget in main vector
+
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ if (m_children[i] == widget)
+ {
+ // Remove widget from main vector
+
+ m_children.erase(i);
+ return true;
+ }
+ }
+
+ // Try to locate in shelved vector
+
+ for (int i = 0; i < m_shelvedWidgets.size(); i++)
+ {
+ if (m_shelvedWidgets[i] == widget)
+ {
+ // Divorce child from parent
+
+ m_shelvedWidgets[i]->setParent((CNxWidget *)NULL);
+
+ // Remove widget from shelved vector
+
+ m_shelvedWidgets.erase(i);
+ widget->disableDrawing();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Run the widget modally.
+ */
+
+void CNxWidget::goModal(void)
+{
+ // Remember that we're running modally
+
+ m_flags.modal = true;
+
+ // Steal focus
+
+ focus();
+
+ // Loop until no longer modal
+
+ while (isModal())
+ {
+ // Process pending events
+
+ bool interestingEvent = m_widgetControl->pollEvents(this);
+
+ // Did any interesting events occur?
+
+ if (!interestingEvent)
+ {
+ // No, give up the CPU until something interesting happens.
+
+ m_widgetControl->waitForModalEvent();
+ }
+ }
+}
+
+/**
+ * Get the index of the specified child widget.
+ *
+ * @param widget The widget to get the index of.
+ * @return The index of the widget. -1 if the widget is not found.
+ */
+
+const int CNxWidget::getWidgetIndex(const CNxWidget *widget) const
+{
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ if (m_children[i] == widget)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/**
+ * Get the child widget at the specified index.
+ *
+ * @param index Index of the child to retrieve.
+ * @return Pointer to the child at the specified index.
+ */
+
+const CNxWidget *CNxWidget::getChild(const int index) const
+{
+ if (index < (int)m_children.size())
+ {
+ return m_children[index];
+ }
+ return (CNxWidget *)NULL;
+}
+
+/**
+ * Sets the border size. The border cannot be drawn over in the
+ * drawContents() method.
+ *
+ * @param borderSize The new border size.
+ */
+
+void CNxWidget::setBorderSize(const WidgetBorderSize &borderSize)
+{
+ m_borderSize.top = borderSize.top;
+ m_borderSize.right = borderSize.right;
+ m_borderSize.bottom = borderSize.bottom;
+ m_borderSize.left = borderSize.left;
+}
+
+/**
+ * Use the provided widget style
+ */
+
+void CNxWidget::useWidgetStyle(const CWidgetStyle *style)
+{
+ m_style.colors.background = style->colors.background;
+ m_style.colors.selectedBackground = style->colors.selectedBackground;
+ m_style.colors.shineEdge = style->colors.shineEdge;
+ m_style.colors.shadowEdge = style->colors.shadowEdge;
+ m_style.colors.highlight = style->colors.highlight;
+ m_style.colors.disabledText = style->colors.disabledText;
+ m_style.colors.enabledText = style->colors.enabledText;
+ m_style.colors.selectedText = style->colors.selectedText;
+ m_style.font = style->font;
+}
+
+/**
+ * Checks if the supplied coordinates collide with a portion of this widget
+ * that is not obscured by its siblings, but that may be obscured by
+ * its children.
+ *
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ * @return True if a collision occurred; false if not.
+ */
+
+bool CNxWidget::checkCollisionWithForegroundRects(nxgl_coord_t x, nxgl_coord_t y) const
+{
+ if (isHidden())
+ {
+ return false;
+ }
+
+ cacheVisibleRects();
+
+ CRect *rect;
+ for (int i = 0; i < m_rectCache->getForegroundRegions()->size(); ++i)
+ {
+ rect = &(m_rectCache->getForegroundRegions()->at(i));
+ if (rect->contains(x, y))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Draw all visible regions of this widget's children.
+ */
+
+void CNxWidget::drawChildren(void)
+{
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ m_children[i]->redraw();
+ }
+}
+
+/**
+ * Erase and remove the supplied child widget from this widget and
+ * send it to the deletion queue.
+ *
+ * @param widget The widget to close.
+ * @see close().
+ */
+
+void CNxWidget::closeChild(CNxWidget *widget)
+{
+ if (widget == NULL)
+ {
+ return;
+ }
+
+ // Ensure widget knows it is being closed
+
+ widget->close();
+
+ // Do we need to make another widget active?
+
+ if (m_focusedChild == widget)
+ {
+ m_focusedChild = (CNxWidget *)NULL;
+ m_widgetControl->clearFocusedWidget(this);
+
+ // Try to choose highest widget
+
+ for (int i = m_children.size() - 1; i > -1; i--)
+ {
+ if ((m_children[i] != widget) && (!m_children[i]->isHidden()))
+ {
+ m_focusedChild = m_children[i];
+ }
+ }
+
+ // Where should the focus go?
+
+ if (m_focusedChild != NULL)
+ {
+ // Send focus to the new active widget
+
+ m_focusedChild->focus();
+
+ // Route keyboard input to the focused widget
+
+ m_widgetControl->setFocusedWidget(this);
+ }
+ else
+ {
+ // Give focus to this
+
+ setFocusedWidget((CNxWidget *)NULL);
+ }
+ }
+
+ moveChildToDeleteQueue(widget);
+}
+
+/**
+ * Erase the supplied child widget and move it out of the main child
+ * list into the shelved list. The widget remains in memory and can
+ * be restored by calling "unshelve()" on the widget.
+ *
+ * @param widget The widget to hide.
+ */
+
+void CNxWidget::shelveChild(CNxWidget *widget)
+{
+ if (widget == NULL)
+ {
+ return;
+ }
+
+ // Ensure widget knows it is being shelved
+
+ widget->shelve();
+
+ // Do we need to give another widget focus?
+
+ if (m_focusedChild == widget)
+ {
+ m_focusedChild = (CNxWidget *)NULL;
+ m_widgetControl->clearFocusedWidget(this);
+
+ // Try to choose highest widget
+
+ for (int i = m_children.size() - 1; i > -1; i--)
+ {
+ if ((m_children[i] != widget) && (!m_children[i]->isHidden()))
+ {
+ m_focusedChild = m_children[i];
+ }
+ }
+
+ // Where should the focus go?
+
+ if (m_focusedChild != NULL)
+ {
+ // Send focus to the new active widget
+
+ m_focusedChild->focus();
+
+ // Route keyboard input to the focused widget
+
+ m_widgetControl->setFocusedWidget(this);
+ }
+ else
+ {
+ // Give focus to this
+
+ setFocusedWidget((CNxWidget *)NULL);
+ }
+ }
+
+ moveChildToShelvedList(widget);
+}
+
+ /**
+ * Redraws all regions of child widgets that fall within the invalidRects
+ * regions.
+ *
+ * @param invalidRects List of invalid regions that need to be redrawn.
+ * @param sender Pointer to the widget that initiated the redraw.
+ */
+
+void CNxWidget::redrawDirtyChildren(TNxArray<CRect> *invalidRects, CNxWidget *sender)
+{
+ for (int i = m_children.size() - 1; i > -1 ; i--)
+ {
+ if (invalidRects->size() > 0)
+ {
+ if (m_children.at(i) != sender)
+ {
+ m_children[i]->redrawDirty(invalidRects, sender);
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+}
+
+/**
+ * Get the index of the next visible widget higher up the z-order.
+ *
+ * @param startIndex The starting index.
+ * @return The index of the next highest visible widget.
+ */
+
+const int CNxWidget::getHigherVisibleWidget(const int startIndex) const
+{
+ for (int i = startIndex; i < m_children.size(); i++)
+ {
+ if (!m_children[i]->isHidden())
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/**
+ * Get the index of the next visible widget lower down the z-order.
+ *
+ * @param startIndex The starting index.
+ * @return The index of the next lowest visible widget.
+ */
+
+const int CNxWidget::getLowerVisibleWidget(const int startIndex) const
+{
+ for (int i = startIndex; i > -1; i--)
+ {
+ if (!m_children[i]->isHidden())
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/**
+ * Notify this widget that it is being dragged, and set its drag point.
+ *
+ * @param x The x coordinate of the drag position relative to this widget.
+ * @param y The y coordinate of the drag position relative to this widget.
+ */
+
+void CNxWidget::startDragging(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (m_flags.draggable)
+ {
+ m_flags.dragging = true;
+ m_flags.clicked = true;
+ m_grabPointX = x - getX();
+ m_grabPointY = y - getY();
+ m_newX = m_rect.getX();
+ m_newY = m_rect.getY();
+
+ onDragStart();
+ }
+}
+
+/**
+ * Notify this widget that it is no longer being dragged.
+ */
+
+void CNxWidget::stopDragging(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (m_flags.dragging)
+ {
+ onDragStop();
+ m_flags.dragging = false;
+ m_widgetEventHandlers->raiseDropEvent(x, y);
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/cnxwindow.cxx b/NxWidgets/libnxwidgets/src/cnxwindow.cxx
new file mode 100644
index 000000000..fd4cc6ef2
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cnxwindow.cxx
@@ -0,0 +1,342 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cnxwindow.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cnxwindow.hxx"
+#include "cbitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param hNxServer Handle to the NX server.
+ */
+
+CNxWindow::CNxWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl)
+ : CCallback(pWidgetControl), m_hNxServer(hNxServer), m_hNxWindow(0),
+ m_widgetControl(pWidgetControl)
+{
+ // Create the CGraphicsPort instance for this window
+
+ m_widgetControl->createGraphicsPort(static_cast<INxWindow*>(this));
+}
+
+/**
+ * Destructor.
+ */
+
+CNxWindow::~CNxWindow(void)
+{
+ // Release the window. We do not release the widget control
+ // instance. The lifetime of that instance is owned by he-who-
+ // constructed-us.
+
+ (void)nx_closewindow(m_hNxWindow);
+}
+
+/**
+ * Creates a new window. Window creation is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the window was successfully opened.
+ */
+
+bool CNxWindow::open(void)
+{
+ // Get the C-callable callback vtable
+
+ FAR struct nx_callback_s *vtable = getCallbackVTable();
+
+ // Create the window
+
+ m_hNxWindow = nx_openwindow(m_hNxServer, vtable, (FAR void *)m_widgetControl);
+ return m_hNxWindow != NULL;
+}
+
+/**
+ * Request the position and size information of the window. The values
+ * will be returned asynchronously through the client callback method.
+ * The GetPosition() method may than be called to obtain the positional
+ * data as provided by the callback.
+ *
+ * @return True on success, false on any failure.
+ */
+
+bool CNxWindow::requestPosition(void)
+{
+ // Request the window position
+
+ return nx_getposition(m_hNxWindow) == OK;
+}
+
+/**
+ * Get the position of the window in the physical display coordinates
+ * (as reported by the NX callback).
+ *
+ * @return The position.
+ */
+
+bool CNxWindow::getPosition(FAR struct nxgl_point_s *pPos)
+{
+ return m_widgetControl->getWindowPosition(pPos);
+}
+
+/**
+ * Get the size of the window (as reported by the NX callback).
+ *
+ * @return The size.
+ */
+
+bool CNxWindow::getSize(FAR struct nxgl_size_s *pSize)
+{
+ return m_widgetControl->getWindowSize(pSize);
+}
+
+/**
+ * Set the position and size of the window.
+ *
+ * @param pPos The new position of the window.
+ * @return True on success, false on any failure.
+ */
+
+bool CNxWindow::setPosition(FAR const struct nxgl_point_s *pPos)
+{
+ // Set the window size and position
+
+ return nx_setposition(m_hNxWindow, pPos) == OK;
+}
+
+/**
+ * Set the size of the selected window.
+ *
+ * @param pSize The new size of the window.
+ * @return True on success, false on any failure.
+ */
+
+bool CNxWindow::setSize(FAR const struct nxgl_size_s *pSize)
+{
+ // Set the window size
+
+ return nx_setsize(m_hNxWindow, pSize) == OK;
+}
+
+/**
+ * Bring the window to the top of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+bool CNxWindow::raise(void)
+{
+ // Raise the window to the top of the display
+
+ return nx_raise(m_hNxWindow) == OK;
+}
+
+/**
+ * Lower the window to the bottom of the display.
+ *
+ * @return True on success, false on any failure.
+ */
+
+bool CNxWindow::lower(void)
+{
+ // Lower the window to the bottom of the display
+
+ return nx_lower(m_hNxWindow) == OK;
+}
+
+/**
+ * Set an individual pixel in the window with the specified color.
+ *
+ * @param pPos The location of the pixel to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxWindow::setPixel(FAR const struct nxgl_point_s *pPos,
+ nxgl_mxpixel_t color)
+{
+ // Set an individual pixel to the specified color
+
+ return nx_setpixel(m_hNxWindow, pPos, &color) == OK;
+}
+
+/**
+ * Fill the specified rectangle in the window with the specified color.
+ *
+ * @param pRect The location to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxWindow::fill(FAR const struct nxgl_rect_s *pRect,
+ nxgl_mxpixel_t color)
+{
+ // Fill a rectangular region with a solid color
+
+ return nx_fill(m_hNxWindow, pRect, &color) == OK;
+}
+
+/**
+ * Get the raw contents of graphic memory within a rectangular region. NOTE:
+ * Since raw graphic memory is returned, the returned memory content may be
+ * the memory of windows above this one and may not necessarily belong to
+ * this window unless you assure that this is the top window.
+ *
+ * @param rect The location to be copied
+ * @param dest - The describes the destination bitmap to receive the
+ * graphics data.
+ */
+
+void CNxWindow::getRectangle(FAR const struct nxgl_rect_s *rect, struct SBitmap *dest)
+{
+ // Get a rectangule region from the window
+
+ (void)nx_getrectangle(m_hNxWindow, rect, 0, (FAR uint8_t*)dest->data, dest->stride);
+}
+/**
+ * Fill the specified trapezoidal region in the window with the specified
+ * color.
+ *
+ * @param pClip Clipping rectangle relative to window (may be null).
+ * @param pTrap The trapezoidal region to be filled.
+ * @param color The color to use in the fill.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
+ FAR const struct nxgl_trapezoid_s *pTrap,
+ nxgl_mxpixel_t color)
+{
+ // Fill a trapezoidal region with a solid color
+
+ return nx_filltrapezoid(m_hNxWindow, pClip, pTrap, &color) == OK;
+}
+
+/**
+ * Fill the specified line in the window with the specified color.
+ *
+ * @param vector - Describes the line to be drawn
+ * @param width - The width of the line
+ * @param color - The color to use to fill the line
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxWindow::drawLine(FAR struct nxgl_vector_s *vector,
+ nxgl_coord_t width, nxgl_mxpixel_t color)
+{
+ // Draw a line with the specified color
+
+ return nx_drawline(m_hNxWindow, vector, width, &color) == OK;
+}
+
+/**
+ * Draw a filled circle at the specified position, size, and color.
+ *
+ * @param center The window-relative coordinates of the circle center.
+ * @param radius The radius of the rectangle in pixels.
+ * @param color The color of the rectangle.
+ */
+
+bool CNxWindow::drawFilledCircle(struct nxgl_point_s *center, nxgl_coord_t radius,
+ nxgl_mxpixel_t color)
+{
+ return nx_fillcircle(m_hNxWindow, center, radius, &color) == OK;
+}
+
+/**
+ * Move a rectangular region within the window.
+ *
+ * @param pRect Describes the rectangular region to move.
+ * @param pOffset The offset to move the region.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxWindow::move(FAR const struct nxgl_rect_s *pRect,
+ FAR const struct nxgl_point_s *pOffset)
+{
+ // Move a rectangular region of the display
+
+ return nx_move(m_hNxWindow, pRect, pOffset) == OK;
+}
+
+/**
+ * Copy a rectangular region of a larger image into the rectangle in the
+ * specified window. The source image is treated as an opaque image.
+ *
+ * @param pDest Describes the rectangular on the display that will receive
+ * the bitmap.
+ * @param pSrc The start of the source image.
+ * @param pOrigin the pOrigin of the upper, left-most corner of the full
+ * bitmap. Both pDest and pOrigin are in window coordinates, however,
+ * pOrigin may lie outside of the display.
+ * @param stride The width of the full source image in bytes.
+ *
+ * @return True on success; false on failure.
+ */
+
+bool CNxWindow::bitmap(FAR const struct nxgl_rect_s *pDest,
+ FAR const void *pSrc,
+ FAR const struct nxgl_point_s *pOrigin,
+ unsigned int stride)
+{
+ // Copy a rectangular bitmap image in a region on the display
+
+ return nx_bitmap(m_hNxWindow, pDest, &pSrc, pOrigin, stride) == OK;
+}
diff --git a/NxWidgets/libnxwidgets/src/cprogressbar.cxx b/NxWidgets/libnxwidgets/src/cprogressbar.cxx
new file mode 100644
index 000000000..5f29a3f7e
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cprogressbar.cxx
@@ -0,0 +1,230 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cprogressbar.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <cstdio>
+#include <cstring>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cprogressbar.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the progress bar, relative to its parent.
+ * @param y The y coordinate of the progress bar, relative to its parent.
+ * @param width The width of the progress bar.
+ * @param height The height of the progress bar.
+ */
+
+CProgressBar::CProgressBar(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+: CNxWidget(pWidgetControl, x, y, width, height, 0)
+{
+ m_minimumValue = 0;
+ m_maximumValue = 0;
+ m_value = 0;
+ m_showPercentageText = true;
+ m_flags.borderless = false;
+}
+
+/**
+ * Set the value that of the progress bar.
+ *
+ * @param value The new value.
+ */
+
+void CProgressBar::setValue(const int16_t value)
+{
+ m_value = value;
+
+ // Limit to max/min values
+
+ if (m_value > m_maximumValue)
+ {
+ m_value = m_maximumValue;
+ }
+
+ if (m_value < m_minimumValue)
+ {
+ m_value = m_minimumValue;
+ }
+
+ redraw();
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CProgressBar::drawContents(CGraphicsPort *port)
+{
+ // Get the drawing window, accounting for the presence of any border
+
+ CRect rect;
+ getRect(rect);
+
+ // Calculate ratio of pixels to value range (max fractional value of 255)
+
+ uint32_t ratio = ((uint32_t)rect.getWidth() << 8) / (uint32_t)(m_maximumValue - m_minimumValue);
+
+ // Convert value using ratio, rounding up and shifting down
+
+ int16_t barWidth = ((m_value * ratio) + 128) >> 8;
+
+ // Draw filled region
+
+ port->drawFilledRect(rect.getX(), rect.getY(), barWidth, rect.getHeight(), getHighlightColor());
+
+ // Draw unfilled background
+
+ if (barWidth < rect.getWidth())
+ {
+ port->drawFilledRect(rect.getX() + barWidth, rect.getY(),
+ rect.getWidth() - barWidth, rect.getHeight(),
+ getBackgroundColor());
+ }
+
+ // Draw completion percentage text
+
+ if (m_showPercentageText)
+ {
+ char text[6];
+ sprintf(text, "%d%%", (100 * m_value) / (m_maximumValue - m_minimumValue));
+
+ struct nxgl_point_s pos;
+ pos.x = rect.getX() +
+ ((rect.getWidth() - getFont()->getStringWidth(text)) >> 1);
+ pos.y = rect.getY() +
+ ((rect.getHeight() - getFont()->getHeight()) >> 1);
+
+ // Determine the background and text color
+
+ nxgl_mxpixel_t textColor;
+
+ if (!isEnabled())
+ {
+ textColor = getDisabledTextColor();
+ }
+ else
+ {
+ textColor = getEnabledTextColor();
+ }
+
+ // And draw the text using the selected color
+
+ port->drawText(&pos, &rect, getFont(), text, 0, strlen(text),
+ textColor);
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CProgressBar::drawBorder(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/cradiobutton.cxx b/NxWidgets/libnxwidgets/src/cradiobutton.cxx
new file mode 100644
index 000000000..86ad4118f
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cradiobutton.cxx
@@ -0,0 +1,225 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cradiobutton.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cradiobutton.hxx"
+#include "cradiobuttongroup.hxx"
+#include "cgraphicsport.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CLabel Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the radio button, relative to its
+ * parent.
+ * @param y The y coordinate of the radio button, relative to its
+ * parent.
+ * @param width The width of the radio button.
+ * @param height The height of the radio button.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * defaultCWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CRadioButton::CRadioButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style)
+: CButton(pWidgetControl, x, y, width, height, *NXWidgets::g_nullString, style)
+{
+ m_state = RADIO_BUTTON_STATE_OFF;
+ m_flags.borderless = true;
+}
+
+/**
+ * Set the state of the radio button.
+ *
+ * @param state The new radio button state.
+ */
+
+void CRadioButton::setState(CRadioButton::RadioButtonState state)
+{
+ if (m_state != state)
+ {
+ m_state = state;
+
+ if (m_state != RADIO_BUTTON_STATE_OFF)
+ {
+ ((CRadioButtonGroup*)m_parent)->setSelectedWidget(this);
+ }
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ redraw();
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CRadioButton::drawContents(CGraphicsPort *port)
+{
+ // Get the X/Y position of the drawable region within the Label
+
+ nxgl_coord_t x = getX();
+ nxgl_coord_t y = getY();
+
+ nxgl_coord_t width = getWidth();
+ nxgl_coord_t height = getHeight();
+
+ // Include and offset for the border
+
+ if (!m_flags.borderless)
+ {
+ x += m_borderSize.left;
+ y += m_borderSize.top;
+
+ width -= (m_borderSize.left + m_borderSize.right);
+ height -= (m_borderSize.top + m_borderSize.bottom);
+ }
+
+ // Decide which glyph to draw
+
+ const struct SBitmap *glyph;
+
+ switch (m_state)
+ {
+ default:
+ case RADIO_BUTTON_STATE_ON:
+ glyph = &g_radioButtonOn;
+ break;
+
+ case RADIO_BUTTON_STATE_OFF:
+ glyph = &g_radioButtonOff;
+ break;
+
+ case RADIO_BUTTON_STATE_MU:
+ glyph = &g_radioButtonMu;
+ break;
+ }
+
+ // Don't exceed the size of the glyph
+
+ if (width > glyph->width)
+ {
+ width = glyph->width;
+ }
+
+ if (height > glyph->height)
+ {
+ height = glyph->height;
+ }
+
+ // Draw button
+
+ port->drawBitmap(x, y, width, height, glyph, 0, 0,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+}
+
+/**
+ * Sets the radiobutton's state to "on".
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CRadioButton::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ setState(RADIO_BUTTON_STATE_ON);
+}
diff --git a/NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx b/NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx
new file mode 100644
index 000000000..b1d75f625
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx
@@ -0,0 +1,344 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cradiobutton.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cradiobuttongroup.hxx"
+#include "cradiobutton.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CLabel Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor. Note that the group determines its width and height
+ * from the position and dimensions of its children.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the group.
+ * @param y The y coordinate of the group.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CRadioButtonGroup::CRadioButtonGroup(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ CWidgetStyle *style)
+: CNxWidget(pWidgetControl, x, y, 0, 0, WIDGET_BORDERLESS, style)
+{
+ m_widgetControl = pWidgetControl;
+ m_selectedWidget = (CRadioButton *)NULL;
+}
+
+/**
+ * Simple method for adding a new radio button to the group.
+ * This should be used in preference to the usual addWidget() method,
+ * as this method automatically resizes the group.
+ *
+ * @param x The x coordinate of the new button, relative to this
+ * widget.
+ * @param y The y coordinate of the new button, relative to this
+ * widget.
+ * @param width The width of the new button.
+ * @param height The height of the new button.
+ */
+
+CRadioButton *CRadioButtonGroup::newRadioButton(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+{
+ CRadioButton *newButton = new CRadioButton(m_widgetControl, x, y, width, height, &m_style);
+ newButton->addWidgetEventHandler(this);
+ addWidget(newButton);
+
+ // Do we need to resize?
+
+ nxgl_coord_t newWidth = getWidth();
+ nxgl_coord_t newHeight = getHeight();
+
+ if (newWidth < x + width)
+ {
+ newWidth = x + width;
+ }
+
+ if (newHeight < y + height)
+ {
+ newHeight = y + height;
+ }
+
+ resize(newWidth, newHeight);
+ return newButton;
+}
+
+/**
+ * Gets a pointer to the selected widget.
+ *
+ * @return Pointer to the selected widget.
+ */
+
+const CRadioButton *CRadioButtonGroup::getSelectedWidget(void) const
+{
+ return (CRadioButton *)m_selectedWidget;
+}
+
+/**
+ * Gets the index of the selected widget.
+ *
+ * @return The index of the selected widget.
+ */
+
+const int CRadioButtonGroup::getSelectedIndex(void) const
+{
+ for (int i = 0; i < m_children.size(); i++)
+ {
+ if (((CRadioButton*)m_children[i]) == m_selectedWidget)
+ {
+ return i;
+ }
+ }
+
+ // Nothing selected
+
+ return -1;
+}
+
+/**
+ * Sets the selected radio button to the supplied widget.
+ *
+ * @param widget The radio button to select.
+ */
+
+void CRadioButtonGroup::setSelectedWidget(CRadioButton* widget)
+{
+ if (m_selectedWidget != widget)
+ {
+ if (m_selectedWidget != NULL)
+ {
+ m_selectedWidget->setState(CRadioButton::RADIO_BUTTON_STATE_OFF);
+ }
+
+ m_selectedWidget = widget;
+
+ if (m_selectedWidget != NULL)
+ {
+ m_selectedWidget->setState(CRadioButton::RADIO_BUTTON_STATE_ON);
+ }
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+}
+
+/**
+ * Selects the widget at the specified index.
+ *
+ * @param index The index of the widget to select.
+ */
+
+void CRadioButtonGroup::setSelectedIndex(int index)
+{
+ if (index < m_children.size())
+ {
+ setSelectedWidget((CRadioButton*)m_children[index]);
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the
+ * widget's parent. Value is based on the length of the largest string
+ * in the set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CRadioButtonGroup::getPreferredDimensions(CRect& rect) const
+{
+ nxgl_coord_t width = 0;
+ nxgl_coord_t height = 0;
+
+ if (!m_flags.borderless)
+ {
+ width = m_borderSize.left + m_borderSize.right;
+ height = m_borderSize.top + m_borderSize.bottom;
+ }
+
+ nxgl_coord_t widgetX = 0;
+ nxgl_coord_t widgetY = 0;
+
+ nxgl_coord_t maxX = 0;
+ nxgl_coord_t maxY = 0;
+
+ // Locate largest x and y coords within children
+
+ for (int i = 0; i < m_children.size(); ++i)
+ {
+ widgetX = m_children[i]->getX() + m_children[i]->getWidth();
+ widgetY = m_children[i]->getY() + m_children[i]->getHeight();
+
+ if (widgetX > maxX)
+ {
+ maxX = widgetX;
+ }
+
+ if (widgetY > maxY)
+ {
+ maxY = widgetY;
+ }
+ }
+
+ rect.setX(m_rect.getX());
+ rect.setY(m_rect.getY());
+ rect.setWidth(width + maxX - getX());
+ rect.setHeight(height + maxY - getY());
+}
+
+/**
+ * Handle a mouse click event.
+ *
+ * @param e The event data.
+ */
+
+void CRadioButtonGroup::handleClickEvent(const CWidgetEventArgs &e)
+{
+ m_widgetEventHandlers->raiseClickEvent(e.getX(), e.getY());
+}
+
+/**
+ * Handle a mouse double-click event.
+ *
+ * @param e The event data.
+ */
+
+void CRadioButtonGroup::handleDoubleClickEvent(const CWidgetEventArgs &e)
+{
+ m_widgetEventHandlers->raiseDoubleClickEvent(e.getX(), e.getY());
+}
+
+/**
+ * Handle a mouse button release event that occurred within the bounds of
+ * the source widget.
+ * @param e The event data.
+ */
+
+void CRadioButtonGroup::handleReleaseEvent(const CWidgetEventArgs &e)
+{
+ m_widgetEventHandlers->raiseReleaseEvent(e.getX(), e.getY());
+}
+
+/**
+ * Handle a mouse button release event that occurred outside the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+void CRadioButtonGroup::handleReleaseOutsideEvent(const CWidgetEventArgs &e)
+{
+ // Child raised a release outside event, but we need to raise a different
+ // event if the release occurred within the bounds of this parent widget
+
+ if (checkCollision(e.getX(), e.getY()))
+ {
+ m_widgetEventHandlers->raiseReleaseEvent(e.getX(), e.getY());
+ }
+ else
+ {
+ m_widgetEventHandlers->raiseReleaseOutsideEvent(e.getX(), e.getY());
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CRadioButtonGroup::drawContents(CGraphicsPort *port)
+{
+ port->drawFilledRect(getX(), getY(), getWidth(), getHeight(), getBackgroundColor());
+}
diff --git a/NxWidgets/libnxwidgets/src/crect.cxx b/NxWidgets/libnxwidgets/src/crect.cxx
new file mode 100644
index 000000000..8e0ed2cd4
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/crect.cxx
@@ -0,0 +1,380 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cbgwindow.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "crect.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ */
+
+CRect::CRect(void)
+{
+ m_pos.x = 0;
+ m_pos.y = 0;
+ m_size.w = 0;
+ m_size.h = 0;
+}
+
+/**
+ * Constructor.
+ *
+ * @param x The x coordinate of the rect.
+ * @param y The y coordinate of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+
+CRect::CRect(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height)
+{
+ m_pos.x = x;
+ m_pos.y = y;
+ m_size.w = width;
+ m_size.h = height;
+}
+
+/**
+ * Constructor.
+ *
+ * @param rect Pointer to an NX rectangle
+ */
+
+CRect::CRect(FAR const nxgl_rect_s *rect)
+{
+ setNxRect(rect);
+}
+
+/**
+ * Copy constructor.
+ *
+ * @param rect CRect to copy.
+ */
+
+CRect::CRect(const CRect &rect)
+{
+ m_pos.x = rect.getX();
+ m_pos.y = rect.getY();
+ m_size.w = rect.getWidth();
+ m_size.h = rect.getHeight();
+}
+
+/**
+ * Create a rect object from the supplied coordinates.
+ *
+ * @param x1 The x coordinate of the rect's top-left corner.
+ * @param y1 The y coordinate of the rect's top-left corner.
+ * @param x2 The x coordinate of the rect's bottom-right corner.
+ * @param y2 The y coordinate of the rect's bottom-right corner.
+ * @return A new rect.
+ */
+
+CRect fromCoordinates(nxgl_coord_t x1, nxgl_coord_t y1,
+ nxgl_coord_t x2, nxgl_coord_t y2)
+{
+ // Ensure x2 is the larger value
+
+ if (x2 < x1)
+ {
+ nxgl_coord_t swap = x1;
+ x1 = x2;
+ x2 = swap;
+ }
+ nxgl_coord_t width = x2 - x1 + 1;
+
+ // Ensure y2 is the larger value
+
+ if (y2 < y1)
+ {
+ nxgl_coord_t swap = y1;
+ y1 = y2;
+ y2 = swap;
+ }
+ nxgl_coord_t height = y2 - y1 + 1;
+
+ // Create the CRect instance
+
+ return CRect(x1, y1, width, height);
+}
+
+/**
+ * Set the x coordinate of the rect's bottom-right corner. If x2 is less
+ * than the rect's current x coordinate the method automatically adjusts
+ * the coordinates so that the rect's width is never negative. Changing this
+ * property will change the width of the rect.
+ *
+ * @param x2 The x coordinate of the rect's bottom-right corner.
+ */
+
+void CRect::setX2(nxgl_coord_t x2)
+{
+ // Ensure that x contains the smaller value
+
+ if (x2 < m_pos.x)
+ {
+ nxgl_coord_t swap = m_pos.x;
+ m_pos.x = x2;
+ x2 = swap;
+ }
+
+ // Then set the width
+
+ m_size.w = x2 - m_pos.x + 1;
+}
+
+/**
+ * Set the y coordinate of the rect's bottom-right corner. If y2 is less
+ * than the rect's current y coordinate the method automatically adjusts
+ * the coordinates so that the rect's height is never negative. Changing this
+ * property will change the height of the rect.
+ *
+ * @param y2 The y coordinate of the rect's bottom-right corner.
+ */
+
+void CRect::setY2(nxgl_coord_t y2)
+{
+ // Ensure that y contains the smaller value
+
+ if (y2 < m_pos.y)
+ {
+ nxgl_coord_t swap = m_pos.y;
+ m_pos.y = y2;
+ y2 = swap;
+ }
+
+ // Then set the height
+
+ m_size.h = y2 - m_pos.y + 1;
+}
+
+/**
+ * Populates dest with a rectangle representating the intersection
+ * of this rectangle and rect.
+ *
+ * @param rect The rectangle to intersect with this.
+ * @param dest The destination rectangle.
+ */
+
+void CRect::getIntersect(const CRect &rect, CRect &dest) const
+{
+ nxgl_coord_t x1 = ngl_max(m_pos.x, rect.getX());
+ nxgl_coord_t y1 = ngl_max(m_pos.y, rect.getY());
+ nxgl_coord_t x2 = ngl_min(getX2(), rect.getX2());
+ nxgl_coord_t y2 = ngl_min(getY2(), rect.getY2());
+
+ dest.setX(x1);
+ dest.setY(y1);
+ dest.setWidth(x2 - x1 + 1);
+ dest.setHeight(y2 - y1 + 1);
+}
+
+/**
+ * Populates dest with a rectangle representating the smallest
+ * rectangle that contains this rectangle and rect.
+ *
+ * @param rect The rectangle to add to this.
+ * @param dest The destination rectangle.
+ */
+
+void CRect::getAddition(const CRect &rect, CRect &dest) const
+{
+
+ nxgl_coord_t x1 = ngl_min(m_pos.x, rect.getX());
+ nxgl_coord_t y1 = ngl_min(m_pos.y, rect.getY());
+ nxgl_coord_t x2 = ngl_max(getX2(), rect.getX2());
+ nxgl_coord_t y2 = ngl_max(getY2(), rect.getY2());
+
+ dest.setX(x1);
+ dest.setY(y1);
+ dest.setWidth(x2 - x1 + 1);
+ dest.setHeight(y2 - y1 + 1);
+}
+
+/**
+ * Clips this rect to the region that intersects the supplied rect.
+ *
+ * @param rect CRect to intersect.
+ */
+
+void CRect::clipToIntersect(const CRect &rect)
+{
+ CRect clipped;
+ getIntersect(rect, clipped);
+
+ setX(clipped.getX());
+ setY(clipped.getY());
+ setWidth(clipped.getWidth());
+ setHeight(clipped.getHeight());
+}
+
+/**
+ * Expands this rect so that it includes the area described by the supplied
+ * rect.
+ *
+ * @param rect CRect to include.
+ */
+
+void CRect::expandToInclude(const CRect& rect)
+{
+ CRect addition;
+ getAddition(rect, addition);
+
+ setX(addition.getX());
+ setY(addition.getY());
+ setWidth(addition.getWidth());
+ setHeight(addition.getHeight());
+}
+
+/**
+ * Check if the supplied rect intersects this.
+ *
+ * @param rect CRect to check for intersection with this.
+ * @return True if the rect intersects this; false if not.
+ */
+
+bool CRect::intersects(const CRect &rect) const
+{
+ return ((m_pos.x + m_size.w > rect.getX()) &&
+ (m_pos.y + m_size.h > rect.getY()) &&
+ (m_pos.x < rect.getX() + rect.getWidth()) &&
+ (m_pos.y < rect.getY() + rect.getHeight()));
+}
+
+/**
+ * Check if the rect contains the supplied point.
+ *
+ * @param x X coordinate of the point.
+ * @param y Y coordinate of the point.
+ * @return True if the rect contains the point; false if not.
+ */
+
+bool CRect::contains(nxgl_coord_t x, nxgl_coord_t y) const
+{
+ return ((x >= m_pos.x) && (y >= m_pos.y) &&
+ (x < m_pos.x + m_size.w) && (y < m_pos.y + m_size.h));
+}
+
+/**
+ * Copy the properties of this rect to the destination rect.
+ *
+ * @param dest Destination rect to copy to.
+ */
+
+void CRect::copyTo(CRect &dest) const
+{
+ dest.setX(m_pos.x);
+ dest.setY(m_pos.y);
+ dest.setWidth(m_size.w);
+ dest.setHeight(m_size.h);
+}
+
+/**
+ * Overloaded & operator. Returns the intersect of this rectangle and the
+ * rectangle passed as the "rect" argument".
+ *
+ * @param rect The rectangle to intersect with this.
+ */
+
+CRect CRect::operator&(const CRect &rect)
+{
+ CRect dest;
+ getIntersect(rect, dest);
+ return dest;
+}
+
+/**
+ * Overloaded + operator. Returns the smallest rectangle that can contain
+ * this rectangle and the rectangle passed as the "rect" argument".
+ *
+ * @param rect The rectangle to add to this.
+ */
+
+CRect CRect::operator+(const CRect &rect)
+{
+ CRect dest;
+ getAddition(rect, dest);
+ return dest;
+}
diff --git a/NxWidgets/libnxwidgets/src/crectcache.cxx b/NxWidgets/libnxwidgets/src/crectcache.cxx
new file mode 100644
index 000000000..3f74ee75d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/crectcache.cxx
@@ -0,0 +1,521 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/crectcache.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "crectcache.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CNxFont Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param widget Widget that contains the rect cache.
+ */
+
+CRectCache::CRectCache(const CNxWidget* widget)
+{
+ m_widget = widget;
+ m_foregroundInvalid = true;
+ m_backgroundInvalid = true;
+}
+
+/**
+ * Rebuild the cache if it is invalid.
+ */
+
+void CRectCache::cache(void)
+{
+ cacheBackgroundRegions();
+}
+
+/**
+ * Works out which rectangles in the invalidRects list overlap this
+ * widget, then cuts the rectangles into smaller pieces. The overlapping
+ * pieces are pushed into validRects, and the non-overlapping pieces are
+ * pushed back into the invalidRects vector.
+ *
+ * @param invalidRects A vector of regions that need to be tested
+ * for collisions against this widget; they represent regions that need
+ * to be redrawn.
+ * @param validRects A vector of regions that represents areas of the
+ * display that do not need to be redrawn.
+ * @param sender Pointer to the widget that initiated the split.
+ */
+
+void CRectCache::splitRectangles(TNxArray<CRect>* invalidRects,
+ TNxArray<CRect>* validRects,
+ FAR const CNxWidget *sender) const
+{
+ // Check for collisions with any rectangles in the vector
+
+ for (int i = 0; i < invalidRects->size(); i++)
+ {
+ // Get rectangle to check
+
+ CRect checkRect = invalidRects->at(i);
+ nxgl_coord_t splitX[4];
+ nxgl_coord_t splitY[4];
+ unsigned int rectXCount = 0;
+ unsigned int rectYCount = 0;
+ unsigned int overlapXRect = 0;
+ unsigned int overlapYRect = 0;
+
+ nxgl_coord_t width = checkRect.getWidth();
+ nxgl_coord_t height = checkRect.getHeight();
+
+ if (m_widget->checkCollision(checkRect.getX(), checkRect.getY(), width, height))
+ {
+ // Got a collision. We need to split this rectangle
+ // Get clipped dimensions of widget
+
+ CRect widgetRect;
+ m_widget->getRectClippedToHierarchy(widgetRect);
+
+ // Vertical split
+ // Start at left edge of rectangle
+
+ splitX[0] = checkRect.getX();
+
+ // Check for second split
+
+ if (checkRect.getX() < widgetRect.getX())
+ {
+ // Widget is to the right of the invalid rectangle (or in the centre)
+
+ if (splitX[rectXCount] != widgetRect.getX())
+ {
+ rectXCount++;
+ splitX[rectXCount] = widgetRect.getX();
+
+ // The next rectangle is the overlap
+
+ overlapXRect = rectXCount;
+ }
+ }
+ else
+ {
+ // Widget rectangle is on the left of the invalid rectangle
+
+ if (splitX[rectXCount] != widgetRect.getX2() + 1)
+ {
+ // We've found the start of the overlapping rectangle!
+
+ overlapXRect = rectXCount;
+ rectXCount++;
+
+ // Split is either the end of the widget or the end of the
+ // invalid rect, whichever comes first
+
+ if (widgetRect.getX2() <= checkRect.getX2())
+ {
+ splitX[rectXCount] = widgetRect.getX2() + 1;
+ }
+ else
+ {
+ splitX[rectXCount] = checkRect.getX2() + 1;
+ }
+ }
+ else
+ {
+ // Found the start of the overlapping rectangle
+
+ overlapXRect = rectXCount;
+ }
+ }
+
+ // Check for third split
+
+ if (widgetRect.getX2() + 1 <= checkRect.getX2() + 1)
+ {
+ // Widget ends before the invalid rectangle
+
+ if (splitX[rectXCount] != widgetRect.getX2() + 1)
+ {
+ // Record end of overlap
+
+ rectXCount++;
+ splitX[rectXCount] = widgetRect.getX2() + 1;
+ }
+ }
+
+ // Store end of invalid rectangle
+
+ if (splitX[rectXCount] <= checkRect.getX2())
+ {
+ rectXCount++;
+ splitX[rectXCount] = checkRect.getX2() + 1;
+ }
+
+ // Horizontal split
+ // Start at left edge of rectangle
+
+ splitY[0] = checkRect.getY();
+
+ // Check for second split
+
+ if (checkRect.getY() < widgetRect.getY())
+ {
+ // Widget below the invalid rectangle (or in the centre)
+
+ if (splitY[rectYCount] != widgetRect.getY())
+ {
+ rectYCount++;
+ splitY[rectYCount] = widgetRect.getY();
+
+ // The next rectangle is the overlap
+
+ overlapYRect = rectYCount;
+ }
+ }
+ else
+ {
+ // Widget rectangle above the invalid rectangle
+
+ if (splitY[rectYCount] != widgetRect.getY2() + 1)
+ {
+ // We've found the start of the overlapping rectangle!
+
+ overlapYRect = rectYCount;
+ rectYCount++;
+
+ // Split is either the end of the widget or the end of the
+ // invalid rect, whichever comes first
+
+ if (widgetRect.getY2() <= checkRect.getY2())
+ {
+ splitY[rectYCount] = widgetRect.getY2() + 1;
+ }
+ else
+ {
+ splitY[rectYCount] = checkRect.getY2() + 1;
+ }
+ }
+ else
+ {
+ // Found the start of the overlapping rectangle
+
+ overlapYRect = rectYCount;
+ }
+ }
+
+ // Check for third split
+
+ if (widgetRect.getY2() < checkRect.getY2())
+ {
+ // Widget ends before the invalid rectangle
+
+ if (splitY[rectYCount] != widgetRect.getY2() + 1)
+ {
+ // Record end of overlap
+
+ rectYCount++;
+ splitY[rectYCount] = widgetRect.getY2() + 1;
+ }
+ }
+
+ // Store end of invalid rectangle
+
+ if (splitY[rectYCount] <= checkRect.getY2())
+ {
+ rectYCount++;
+ splitY[rectYCount] = checkRect.getY() + 1;
+ }
+
+ // Remove the original rectangle
+
+ invalidRects->erase(i);
+
+ // Force the loop to re-examine the new rectangle at this index
+
+ i--;
+
+ // Add the new rectangles (not the overlap; that's the one we need to draw)
+
+ for (unsigned int xRects = 0; xRects < rectXCount; xRects++)
+ {
+ for (unsigned int yRects = 0; yRects < rectYCount; yRects++)
+ {
+ // Is this the overlap?
+
+ if ((overlapXRect == xRects) && (overlapYRect == yRects))
+ {
+ // Got the overlap, so set the output values
+
+ CRect overlapRect;
+ overlapRect.setX(splitX[xRects]);
+ overlapRect.setY(splitY[yRects]);
+ overlapRect.setX2(splitX[xRects + 1] - 1);
+ overlapRect.setY2(splitY[yRects + 1] - 1);
+
+ if (overlapRect.hasDimensions())
+ {
+ validRects->push_back(overlapRect);
+ }
+ }
+ else
+ {
+ // Not an overlap; add to vector
+
+ CRect newRect;
+ newRect.setX(splitX[xRects]);
+ newRect.setY(splitY[yRects]);
+ newRect.setX2(splitX[xRects + 1] - 1);
+ newRect.setY2(splitY[yRects + 1] - 1);
+
+ // Insert the new rectangle at the start so we don't
+
+ if (newRect.hasDimensions())
+ {
+ invalidRects->push_back(newRect);
+ }
+
+ // Increase iterator to compensate for insertion
+
+ i++;
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Move any rectangles from the visibleRects list that overlap this widget
+ * into the invisibleRects list. Used during visible region calculations.
+ *
+ * @param visibleRects A vector of regions that are not overlapped.
+ * @param invisibleRects A vector of regions that are overlapped.
+ * @param widget The widget that requested the lists.
+ * @see splitRectangles()
+ */
+
+void CRectCache::removeOverlappedRects(TNxArray<CRect> *visibleRects,
+ TNxArray<CRect> *invisibleRects,
+ FAR const CNxWidget* widget) const
+{
+ const CNxWidget* parent = m_widget;
+ int widgetIndex = -1;
+
+ while ((widget != NULL) && (parent != NULL))
+ {
+ // Locate widget in the list; we add one to the index to
+ // ensure that we deal with the next widget up in the z-order
+
+ widgetIndex = parent->getWidgetIndex(widget) + 1;
+
+ // Widget should never be the bottom item on the screen
+
+ if (widgetIndex > 0)
+ {
+ // Remove any overlapped rectangles
+
+ for (int i = widgetIndex; i < parent->getChildCount(); i++)
+ {
+ if (visibleRects->size() > 0)
+ {
+ parent->getChild(i)->getCRectCache()->splitRectangles(visibleRects, invisibleRects, widget);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ if (visibleRects->size() > 0)
+ {
+ widget = parent;
+
+ if (parent != NULL)
+ {
+ parent = parent->getParent();
+ }
+ }
+ else
+ {
+ return;
+ }
+ }
+}
+
+/**
+ * Cache the foreground regions.
+ */
+
+void CRectCache::cacheForegroundRegions(void)
+{
+ if (m_foregroundInvalid)
+ {
+ // Use internal region cache to store the non-overlapped rectangles
+ // We will use this to clip the widget
+
+ m_foregroundRegions.clear();
+
+ // Create pointer to a vector to store the overlapped rectangles
+ // We can discard this later as we don't need it
+
+ TNxArray<CRect>* invisibleRects = new TNxArray<CRect>();
+
+ // Copy the clipped widget dimensions into a rect
+
+ CRect rect;
+ m_widget->getRectClippedToHierarchy(rect);
+
+ // Do we have a visible region left?
+
+ if (rect.hasDimensions())
+ {
+ // Add rect to list
+
+ m_foregroundRegions.push_back(rect);
+
+ // Request refresh
+
+ if (m_widget->getParent() != NULL)
+ {
+ m_widget->getParent()->getCRectCache()->removeOverlappedRects(&m_foregroundRegions, invisibleRects, m_widget);
+ }
+ }
+
+ // Tidy up
+
+ delete invisibleRects;
+ m_foregroundInvalid = false;
+ }
+}
+
+/**
+ * Cache the background regions.
+ */
+
+void CRectCache::cacheBackgroundRegions(void)
+{
+ // Ensure that foreground is up to date
+
+ cacheForegroundRegions();
+
+ if (m_backgroundInvalid)
+ {
+ // Cache visible regions not overlapped by children
+
+ m_backgroundRegions.clear();
+
+ // Create pointer to a vector to store the overlapped rectangles
+ // We can discard this later as we don't need it
+
+ TNxArray<CRect>* invisibleRects = new TNxArray<CRect>();
+
+ // Copy all foreground regions into the new vector
+
+ for (int i = 0; i < m_foregroundRegions.size(); i++)
+ {
+ m_backgroundRegions.push_back(m_foregroundRegions[i]);
+ }
+
+ // Remove all child rects from the visible vector
+
+ for (int i = 0; i < m_widget->getChildCount(); i++)
+ {
+ if (m_backgroundRegions.size() > 0)
+ {
+ m_widget->getChild(i)->getCRectCache()->splitRectangles(&m_backgroundRegions, invisibleRects, m_widget);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // Tidy up
+
+ delete invisibleRects;
+ m_backgroundInvalid = false;
+ }
+}
+
+
diff --git a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx
new file mode 100644
index 000000000..25e9473ed
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx
@@ -0,0 +1,414 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/crlepalettebitmap.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <cstring>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "crlepalettebitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param bitmap The bitmap structure being wrapped.
+ */
+
+CRlePaletteBitmap::CRlePaletteBitmap(const struct SRlePaletteBitmap *bitmap)
+{
+ m_bitmap = bitmap;
+ startOfImage();
+}
+
+/**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's width.
+ */
+
+const uint8_t CRlePaletteBitmap::getColorFormat(void) const
+{
+ return m_bitmap->fmt;
+}
+
+/**
+ * Get the bitmap's color format.
+ *
+ * @return The bitmap's color format.
+ */
+
+const uint8_t CRlePaletteBitmap::getBitsPerPixel(void) const
+{
+ return m_bitmap->bpp;
+}
+
+/**
+ * Get the bitmap's width (in pixels/columns).
+ *
+ * @return The bitmap's pixel depth.
+ */
+
+const nxgl_coord_t CRlePaletteBitmap::getWidth(void) const
+{
+ return m_bitmap->width;
+}
+
+/**
+ * Get the bitmap's height (in rows).
+ *
+ * @return The bitmap's height.
+ */
+
+const nxgl_coord_t CRlePaletteBitmap::getHeight(void) const
+{
+ return m_bitmap->height;
+}
+
+/**
+ * Get the bitmap's width (in bytes).
+ *
+ * @return The bitmap's width.
+ */
+
+const nxgl_coord_t CRlePaletteBitmap::getStride(void) const
+{
+ // This only works if the bpp is an even multiple of 8-bit bytes
+
+ return (m_bitmap->width * m_bitmap->bpp) >> 3;
+}
+
+/**
+ * Get one row from the bit map image.
+ *
+ * @param x The offset into the row to get
+ * @param y The row number to get
+ * @param width The number of pixels to get from the row
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ * @param True if the run was returned successfully.
+ */
+
+bool CRlePaletteBitmap::getRun(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width,
+ FAR void *data)
+{
+ // Check ranges. Casts to unsigned int are ugly but permit one-sided comparisons
+
+ if (((unsigned int)x < (unsigned int)width) &&
+ ((unsigned int)(x + width) <= (unsigned int)m_bitmap->width))
+ {
+ // Seek to the requested row
+
+ if (!seekRow(y))
+ {
+ return false;
+ }
+
+ // Offset to the starting X position
+
+ if (x > 0)
+ {
+ if (!skipPixels(x))
+ {
+ return false;
+ }
+ }
+
+ // Then copy the requested number of pixels
+
+ return copyPixels(width, data);
+ }
+
+ return false;
+}
+
+/**
+ * Reset to the beginning of the image
+ */
+
+void CRlePaletteBitmap::startOfImage(void)
+{
+ m_row = 0;
+ m_col = 0;
+ m_rle = &m_bitmap->data[0];
+ m_remaining = m_rle->npixels;
+}
+
+/**
+ * Advance position data ahead. Called after npixels have
+ * have been consume.
+ *
+ * @param npixels The number of pixels to advance
+ * @return False if this goes beyond the end of the image
+ */
+
+bool CRlePaletteBitmap::advancePosition(nxgl_coord_t npixels)
+{
+ int newcol = m_col + npixels;
+
+ while (newcol >= m_bitmap->width)
+ {
+ newcol -= m_bitmap->width;
+ if (++m_row >= m_bitmap->height)
+ {
+ return false;
+ }
+ }
+
+ m_col = newcol;
+ return true;
+}
+
+/**
+ * Seek ahead the specific number of pixels -- discarding
+ * and advancing.
+ *
+ * @param npixels The number of pixels to skip
+ */
+
+bool CRlePaletteBitmap::skipPixels(nxgl_coord_t npixels)
+{
+ do
+ {
+ // Skip values in the current RLE entry
+
+ if (m_remaining > npixels)
+ {
+ // Subtract from the number of pixels remaining
+
+ m_remaining -= npixels;
+ return advancePosition(npixels);
+ }
+
+ // Not enough (or just enough) in the current entry. Take what we
+ // can from the current entry and move to the next entry
+
+ npixels -= m_remaining;
+ if (!advancePosition(m_remaining))
+ {
+ return false;
+ }
+
+ m_rle++;
+ m_remaining = m_rle->npixels;
+ }
+ while (npixels > 0);
+
+ return true;
+}
+
+/** Seek to the beginning of the next row
+ *
+ * @return False if this was the last row of the image
+ */
+
+bool CRlePaletteBitmap::nextRow(void)
+{
+ return skipPixels(m_bitmap->width - m_col);
+}
+
+/** Seek to the beignning specific row
+ *
+ * @param row The row number to seek to
+ * @return False if this goes beyond the end of the image
+ */
+
+bool CRlePaletteBitmap::seekRow(nxgl_coord_t row)
+{
+ // Is the current position already past the requested position?
+
+ if (row > m_row || (row == m_row && m_col != 0))
+ {
+ // Yes.. rewind to the beginning of the image
+
+ startOfImage();
+ }
+
+ // Seek ahead, row-by-row until we are at the beginning of
+ // the requested row
+
+ while (m_row < row)
+ {
+ if (!nextRow())
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/** Copy the pixels from the current RLE entry the specified number of times.
+ *
+ * @param npixels The number of pixels to copy. Must be less than or equal
+ * to m_remaining (not checked here, must be handled by higher level code).
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ */
+
+void CRlePaletteBitmap::copyColor(nxgl_coord_t npixels, FAR void *data)
+{
+ // Right now, only a single pixel depth is supported
+
+ nxwidget_pixel_t *nxlut = (nxwidget_pixel_t *)m_bitmap->lut;
+ nxwidget_pixel_t color = nxlut[m_rle->lookup];
+
+ // Copy the requested pixels
+
+ FAR nxwidget_pixel_t *dest = (FAR nxwidget_pixel_t *)data;
+ for (int i = 0; i < npixels; i++)
+ {
+ *dest++ = color;
+ }
+
+ // Adjust the number of pixels remaining in the RLE entry
+
+ m_remaining -= npixels;
+}
+
+/** Copy pixels from the current position
+ *
+ * @param npixels The number of pixels to copy
+ * @param data The memory location provided by the caller
+ * in which to return the data. This should be at least
+ * (getWidth()*getBitsPerPixl() + 7)/8 bytes in length
+ * and properly aligned for the pixel color format.
+ * @return False if this goes beyond the end of the image
+ */
+
+bool CRlePaletteBitmap::copyPixels(nxgl_coord_t npixels, FAR void *data)
+{
+ FAR nxwidget_pixel_t *ptr = (FAR nxwidget_pixel_t *)data;
+ do
+ {
+ // Get values in the current RLE entry
+
+ if (m_remaining > npixels)
+ {
+ // Copy npixels from the current RLE entry (it won't be empty)
+
+ copyColor(npixels, (FAR void *)ptr);
+
+ // Then advance row/column position information
+
+ return advancePosition(npixels);
+ }
+
+ // Not enough (or just enough) in the current entry. Take what we
+ // can from the current entry and move to the next entry
+
+ uint8_t nTaken = m_remaining; // Temporary.. copyColor clobbers m_remaining
+ npixels -= m_remaining; // New number of pixels needed
+
+ // Copy all of the colors available in this RLE entry
+
+ copyColor(m_remaining, (FAR void *)ptr);
+
+ // Then advance row/column position information
+
+ if (!advancePosition(nTaken))
+ {
+ return false;
+ }
+
+ // Advance the destination pointer by the number of pixels taken
+ // from the RLE entry
+
+ ptr += nTaken;
+
+ // Then move to the next RLE entry
+
+ m_rle++;
+ m_remaining = m_rle->npixels;
+ }
+ while (npixels > 0);
+
+ return true;
+}
diff --git a/NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx b/NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx
new file mode 100644
index 000000000..13e33815d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx
@@ -0,0 +1,402 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollbarhorizontal.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "cnxwidget.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "islider.hxx"
+#include "cscrollbarhorizontal.hxx"
+#include "cglyphbutton.hxx"
+#include "csliderhorizontal.hxx"
+#include "cnxtimer.hxx"
+#include "glyphs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementation
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control instance for the window.
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CScrollbarHorizontal::CScrollbarHorizontal(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle* style)
+: CNxWidget(pWidgetControl, x, y, width, height, WIDGET_BORDERLESS, style)
+{
+ m_buttonWidth = 10;
+
+ // Create the children
+
+ m_slider = new CSliderHorizontal(pWidgetControl, m_buttonWidth, 0,
+ width - (m_buttonWidth << 1), height);
+ m_slider->addWidgetEventHandler(this);
+
+ // Set up the left glyph button
+
+ m_leftButton = new CGlyphButton(pWidgetControl,
+ 0, 0,
+ m_buttonWidth, height,
+ 0, 0,
+ &g_arrowLeft, &g_arrowLeft, &m_style);
+ m_leftButton->addWidgetEventHandler(this);
+
+ // Set up the right glyph button
+
+ m_rightButton = new CGlyphButton(pWidgetControl,
+ width - m_buttonWidth, 0,
+ m_buttonWidth, height,
+ 0, 0,
+ &g_arrowRight, &g_arrowRight, &m_style);
+ m_rightButton->addWidgetEventHandler(this);
+
+ // Create timer
+
+ m_scrollTimeout = 10;
+ m_timer = new CNxTimer(pWidgetControl, m_scrollTimeout, true);
+ m_timer->addWidgetEventHandler(this);
+
+ addWidget(m_slider);
+ addWidget(m_leftButton);
+ addWidget(m_rightButton);
+ addWidget(m_timer);
+}
+
+/**
+ * Get the smallest value that the slider can represent.
+ *
+ * @return The smallest value.
+ */
+
+const nxgl_coord_t CScrollbarHorizontal::getMinimumValue(void) const
+{
+ return m_slider->getMinimumValue();
+}
+
+/**
+ * Get the largest value that the slider can represent.
+ *
+ * @return The largest value.
+ */
+
+const nxgl_coord_t CScrollbarHorizontal::getMaximumValue(void) const
+{
+ return m_slider->getMaximumValue();
+}
+
+/**
+ * Get the current value of the slider.
+ *
+ * @return The current slider value.
+ */
+
+const nxgl_coord_t CScrollbarHorizontal::getValue(void) const
+{
+ return m_slider->getValue();
+}
+
+/**
+ * Get the value represented by the height of the grip.
+ * For sliders, this would typically be 1 (so each new
+ * grip position is worth 1). For scrollbars, this
+ * would be the height of the scrolling widget.
+ *
+ * @return The page size.
+ */
+
+const nxgl_coord_t CScrollbarHorizontal::getPageSize(void) const
+{
+ return m_slider->getPageSize();
+}
+
+/**
+ * Set the smallest value that the slider can represent.
+ *
+ * @param value The smallest value.
+ */
+
+void CScrollbarHorizontal::setMinimumValue(const nxgl_coord_t value)
+{
+ m_slider->setMinimumValue(value);
+}
+
+/**
+ * Set the largest value that the slider can represent.
+ *
+ * @param value The largest value.
+ */
+
+void CScrollbarHorizontal::setMaximumValue(const nxgl_coord_t value)
+{
+ m_slider->setMaximumValue(value);
+}
+
+/**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+void CScrollbarHorizontal::setValue(const nxgl_coord_t value)
+{
+ m_slider->setValue(value);
+}
+
+/**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+void CScrollbarHorizontal::setValueWithBitshift(const int32_t value)
+{
+ m_slider->setValueWithBitshift(value);
+}
+
+/**
+ * Set the page size represented by the grip.
+ *
+ * @param pageSize The page size.
+ * @see getPageSize().
+ */
+
+void CScrollbarHorizontal::setPageSize(nxgl_coord_t pageSize)
+{
+ m_slider->setPageSize(pageSize);
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarHorizontal::handleActionEvent(const CWidgetEventArgs &e)
+{
+ // Check which widget fired the event
+
+ if (e.getSource() == m_timer)
+ {
+ // Which widget is clicked?
+
+ if (m_leftButton->isClicked())
+ {
+ // Move the grip left
+
+ m_slider->setValue(m_slider->getValue() - m_slider->getMinimumStep());
+ }
+ else if (m_rightButton->isClicked())
+ {
+ // Move the grip right
+
+ m_slider->setValue(m_slider->getValue() + m_slider->getMinimumStep());
+ }
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarHorizontal::handleClickEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() == m_leftButton)
+ {
+ // Start the timer
+
+ m_timer->start();
+
+ // Move the grip left
+
+ m_slider->setValue(m_slider->getValue() - m_slider->getMinimumStep());
+ }
+ else if (e.getSource() == m_rightButton)
+ {
+ // Start the timer
+
+ m_timer->start();
+
+ // Move the grip right
+
+ m_slider->setValue(m_slider->getValue() + m_slider->getMinimumStep());
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarHorizontal::handleReleaseEvent(const CWidgetEventArgs &e)
+{
+ if ((e.getSource() == m_leftButton) || (e.getSource() == m_rightButton))
+ {
+ // Stop the timer
+
+ m_timer->stop();
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarHorizontal::handleReleaseOutsideEvent(const CWidgetEventArgs &e)
+{
+ if ((e.getSource() == m_leftButton) || (e.getSource() == m_rightButton))
+ {
+ // Stop the timer
+
+ m_timer->stop();
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarHorizontal::handleValueChangeEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() == m_slider)
+ {
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+}
+
+/**
+ * Resize the scrollbar to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CScrollbarHorizontal::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Remember current values
+
+ nxgl_coord_t value = getValue();
+ bool events = raisesEvents();
+
+ // Disable event raising
+
+ setRaisesEvents(false);
+
+ // Resize and move children
+
+ m_slider->resize(width - (m_buttonWidth << 1), height);
+ m_leftButton->moveTo(m_slider->getWidth(), 0);
+ m_rightButton->moveTo(m_slider->getWidth() + m_buttonWidth, 0);
+
+ // Set back to current value
+
+ setValue(value);
+
+ // Reset event raising
+
+ setRaisesEvents(events);
+}
diff --git a/NxWidgets/libnxwidgets/src/cscrollbarpanel.cxx b/NxWidgets/libnxwidgets/src/cscrollbarpanel.cxx
new file mode 100644
index 000000000..f21cd7766
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cscrollbarpanel.cxx
@@ -0,0 +1,438 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cscrollbarpanel.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cscrollbarpanel.hxx"
+#include "cbutton.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param flags The usual widget flags.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CScollbarPanel::CScollbarPanel(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ uint32_t flags, CWidgetStyle *style)
+: CNxWidget(pWidgetControl, x, y, width, height, flags, style)
+{
+ m_scrollbarWidth = 10;
+ m_scrollbarHeight = 10;
+ m_hasVerticalScrollbar = true;
+ m_hasHorizontalScrollbar = true;
+
+ m_borderSize.top = 0;
+ m_borderSize.right = 0;
+ m_borderSize.left = 0;
+ m_borderSize.bottom = 0;
+ m_flags.borderless = true;
+
+ m_widgetControl = pWidgetControl;
+ m_panel = (CScrollingPanel *)NULL;
+ m_scrollbarVertical = (CScrollbarVertical *)NULL;
+ m_scrollbarHorizontal = (CScrollbarHorizontal *)NULL;
+
+ buildUI();
+}
+
+/**
+ * Scroll the panel by the specified amounts.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+void CScollbarPanel::scroll(int32_t dx, int32_t dy)
+{
+ m_panel->scroll(dx, dy);
+}
+
+/**
+ * Reposition the panel's scrolling region to the specified coordinates.
+ *
+ * @param x The new x coordinate of the scrolling region.
+ * @param y The new y coordinate of the scrolling region.
+ */
+
+void CScollbarPanel::jump(int32_t x, int32_t y)
+{
+ m_panel->jump(x, y);
+}
+
+/**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+void CScollbarPanel::setAllowsVerticalScroll(bool allow)
+{
+ m_panel->setAllowsVerticalScroll(allow);
+
+ if (m_hasVerticalScrollbar)
+ {
+ if (allow)
+ {
+ m_scrollbarVertical->enable();
+ }
+ else
+ {
+ m_scrollbarVertical->disable();
+ }
+ }
+}
+
+/**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+void CScollbarPanel::setAllowsHorizontalScroll(bool allow)
+{
+ m_panel->setAllowsHorizontalScroll(allow);
+
+ if (m_hasHorizontalScrollbar)
+ {
+ if (allow)
+ {
+ m_scrollbarHorizontal->enable();
+ }
+ else
+ {
+ m_scrollbarHorizontal->disable();
+ }
+ }
+}
+
+/**
+ * Sets the width of the virtual canvas.
+ *
+ * @param width The width of the virtual canvas.
+ */
+
+void CScollbarPanel::setCanvasWidth(const int32_t width)
+{
+ m_panel->setCanvasWidth(width);
+ m_scrollbarHorizontal->setMaximumValue(width);
+}
+
+/**
+ * Sets the height of the virtual canvas.
+ *
+ * @param height The height of the virtual canvas.
+ */
+
+void CScollbarPanel::setCanvasHeight(const int32_t height)
+{
+ m_panel->setCanvasHeight(height);
+ m_scrollbarVertical->setMaximumValue(height);
+}
+
+/**
+ * Returns true if vertical scrolling is allowed.
+ *
+ * @return True if vertical scrolling is allowed.
+ */
+
+bool CScollbarPanel::allowsVerticalScroll(void) const
+{
+ return m_panel->allowsVerticalScroll();
+}
+
+/**
+ * Returns true if horizontal scrolling is allowed.
+ *
+ * @return True if horizontal scrolling is allowed.
+ */
+
+bool CScollbarPanel::allowsHorizontalScroll(void) const
+{
+ return m_panel->allowsHorizontalScroll();
+}
+
+/**
+ * Gets the x coordinate of the virtual canvas.
+ *
+ * @return The x coordinate of the virtual canvas.
+ */
+
+const int32_t CScollbarPanel::getCanvasX(void) const
+{
+ return m_panel->getCanvasX();
+}
+
+/**
+ * Gets the y coordinate of the virtual canvas.
+ *
+ * @return The y coordinate of the virtual canvas.
+ */
+
+const int32_t CScollbarPanel::getCanvasY(void) const
+{
+ return m_panel->getCanvasY();
+}
+
+/**
+ * Gets the width of the virtual canvas.
+ *
+ * @return The width of the virtual canvas.
+ */
+
+const int32_t CScollbarPanel::getCanvasWidth(void) const
+{
+ return m_panel->getCanvasWidth();
+}
+
+/**
+ * Gets the height of the virtual canvas.
+ *
+ * @return The height of the virtual canvas.
+ */
+
+const int32_t CScollbarPanel::getCanvasHeight(void) const
+{
+ return m_panel->getCanvasHeight();
+}
+
+/**
+ * Handle a widget scroll event.
+ *
+ * @param e The event data.
+ */
+
+void CScollbarPanel::handleScrollEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() != NULL)
+ {
+ if (e.getSource() == m_panel)
+ {
+ if (m_scrollbarVertical != NULL)
+ {
+ m_scrollbarVertical->setRaisesEvents(false);
+ m_scrollbarVertical->setValue(0 - m_panel->getCanvasY());
+ m_scrollbarVertical->setRaisesEvents(true);
+ }
+ else if (m_scrollbarHorizontal != NULL)
+ {
+ m_scrollbarHorizontal->setRaisesEvents(false);
+ m_scrollbarHorizontal->setValue(0 - m_panel->getCanvasX());
+ m_scrollbarHorizontal->setRaisesEvents(true);
+ }
+ }
+ }
+}
+
+/**
+ * Handle a widget value change event.
+ *
+ * @param e The event data.
+ */
+
+void CScollbarPanel::handleValueChangeEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() != NULL)
+ {
+ if (e.getSource() == m_scrollbarVertical)
+ {
+ if (m_panel != NULL)
+ {
+ m_panel->setRaisesEvents(false);
+ m_panel->jump(m_panel->getCanvasX(), 0 - m_scrollbarVertical->getValue());
+ m_panel->setRaisesEvents(true);
+ }
+ }
+ else if (e.getSource() == m_scrollbarHorizontal)
+ {
+ if (m_panel != NULL)
+ {
+ m_panel->setRaisesEvents(false);
+ m_panel->jump(0 - m_scrollbarHorizontal->getValue(), m_panel->getCanvasY());
+ m_panel->setRaisesEvents(true);
+ }
+ }
+ }
+}
+
+/**
+ * Creates the child widgets.
+ */
+
+void CScollbarPanel::buildUI(void)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ nxgl_coord_t panelWidth = rect.getWidth();
+ if (m_hasVerticalScrollbar)
+ {
+ panelWidth -= m_scrollbarWidth;
+ }
+
+ nxgl_coord_t panelHeight = rect.getHeight();
+ if (m_hasHorizontalScrollbar)
+ {
+ panelHeight -= m_scrollbarHeight;
+ }
+
+ m_panel = new CScrollingPanel(m_widgetControl, rect.getX(), rect.getY(),
+ panelWidth, panelHeight, 0, &m_style);
+ addWidget(m_panel);
+
+ CRect panelRect;
+ m_panel->getClientRect(panelRect);
+
+ // Disable content scrolling by default, as the panel cannot be drawn to
+ // without some additional programmer effort
+
+ m_panel->setContentScrolled(false);
+
+ // Adjust scrollbar dimensions based on scrollbar visibility
+
+ nxgl_coord_t verticalScrollHeight = rect.getHeight();
+ if (m_hasHorizontalScrollbar)
+ {
+ verticalScrollHeight -= m_scrollbarHeight;
+ }
+
+ nxgl_coord_t horizontalScrollWidth = rect.getWidth();
+ if (m_hasVerticalScrollbar)
+ {
+ horizontalScrollWidth -= m_scrollbarWidth;
+ }
+
+ if (m_hasHorizontalScrollbar)
+ {
+ m_scrollbarHorizontal =
+ new CScrollbarHorizontal(m_widgetControl,
+ rect.getX(), rect.getHeight() - m_scrollbarHeight,
+ horizontalScrollWidth, m_scrollbarHeight,
+ &m_style);
+ m_scrollbarHorizontal->setMinimumValue(0);
+ m_scrollbarHorizontal->setMaximumValue(getCanvasWidth());
+ m_scrollbarHorizontal->setPageSize(panelRect.getWidth());
+ m_scrollbarHorizontal->addWidgetEventHandler(this);
+ addWidget(m_scrollbarHorizontal);
+ }
+
+ if (m_hasVerticalScrollbar)
+ {
+ m_scrollbarVertical =
+ new CScrollbarVertical(m_widgetControl,
+ rect.getWidth() - m_scrollbarWidth,
+ rect.getY(), m_scrollbarWidth,
+ verticalScrollHeight, &m_style);
+ m_scrollbarVertical->setMinimumValue(0);
+ m_scrollbarVertical->setMaximumValue(getCanvasHeight());
+ m_scrollbarVertical->setPageSize(panelRect.getHeight());
+ m_scrollbarVertical->addWidgetEventHandler(this);
+ addWidget(m_scrollbarVertical);
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CScollbarPanel::drawContents(CGraphicsPort *port)
+{
+ port->drawFilledRect(0, 0, getWidth(), getHeight(), getBackgroundColor());
+}
diff --git a/NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx b/NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx
new file mode 100644
index 000000000..76b5c5dec
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx
@@ -0,0 +1,404 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cscrollbarhorizontal.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "cscrollbarvertical.hxx"
+#include "cglyphbutton.hxx"
+#include "cslidervertical.hxx"
+#include "cnxtimer.hxx"
+#include "glyphs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementation
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control instance for the window.
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CScrollbarVertical::CScrollbarVertical(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style)
+: CNxWidget(pWidgetControl, x, y, width, height, WIDGET_BORDERLESS, style)
+{
+ m_buttonHeight = 10;
+
+ // Create the children
+
+ m_slider = new CSliderVertical(pWidgetControl, 0, m_buttonHeight,
+ width, height - (m_buttonHeight << 1));
+ m_slider->addWidgetEventHandler(this);
+
+ // Setup the up button
+
+ m_upButton = new CGlyphButton(pWidgetControl,
+ 0, 0,
+ width, m_buttonHeight,
+ 0, 0,
+ &g_arrowUp, &g_arrowUp, &m_style);
+ m_upButton->addWidgetEventHandler(this);
+
+ // Setup the down button
+
+ m_downButton = new CGlyphButton(pWidgetControl,
+ 0, height - m_buttonHeight,
+ width, m_buttonHeight,
+ 0, 0,
+ &g_arrowDown, &g_arrowDown, &m_style);
+ m_downButton->addWidgetEventHandler(this);
+
+ // Create timer
+
+ m_scrollTimeout = 10;
+
+ m_timer = new CNxTimer(pWidgetControl, m_scrollTimeout, true);
+ m_timer->addWidgetEventHandler(this);
+
+ addWidget(m_slider);
+ addWidget(m_upButton);
+ addWidget(m_downButton);
+ addWidget(m_timer);
+}
+
+/**
+ * Get the smallest value that the slider can represent.
+ *
+ * @return The smallest value.
+ */
+
+const nxgl_coord_t CScrollbarVertical::getMinimumValue(void) const
+{
+ return m_slider->getMinimumValue();
+}
+
+/**
+ * Get the largest value that the slider can represent.
+ *
+ * @return The largest value.
+ */
+
+const nxgl_coord_t CScrollbarVertical::getMaximumValue(void) const
+{
+ return m_slider->getMaximumValue();
+}
+
+/**
+ * Get the current value of the slider.
+ *
+ * @return The current slider value.
+ */
+
+const nxgl_coord_t CScrollbarVertical::getValue(void) const
+{
+ return m_slider->getValue();
+}
+
+/**
+ * Get the value represented by the height of the grip.
+ * For sliders, this would typically be 1 (so each new
+ * grip position is worth 1). For scrollbars, this
+ * would be the height of the scrolling widget.
+ *
+ * @return The page size.
+ */
+
+const nxgl_coord_t CScrollbarVertical::getPageSize(void) const
+{
+ return m_slider->getPageSize();
+}
+
+/**
+ * Set the smallest value that the slider can represent.
+ *
+ * @param value The smallest value.
+ */
+
+void CScrollbarVertical::setMinimumValue(const nxgl_coord_t value)
+{
+ m_slider->setMinimumValue(value);
+}
+
+/**
+ * Set the largest value that the slider can represent.
+ *
+ * @param value The largest value.
+ */
+
+void CScrollbarVertical::setMaximumValue(const nxgl_coord_t value)
+{
+ m_slider->setMaximumValue(value);
+}
+
+/**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+void CScrollbarVertical::setValue(const nxgl_coord_t value)
+{
+ m_slider->setValue(value);
+}
+
+/**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+void CScrollbarVertical::setValueWithBitshift(const int32_t value)
+{
+ m_slider->setValueWithBitshift(value);
+}
+
+/**
+ * Set the page size represented by the grip.
+ *
+ * @param pageSize The page size.
+ * @see getPageSize().
+ */
+
+void CScrollbarVertical::setPageSize(nxgl_coord_t pageSize)
+{
+ m_slider->setPageSize(pageSize);
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarVertical::handleActionEvent(const CWidgetEventArgs &e)
+{
+ // Check which widget fired the event
+
+ if (e.getSource() == m_timer)
+ {
+ // Which widget is clicked?
+
+ if (m_upButton->isClicked())
+ {
+ // Move the grip up
+
+ m_slider->setValue(m_slider->getValue() - m_slider->getMinimumStep());
+ }
+ else if (m_downButton->isClicked())
+ {
+ // Move the grip down
+
+ m_slider->setValue(m_slider->getValue() + m_slider->getMinimumStep());
+ }
+
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarVertical::handleClickEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() == m_upButton)
+ {
+ // Start the timer
+
+ m_timer->start();
+
+ // Move the grip up
+
+ m_slider->setValue(m_slider->getValue() - m_slider->getMinimumStep());
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+ else if (e.getSource() == m_downButton)
+ {
+ // Start the timer
+
+ m_timer->start();
+
+ // Move the grip down
+
+ m_slider->setValue(m_slider->getValue() + m_slider->getMinimumStep());
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarVertical::handleReleaseEvent(const CWidgetEventArgs &e)
+{
+ if ((e.getSource() == m_upButton) || (e.getSource() == m_downButton))
+ {
+ // Stop the timer
+
+ m_timer->stop();
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarVertical::handleReleaseOutsideEvent(const CWidgetEventArgs &e)
+{
+ if ((e.getSource() == m_upButton) || (e.getSource() == m_downButton))
+ {
+ // Stop the timer
+
+ m_timer->stop();
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CScrollbarVertical::handleValueChangeEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() == m_slider)
+ {
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+}
+
+/**
+ * Resize the scrollbar to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CScrollbarVertical::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Remember current values
+
+ nxgl_coord_t value = getValue();
+ bool events = raisesEvents();
+
+ // Disable event raising
+
+ setRaisesEvents(false);
+
+ // Resize and move children
+
+ m_slider->resize(width, height - (m_buttonHeight << 1));
+ m_upButton->moveTo(0, m_slider->getHeight());
+ m_downButton->moveTo(0, m_slider->getHeight() + m_buttonHeight);
+
+ // Set back to current value
+
+ setValue(value);
+
+ // Reset event raising
+
+ setRaisesEvents(events);
+}
diff --git a/NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx b/NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx
new file mode 100644
index 000000000..e0d041d34
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx
@@ -0,0 +1,415 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cscrollinglistbox.hxx"
+#include "cscrollbarvertical.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CScrollingListBox::CScrollingListBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ CWidgetStyle *style)
+: CNxWidget(pWidgetControl, x, y, width, height, 0, style)
+{
+ m_scrollbarWidth = 10;
+
+ setBorderless(true);
+
+ m_listbox = new CListBox(pWidgetControl, 0, 0, width - m_scrollbarWidth,
+ height, &m_style);
+ m_listbox->addWidgetEventHandler(this);
+
+ // Create scrollbar
+
+ CRect rect;
+ m_listbox->getClientRect(rect);
+ m_scrollbar = new CScrollbarVertical(pWidgetControl, width - m_scrollbarWidth,
+ 0, m_scrollbarWidth, height, &m_style);
+ m_scrollbar->setMinimumValue(0);
+ m_scrollbar->setMaximumValue(0);
+ m_scrollbar->setPageSize(rect.getHeight() / m_listbox->getOptionHeight());
+ m_scrollbar->addWidgetEventHandler(this);
+
+ // Add children to child array
+
+ addWidget(m_listbox);
+ addWidget(m_scrollbar);
+}
+
+/**
+ * Add a new option to the widget using default colors.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ */
+
+void CScrollingListBox::addOption(const CNxString &text, const uint32_t value)
+{
+ m_listbox->addOption(text, value);
+ m_scrollbar->setMaximumValue(m_listbox->getOptionCount() - 1);
+}
+
+/**
+ * Add an option to the widget.
+ *
+ * @param option The option to add.
+ */
+
+void CScrollingListBox::addOption(CListBoxDataItem *item)
+{
+ m_listbox->addOption(item);
+ m_scrollbar->setMaximumValue(m_listbox->getOptionCount() - 1);
+}
+
+/**
+ * Add a new option to the widget.
+ *
+ * @param text Text to show in the option.
+ * @param value The value of the option.
+ * @param normalTextColor Color to draw the text with when not selected.
+ * @param normalBackColor Color to draw the background with when not selected.
+ * @param selectedTextColor Color to draw the text with when selected.
+ * @param selectedBackColor Color to draw the background with when selected.
+ */
+
+void CScrollingListBox::addOption(const CNxString &text, const uint32_t value,
+ const nxwidget_pixel_t normalTextColor,
+ const nxwidget_pixel_t normalBackColor,
+ const nxwidget_pixel_t selectedTextColor,
+ const nxwidget_pixel_t selectedBackColor)
+{
+ m_listbox->addOption(text, value, normalTextColor, normalBackColor,
+ selectedTextColor, selectedBackColor);
+ m_scrollbar->setMaximumValue(m_listbox->getOptionCount() - 1);
+}
+
+/**
+ * Remove an option from the widget by its index.
+ *
+ * @param index The index of the option to remove.
+ */
+
+void CScrollingListBox::removeOption(const int index)
+{
+ m_listbox->removeOption(index);
+ m_scrollbar->setMaximumValue(m_listbox->getOptionCount() - 1);
+
+ // Reposition grip if necessary
+
+ if (m_scrollbar->getValue() > m_listbox->getOptionCount())
+ {
+ m_scrollbar->setValue(0);
+ }
+}
+
+/**
+ * Remove all options from the widget.
+ */
+
+void CScrollingListBox::removeAllOptions(void)
+{
+ m_listbox->removeAllOptions();
+ m_scrollbar->setMaximumValue(0);
+ m_scrollbar->setValue(0);
+}
+
+/**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+void CScrollingListBox::handleValueChangeEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() != NULL)
+ {
+ if (e.getSource() == m_scrollbar)
+ {
+ if (m_listbox != NULL)
+ {
+ m_listbox->setRaisesEvents(false);
+ m_listbox->jump(0, 0 - (m_scrollbar->getValue() * m_listbox->getOptionHeight()));
+ m_listbox->setRaisesEvents(true);
+ }
+ }
+ else if (e.getSource() == m_listbox)
+ {
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+ }
+}
+
+/**
+ * Handle a widget action event.
+ *
+ * @param e The event data.
+ */
+
+void CScrollingListBox::handleActionEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() != NULL)
+ {
+ if (e.getSource() == m_listbox)
+ {
+ // Raise action events from list box to event handler
+
+ m_widgetEventHandlers->raiseActionEvent();
+ }
+ }
+}
+
+/**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+void CScrollingListBox::handleScrollEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() != NULL)
+ {
+ if (e.getSource() == m_listbox)
+ {
+ if (m_scrollbar != NULL)
+ {
+ m_scrollbar->setRaisesEvents(false);
+
+ int value = ((0 - m_listbox->getCanvasY()) << 16) / m_listbox->getOptionHeight();
+
+ m_scrollbar->setValueWithBitshift(value);
+ m_scrollbar->setRaisesEvents(true);
+ }
+ }
+ }
+}
+
+/**
+ * Handle a mouse button click event.
+ *
+ * @param e The event data.
+ */
+
+void CScrollingListBox::handleClickEvent(const CWidgetEventArgs &e)
+{
+ m_widgetEventHandlers->raiseClickEvent(e.getX(), e.getY());
+}
+
+/**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+void CScrollingListBox::handleDoubleClickEvent(const CWidgetEventArgs &e)
+{
+ m_widgetEventHandlers->raiseDoubleClickEvent(e.getX(), e.getY());
+}
+
+/**
+ * Handle a mouse button release event that occurred within the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+void CScrollingListBox::handleReleaseEvent(const CWidgetEventArgs &e)
+{
+ m_widgetEventHandlers->raiseReleaseEvent(e.getX(), e.getY());
+}
+
+/**
+ * Handle a mouse button release event that occurred outside the bounds of
+ * the source widget.
+ *
+ * @param e The event data.
+ */
+
+void CScrollingListBox::handleReleaseOutsideEvent(const CWidgetEventArgs &e)
+{
+ // Child raised a release outside event, but we need to raise a different
+ // event if the release occurred within the bounds of this parent widget
+
+ if (checkCollision(e.getX(), e.getY()))
+ {
+ m_widgetEventHandlers->raiseReleaseEvent(e.getX(), e.getY());
+ }
+ else
+ {
+ m_widgetEventHandlers->raiseReleaseOutsideEvent(e.getX(), e.getY());
+ }
+}
+
+/**
+ * Set the font used in the textbox.
+ *
+ * @param font Pointer to the new font.
+ */
+
+void CScrollingListBox::setFont(CNxFont *font)
+{
+ m_style.font = font;
+ m_listbox->setFont(font);
+ m_scrollbar->setFont(font);
+}
+
+/**
+ * Insert the dimensions that this widget wants to have into the rect
+ * passed in as a parameter. All coordinates are relative to the widget's
+ * parent. Value is based on the length of the largest string in the
+ * set of options.
+ *
+ * @param rect Reference to a rect to populate with data.
+ */
+
+void CScrollingListBox::getPreferredDimensions(CRect &rect) const
+{
+ // Get the listbox's preferred dimensions
+
+ m_listbox->getPreferredDimensions(rect);
+
+ // Add on the scrollbar width
+
+ nxgl_coord_t width = rect.getWidth();
+ rect.setWidth(width + m_scrollbarWidth);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CScrollingListBox::drawContents(CGraphicsPort *port)
+{
+ port->drawFilledRect(0, 0, getWidth(), getHeight(), getBackgroundColor());
+}
+
+/**
+ * Resize the listbox to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CScrollingListBox::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Resize the children
+
+ m_listbox->resize(width - m_scrollbarWidth, height);
+ m_scrollbar->resize(m_scrollbarWidth, height);
+
+ // Adjust scrollbar page size
+
+ CRect rect;
+ getClientRect(rect);
+ m_scrollbar->setPageSize(rect.getHeight() / m_listbox->getOptionHeight());
+
+ // Move the scrollbar
+
+ m_scrollbar->moveTo(width - m_scrollbarWidth, 0);
+}
+
+
+
+
diff --git a/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx
new file mode 100644
index 000000000..d3ee40cf9
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx
@@ -0,0 +1,320 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cscrollingpanel.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cscrollingpanel.hxx"
+#include "cgraphicsport.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the widget.
+ * @param y The y coordinate of the widget.
+ * @param width The width of the widget.
+ * @param height The height of the widget.
+ * @param flags The usual widget flags.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CScrollingPanel::CScrollingPanel(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ uint32_t flags, CWidgetStyle* style)
+: CNxWidget(pWidgetControl, x, y, width, height, flags, style)
+{
+ m_widgetControl = pWidgetControl;
+ CRect rect;
+ getClientRect(rect);
+
+ m_canvasWidth = rect.getWidth();
+ m_canvasHeight = rect.getHeight();
+ m_canvasX = 0;
+ m_canvasY = 0;
+
+ setAllowsVerticalScroll(true);
+ setAllowsHorizontalScroll(true);
+ setContentScrolled(true);
+
+ m_flags.permeable = true;
+}
+
+/**
+ * Scroll the panel by the specified amounts.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+void CScrollingPanel::scroll(int32_t dx, int32_t dy)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ // Prevent scrolling outside boundaries
+
+ if (m_canvasX + dx < -(m_canvasWidth - rect.getWidth()))
+ {
+ dx = -(m_canvasWidth - rect.getWidth()) - m_canvasX;
+ }
+ else if (m_canvasX + dx > 0)
+ {
+ dx = -m_canvasX;
+ }
+
+ if (m_canvasY + dy < -(m_canvasHeight - rect.getHeight()))
+ {
+ dy = -(m_canvasHeight - rect.getHeight()) - m_canvasY;
+ }
+ else if (m_canvasY + dy > 0)
+ {
+ dy = -m_canvasY;
+ }
+
+ // Prevent scrolling in disallowed planes
+
+ if (!allowsVerticalScroll())
+ {
+ dy = 0;
+ }
+
+ if (!allowsHorizontalScroll())
+ {
+ dx = 0;
+ }
+
+ // Perform scroll if necessary
+
+ if ((dx != 0) || (dy != 0))
+ {
+ // Only scroll if content scrolling is enabled
+
+ if (m_isContentScrolled)
+ {
+ // Perform scroll
+
+ TNxArray<CRect> revealedRects;
+ CGraphicsPort *port = m_widgetControl->getGraphicsPort();
+ port->move(getX(), getY(), dx, dy, rect.getWidth(), rect.getHeight());
+
+ // Adjust the scroll values
+
+ m_canvasY += dy;
+ m_canvasX += dx;
+
+ if (revealedRects.size() > 0)
+ {
+ // Draw revealed sections
+
+ for (int i = 0; i < revealedRects.size(); ++i)
+ {
+ drawBorder(port);
+ drawContents(port);
+ }
+ }
+ }
+ else
+ {
+ // Adjust the scroll values
+
+ m_canvasY += dy;
+ m_canvasX += dx;
+ }
+
+ // Scroll all child widgets
+
+ scrollChildren(dx, dy);
+
+ // Notify event handlers
+
+ m_widgetEventHandlers->raiseScrollEvent(dx, dy);
+ }
+}
+
+/**
+ * Reposition the panel's scrolling region to the specified coordinates.
+ *
+ * @param x The new x coordinate of the scrolling region.
+ * @param y The new y coordinate of the scrolling region.
+ */
+
+void CScrollingPanel::jump(int32_t x, int32_t y)
+{
+ // Calculate difference between jump value and current value and scroll
+
+ scroll(x - m_canvasX, y - m_canvasY);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CScrollingPanel::drawContents(CGraphicsPort *port)
+{
+ port->drawFilledRect(getX(), getY(), getWidth(), getHeight(),
+ getBackgroundColor());
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CScrollingPanel::drawBorder(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Scrolls the panel to match the drag.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal drag distance.
+ * @param vY The vertical drag distance.
+ */
+
+void CScrollingPanel::onDrag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY)
+{
+ scroll(vX, vY);
+}
+
+/**
+ * Starts the dragging system.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CScrollingPanel::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ startDragging(x, y);
+}
+
+/**
+ * Scroll all child widgets by the specified amounts. Actually uses
+ * the widget's moveTo() function to reposition them.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy)
+{
+ nxgl_coord_t widgetX = 0;
+ nxgl_coord_t widgetY = 0;
+ nxgl_coord_t thisX = getX();
+ nxgl_coord_t thisY = getY();
+ CNxWidget *widget = (CNxWidget *)NULL;
+
+ for (int32_t i = 0; i < m_children.size(); i++)
+ {
+ widget = m_children[i];
+ widgetX = (widget->getX() - thisX) + dx;
+ widgetY = (widget->getY() - thisY) + dy;
+ widget->moveTo(widgetX, widgetY);
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx b/NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx
new file mode 100644
index 000000000..4de63fdf6
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx
@@ -0,0 +1,577 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cscrollingtextbox.hxx"
+#include "cscrollbarvertical.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param flags Standard widget flag options.
+ * @param maxRows The maximum number of rows the textbox can track. Adding
+ * text beyond this number will cause rows at the start of the text to be
+ * forgotten; text is essentially stored as a queue, and adding to the back
+ * of a full queue causes the front items to be popped off. Setting this to
+ * 0 will make the textbox track only the visible rows.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * g_defaultWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CScrollingTextBox::CScrollingTextBox(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text, uint32_t flags,
+ nxgl_coord_t maxRows, CWidgetStyle *style)
+: CNxWidget(pWidgetControl, x, y, width, height, flags, style)
+{
+ m_scrollbarWidth = 10;
+ setBorderless(true);
+
+ m_texbox = new CMultiLineTextBox(pWidgetControl,
+ 0, 0, width - m_scrollbarWidth, height,
+ text, flags, maxRows, &m_style);
+ m_texbox->addWidgetEventHandler(this);
+
+ // Create scrollbar
+
+ CRect rect;
+ m_texbox->getClientRect(rect);
+ m_scrollbar = new CScrollbarVertical(pWidgetControl,
+ width - m_scrollbarWidth, 0,
+ m_scrollbarWidth, height, &m_style);
+ m_scrollbar->setMinimumValue(0);
+ m_scrollbar->setMaximumValue(m_texbox->getCanvasHeight());
+ m_scrollbar->setPageSize(rect.getHeight());
+ m_scrollbar->setValue(0 - m_texbox->getCanvasY());
+ m_scrollbar->addWidgetEventHandler(this);
+
+ // Add children to child array
+
+ addWidget(m_texbox);
+ addWidget(m_scrollbar);
+}
+
+/**
+ * Set the horizontal alignment of text within the textbox.
+ *
+ * @param alignment The horizontal position of the text.
+ */
+
+void CScrollingTextBox::setTextAlignmentHoriz(CMultiLineTextBox::TextAlignmentHoriz alignment)
+{
+ m_texbox->setTextAlignmentHoriz(alignment);
+}
+
+/**
+ * Set the vertical alignment of text within the textbox.
+ *
+ * @param alignment The vertical position of the text.
+ */
+
+void CScrollingTextBox::setTextAlignmentVert(CMultiLineTextBox::TextAlignmentVert alignment)
+{
+ m_texbox->setTextAlignmentVert(alignment);
+}
+
+/**
+ * Returns the number of "pages" that the text spans. A page
+ * is defined as the amount of text that can be displayed within
+ * the textbox at one time.
+ *
+ * @return The page count.
+ */
+
+const uint16_t CScrollingTextBox::getPageCount(void) const
+{
+ return m_texbox->getPageCount();
+}
+
+/**
+ * Returns the current page.
+ *
+ * @return The current page.
+ * @see getPageCount().
+ */
+
+const uint16_t CScrollingTextBox::getCurrentPage(void) const
+{
+ return m_texbox->getCurrentPage();
+}
+
+/**
+ * Returns a pointer to the Text object that contains the
+ * wrapped text used in the textbox. It is used as the
+ * pre-processed data source for the textbox, and should
+ * not be altered.
+ *
+ * @return Pointer to the Text object.
+ */
+
+const CText *CScrollingTextBox::getText(void) const
+{
+ return m_texbox->getText();
+}
+
+/**
+ * Set the text displayed in the textbox.
+ *
+ * @param text String to display.
+ */
+
+void CScrollingTextBox::setText(const CNxString &text)
+{
+ m_texbox->setText(text);
+ m_scrollbar->redraw();
+}
+
+/**
+ * Append new text to the end of the current text
+ * displayed in the textbox.
+ *
+ * @param text String to append.
+ */
+
+void CScrollingTextBox::appendText(const CNxString &text)
+{
+ m_texbox->appendText(text);
+ m_scrollbar->redraw();
+}
+
+/**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+void CScrollingTextBox::removeText(const unsigned int startIndex)
+{
+ m_texbox->removeText(startIndex);
+ m_scrollbar->redraw();
+}
+
+/**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+void CScrollingTextBox::removeText(const unsigned int startIndex,
+ const unsigned int count)
+{
+ m_texbox->removeText(startIndex, count);
+ m_scrollbar->redraw();
+}
+
+/**
+ * Set the font used in the textbox.
+ *
+ * @param font Pointer to the new font.
+ */
+
+void CScrollingTextBox::setFont(CNxFont *font)
+{
+ m_style.font = font;
+ m_texbox->setFont(font);
+ m_scrollbar->setFont(font);
+}
+
+/**
+ * Get the length of the text string.
+ *
+ * @return The length of the text string.
+ */
+
+const unsigned int CScrollingTextBox::getTextLength(void) const
+{
+ return m_texbox->getTextLength();
+}
+
+/**
+ * Sets the cursor display mode.
+ *
+ * @param cursorMode Determines cursor display mode
+ */
+
+void CScrollingTextBox::showCursor(EShowCursor cursorMode)
+{
+ m_texbox->showCursor(cursorMode);
+}
+
+/**
+ * Enables/disables cursor wrapping
+ *
+ * @param wrap True enables cursor wrapping
+ */
+
+void CScrollingTextBox::wrapCursor(bool wrap)
+{
+ m_texbox->wrapCursor(wrap);
+}
+
+/**
+ * Move the cursor to the text position specified. 0 indicates the start
+ * of the string. If position is greater than the length of the string,
+ * the cursor is moved to the end of the string.
+ *
+ * @param position The new cursor position.
+ */
+
+void CScrollingTextBox::moveCursorToPosition(const int32_t position)
+{
+ m_texbox->moveCursorToPosition(position);
+ m_scrollbar->redraw();
+}
+
+/**
+ * Get the cursor position. This is the index within the string that
+ * the cursor is currently positioned over.
+ *
+ * @return position The cursor position.
+ */
+
+const int32_t CScrollingTextBox::getCursorPosition(void) const
+{
+ return m_texbox->getCursorPosition();
+}
+
+/**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+void CScrollingTextBox::insertText(const CNxString &text,
+ const unsigned int index)
+{
+ m_texbox->insertText(text, index);
+ m_scrollbar->redraw();
+}
+
+/**
+ * Insert text at the current cursor position.
+ *
+ * @param text The text to insert.
+ */
+
+void CScrollingTextBox::insertTextAtCursor(const CNxString &text)
+{
+ m_texbox->insertTextAtCursor(text);
+ m_scrollbar->redraw();
+}
+
+/**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+void CScrollingTextBox::handleValueChangeEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() != NULL)
+ {
+ if (e.getSource() == m_scrollbar)
+ {
+ if (m_texbox != NULL)
+ {
+ m_texbox->setRaisesEvents(false);
+ m_texbox->jump(0, 0 - m_scrollbar->getValue());
+ m_texbox->setRaisesEvents(true);
+ }
+ }
+ else if (e.getSource() == m_texbox)
+ {
+ if (m_scrollbar != NULL)
+ {
+ m_scrollbar->setRaisesEvents(false);
+ m_scrollbar->setMaximumValue(m_texbox->getCanvasHeight());
+ m_scrollbar->setValue(0 - m_texbox->getCanvasY());
+ m_scrollbar->setRaisesEvents(true);
+ }
+ }
+ }
+}
+
+/**
+ * Handles events raised by its sub-widgets.
+ *
+ * @param e Event arguments.
+ */
+
+void CScrollingTextBox::handleScrollEvent(const CWidgetEventArgs &e)
+{
+ if (e.getSource() != NULL)
+ {
+ if (e.getSource() == m_texbox)
+ {
+ if (m_scrollbar != NULL)
+ {
+ m_scrollbar->setRaisesEvents(false);
+ m_scrollbar->setValue(0 - m_texbox->getCanvasY());
+ m_scrollbar->setRaisesEvents(true);
+ }
+ }
+ }
+}
+
+/**
+ * Gets the x coordinate of the virtual canvas.
+ *
+ * @return The x coordinate of the virtual canvas.
+ */
+
+const int32_t CScrollingTextBox::getCanvasX(void) const
+{
+ return m_texbox->getCanvasX();
+}
+
+/**
+ * Gets the y coordinate of the virtual canvas.
+ *
+ * @return The y coordinate of the virtual canvas.
+ */
+
+const int32_t CScrollingTextBox::getCanvasY(void) const
+{
+ return m_texbox->getCanvasY();
+}
+
+/**
+ * Gets the width of the virtual canvas.
+ *
+ * @return The width of the virtual canvas.
+ */
+
+const int32_t CScrollingTextBox::getCanvasWidth(void) const
+{
+ return m_texbox->getCanvasWidth();
+}
+
+/**
+ * Gets the height of the virtual canvas.
+ *
+ * @return The height of the virtual canvas.
+ */
+
+const int32_t CScrollingTextBox::getCanvasHeight(void) const
+{
+ return m_texbox->getCanvasHeight();
+}
+
+/**
+ * Scroll the panel by the specified amounts.
+ *
+ * @param dx The horizontal distance to scroll.
+ * @param dy The vertical distance to scroll.
+ */
+
+void CScrollingTextBox::scroll(int32_t dx, int32_t dy)
+{
+ m_texbox->scroll(dx, dy);
+}
+
+/**
+ * Reposition the panel's scrolling region to the specified coordinates.
+ *
+ * @param x The new x coordinate of the scrolling region.
+ * @param y The new y coordinate of the scrolling region.
+ */
+
+void CScrollingTextBox::jump(int32_t x, int32_t y)
+{
+ m_texbox->jump(x, y);
+}
+
+/**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+void CScrollingTextBox::setAllowsVerticalScroll(bool allow)
+{
+ m_texbox->setAllowsVerticalScroll(allow);
+}
+
+/**
+ * Set whether or not horizontal scrolling is allowed.
+ *
+ * @param allow True to allow horizontal scrolling; false to deny it.
+ */
+
+void CScrollingTextBox::setAllowsHorizontalScroll(bool allow)
+{
+ // NOP
+}
+
+/**
+ * Sets the width of the virtual canvas.
+ *
+ * @param width The width of the virtual canvas.
+ */
+
+void CScrollingTextBox::setCanvasWidth(const int32_t width)
+{
+ // NOP
+}
+
+/**
+ * Sets the height of the virtual canvas.
+ *
+ * @param height The height of the virtual canvas.
+ */
+
+void CScrollingTextBox::setCanvasHeight(const int32_t height)
+{
+ // NOP
+}
+
+/**
+ * Returns true if vertical scrolling is allowed.
+ *
+ * @return True if vertical scrolling is allowed.
+ */
+
+bool CScrollingTextBox::allowsVerticalScroll(void) const
+{
+ return m_texbox->allowsVerticalScroll();
+}
+
+/**
+ * Returns true if horizontal scrolling is allowed.
+ *
+ * @return True if horizontal scrolling is allowed.
+ */
+
+bool CScrollingTextBox::allowsHorizontalScroll(void) const
+{
+ return m_texbox->allowsHorizontalScroll();
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CScrollingTextBox::drawContents(CGraphicsPort *port)
+{
+ port->drawFilledRect(0, 0, getWidth(), getHeight(), getBackgroundColor());
+}
+
+/**
+ * Resize the textbox to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CScrollingTextBox::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Resize the children
+
+ m_texbox->resize(width - m_scrollbarWidth, height);
+ m_scrollbar->resize(m_scrollbarWidth, height);
+
+ // Move the scrollbar
+
+ m_scrollbar->moveTo(width - m_scrollbarWidth, 0);
+}
diff --git a/NxWidgets/libnxwidgets/src/csliderhorizontal.cxx b/NxWidgets/libnxwidgets/src/csliderhorizontal.cxx
new file mode 100644
index 000000000..2fe47556c
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/csliderhorizontal.cxx
@@ -0,0 +1,402 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/csliderhorizontal.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "csliderhorizontal.hxx"
+#include "csliderhorizontalgrip.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ */
+
+CSliderHorizontal::CSliderHorizontal(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+: CNxWidget(pWidgetControl, x, y, width, height, WIDGET_DRAGGABLE)
+{
+ m_minimumValue = 0;
+ m_maximumValue = 0;
+ m_contentSize = 0;
+ m_value = 0;
+ m_minimumGripWidth = 10;
+ m_pageSize = 1;
+
+ m_flags.permeable = false;
+ m_flags.borderless = false;
+ m_flags.doubleClickable = false;
+
+ // Create grip
+
+ CRect rect;
+ getClientRect(rect);
+
+ m_grip = new CSliderHorizontalGrip(pWidgetControl, rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight());
+ m_grip->addWidgetEventHandler(this);
+ addWidget(m_grip);
+
+ m_gutterWidth = rect.getWidth();
+}
+
+/**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+void CSliderHorizontal::setValue(const nxgl_coord_t value)
+{
+ setValueWithBitshift((int32_t)value << 16);
+}
+
+/**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+void CSliderHorizontal::setValueWithBitshift(const int32_t value)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ // Can the grip move?
+
+ if ((rect.getWidth() > m_grip->getWidth()) && (m_maximumValue != m_minimumValue))
+ {
+ int32_t newValue = value;
+ int32_t maxValue = getPhysicalMaximumValueWithBitshift();
+
+ // Limit to max/min values
+
+ if (newValue > maxValue)
+ {
+ newValue = maxValue;
+ }
+
+ if (newValue >> 16 < m_minimumValue)
+ {
+ newValue = m_minimumValue << 16;
+ }
+
+ uint32_t scrollRatio = newValue / m_contentSize;
+ int32_t newGripX = m_gutterWidth * scrollRatio;
+ newGripX += newGripX & 0x8000;
+ newGripX >>= 16;
+ newGripX += rect.getX();
+
+ m_grip->moveTo(newGripX, rect.getY());
+
+ // Update stored value if necessary
+
+ if (m_value != newValue)
+ {
+ m_value = newValue;
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CSliderHorizontal::handleDragEvent(const CWidgetEventArgs &e)
+{
+ // Handle grip events
+
+ if ((e.getSource() == m_grip) && (e.getSource() != NULL))
+ {
+ int32_t newValue = getGripValue() >> 16;
+
+ // Grip has moved - compare values and raise event if the
+ // value has changed. Compare using integer values rather
+ // than fixed-point.
+
+ if (m_value >> 16 != newValue)
+ {
+ m_value = newValue << 16;
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+ }
+}
+
+/**
+ * Get the smallest value that the slider can move through when
+ * dragged.
+ *
+ * @return The smallest value that the slider can move through when
+ * dragged.
+ */
+
+nxgl_coord_t CSliderHorizontal::getMinimumStep(void) const
+{
+ // If the ratio of content to gutter is greater than or equal to one,
+ // the minimum step that the slider can represent will be that ratio.
+
+ uint32_t gutterRatio = m_contentSize << 16 / m_gutterWidth;
+ gutterRatio += gutterRatio & 0x8000;
+ gutterRatio >>= 16;
+
+ if (gutterRatio > 0)
+ {
+ return gutterRatio;
+ }
+
+ return 1;
+}
+
+/**
+ * Get the maximum possible value that the slider can represent. Useful when
+ * using the slider as a scrollbar, as the height of the grip prevents the full
+ * range of values being accessed (intentionally).
+ * The returned value is bitshfted left 16 places for more accuracy in fixed-point
+ * calculations.
+ *
+ * @return The maximum possible value that the slider can represent.
+ */
+
+int32_t CSliderHorizontal::getPhysicalMaximumValueWithBitshift(void) const
+{
+ uint32_t maxX = m_gutterWidth - m_grip->getWidth();
+ uint32_t scrollRatio = (maxX << 16) / m_gutterWidth;
+ int32_t value = (scrollRatio * m_contentSize);
+
+ return value;
+}
+
+/**
+ * Get the value represented by the top of the grip.
+ * return The value represented by the top of the grip.
+ */
+
+const int32_t CSliderHorizontal::getGripValue(void) const
+{
+ // Calculate the current value represented by the top of the grip
+
+ CRect rect;
+ getClientRect(rect);
+
+ uint32_t gripPos = ((m_grip->getX() - getX()) - rect.getX());
+ uint32_t scrollRatio = (gripPos << 16) / m_gutterWidth;
+ int32_t value = (scrollRatio * m_contentSize);
+
+ return value;
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderHorizontal::drawContents(CGraphicsPort *port)
+{
+ CRect rect;
+ getRect(rect);
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(),
+ getSelectedBackgroundColor());
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderHorizontal::drawBorder(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Resize the slider to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CSliderHorizontal::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Remember current values
+
+ int32_t oldValue = m_value;
+ bool events = raisesEvents();
+
+ // Disable event raising
+
+ setRaisesEvents(false);
+ resizeGrip();
+
+ // Set back to current value
+
+ setValue(oldValue);
+
+ // Reset event raising
+
+ setRaisesEvents(events);
+}
+
+/**
+ * Moves the grip towards the mouse.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CSliderHorizontal::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Which way should the grip move?
+
+ if (x > m_grip->getX())
+ {
+ // Move grip right
+
+ setValueWithBitshift(m_value + (m_pageSize << 16));
+ }
+ else
+ {
+ // Move grip left
+
+ setValueWithBitshift(m_value - (m_pageSize << 16));
+ }
+}
+
+/**
+ * Resize and redraw the grip.
+ */
+
+void CSliderHorizontal::resizeGrip(void)
+{
+ // Get available size
+
+ CRect rect;
+ getClientRect(rect);
+
+ int32_t gripRatio = (m_pageSize << 16) / m_contentSize;
+ int32_t gripSize = rect.getWidth() * gripRatio;
+ gripSize >>= 16;
+ m_gutterWidth = rect.getWidth();
+
+ if (gripSize < m_minimumGripWidth)
+ {
+ // TODO: Need to implement scaling here. If we resize the grip to be
+ // artificially larger, we effectively reduce the scale (not just the
+ // height) of the gutter. Each position in the gutter needs to be
+ // reduced in value.
+ }
+
+ m_grip->resize(gripSize, rect.getHeight());
+}
+
+
diff --git a/NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx b/NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx
new file mode 100644
index 000000000..aebdbf51d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx
@@ -0,0 +1,246 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "csliderhorizontalgrip.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the grip, relative to its parent.
+ * @param y The y coordinate of the grip, relative to its parent.
+ * @param width The width of the grip.
+ * @param height The height of the grip.
+ */
+
+CSliderHorizontalGrip::CSliderHorizontalGrip(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+: CNxWidget(pWidgetControl, x, y, width, height, WIDGET_DRAGGABLE)
+{
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderHorizontalGrip::drawContents(CGraphicsPort *port)
+{
+ CRect rect;
+ getRect(rect);
+
+ nxwidget_pixel_t color;
+ if (!m_flags.clicked)
+ {
+ color = getSelectedBackgroundColor();
+ }
+ else
+ {
+ color = getHighlightColor();
+ }
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(),
+ color);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderHorizontalGrip::drawBorder(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ if (isClicked())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+ else
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShineEdgeColor(), getShadowEdgeColor());
+ }
+ }
+}
+
+/**
+ * Starts dragging the grip and redraws it.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CSliderHorizontalGrip::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ startDragging(x, y);
+ redraw();
+}
+
+/**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CSliderHorizontalGrip::onRelease(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
+/**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CSliderHorizontalGrip::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
+/**
+ * Moves the grip to follow the mouse.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal distance of the drag.
+ * @param vY The vertical distance of the drag.
+ */
+
+void CSliderHorizontalGrip::onDrag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY)
+{
+ // Work out where we're moving to
+
+ nxgl_coord_t destX = x - m_grabPointX - m_parent->getX();
+
+ // Do we need to move?
+
+ if (destX != m_rect.getX())
+ {
+ // Get parent rect
+
+ CRect rect;
+ m_parent->getClientRect(rect);
+
+ // Prevent grip from moving outside parent
+
+ if (destX < rect.getX())
+ {
+ destX = rect.getX();
+ }
+ else
+ {
+ if (destX + getWidth() > rect.getWidth() + rect.getX())
+ {
+ destX = (rect.getWidth() + rect.getX()) - getWidth() ;
+ }
+ }
+
+ // Move to new location
+
+ moveTo(destX, rect.getY());
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/cslidervertical.cxx b/NxWidgets/libnxwidgets/src/cslidervertical.cxx
new file mode 100644
index 000000000..74d2d956b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cslidervertical.cxx
@@ -0,0 +1,402 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cslidervertical.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cwidgetcontrol.hxx"
+#include "cslidervertical.hxx"
+#include "csliderverticalgrip.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the slider, relative to its parent.
+ * @param y The y coordinate of the slider, relative to its parent.
+ * @param width The width of the slider.
+ * @param height The height of the slider.
+ */
+
+CSliderVertical::CSliderVertical(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+: CNxWidget(pWidgetControl, x, y, width, height, WIDGET_DRAGGABLE)
+{
+ m_minimumValue = 0;
+ m_maximumValue = 0;
+ m_contentSize = 0;
+ m_value = 0;
+ m_minimumGripHeight = 10;
+ m_pageSize = 1;
+
+ m_flags.permeable = false;
+ m_flags.borderless = false;
+ m_flags.doubleClickable = false;
+
+ // Create grip
+
+ CRect rect;
+ getClientRect(rect);
+
+ m_grip = new CSliderVerticalGrip(pWidgetControl,
+ rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight());
+ m_grip->addWidgetEventHandler(this);
+ addWidget(m_grip);
+
+ m_gutterHeight = rect.getHeight();
+}
+
+/**
+ * Set the value that of the slider. This will reposition
+ * and redraw the grip.
+ *
+ * @param value The new value.
+ */
+
+void CSliderVertical::setValue(const nxgl_coord_t value)
+{
+ setValueWithBitshift((int32_t)value << 16);
+}
+
+/**
+ * Set the value that of the slider. This will reposition and redraw
+ * the grip. The supplied value should be bitshifted left 16 places.
+ * This ensures greater accuracy than the standard setValue() method if
+ * the slider is being used as a scrollbar.
+ *
+ * @param value The new value.
+ */
+
+void CSliderVertical::setValueWithBitshift(const int32_t value)
+{
+ CRect rect;
+ getClientRect(rect);
+
+ // Can the grip move?
+
+ if ((rect.getHeight() > m_grip->getHeight()) && (m_maximumValue != m_minimumValue))
+ {
+ int32_t newValue = value;
+ int32_t maxValue = getPhysicalMaximumValueWithBitshift();
+
+ // Limit to max/min values
+
+ if (newValue > maxValue)
+ {
+ newValue = maxValue;
+ }
+
+ if (newValue >> 16 < m_minimumValue)
+ {
+ newValue = m_minimumValue << 16;
+ }
+
+ uint32_t scrollRatio = newValue / m_contentSize;
+ int32_t newGripY = m_gutterHeight * scrollRatio;
+ newGripY += newGripY & 0x8000;
+ newGripY >>= 16;
+ newGripY += rect.getY();
+
+ m_grip->moveTo(rect.getX(), newGripY);
+
+ // Update stored value if necessary
+
+ if (m_value != newValue)
+ {
+ m_value = newValue;
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+ }
+}
+
+/**
+ * Process events fired by the grip.
+ *
+ * @param e The event details.
+ */
+
+void CSliderVertical::handleDragEvent(const CWidgetEventArgs &e)
+{
+ // Handle grip events
+
+ if ((e.getSource() == m_grip) && (e.getSource() != NULL))
+ {
+ int32_t newValue = getGripValue() >> 16;
+
+ // Grip has moved - compare values and raise event if the
+ // value has changed. Compare using integer values rather
+ // than fixed-point.
+
+ if (m_value >> 16 != newValue)
+ {
+ m_value = newValue << 16;
+ m_widgetEventHandlers->raiseValueChangeEvent();
+ }
+ }
+}
+
+/**
+ * Get the smallest value that the slider can move through when
+ * dragged.
+ *
+ * @return The smallest value that the slider can move through when
+ * dragged.
+ */
+
+nxgl_coord_t CSliderVertical::getMinimumStep(void) const
+{
+ // If the ratio of content to gutter is greater than or equal to one,
+ // the minimum step that the slider can represent will be that ratio.
+
+ uint32_t gutterRatio = m_contentSize << 16 / m_gutterHeight;
+ gutterRatio += gutterRatio & 0x8000;
+ gutterRatio >>= 16;
+
+ if (gutterRatio > 0)
+ {
+ return gutterRatio;
+ }
+
+ return 1;
+}
+
+/**
+ * Get the maximum possible value that the slider can represent. Useful when
+ * using the slider as a scrollbar, as the height of the grip prevents the full
+ * range of values being accessed (intentionally).
+ * The returned value is bitshfted left 16 places for more accuracy in fixed-point
+ * calculations.
+ *
+ * @return The maximum possible value that the slider can represent.
+ */
+
+int32_t CSliderVertical::getPhysicalMaximumValueWithBitshift(void) const
+{
+ uint32_t maxY = m_gutterHeight - m_grip->getHeight();
+ uint32_t scrollRatio = (maxY << 16) / m_gutterHeight;
+ int32_t value = (scrollRatio * m_contentSize);
+
+ return value;
+}
+
+/**
+ * Get the value represented by the top of the grip. The value is
+ * bitshifted left 16 places for accuracy.
+ * return The value represented by the top of the grip.
+ */
+
+const int32_t CSliderVertical::getGripValue(void) const
+{
+ // Calculate the current value represented by the top of the grip
+
+ CRect rect;
+ getClientRect(rect);
+
+ uint32_t gripPos = ((m_grip->getY() - getY()) - rect.getY());
+ uint32_t scrollRatio = (gripPos << 16) / m_gutterHeight;
+ int32_t value = (scrollRatio * m_contentSize);
+
+ return value;
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderVertical::drawContents(CGraphicsPort *port)
+{
+ CRect rect;
+ getRect(rect);
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(),
+ getSelectedBackgroundColor());
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderVertical::drawBorder(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Resize the slider to the new dimensions.
+ *
+ * @param width The new width.
+ * @param height The new height.
+ */
+
+void CSliderVertical::onResize(nxgl_coord_t width, nxgl_coord_t height)
+{
+ // Remember current values
+
+ int32_t oldValue = m_value;
+ bool events = raisesEvents();
+
+ // Disable event raising
+
+ setRaisesEvents(false);
+ resizeGrip();
+
+ // Set back to current value
+
+ setValue(oldValue);
+
+ // Reset event raising
+
+ setRaisesEvents(events);
+}
+
+/**
+ * Moves the grip towards the mouse.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CSliderVertical::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Which way should the grip move?
+
+ if (y > m_grip->getY())
+ {
+ // Move grip down
+
+ setValueWithBitshift(m_value + (m_pageSize << 16));
+ }
+ else
+ {
+ // Move grip up
+
+ setValueWithBitshift(m_value - (m_pageSize << 16));
+ }
+}
+
+/**
+ * Resize and redraw the grip.
+ */
+
+void CSliderVertical::resizeGrip(void)
+{
+ // Get available size
+
+ CRect rect;
+ getClientRect(rect);
+
+ int32_t gripRatio = (m_pageSize << 16) / m_contentSize;
+ int32_t gripSize = rect.getHeight() * gripRatio;
+ gripSize >>= 16;
+ m_gutterHeight = rect.getHeight();
+
+ if (gripSize < m_minimumGripHeight)
+ {
+ // TODO: Need to implement scaling here. If we resize the grip to be
+ // artificially larger, we effectively reduce the scale (not just the
+ // height) of the gutter. Each position in the gutter needs to be
+ // reduced in value.
+ }
+
+ m_grip->resize(rect.getWidth(), gripSize);
+}
diff --git a/NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx b/NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx
new file mode 100644
index 000000000..2ddf364e8
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx
@@ -0,0 +1,245 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cslidervertical.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "nxconfig.hxx"
+#include "cwidgetcontrol.hxx"
+#include "csliderverticalgrip.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+/**
+ * Constructor.
+ *
+ * @param pWidgetControl The controlling widget for the display
+ * @param x The x coordinate of the grip, relative to its parent.
+ * @param y The y coordinate of the grip, relative to its parent.
+ * @param width The width of the grip.
+ * @param height The height of the grip.
+ */
+
+CSliderVerticalGrip::CSliderVerticalGrip(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height)
+: CNxWidget(pWidgetControl, x, y, width, height, WIDGET_DRAGGABLE)
+{
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderVerticalGrip::drawContents(CGraphicsPort *port)
+{
+ CRect rect;
+ getRect(rect);
+
+ nxwidget_pixel_t color;
+ if (!m_flags.clicked)
+ {
+ color = getSelectedBackgroundColor();
+ }
+ else
+ {
+ color = getHighlightColor();
+ }
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(),
+ color);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CSliderVerticalGrip::drawBorder(CGraphicsPort *port)
+{
+ // Stop drawing if the widget indicates it should not have an outline
+
+ if (!isBorderless())
+ {
+ if (isClicked())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+ else
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShineEdgeColor(), getShadowEdgeColor());
+ }
+ }
+}
+
+/**
+ * Starts dragging the grip and redraws it.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CSliderVerticalGrip::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ startDragging(x, y);
+ redraw();
+}
+
+/**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CSliderVerticalGrip::onRelease(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
+/**
+ * Redraws the grip.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ */
+
+void CSliderVerticalGrip::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
+{
+ redraw();
+}
+
+/**
+ * Moves the grip to follow the mouse.
+ *
+ * @param x The x coordinate of the mouse.
+ * @param y The y coordinate of the mouse.
+ * @param vX The horizontal distance of the drag.
+ * @param vY The vertical distance of the drag.
+ */
+
+void CSliderVerticalGrip::onDrag(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY)
+{
+ // Work out where we're moving to
+
+ nxgl_coord_t destY = y - m_grabPointY - m_parent->getY();
+
+ // Do we need to move?
+
+ if (destY != m_rect.getY())
+ {
+ // Get parent rect
+
+ CRect rect;
+ m_parent->getClientRect(rect);
+
+ // Prevent grip from moving outside parent
+
+ if (destY < rect.getY())
+ {
+ destY = rect.getY();
+ }
+ else
+ {
+ if (destY + getHeight() > rect.getHeight() + rect.getY())
+ {
+ destY = (rect.getHeight() + rect.getY()) - getHeight();
+ }
+ }
+
+ // Move to new location
+
+ moveTo(rect.getX(), destY);
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/cstickybutton.cxx b/NxWidgets/libnxwidgets/src/cstickybutton.cxx
new file mode 100644
index 000000000..76852eaf7
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cstickybutton.cxx
@@ -0,0 +1,168 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cstickybutton.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cstickybutton.hxx"
+#include "cgraphicsport.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for buttons that display a string.
+ *
+ * @param pWidgetControl The controlling widget for the display.
+ * @param x The x coordinate of the button, relative to its parent.
+ * @param y The y coordinate of the button, relative to its parent.
+ * @param width The width of the button.
+ * @param height The height of the button.
+ * @param text The text for the button to display.
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CStickyButton::CStickyButton(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text,
+ CWidgetStyle *style)
+: CButton(pWidgetControl, x, y, width, height, text, style)
+{
+ m_isStuckDown = false;
+}
+
+/**
+ * Sets the key's stuck down state. If this is true, the key has a
+ * inwards-bevelled border when drawn. If it is false, the key has
+ * an outwards-bevelled border.
+ *
+ * @param stuckDown The new stuck down state.
+ */
+
+void CStickyButton::setStuckDown(bool stuckDown)
+ {
+ m_isStuckDown = stuckDown;
+ redraw();
+ }
+
+/**
+ * Draws the outline of the button.
+ *
+ * @param port Graphics port to draw to.
+ */
+
+void CStickyButton::drawOutline(CGraphicsPort *port)
+{
+ CButton::drawOutline(port, m_isStuckDown);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CStickyButton::drawContents(CGraphicsPort *port)
+{
+ CButton::drawContents(port, m_isStuckDown);
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CStickyButton::drawBorder(CGraphicsPort *port)
+{
+ CButton::drawBorder(port, m_isStuckDown);
+}
diff --git a/NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx b/NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx
new file mode 100644
index 000000000..05c9d8928
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx
@@ -0,0 +1,292 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/include/cstickybuttonarray.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "cstickybuttonarray.hxx"
+#include "cgraphicsport.hxx"
+#include "cwidgetstyle.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CStickyButtonArray Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for an array of sticky buttons.
+ *
+ * @param pWidgetControl The widget control for the display.
+ * @param x The x coordinate of the button array, relative to its parent.
+ * @param y The y coordinate of the button array, relative to its parent.
+ * @param buttonColumns The number of buttons in one row of the button array
+ * @param buttonRows The number of buttons in one column of the button array
+ * @param buttonWidth The width of one button
+ * @param buttonHeight The height of one button
+ * @param style The style that the button should use. If this is not
+ * specified, the button will use the global default widget
+ * style.
+ */
+
+CStickyButtonArray::CStickyButtonArray(CWidgetControl *pWidgetControl,
+ nxgl_coord_t x, nxgl_coord_t y,
+ uint8_t buttonColumns, uint8_t buttonRows,
+ nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
+ CWidgetStyle *style)
+: CButtonArray(pWidgetControl, x, y, buttonColumns, buttonRows, buttonWidth, buttonHeight, style)
+{
+ // Initialize state
+
+ m_isStuckDown = false;
+ m_stickDown = false;
+}
+
+/**
+ * Check if any button in the array is stuck down and, if so,
+ * return the indices of the stuck down button.
+ *
+ * @param column The location to return the column index of the button
+ * of interest
+ * @param row The location to return the row index of the button of
+ * interest
+ * @return True if a button in the array is clicked
+ */
+
+bool CStickyButtonArray::isAnyButtonStuckDown(int &column, int &row) const
+{
+ // Return the indices of the last stuck button
+
+ column = m_stickyColumn;
+ row = m_stickyRow;
+
+ // Return true if the button is currently stuck
+
+ return m_isStuckDown;
+}
+
+/**
+ * Check if this specific button in the array is stuck down
+ *
+ * @param column The column of the button to check.
+ * @param row The row of the button to check.
+ * @return True if this button is stuck down
+ */
+
+bool CStickyButtonArray::isThisButtonStuckDown(int column, int row) const
+{
+ // Does this match the index of the last stuck button?
+
+ if (column == m_stickyColumn && row == m_stickyRow)
+ {
+ // Yes.. return true if it is still stuck
+
+ return m_isStuckDown;
+ }
+ else
+ {
+ // This button is definitely not stuck down
+
+ return false;
+ }
+}
+
+/**
+ * Force the button at this position into the stuck down state
+ *
+ * @param column The column containing the button to stick down
+ * @param row The rowtcontaining the button to stick down
+ * @return False(0) is returned if the indices are out of range.
+ */
+
+bool CStickyButtonArray::stickDown(int column, int row)
+{
+ // Verify that the cursor position is within range
+
+ if ((unsigned)column < m_buttonColumns && (unsigned)row < m_buttonRows)
+ {
+ // First, unstick any currently stuck buttons
+
+ unstick();
+
+ // Then stick this button down
+
+ m_stickyColumn = column;
+ m_stickyRow = row;
+ m_isStuckDown = true;
+
+ // We only want to update the stuck down buttons
+
+ m_stickDown = true;
+ redraw();
+ m_stickDown = false;
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Unstick all buttons.
+ */
+
+void CStickyButtonArray::unstick(void)
+{
+ // Is any button stuck down?
+
+ if (m_isStuckDown)
+ {
+ // Yes.. unstick it and update the button display
+
+ m_isStuckDown = false;
+
+ // We only want to update the stuck down buttons
+
+ m_stickDown = true;
+ redraw();
+ m_stickDown = false;
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CStickyButtonArray::drawContents(CGraphicsPort *port)
+{
+ // Are we just updating the stuck down button?
+
+ if (m_stickDown)
+ {
+ // There are two cases: (1) A sticky button was unstuck, or (2) a new
+ // button is stuck down. m_isStuckDown will distinguish these
+ //
+ // Draw the button using the clicked style if either (1) it is
+ // stuck down OR (2) it is currently clicked. Draw the button in
+ // the normal style if is is un-stuck and not clicked.
+ //
+ // NOTE: If usedClicked is false, the button may revert to either
+ // (1) the "normal" button state, or (2) the "highlighted" button
+ // stated. drawButton() will handle that.
+
+ bool useClicked = m_isStuckDown || isThisButtonClicked(m_stickyColumn, m_stickyRow);
+ drawButton(port, m_stickyColumn, m_stickyRow, useClicked);
+ }
+
+ // Do we draw just one button (due to click or release)?
+
+ else if (m_redrawButton)
+ {
+ // Just one. Get the row/column indices from the last click
+
+ int column;
+ int row;
+ bool useClicked = isButtonClicked(column, row);
+
+ // If this is a press or release on the stuck down button, then don't
+ // redraw the button. Drawing of stuck down and unstuck buttons is
+ // controlled entirely by the m_stickDown case.
+
+ if (!isThisButtonStuckDown(column, row))
+ {
+ // Not a stuck down button. Re-draw that button
+
+ drawButton(port, column, row, useClicked);
+ }
+ }
+
+ // Do we just draw the hightlighted button?
+
+ else if (m_cursorChange)
+ {
+ // Do nothing if the highlighted button is also the stuck down button
+ // or the clicked button
+
+ if (!isThisButtonStuckDown(m_cursorColumn, m_cursorRow) &&
+ !isThisButtonClicked(m_cursorColumn, m_cursorRow))
+ {
+ drawButton(port, m_cursorColumn, m_cursorRow, false);
+ }
+ }
+
+ // Draw all buttons
+
+ else
+ {
+ // Visit each column
+
+ for (int column = 0; column < m_buttonColumns; column++)
+ {
+ // Visit each row
+
+ for (int row = 0; row < m_buttonRows; row++)
+ {
+ // Is the button clicked?
+
+ bool useClicked = isThisButtonClicked(column, row);
+
+ // If the button is not clicked but it is the stuck button,
+ // then draw it as clicked anyway.
+
+ if (!useClicked)
+ {
+ useClicked = isThisButtonStuckDown(column, row);
+ }
+
+ // Draw each button. If useClicked is false, then drawButton
+ // will do the right thing if the button is highlighted.
+
+ drawButton(port, column, row, useClicked);
+ }
+ }
+ }
+}
+
diff --git a/NxWidgets/libnxwidgets/src/cstringiterator.cxx b/NxWidgets/libnxwidgets/src/cstringiterator.cxx
new file mode 100644
index 000000000..2327af38f
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cstringiterator.cxx
@@ -0,0 +1,198 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cgraphicsport.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cnxstring.hxx"
+#include "cstringiterator.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor. Moves the iterator to the first character in the string.
+ *
+ * @param string Pointer to the string that will be iterated over.
+ */
+
+CStringIterator::CStringIterator(FAR const CNxString* string)
+{
+ m_pString = string;
+ m_pCurrentChar = m_pString->getCharArray();
+ m_currentIndex = 0;
+}
+
+/**
+ * Moves the iterator to the first character in the string.
+ *
+ * @param Returns false if the string is empty
+ */
+
+bool CStringIterator::moveToFirst()
+{
+ int length = m_pString->getLength();
+ if (length > 0)
+ {
+ m_pCurrentChar = m_pString->getCharArray();
+ m_currentIndex = 0;
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Moves the iterator to the last character in the string.
+ *
+ * @param Returns false if the string is empty
+ */
+
+bool CStringIterator::moveToLast(void)
+{
+ int length = m_pString->getLength();
+ if (length > 0)
+ {
+ m_pCurrentChar = m_pString->getCharArray() + length - 1;
+ m_currentIndex = length - 1;
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Move the iterator to the next character in the string.
+ *
+ * @return True if the iterator moved; false if not (indicates end of string).
+ */
+
+bool CStringIterator::moveToNext(void)
+{
+ if (m_currentIndex < m_pString->getLength() - 1)
+ {
+ m_pCurrentChar++;
+ m_currentIndex++;
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Move the iterator to the previous character in the string.
+ *
+ * @return True if the iterator moved; false if not (indicates start of string).
+ */
+
+bool CStringIterator::moveToPrevious(void)
+{
+ if (m_currentIndex > 0)
+ {
+ m_pCurrentChar--;
+ m_currentIndex--;
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Move the iterator to the specified index.
+ *
+ * @param index The index to move to.
+ * @return True if the iterator moved; false if not (indicates end of string).
+ */
+
+bool CStringIterator::moveTo(int index)
+{
+ // Abort if index exceeds the size of the string
+
+ if (index < m_pString->getLength())
+ {
+ // Move to the requested position
+
+ m_pCurrentChar = m_pString->getCharArray() + index;
+ m_currentIndex = index;
+ return true;
+ }
+ return false;
+}
diff --git a/NxWidgets/libnxwidgets/src/ctext.cxx b/NxWidgets/libnxwidgets/src/ctext.cxx
new file mode 100644
index 000000000..688031d88
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/ctext.cxx
@@ -0,0 +1,675 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/ctext.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "ctext.hxx"
+#include "cstringiterator.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param font The font to use for this text object.
+ * @param text A string that this text object should wrap around.
+ * @param width The pixel width at which the text should wrap.
+ */
+
+CText::CText(CNxFont *font, const CNxString &text, nxgl_coord_t width)
+: CNxString(text)
+{
+ m_font = font;
+ m_width = width;
+ m_lineSpacing = 1;
+ wrap();
+}
+
+/**
+ * Set the text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+void CText::setText(const CNxString &text)
+{
+ CNxString::setText(text);
+ wrap();
+}
+
+/**
+ * Set the text in the string.
+ *
+ * @param text Char array to use as the new data for this string.
+ */
+
+void CText::setText(FAR const char *text)
+{
+ CNxString::setText(text);
+ wrap();
+}
+
+/**
+ * Set the text in the string.
+ *
+ * @param text Character to to use as the new data for this string.
+ */
+
+void CText::setText(const nxwidget_char_t text)
+{
+ CNxString::setText(text);
+ wrap();
+}
+
+/**
+ * Append text to the end of the string.
+ *
+ * @param text String to append.
+ */
+
+void CText::append(const CNxString &text)
+{
+ CNxString::append(text);
+ wrap(getLength() - 1);
+}
+
+/**
+ * Insert text at the specified character index.
+ *
+ * @param text The text to insert.
+ * @param index The char index to insert at.
+ */
+
+void CText::insert(const CNxString &text, const int index)
+{
+ CNxString::insert(text, index);
+ wrap(index);
+}
+
+/**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex The char index to start removing from.
+ */
+
+void CText::remove(const int startIndex)
+{
+ CNxString::remove(startIndex);
+ wrap(startIndex);
+}
+
+/**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex The char index to start removing from.
+ * @param count The number of chars to remove.
+ */
+
+void CText::remove(const int startIndex, const int count)
+{
+ CNxString::remove(startIndex, count);
+ wrap(startIndex);
+}
+
+
+/**
+ * Set the vertical spacing between rows of text.
+ *
+ * @param lineSpacing The line spacing.
+ */
+
+void CText::setLineSpacing(uint8_t lineSpacing)
+{
+ m_lineSpacing = lineSpacing;
+ wrap();
+}
+
+/**
+ * Sets the pixel width of the text; text wider than
+ * this will automatically wrap.
+ *
+ * @param width Maximum pixel width of the text.
+ */
+
+void CText::setWidth(nxgl_coord_t width)
+{
+ m_width = width;
+ wrap();
+}
+
+/**
+ * Set the font to use.
+ *
+ * @param font Pointer to the new font.
+ */
+
+void CText::setFont(CNxFont* font)
+{
+ m_font = font;
+ wrap();
+}
+
+/**
+ * Get the number of characters in the specified line number.
+ *
+ * @param lineNumber The line number to check.
+ * @return The number of characters in the line.
+ */
+
+const int CText::getLineLength(const int lineNumber) const
+{
+ if (lineNumber < getLineCount() - 1)
+ {
+ return m_linePositions[lineNumber + 1] - m_linePositions[lineNumber];
+ }
+
+ return getLength() - m_linePositions[lineNumber];
+}
+
+/**
+ * Get the number of characters in the specified line number,
+ * ignoring any trailing blank characters.
+ *
+ * @param lineNumber The line number to check.
+ * @return The number of characters in the line.
+ */
+
+const int CText::getLineTrimmedLength(const int lineNumber) const
+{
+ nxgl_coord_t length = getLineLength(lineNumber);
+
+ // Loop through string until the end
+
+ CStringIterator *iterator = newStringIterator();
+
+ // Get char at the end of the line
+
+ if (iterator->moveTo(m_linePositions[lineNumber] + length - 1))
+ {
+ do
+ {
+ if (!m_font->isCharBlank(iterator->getChar()))
+ {
+ break;
+ }
+ length--;
+ }
+ while (iterator->moveToPrevious() && (length > 0));
+ return length;
+ }
+
+ // May occur if data has been horribly corrupted somewhere
+
+ return 0;
+}
+
+/**
+ * Get the width in pixels of the specified line number.
+ *
+ * @param lineNumber The line number to check.
+ * @return The pixel width of the line.
+ */
+
+const nxgl_coord_t CText::getLinePixelLength(const int lineNumber) const
+{
+ return m_font->getStringWidth(*this, getLineStartIndex(lineNumber),
+ getLineLength(lineNumber));
+}
+
+/**
+ * Get the width in pixels of the specified line number,
+ * ignoring any trailing blank characters.
+ *
+ * @param lineNumber The line number to check.
+ * @return The pixel width of the line.
+ */
+
+const nxgl_coord_t CText::getLineTrimmedPixelLength(const int lineNumber) const
+{
+ return m_font->getStringWidth(*this, getLineStartIndex(lineNumber),
+ getLineTrimmedLength(lineNumber));
+}
+
+/**
+ * Get a pointer to the CText object's font.
+ *
+ * @return Pointer to the font.
+ */
+
+CNxFont *CText::getFont(void) const
+{
+ return m_font;
+}
+
+/**
+ * Removes lines of text from the start of the text buffer.
+ *
+ * @param lines Number of lines to remove
+ */
+
+void CText::stripTopLines(const int lines)
+{
+ // Get the start point of the text we want to keep
+
+ nxgl_coord_t textStart = 0;
+
+ for (int i = 0; i < lines; i++)
+ {
+ textStart += getLineLength(i);
+ }
+
+ // Remove the characters from the start of the string to the found location
+
+ remove(0, textStart);
+
+ // Rewrap the text
+
+ wrap();
+}
+
+/**
+ * Wrap all of the text.
+ */
+
+void CText::wrap(void)
+{
+ wrap(0);
+}
+
+/**
+ * Wrap the text from the line containing the specified char index onwards.
+ *
+ * @param charIndex The index of the char to start wrapping from; note
+ * that the wrapping function will re-wrap that entire line of text.
+ */
+
+void CText::wrap(int charIndex)
+{
+ // Declare vars in advance of loop
+
+ int pos = 0;
+ int lineWidth;
+ int breakIndex;
+ bool endReached = false;
+
+ if (m_linePositions.size() == 0)
+ {
+ charIndex = 0;
+ }
+
+ // If we're wrapping from an offset in the text, ensure that any existing data
+ // after the offset gets removed
+
+ if (charIndex > 0)
+ {
+ // Remove wrapping data past this point
+
+ // Get the index of the line in which the char index appears
+
+ int lineIndex = getLineContainingCharIndex(charIndex);
+
+ // Remove any longest line records that occur from the line index onwards
+
+ while ((m_longestLines.size() > 0) &&
+ (m_longestLines[m_longestLines.size() - 1].index >= lineIndex))
+ {
+ m_longestLines.pop_back();
+ }
+
+ // If there are any longest line records remaining, update the text pixel width
+ // The last longest line record will always be the last valid longest line as
+ // the vector is sorted by length
+
+ if (m_longestLines.size() > 0)
+ {
+ m_textPixelWidth = m_longestLines[m_longestLines.size() - 1].width;
+ }
+ else
+ {
+ m_textPixelWidth = 0;
+ }
+
+ // Remove any wrapping data from after this line index onwards
+
+ while ((m_linePositions.size() > 0) &&
+ (m_linePositions.size() - 1 > (int)lineIndex))
+ {
+ m_linePositions.pop_back();
+ }
+
+ // Adjust start position of wrapping loop so that it starts with
+ // the current line index
+
+ if (m_linePositions.size() > 0)
+ {
+ pos = m_linePositions[m_linePositions.size() - 1];
+ }
+ }
+ else
+ {
+ // Remove all wrapping data
+
+ // Wipe the width variable
+
+ m_textPixelWidth = 0;
+
+ // Empty existing longest lines
+
+ m_longestLines.clear();
+
+ // Empty existing line positions
+
+ m_linePositions.clear();
+
+ // Push first line start into vector
+
+ m_linePositions.push_back(0);
+ }
+
+ // Loop through string until the end
+
+ CStringIterator *iterator = newStringIterator();
+
+ while (!endReached)
+ {
+ breakIndex = 0;
+ lineWidth = 0;
+
+ if (iterator->moveTo(pos))
+ {
+ // Search for line breaks and valid breakpoints until we
+ // exceed the width of the text field or we run out of
+ // string to process
+
+ while (lineWidth + m_font->getCharWidth(iterator->getChar()) <= m_width)
+ {
+ lineWidth += m_font->getCharWidth(iterator->getChar());
+
+ // Check for line return
+
+ if (iterator->getChar() == '\n')
+ {
+ // Remember this breakpoint
+
+ breakIndex = iterator->getIndex();
+ break;
+ }
+ else if ((iterator->getChar() == ' ') ||
+ (iterator->getChar() == ',') ||
+ (iterator->getChar() == '.') ||
+ (iterator->getChar() == '-') ||
+ (iterator->getChar() == ':') ||
+ (iterator->getChar() == ';') ||
+ (iterator->getChar() == '?') ||
+ (iterator->getChar() == '!') ||
+ (iterator->getChar() == '+') ||
+ (iterator->getChar() == '=') ||
+ (iterator->getChar() == '/') ||
+ (iterator->getChar() == '\0'))
+ {
+ // Remember the most recent breakpoint
+
+ breakIndex = iterator->getIndex();
+ }
+
+ // Move to the next character
+
+ if (!iterator->moveToNext())
+ {
+ // No more text; abort loop
+
+ endReached = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ endReached = true;
+ }
+
+ if ((!endReached) && (iterator->getIndex() > pos))
+ {
+ // Process any found data
+
+ // If we didn't find a breakpoint split at the current position
+
+ if (breakIndex == 0)
+ {
+ breakIndex = iterator->getIndex() - 1;
+ }
+
+ // Trim blank space from the start of the next line
+
+ CStringIterator *breakIterator = newStringIterator();
+
+ if (breakIterator->moveTo(breakIndex + 1))
+ {
+ while (breakIterator->getChar() == ' ')
+ {
+ if (breakIterator->moveToNext())
+ {
+ breakIndex++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ delete breakIterator;
+
+ // Add the start of the next line to the vector
+
+ pos = breakIndex + 1;
+ m_linePositions.push_back(pos);
+
+ // Is this the longest line observed so far?
+
+ if (lineWidth > m_textPixelWidth)
+ {
+ m_textPixelWidth = lineWidth;
+
+ // Push the description of the line into the longest lines
+ // vector (note that we store the index in m_linePositions that
+ // refers to the start of the line, *not* the position of the
+ // line in the char array)
+
+ LongestLine line;
+ line.index = m_linePositions.size() - 2;
+ line.width = lineWidth;
+ m_longestLines.push_back(line);
+ }
+ }
+ else if (!endReached)
+ {
+ // Add a blank row if we're not at the end of the string
+
+ pos++;
+ m_linePositions.push_back(pos);
+ }
+ }
+
+ // Add marker indicating end of text
+ // If we reached the end of the text, append the stopping point
+
+ if (m_linePositions[m_linePositions.size() - 1] != getLength() + 1)
+ {
+ m_linePositions.push_back(getLength());
+ }
+
+ delete iterator;
+
+ // Calculate the total height of the text
+
+ m_textPixelHeight = getLineCount() * (m_font->getHeight() + m_lineSpacing);
+
+ // Ensure height is always at least one row
+
+ if (m_textPixelHeight == 0)
+ {
+ m_textPixelHeight = m_font->getHeight() + m_lineSpacing;
+ }
+}
+
+/**
+ * Get the index of the line of text that contains the specified index
+ * within the raw char array.
+ *
+ * @param index The index to locate within the wrapped lines of text.
+ * @return The number of the line of wrapped text that contains the
+ * specified index.
+ */
+
+const int CText::getLineContainingCharIndex(const int index) const
+{
+ // Early exit if there is no existing line data
+
+ if (m_linePositions.size() == 0)
+ {
+ return 0;
+ }
+
+ // Early exit if the character is in the last row
+
+ if (index >= m_linePositions[m_linePositions.size() - 2])
+ {
+ return m_linePositions.size() - 2;
+ }
+
+ // Binary search the line vector for the line containing the supplied index
+
+ int bottom = 0;
+ int top = m_linePositions.size() - 1;
+ int mid;
+
+ while (bottom <= top)
+ {
+ // Standard binary search
+
+ mid = (bottom + top) >> 1;
+
+ if (index < m_linePositions[mid])
+ {
+ // Index is somewhere in the lower search space
+
+ top = mid - 1;
+ }
+ else if (index > m_linePositions[mid])
+ {
+ // Index is somewhere in the upper search space
+
+ bottom = mid + 1;
+ }
+ else if (index == m_linePositions[mid])
+ {
+ // Located the index
+
+ return mid;
+ }
+
+ // Check to see if we've moved past the line that contains the index
+ // We have to do this because the index we're looking for can be within
+ // a line; it isn't necessarily the start of a line (which is what is
+ // stored in the m_linePositions vector)
+
+ if (index > m_linePositions[top])
+ {
+ // Search index falls within the line represented by the top position
+
+ return top;
+ }
+ else if (index < m_linePositions[bottom])
+ {
+ // Search index falls within the line represented by the bottom position
+
+ return bottom - 1;
+ }
+ }
+
+ // Line cannot be found
+
+ return 0;
+}
diff --git a/NxWidgets/libnxwidgets/src/ctextbox.cxx b/NxWidgets/libnxwidgets/src/ctextbox.cxx
new file mode 100644
index 000000000..9c22a2bfa
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/ctextbox.cxx
@@ -0,0 +1,679 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/ctextbox.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxconfig.hxx"
+#include "ctextbox.hxx"
+#include "cgraphicsport.hxx"
+#include "cnxtimer.hxx"
+#include "cstringiterator.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * CButton Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor for a textbox containing a string.
+ *
+ * @param pWidgetControl The controlling widget for the window
+ * @param x The x coordinate of the text box, relative to its parent.
+ * @param y The y coordinate of the text box, relative to its parent.
+ * @param width The width of the textbox.
+ * @param height The height of the textbox.
+ * @param text Pointer to a string to display in the textbox.
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * defaultCWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CTextBox::CTextBox(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t width, nxgl_coord_t height,
+ const CNxString &text, CWidgetStyle *style)
+ : CLabel(pWidgetControl, x, y, width, height, text, style)
+{
+ // Initialize state
+
+ m_cursorPos = 0;
+ m_showCursor = SHOW_CURSOR_ONFOCUS;
+ m_wrapCursor = false;
+ m_textChange = false;
+ m_flags.doubleClickable = true;
+
+ // Set the border thickness (2 lines)
+
+ m_borderSize.top = 2;
+ m_borderSize.right = 2;
+ m_borderSize.bottom = 2;
+ m_borderSize.left = 2;
+
+ // Move the cursor to the end of the string
+
+ moveCursorToPosition(m_text.getLength());
+
+ // Register to receive keypress events
+
+ addWidgetEventHandler(static_cast<CWidgetEventHandler *>(this));
+}
+
+/**
+ * Shows the cursor.
+ *
+ * @param cursorMode Determines cursor display mode
+ */
+
+void CTextBox::showCursor(EShowCursor cursorMode)
+{
+ if (m_showCursor != cursorMode)
+ {
+ m_showCursor = cursorMode;
+ redraw();
+ }
+}
+
+/**
+ * Set the text displayed in the label.
+ *
+ * @param text String to display.
+ */
+
+void CTextBox::setText(const CNxString &text)
+{
+ m_text.setText(text);
+ repositionCursor(m_text.getLength());
+ onTextChange();
+}
+
+/**
+ * Append new text to the end of the current text displayed in the
+ * label.
+ *
+ * @param text String to append.
+ */
+
+void CTextBox::appendText(const CNxString &text)
+{
+ m_text.append(text);
+ repositionCursor(m_text.getLength());
+ onTextChange();
+}
+
+/**
+ * Remove all characters from the string from the start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ */
+
+void CTextBox::removeText(const unsigned int startIndex)
+{
+ m_text.remove(startIndex);
+ repositionCursor(startIndex);
+ onTextChange();
+}
+
+/**
+ * Remove specified number of characters from the string from the
+ * start index onwards.
+ *
+ * @param startIndex Index to remove from.
+ * @param count Number of characters to remove.
+ */
+
+void CTextBox::removeText(const unsigned int startIndex, const unsigned int count)
+{
+ m_text.remove(startIndex, count);
+ repositionCursor(startIndex);
+ onTextChange();
+}
+
+/**
+ * Insert text at the specified index.
+ *
+ * @param text The text to insert.
+ * @param index Index at which to insert the text.
+ */
+
+void CTextBox::insertText(const CNxString &text, const unsigned int index)
+{
+ m_text.insert(text, index);
+ repositionCursor(index + text.getLength());
+ onTextChange();
+}
+
+/**
+ * Insert text at the current cursor position.
+ *
+ * @param text The text to insert.
+ */
+
+void CTextBox::insertTextAtCursor(const CNxString &text)
+{
+ insertText(text, getCursorPosition());
+}
+
+/**
+ * Move the cursor to the text position specified. 0 indicates the
+ * start of the string. If position is greater than the length of the
+ * string, the cursor is moved to the end of the string.
+ *
+ * @param position The new cursor position.
+ */
+
+void CTextBox::moveCursorToPosition(const int position)
+{
+ if (repositionCursor(position))
+ {
+ calculateTextPositionHorizontal();
+ redraw();
+ }
+}
+
+/**
+ * Handle a keyboard press event.
+ *
+ * @param e The event data.
+ */
+
+void CTextBox::handleKeyPressEvent(const CWidgetEventArgs &e)
+{
+ nxwidget_char_t key = e.getKey();
+
+ if (key == KEY_CODE_BACKSPACE)
+ {
+ if (m_cursorPos == 0) return;
+
+ // Delete the character in front of the cursor
+
+ removeText(m_cursorPos - 1, 1);
+ }
+ else if (key == KEY_CODE_ENTER)
+ {
+ // Fire an action event
+
+ m_widgetEventHandlers->raiseActionEvent();
+ }
+ else if (key != KEY_CODE_NONE)
+ {
+ // Not modifier; append value
+
+ insertTextAtCursor(key);
+ }
+}
+
+/**
+ * Handle a cursor control event. Replaces CWidgetEventHandler method.
+ *
+ * @param e The event data.
+ */
+
+void CTextBox::handleCursorControlEvent(const CWidgetEventArgs &e)
+{
+ ECursorControl control = e.getCursorControl();
+
+ if (control == CURSOR_LEFT)
+ {
+ if (m_cursorPos > 0)
+ {
+ moveCursorToPosition(m_cursorPos - 1);
+ }
+ else if (m_wrapCursor)
+ {
+ moveCursorToPosition(m_text.getLength() - 1);
+ }
+ }
+ else if (control == CURSOR_RIGHT)
+ {
+ if (m_cursorPos < m_text.getLength())
+ {
+ moveCursorToPosition(m_cursorPos + 1);
+ }
+ else if (m_wrapCursor)
+ {
+ moveCursorToPosition(0);
+ }
+ }
+}
+
+/**
+ * Redraws the widget
+ */
+
+void CTextBox::onBlur(void)
+{
+ redraw();
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CTextBox::drawContents(CGraphicsPort *port)
+{
+ // Get the drawing area (excluding the border)
+
+ CRect rect;
+ getRect(rect);
+
+ // Determine the background and text color
+
+ nxgl_mxpixel_t textColor;
+ nxgl_mxpixel_t backColor;
+
+ if (!isEnabled())
+ {
+ textColor = getDisabledTextColor();
+ backColor = getBackgroundColor();
+ }
+ else if (m_highlighted)
+ {
+ textColor = getSelectedTextColor();
+ backColor = getSelectedBackgroundColor();
+ }
+ else
+ {
+ textColor = getEnabledTextColor();
+ backColor = getBackgroundColor();
+ }
+
+ // Draw the background (excluding the border)
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ rect.getWidth(), rect.getHeight(), backColor);
+
+ // Get the X/Y position of the text within the textbox
+
+ struct nxgl_point_s pos;
+ pos.x = rect.getX() + m_align.x;
+ pos.y = rect.getY() + m_align.y;
+
+ // And draw the text
+
+ CNxFont *font = getFont();
+ port->drawText(&pos, &rect, font, m_text, 0, m_text.getLength(), textColor);
+
+ // Draw cursor
+
+ if (isCursorVisible())
+ {
+ // Calculate the (relative) cursor position
+ // Warning: drawText modifies pos!
+
+ pos.x = getCursorXPos() + m_align.x;
+ pos.y = m_align.y;
+
+ // Calculate the cursor width
+
+ struct nxgl_size_s size;
+ size.w = getCursorWidth();
+ size.h = getFont()->getHeight();
+
+ // Is the cursor wholly within the visible region?
+
+ if (pos.x >= 0 && pos.x + size.w < rect.getWidth())
+ {
+ // Invert the colors in the cursor region.
+
+ pos.x += rect.getX();
+ pos.y += rect.getY();
+
+ port->invert(pos.x, pos.y, size.w, size.h);
+ }
+ }
+}
+
+/**
+ * Moves the cursor without redrawing.
+ *
+ * @param position New cursor position.
+ */
+
+bool CTextBox::repositionCursor(const int position)
+{
+ int len = m_text.getLength();
+
+ // Set the cursor position if the new position is within the string.
+
+ if (m_cursorPos != position && position <= len)
+ {
+ m_cursorPos = position;
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Move the cursor to the specified coordinates. The coordinates
+ * are expected to be the result of a click, and therefore in
+ * world-space rather than widget-space.
+ */
+
+void CTextBox::moveCursorToClickLocation(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // Work out where in the string the click coordinates represent
+ // and move the cursor to that location
+
+ if (m_text.getLength() > 0)
+ {
+ // Transform click coordinates to widget-space coordinates
+
+ nxgl_coord_t clickX = x - getX() - m_borderSize.left;
+ nxgl_coord_t charX = m_align.x;
+
+ // Locate the first character that comes after the clicked character
+
+ CStringIterator *iterator = m_text.newStringIterator();
+
+ while (charX < clickX)
+ {
+ charX += getFont()->getCharWidth(iterator->getChar());
+
+ if (!iterator->moveToNext())
+ {
+ break;
+ }
+ }
+
+ int index = iterator->getIndex();
+
+ // Move back to the clicked character if we've moved past it
+
+ if (charX > clickX)
+ {
+ iterator->moveToPrevious();
+ index = iterator->getIndex();
+ }
+ else if (charX < clickX)
+ {
+ // Move past end of string if click is after the text
+
+ index++;
+ }
+
+ moveCursorToPosition(index);
+ delete iterator;
+ }
+}
+
+/**
+ * Draw the area of this widget that falls within the clipping region.
+ * Called by the redraw() function to draw all visible regions.
+ *
+ * @param port The CGraphicsPort to draw to.
+ * @see redraw()
+ */
+
+void CTextBox::drawBorder(CGraphicsPort *port)
+{
+ // Check if the widget indicates it should have an outline: That
+ // the outline is enabled and the this is not just a text-only
+ // redraw
+
+ if (!isBorderless() && !isTextChange())
+ {
+ port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
+ getShineEdgeColor(), getShadowEdgeColor());
+ port->drawBevelledRect(getX() + 1, getY() + 1, getWidth() - 2, getHeight() - 2,
+ getShadowEdgeColor(), getShineEdgeColor());
+ }
+}
+
+/**
+ * Moves the cursor to the clicked coordinates.
+ *
+ * @param x The x coordinates of the click.
+ * @param y The y coordinates of the click.
+ */
+
+void CTextBox::onClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ moveCursorToClickLocation(x, y);
+}
+
+/**
+ * Does nothing.
+ *
+ * @param x The x coordinates of the click.
+ * @param y The y coordinates of the click.
+ */
+
+void CTextBox::onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
+{
+ // No double click action
+}
+
+/**
+ * Return true if the cursor is visible
+ */
+
+bool CTextBox::isCursorVisible(void) const
+{
+ return (m_showCursor == SHOW_CURSOR_ALWAYS ||
+ (m_showCursor == SHOW_CURSOR_ONFOCUS && hasFocus()));
+}
+
+/**
+ * Get the x coordinate of the cursor in pixels relative
+ * to the left-hand edge of the client rect.
+ *
+ * @return The x coordinate of the cursor in pixels.
+ */
+
+const nxgl_coord_t CTextBox::getCursorXPos(void) const
+{
+ // Calculate position of cursor
+
+ nxgl_coord_t cursorX = 0;
+
+ CStringIterator *iterator = m_text.newStringIterator();
+
+ for (nxgl_coord_t i = 0; i < m_cursorPos; i++)
+ {
+ cursorX += getFont()->getCharWidth(iterator->getChar());
+ iterator->moveToNext();
+ }
+
+ delete iterator;
+ return cursorX;
+}
+
+/**
+ * Get the width of the cursor in pixels.
+ *
+ * @return The width of the cursor in pixels.
+ */
+
+nxgl_coord_t CTextBox::getCursorWidth(void) const
+{
+ if (m_cursorPos < m_text.getLength())
+ {
+ // Cursor within the string - get the width of the character
+
+ return getFont()->getCharWidth(m_text.getCharAt(m_cursorPos));
+ }
+ else
+ {
+ // Cursor past end of string - get the width of a space
+
+ return getFont()->getCharWidth(' ');
+ }
+}
+
+/**
+ * Calculate the horizontal position of the string based on its length
+ * and the alignment options. Alignment options are overridden if the
+ * width of the string exceeds the width of the textbox.
+ */
+
+void CTextBox::calculateTextPositionHorizontal(void)
+{
+ // Calculate the string width - if the width is longer than the box,
+ // ignore alignment and align left
+
+ nxgl_coord_t stringWidth = getFont()->getStringWidth(m_text);
+
+ // Add the width of a blank space to the width to ensure that we can
+ // see the cursor
+
+ if (isCursorVisible())
+ {
+ stringWidth += getFont()->getCharWidth(' ');
+ }
+
+ CRect rect;
+ getClientRect(rect);
+
+ // Use alignment options if cursor is hidden or string is smaller
+ // than textbox
+
+ nxgl_coord_t width = rect.getWidth();
+ if ((stringWidth < width) || !isCursorVisible())
+ {
+ // Text not wider than box, so apply alignment options
+
+ switch (m_hAlignment)
+ {
+ case TEXT_ALIGNMENT_HORIZ_CENTER:
+ m_align.x = (width - stringWidth) >> 1;
+ break;
+
+ case TEXT_ALIGNMENT_HORIZ_LEFT:
+ m_align.x = rect.getX();
+ break;
+
+ case TEXT_ALIGNMENT_HORIZ_RIGHT:
+ m_align.x = width - stringWidth;
+ break;
+ }
+
+ return;
+ }
+
+ // Text is wider than box - view needs to follow the cursor
+ // If cursor is at the end of the text, we can just right-align
+
+ if (m_cursorPos == m_text.getLength())
+ {
+ m_align.x = width - stringWidth;
+ return;
+ }
+
+ // Work out the coordinates of the left edge of the cursor
+
+ int cursorX1 = getCursorXPos();
+
+ // Work out the coordinates of the right edge of the cursor
+
+ int cursorX2 = cursorX1 + getCursorWidth();
+
+ // Ensure that the cursor is on-screen
+
+ if (cursorX1 + m_align.x < 0)
+ {
+ // Cursor is off left side of screen, so adjust m_align.x
+
+ m_align.x = 0 - cursorX1;
+ }
+ else if (cursorX2 + m_align.x > width)
+ {
+ // Cursor is off right side of screen, so adjust m_align.x
+
+ m_align.x = width - cursorX2;
+ }
+
+ // We need to ensure that the text cannot be positioned in
+ // such a way that there is a gap between the end of the
+ // text and the right edge of the textbox
+
+ if (stringWidth + m_align.x < width)
+ {
+ m_align.x = width - stringWidth;
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
new file mode 100644
index 000000000..5ea672a2f
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
@@ -0,0 +1,890 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <cstring>
+
+#include "nxconfig.hxx"
+#include "cnxserver.hxx"
+#include "cnxwidget.hxx"
+#include "cnxfont.hxx"
+#include "cwidgetstyle.hxx"
+#include "cnxtimer.hxx"
+#include "cgraphicsport.hxx"
+#include "cwidgetcontrol.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Global Static Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+/**
+ * CWidgetControl constructor (for the case where the display size is known)
+ *
+ * @param style The style that the widget should use. If this is not
+ * specified, the widget will use the values stored in the global
+ * defaultCWidgetStyle object. The widget will copy the properties of
+ * the style into its own internal style object.
+ */
+
+CWidgetControl::CWidgetControl(FAR const CWidgetStyle *style)
+{
+ // Initialize state
+
+ m_port = (CGraphicsPort *)NULL;
+ m_modal = false;
+ m_clickedWidget = (CNxWidget *)NULL;
+ m_focusedWidget = (CNxWidget *)NULL;
+
+ // Initialize data that we will get from the position callback
+
+ m_hWindow = NULL;
+ m_size.h = 0;
+ m_size.w = 0;
+ m_pos.x = 0;
+ m_pos.y = 0;
+ m_bounds.pt1.x = 0;
+ m_bounds.pt1.y = 0;
+ m_bounds.pt2.y = 0;
+ m_bounds.pt2.y = 0;
+
+ // Initialize the mouse/touchscreen event and keyboard data structures
+
+ memset(&m_mouse, 0, sizeof(struct SMouse));
+ m_nCh = 0;
+ m_nCc = 0;
+
+ // Enable the semaphore that will wake up the modal loop on mouse or
+ // keypress events
+
+ sem_init(&m_modalsem, 0, 0);
+
+ // Do we need to fetch the default style?
+
+ if (style == (CWidgetStyle *)NULL)
+ {
+ // Get the style from the controlling widget
+
+ copyWidgetStyle(&m_style, g_defaultWidgetStyle);
+ }
+ else
+ {
+ // Use specified style
+
+ copyWidgetStyle(&m_style, style);
+ }
+}
+
+
+/**
+ * Destructor.
+ */
+
+CWidgetControl::~CWidgetControl(void)
+{
+ // Stop any ongoing modal operation
+
+ stopModal();
+
+ // Delete any contained instances
+
+ if (m_port)
+ {
+ delete m_port;
+ }
+
+ // Flush the delete queue
+
+ processDeleteQueue();
+
+ // Delete controlled widget list
+
+ while (m_widgets.size() > 0)
+ {
+ m_widgets[0]->destroy();
+ }
+}
+
+/**
+ * Run the widget modally. This will run the CWidgetControl
+ * application until stopModal() is called.
+ */
+
+void CWidgetControl::goModal(void)
+{
+ // Enter modal
+
+ m_modal = true;
+
+ // Loop until stopModal() is called
+
+ while (m_modal)
+ {
+ // Process pending events
+
+ bool interestingEvent = pollEvents();
+
+ // Did any interesting events occur?
+
+ if (!interestingEvent)
+ {
+ // No, give up the CPU until something interesting happens.
+
+ waitForModalEvent();
+ }
+ }
+}
+
+/**
+ * Wait for an interesting modal event to occur (like a mouse or keyboard event)
+ */
+
+void CWidgetControl::waitForModalEvent(void)
+{
+ // It would be an error if this were called outside of a modal loop
+
+ if (m_modal)
+ {
+ // Wait for an interesting event (like a mouse or keyboard event)
+
+ (void)sem_wait(&m_modalsem);
+ }
+}
+
+/**
+ * Wake up the modal loop
+ */
+
+void CWidgetControl::wakeupModalLoop(void)
+{
+ if (m_modal)
+ {
+ (void)sem_post(&m_modalsem);
+ }
+}
+
+/**
+ * Stop the widget running modally.
+ */
+
+void CWidgetControl::stopModal(void)
+{
+ if (m_modal)
+ {
+ // No longer modal
+
+ m_modal = false;
+
+ // Wake up the modal loop so that it can terminate properly
+
+ (void)sem_post(&m_modalsem);
+ }
+}
+
+/**
+ * Run all code that needs to take place on a periodic basis.
+ * This is normally called from and is the main body of goModal()
+ * with widget == NULL.
+ *
+ * @param widget Sub-widget to run, used for modal widgets; omit
+ * this parameter to run the whole system.
+ * @return True means some interesting event occurred
+ */
+
+bool CWidgetControl::pollEvents(CNxWidget *widget)
+{
+ // Delete any queued widgets
+
+ processDeleteQueue();
+
+ // Handle mouse input
+
+ bool mouseEvent = pollMouseEvents(widget);
+
+ // Handle keyboard input
+
+ bool keyboardEvent = pollKeyboardEvents();
+
+ // Handle cursor control input
+
+ bool cursorControlEvent = pollCursorControlEvents();
+ return mouseEvent || keyboardEvent || cursorControlEvent;
+}
+
+/**
+ * Get the index of the specified controlled widget.
+ *
+ * @param widget The widget to get the index of.
+ * @return The index of the widget. -1 if the widget is not found.
+ */
+
+const int CWidgetControl::getWidgetIndex(const CNxWidget *widget) const
+{
+ for (int i = 0; i < m_widgets.size(); i++)
+ {
+ if (m_widgets[i] == widget)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/**
+ * Redraws any dirty regions within the supplied region.
+ *
+ * @param rect The region to redraw
+ */
+
+void CWidgetControl::eraseRect(CRect rect)
+{
+ // Create pointer to a vector to store the invalid rectangles
+
+ TNxArray<CRect> *invalidRectangles = new TNxArray<CRect>();
+
+ if (invalidRectangles != (TNxArray<CRect> *)NULL)
+ {
+ // Add rectangle into the vector
+
+ invalidRectangles->push_back(rect);
+
+ // Refresh children
+
+ for (int i = m_widgets.size() - 1; i > -1 ; i--)
+ {
+ if (invalidRectangles->size() > 0)
+ {
+ m_widgets[i]->redrawDirty(invalidRectangles, (CNxWidget *)NULL);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // Tidy up
+
+ delete invalidRectangles;
+ }
+}
+
+/**
+ * Remove a controlled widget
+ *
+ * @param widget The widget to be removed
+ */
+
+void CWidgetControl::removeControlledWidget(CNxWidget *widget)
+{
+ // Locate the widget
+
+ int index = getWidgetIndex(widget);
+ if (index >= 0)
+ {
+ m_widgets.erase(index);
+ }
+}
+
+/**
+ * Add a widget to the list of widgets to be deleted.
+ * Must never be called by anything other than the framework itself.
+ *
+ * @param widget The widget to add to the delete queue.
+ */
+
+void CWidgetControl::addToDeleteQueue(CNxWidget *widget)
+{
+ m_deleteQueue.push_back(widget);
+}
+
+/**
+ * Set the clicked widget pointer. Note that this should not be
+ * called by code other than within the CWidgetControl library itself.
+ *
+ * @param widget The new clicked widget.
+ */
+
+void CWidgetControl::setClickedWidget(CNxWidget *widget)
+{
+ // Do we have a clicked widget already?
+
+ if (m_clickedWidget != (CNxWidget *)NULL)
+ {
+ // Ensure that the existing clicked widget is released *outside* its bounds
+
+ m_clickedWidget->release(m_clickedWidget->getX() - 10, 0);
+ }
+
+ // Update the pointer
+
+ m_clickedWidget = widget;
+}
+
+/**
+ * Set the focused widget that will receive keyboard input.
+ *
+ * @param widget The new focused widget.
+ */
+
+void CWidgetControl::setFocusedWidget(CNxWidget *widget)
+{
+ if (m_focusedWidget != widget)
+ {
+ // This widget will now receive focus
+
+ m_focusedWidget = widget;
+
+ // Make sure that the widget knows that is has focus
+
+ widget->focus();
+ }
+#warning "Widgets with focus need to go on a stack so that focus can be restored"
+}
+
+/**
+ * This event is called from CCallback instance to provide
+ * notifications of certain NX-server related events. This event,
+ * in particular, will occur when the position or size of the underlying
+ * window occurs.
+ *
+ * @param hWindow The window handle that should be used to communicate
+ * with the window
+ * @param pos The position of the window in the physical device space.
+ * @param size The size of the window.
+ * @param bounds The size of the underlying display (pixels x rows)
+ */
+
+void CWidgetControl::geometryEvent(NXHANDLE hWindow,
+ const struct nxgl_size_s *size,
+ const struct nxgl_point_s *pos,
+ const struct nxgl_rect_s *bounds)
+{
+ // Save positional data that may change dynamically
+
+ m_pos.x = pos->x;
+ m_pos.y = pos->y;
+ m_size.h = size->h;
+ m_size.w = size->w;
+
+ // The first callback is important. This is the handshake that proves
+ // that we are truly communicating with the servier. This is also
+ // a critical point because this is when we know the physical
+ // dimensions of the underlying window.
+
+ if (!m_hWindow)
+ {
+ // Save one-time server specific information
+
+ m_hWindow = hWindow;
+ nxgl_rectcopy(&m_bounds, bounds);
+ }
+}
+
+/**
+ * This event is called from CCallback instance to provide
+ * notifications of certain NX-server related events. This event,
+ * in particular, will occur when the a portion of the window that was
+ * previously obscured is now exposed.
+ *
+ * @param rect The region in the window that must be redrawn.
+ * @param more True means that more re-draw requests will follow
+ */
+
+void CWidgetControl::redrawEvent(FAR const struct nxgl_rect_s *nxRect, bool more)
+{
+ CRect rect;
+ rect.setNxRect(nxRect);
+ eraseRect(rect);
+}
+
+/**
+ * This event is called from CCallback instance to provide notifications of
+ * certain NX-server related events. This event, in particular, means that
+ * new mouse data is available for the window.
+ *
+ * @param pPos The (x,y) position of the mouse.
+ * @param buttons See NX_MOUSE_* definitions.
+ */
+
+void CWidgetControl::newMouseEvent(FAR const struct nxgl_point_s *pPos, uint8_t buttons)
+{
+ // Save the mouse X/Y position
+
+ m_mouse.x = pPos->x;
+ m_mouse.y = pPos->y;
+
+ // Update button press states
+
+ clearMouseEvents();
+
+ if ((buttons & NX_MOUSE_LEFTBUTTON) != 0)
+ {
+ // Handle left button press events. leftHeld means that the left mouse
+ // button was pressed on the previous sample as well.
+
+ if (m_mouse.leftHeld)
+ {
+ m_mouse.leftDrag = 1;
+ }
+ else
+ {
+ // New left button press
+
+ m_mouse.leftPressed = 1;
+
+ (void)clock_gettime(CLOCK_REALTIME, &m_mouse.leftPressTime);
+
+ // Check for double click event
+
+ if (elapsedTime(&m_mouse.leftReleaseTime) <= CONFIG_NXWIDGETS_DOUBLECLICK_TIME)
+ {
+ m_mouse.doubleClick = 1;
+ }
+ }
+
+ m_mouse.leftHeld = 1;
+ }
+ else
+ {
+ // Handle left button release events
+
+ if (m_mouse.leftHeld)
+ {
+ // New left button release
+
+ m_mouse.leftReleased = 1;
+ (void)clock_gettime(CLOCK_REALTIME, &m_mouse.leftReleaseTime);
+ }
+
+ m_mouse.leftHeld = 0;
+ }
+
+#if 0 // Center and right buttons not used
+ if ((buttons & NX_MOUSE_CENTERBUTTON) != 0)
+ {
+ // Handle center button press events. centerHeld means that the center mouse
+ // button was pressed on the previous sample as well.
+
+ if (m_mouse.centerHeld)
+ {
+ m_mouse.centerDrag = 1;
+ }
+ else
+ {
+ // New center button press
+
+ m_mouse.centerPressed = 1;
+ }
+
+ m_mouse.centerHeld = 1;
+ }
+ else
+ {
+ // Handle center button release events
+
+ if (m_mouse.centerHeld)
+ {
+ // New center button release
+
+ m_mouse.centerReleased = 1;
+ }
+
+ m_mouse.centerHeld = 0;
+ }
+
+ if ((buttons & NX_MOUSE_RIGHTBUTTON) != 0)
+ {
+ // Handle right button press events. rightHeld means that the right mouse
+ // button was pressed on the previous sample as well.
+
+ if (m_mouse.rightHeld)
+ {
+ m_mouse.rightDrag = 1;
+ }
+ else
+ {
+ // New right button press
+
+ m_mouse.rightPressed = 1;
+ }
+
+ m_mouse.rightHeld = 1;
+ }
+ else
+ {
+ // Handle right button release events
+
+ if (m_mouse.rightHeld)
+ {
+ // New right button release
+
+ m_mouse.rightReleased = 1;
+ }
+
+ m_mouse.rightHeld = 0;
+ }
+#endif
+
+ // Then wake up the modal loop
+
+ wakeupModalLoop();
+}
+
+/**
+ * This event is called from CCallback instance to provide notifications of
+ * certain NX-server related events. This event, in particular, means that
+ * keyboard/keypad data is available for the window.
+ *
+ * @param nCh The number of characters that are available in pStr[].
+ * @param pStr The array of characters.
+ */
+
+void CWidgetControl::newKeyboardEvent(uint8_t nCh, FAR const uint8_t *pStr)
+{
+ FAR uint8_t *pBuffer = &m_kbdbuf[m_nCh];
+
+ // Append each new character to keyboard character buffer
+
+ for (uint8_t i = 0;
+ i < nCh && m_nCh < CONFIG_NXWIDGETS_KBDBUFFER_SIZE;
+ i++, m_nCh++)
+ {
+ *pBuffer++ = *pStr++;
+ }
+
+ // Then wake up the modal loop
+
+ wakeupModalLoop();
+}
+
+/**
+ * This event means that cursor control data is available for the window.
+ *
+ * @param cursorControl The cursor control code received.
+ */
+
+void CWidgetControl::newCursorControlEvent(ECursorControl cursorControl)
+{
+ // Append the new cursor control
+
+ if (m_nCc < CONFIG_NXWIDGETS_CURSORCONTROL_SIZE)
+ {
+ m_controls[m_nCc] = (uint8_t)cursorControl;
+ m_nCc++;
+ }
+
+ // Then wake up the modal loop
+
+ wakeupModalLoop();
+}
+
+/**
+ * Copy a widget style
+ *
+ * @param dest The destination style
+ * @param src The source to use
+ */
+
+void CWidgetControl::copyWidgetStyle(CWidgetStyle *dest, const CWidgetStyle *src)
+{
+ dest->colors.background = src->colors.background;
+ dest->colors.selectedBackground = src->colors.selectedBackground;
+ dest->colors.shineEdge = src->colors.shineEdge;
+ dest->colors.shadowEdge = src->colors.shadowEdge;
+ dest->colors.highlight = src->colors.highlight;
+ dest->colors.disabledText = src->colors.disabledText;
+ dest->colors.enabledText = src->colors.enabledText;
+ dest->colors.selectedText = src->colors.selectedText;
+ dest->font = src->font;
+}
+
+/**
+ * Return the elapsed time in millisconds
+ *
+ * @param tp A time in the past from which to compute the elapsed time.
+ * @return The elapsed time since tp
+ */
+
+uint32_t CWidgetControl::elapsedTime(FAR const struct timespec *startTime)
+{
+ struct timespec endTime;
+
+ (void)clock_gettime(CLOCK_REALTIME, &endTime);
+ if (startTime->tv_sec <= endTime.tv_sec)
+ {
+ // Get the elapsed seconds
+
+ uint32_t seconds = endTime.tv_sec - startTime->tv_sec;
+
+ // Get the elapsed nanoseconds, borrowing from the seconds if necessary
+
+ int32_t endNanoSeconds = endTime.tv_nsec;
+ if (startTime->tv_nsec > endNanoSeconds)
+ {
+ // Are there any seconds to borrow from?
+
+ if (seconds < 1)
+ {
+ // startTime is in the future???
+
+ return 0;
+ }
+
+ // Borrow from the seconds
+
+ seconds--;
+ endNanoSeconds += 1000000000;
+ }
+ uint32_t nanoseconds = endNanoSeconds - startTime->tv_nsec;
+
+ // Then return the elapsed time in milliseconds
+
+ return seconds * 1000000 + nanoseconds / 1000;
+ }
+
+ // startTime is in the future???
+
+ return 0;
+}
+
+/**
+ * Pass clicks to the widget hierarchy. If a single widget
+ * is supplied, only that widget is sent the click. That widget
+ * should be running modally.
+ *
+ * @param x Click xcoordinate.
+ * @param y Click ycoordinate.
+ * @param widget Pointer to a modally-running widget or NULL.
+ */
+
+void CWidgetControl::handleLeftClick(nxgl_coord_t x, nxgl_coord_t y, CNxWidget *widget)
+{
+ // Working with a modal widget or the whole structure?
+
+ if (widget == (CNxWidget *)NULL)
+ {
+ // All widgets
+
+ for (int i = m_widgets.size() - 1; i > -1; i--)
+ {
+ if (m_widgets[i]->click(x, y))
+ {
+ return;
+ }
+ }
+ }
+ else
+ {
+ // One widget
+
+ (void)widget->click(x, y);
+ }
+}
+
+/**
+ * Delete any widgets in the deletion queue.
+ */
+
+void CWidgetControl::processDeleteQueue(void)
+{
+ int i = 0;
+ while (i < m_deleteQueue.size())
+ {
+ m_deleteQueue[i]->destroy();
+ i++;
+ }
+
+ m_deleteQueue.clear();
+}
+
+/**
+ * Process mouse/touchscreen events and send throughout the hierarchy.
+ *
+ * @param widget to process, used for modal widgets; omit this parameter
+ * to run the whole system.
+ * @return True means a mouse event occurred
+ */
+
+bool CWidgetControl::pollMouseEvents(CNxWidget *widget)
+{
+ bool mouseEvent = true; // Assume that an interesting mouse event occurred
+
+ // All widgets
+
+ if (m_mouse.leftPressed)
+ {
+ // Handle a new left button press event
+
+ handleLeftClick(m_mouse.x, m_mouse.y, widget);
+ }
+ else if (m_mouse.leftDrag)
+ {
+ // The left button is still being held down
+
+ if (m_clickedWidget != (CNxWidget *)NULL)
+ {
+ // Handle a mouse drag event
+
+ m_clickedWidget->drag(m_mouse.x, m_mouse.y,
+ m_mouse.x - m_mouse.lastX,
+ m_mouse.y - m_mouse.lastY);
+ }
+ }
+ else if (m_clickedWidget != (CNxWidget *)NULL)
+ {
+ // Mouse left button release event
+
+ m_clickedWidget->release(m_mouse.x, m_mouse.y);
+ }
+ else
+ {
+ // No interesting mouse events
+
+ mouseEvent = false;
+ }
+
+ // Clear all press and release events once they have been processed
+
+ clearMouseEvents();
+
+ // Save the mouse position for the next poll
+
+ m_mouse.lastX = m_mouse.x;
+ m_mouse.lastY = m_mouse.y;
+ return mouseEvent;
+}
+
+/**
+ * Process keypad events and send throughout the hierarchy.
+ *
+ * @return True means a keyboard event occurred
+ */
+
+bool CWidgetControl::pollKeyboardEvents(void)
+{
+ bool keyboardEvent = false; // Assume no interesting keyboard events
+
+ // Keyboard presses with no focused widget is not an interesting
+ // event
+
+ if (m_focusedWidget != (CNxWidget *)NULL)
+ {
+ // Forward each character to the widget with the focus
+
+ for (uint8_t i = 0; i < m_nCh; i++)
+ {
+ m_focusedWidget->keyPress((nxwidget_char_t)m_kbdbuf[i]);
+ keyboardEvent = true;
+ }
+ }
+
+ // All of the buffered characters have been consumed
+
+ m_nCh = 0;
+ return keyboardEvent;
+}
+
+/**
+ * Process cursor control events and send throughout the hierarchy.
+ *
+ * @return True means a cursor control event was processes
+ */
+
+bool CWidgetControl::pollCursorControlEvents(void)
+{
+ bool cursorControlEvent = false; // Assume no interesting cursor events
+
+ // Cursor controls with no focused widget is not an interesting
+ // event
+
+ if (m_focusedWidget != (CNxWidget *)NULL)
+ {
+ // Forward each cursor control to the widget with the focus
+
+ for (uint8_t i = 0; i < m_nCc; i++)
+ {
+ m_focusedWidget->cursorControl((ECursorControl)m_controls[i]);
+ cursorControlEvent = true;
+ }
+ }
+
+ // All of the buffered events have been consumed
+
+ m_nCc = 0;
+ return cursorControlEvent;
+}
+
+/**
+ * Clear all mouse events
+ */
+
+void CWidgetControl::clearMouseEvents(void)
+{
+ // Clear all press and release events once they have been processed
+
+ m_mouse.leftPressed = 0;
+ m_mouse.leftReleased = 0;
+ m_mouse.leftDrag = 0;
+
+#if 0 // Center and right buttons are not used
+ m_mouse.centerPressed = 0;
+ m_mouse.centerReleased = 0;
+ m_mouse.centerDrag = 0;
+
+ m_mouse.rightPressed = 0;
+ m_mouse.rightReleased = 0;
+ m_mouse.rightDrag = 0;
+#endif
+
+ m_mouse.doubleClick = 0;
+}
diff --git a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx
new file mode 100644
index 000000000..48b762d0d
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx
@@ -0,0 +1,606 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cnxwidget.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "cwidgeteventargs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+#define DOUBLE_CLICK_BOUNDS 10
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/**
+ * Constructor.
+ *
+ * @param widget The owning widget.
+ */
+
+CWidgetEventHandlerList::CWidgetEventHandlerList(CNxWidget *widget)
+{
+ m_widget = widget;
+ m_isEnabled = true;
+}
+
+/**
+ * Check if the object raises events or not.
+ *
+ * @return True if events are enabled.
+ */
+
+const bool CWidgetEventHandlerList::isEnabled(void) const
+{
+ return m_isEnabled && !m_widget->isDeleted();
+}
+
+/**
+ * Adds a widget event handler. The event handler will receive
+ * all events raised by this object.
+ * @param eventHandler A pointer to the event handler.
+ */
+
+void CWidgetEventHandlerList::addWidgetEventHandler(CWidgetEventHandler *eventHandler)
+{
+ // Prevent insertion if the handler already exists
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ if (m_widgetEventHandlers.at(i) == eventHandler)
+ {
+ return;
+ }
+ }
+
+ // Add the new handler
+
+ m_widgetEventHandlers.push_back(eventHandler);
+}
+
+/**
+ * Remove a widget event handler.
+ *
+ * @param eventHandler A pointer to the event handler to remove.
+ */
+
+void CWidgetEventHandlerList::removeWidgetEventHandler(CWidgetEventHandler *eventHandler)
+{
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ if (m_widgetEventHandlers.at(i) == eventHandler)
+ {
+ m_widgetEventHandlers.erase(i);
+ return;
+ }
+ }
+}
+
+/**
+ * Raise a click event to the event handler.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CWidgetEventHandlerList::raiseClickEvent(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, x, y, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleClickEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a double-click event to the event handler.
+ *
+ * @param x The x coordinate of the click.
+ * @param y The y coordinate of the click.
+ */
+
+void CWidgetEventHandlerList::raiseDoubleClickEvent(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, x, y, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleDoubleClickEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a mouse release event to the event handler.
+ *
+ * @param x The x coordinate of the release.
+ * @param y The y coordinate of the release.
+ */
+
+void CWidgetEventHandlerList::raiseReleaseEvent(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, x, y, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleReleaseEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a mouse release-outside event to the event handler.
+ *
+ * @param x The x coordinate of the release.
+ * @param y The y coordinate of the release.
+ */
+
+void CWidgetEventHandlerList::raiseReleaseOutsideEvent(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, x, y, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleReleaseOutsideEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a mouse drag event to the event handler.
+ *
+ * @param x The x coordinate of the mouse when the drag started.
+ * @param y The y coordinate of the mouse when the drag started.
+ * @param vX The horizontal distance dragged.
+ * @param vY The vertical distance dragged.
+ */
+
+void CWidgetEventHandlerList::raiseDragEvent(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, x, y, vX, vY, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleDragEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a widget drop event to the event handler.
+ *
+ * @param x The x coordinate of the mouse when the drop occurred.
+ * @param y The y coordinate of the mouse when the drop occurred.
+ */
+
+void CWidgetEventHandlerList::raiseDropEvent(nxgl_coord_t x, nxgl_coord_t y)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, x, y, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleDropEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a move forward event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseMoveForwardEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleMoveForwardEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a move backward event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseMoveBackwardEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleMoveBackwardEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a key press event to the event handler.
+ *
+ * @param key The code of the key that caused the event.
+ */
+
+void CWidgetEventHandlerList::raiseKeyPressEvent(nxwidget_char_t key)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, key);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleKeyPressEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a cursor control event to the event handler.
+ *
+ * @param cursorControl The cursor control code that caused the event.
+ */
+
+void CWidgetEventHandlerList::raiseCursorControlEvent(ECursorControl cursorControl)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, (nxwidget_char_t)cursorControl);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleCursorControlEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a focus event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseFocusEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleFocusEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a blur event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseBlurEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleBlurEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a close event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseCloseEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleCloseEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a hide event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseHideEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleHideEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a show event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseShowEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleShowEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a shelve event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseShelveEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleShelveEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a unshelve event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseUnshelveEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleUnshelveEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise an enable event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseEnableEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleEnableEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a disable event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseDisableEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleDisableEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a value change event to the event handler.
+ */
+
+void CWidgetEventHandlerList::raiseValueChangeEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleValueChangeEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a resize event to the event handler.
+ *
+ * @param width The new width of the widget.
+ * @param height The new height of the widget.
+ */
+
+void CWidgetEventHandlerList::raiseResizeEvent(nxgl_coord_t width, nxgl_coord_t height)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleResizeEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise a move event to the event handler.
+ *
+ * @param x The new x coordinate of the widget.
+ * @param y The new y coordinate of the widget.
+ * @param vX The horizontal distance moved.
+ * @param vY The vertical distance moved.
+ */
+
+void CWidgetEventHandlerList::raiseMoveEvent(nxgl_coord_t x, nxgl_coord_t y,
+ nxgl_coord_t vX, nxgl_coord_t vY)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, x, y, vX, vY, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleMoveEvent(e);
+ }
+ }
+}
+
+/**
+ * Raise an action event to the event handler. This should be called
+ * when a widget's purpose has been fulfilled. For example, in the case
+ * of a button, this event is raised when the button is released within
+ * its boundaries. The button has produced a valid click, and thus
+ * fulfilled its purpose, so it needs to raise an "action" event.
+ */
+
+void CWidgetEventHandlerList::raiseActionEvent(void)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, 0, 0, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleActionEvent(e);
+ }
+ }
+}
+
+/**
+ * Raises a scroll event. Fired when the panel scrolls.
+ *
+ * @param vX Horizontal distance scrolled.
+ * @param vY Vertical distance scrolled.
+ */
+
+void CWidgetEventHandlerList::raiseScrollEvent(nxgl_coord_t vX, nxgl_coord_t vY)
+{
+ if (isEnabled())
+ {
+ CWidgetEventArgs e(m_widget, 0, 0, vX, vY, KEY_CODE_NONE);
+
+ for (int i = 0; i < m_widgetEventHandlers.size(); ++i)
+ {
+ m_widgetEventHandlers.at(i)->handleScrollEvent(e);
+ }
+ }
+}
diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx
new file mode 100644
index 000000000..ec2a6baf0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_arrowDownGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_BLACK,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_BLACK,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_BLACK,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_BLACK,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_BLACK,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_BLACK,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_BLACK,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_BLACK,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_arrowDownGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_BLACK,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_BLACK,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_BLACK,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_BLACK,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_BLACK,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_BLACK,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_BLACK,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_BLACK,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_arrowDown =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 6, // width - Width in pixels
+ 10, // height - Height in rows
+ (6*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_arrowDownGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx
new file mode 100644
index 000000000..6b3e8ee92
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_glypharrowleft.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_arrowLeftGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_arrowLeftGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_arrowLeft =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 7, // width - Width in pixels
+ 10, // height - Height in rows
+ (7*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_arrowLeftGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowright.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowright.cxx
new file mode 100644
index 000000000..74763a6fd
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_arrowright.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_arrowright.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_arrowRightGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_arrowRightGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_arrowRight =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 7, // width - Width in pixels
+ 10, // height - Height in rows
+ (7*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_arrowRightGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowup.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowup.cxx
new file mode 100644
index 000000000..9ec840d43
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_arrowup.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_arrowup.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_arrowUpGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_arrowUpGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_arrowUp =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 6, // width - Width in pixels
+ 10, // height - Height in rows
+ (6*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_arrowUpGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_backspace.cxx b/NxWidgets/libnxwidgets/src/glyph_backspace.cxx
new file mode 100644
index 000000000..967963347
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_backspace.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_backspace.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_backspaceGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_backspaceGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_backspace =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_backspaceGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_capslock.cxx b/NxWidgets/libnxwidgets/src/glyph_capslock.cxx
new file mode 100644
index 000000000..663e601f0
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_capslock.cxx
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_capslock.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_capslockGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_capslockGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_capslock =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_capslockGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
+
diff --git a/NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx b/NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx
new file mode 100644
index 000000000..681c17445
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_checkBoxMuGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP,
+ RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_checkBoxMuGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP,
+ RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_checkBoxMu =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_checkBoxMuGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx b/NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx
new file mode 100644
index 000000000..250d2455e
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_checkBoxOff =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 0, // width - Width in pixels
+ 0, // height - Height in rows
+ (0*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ (const nxgl_mxpixel_t*)NULL // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx b/NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx
new file mode 100644
index 000000000..5b9c18b78
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_checkBoxOnGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_checkBoxOnGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_checkBoxOn =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_checkBoxOnGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_control.cxx b/NxWidgets/libnxwidgets/src/glyph_control.cxx
new file mode 100644
index 000000000..ffbdf965b
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_control.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_control.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_controlGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_controlGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_control =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 7, // width - Width in pixels
+ 10, // height - Height in rows
+ (7*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_controlGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_cycle.cxx b/NxWidgets/libnxwidgets/src/glyph_cycle.cxx
new file mode 100644
index 000000000..5c98b8b90
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_cycle.cxx
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_cycle.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_cycleGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_cycleGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_cycle =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 7, // width - Width in pixels
+ 10, // height - Height in rows
+ (7*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_cycleGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
+
diff --git a/NxWidgets/libnxwidgets/src/glyph_nxlogo.cxx b/NxWidgets/libnxwidgets/src/glyph_nxlogo.cxx
new file mode 100644
index 000000000..1b3aab143
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_nxlogo.cxx
@@ -0,0 +1,3450 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_nxlogo.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "crlepalettebitmap.hxx"
+#include "glyphs.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+/* RGB24 (8-8-8) Colors */
+
+#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define BITMAP_NLUTCODES 164 /* Number of unique RGB colors in the image */
+
+static const uint32_t g_nuttxLut[BITMAP_NLUTCODES] =
+{
+ 0x000000, 0x102028, 0x5898e0, 0x3c30e4, 0x3c34e4, 0x0c0828, 0x382ce4, 0x3c34e8, /* Codes 0-7 */
+ 0x3834d4, 0x241c74, 0x2c2490, 0x343c8c, 0x5ca0ec, 0x4454d0, 0x2c288c, 0x5ca0e8, /* Codes 8-15 */
+ 0x3830d4, 0x687078, 0xd0e4f0, 0x3428e4, 0x24282c, 0xcce4f0, 0x848cec, 0xdcf4f4, /* Codes 16-23 */
+ 0xd8ecf0, 0x2c24e0, 0xa8b8c4, 0xb4c4f0, 0x5854e4, 0xd8f0f0, 0xd8f0f4, 0x484890, /* Codes 24-31 */
+ 0x2c287c, 0x28287c, 0x282478, 0x342cb4, 0xcce0f0, 0xd8e8f4, 0xa8bcc8, 0x587c98, /* Codes 32-39 */
+ 0x5c98bc, 0x2c4c60, 0xe0f8fc, 0x1c1478, 0x2c2884, 0x302894, 0xfcfcfc, 0xd4e8f4, /* Codes 40-47 */
+ 0x5090b8, 0x101c20, 0xd8ecf8, 0x5c94bc, 0x8c90ec, 0x7c84bc, 0xc8e0f0, 0x98c0d8, /* Codes 48-55 */
+ 0xe8f0f8, 0x94bcd8, 0x3830e4, 0xb0bcec, 0xf4f8fc, 0xe4f0f8, 0x3c34ec, 0x142028, /* Codes 56-63 */
+ 0x5894bc, 0x5078ac, 0x5084b4, 0x282080, 0x3428b4, 0xd0e4f4, 0x70a4c8, 0x3c34d8, /* Codes 64-71 */
+ 0x7880b0, 0x5490b8, 0x5484b4, 0x281c78, 0x5ca4ec, 0xdcf4fc, 0x181078, 0x2c2880, /* Codes 72-79 */
+ 0x382cd0, 0x342cb8, 0x1c1888, 0x888cf0, 0xc4e0f0, 0x98c4dc, 0x180c74, 0x5080b0, /* Codes 80-87 */
+ 0x282480, 0x04000c, 0x282474, 0x4038f4, 0x3024ec, 0x302c9c, 0x7c84b4, 0x0c1c28, /* Codes 88-95 */
+ 0x5090e0, 0x3020e4, 0xd8f0f8, 0x7478b4, 0x100870, 0x08006c, 0x24188c, 0x201c7c, /* Codes 96-103 */
+ 0x2c2090, 0x5098d0, 0xd4e4f0, 0x589cd0, 0x3840e0, 0x4048e4, 0xc4dcf0, 0xdcf4f8, /* Codes 104-111 */
+ 0x3024e8, 0x342cac, 0x4878b8, 0x4048e0, 0x8084e8, 0x2c248c, 0x3430bc, 0x241c70, /* Codes 112-119 */
+ 0x141074, 0x3428e0, 0x342cec, 0x2c24b4, 0x201c78, 0x3028d0, 0x241c8c, 0x7078b4, /* Codes 120-127 */
+ 0x040028, 0xd4e8f0, 0x4c7cd4, 0x282078, 0x5484b0, 0x20285c, 0x20187c, 0x4c7cb0, /* Codes 128-135 */
+ 0x3830d0, 0x4034f0, 0x2820c8, 0xdcf0f4, 0x34408c, 0x98d4ec, 0x2c1ce0, 0x5080ac, /* Codes 136-143 */
+ 0x3c30e8, 0x7078a8, 0x04001c, 0x2c3034, 0x305064, 0x2c4458, 0x74a8c8, 0xf8f8fc, /* Codes 144-151 */
+ 0xdcecf8, 0xb0c0dc, 0xa0b0bc, 0xb4d4e4, 0x707880, 0x7c98a8, 0xdcf4f0, 0x2820ac, /* Codes 152-159 */
+ 0x201874, 0x302898, 0x3844ac, 0x507ce0, /* Codes 160-163 */
+};
+
+/* RGB16 (565) Colors (four of the colors in this map are duplicates) */
+
+#elif CONFIG_NXWIDGETS_BPP == 16
+# define BITMAP_NLUTCODES 141 /* Number of unique RGB colors in the image */
+
+static const uint16_t g_nuttxLut[BITMAP_NLUTCODES] =
+{
+ 0x0000, 0x1105, 0x5cdc, 0x399c, 0x41bc, 0x0845, 0x397c, 0x39bc, 0x41bd, 0x39ba, /* Codes 0-9 */
+ 0x28ee, 0x3132, 0x31f2, 0x5d1d, 0x42ba, 0x3152, 0x399a, 0x6b8f, 0xd73e, 0x315c, /* Codes 10-19 */
+ 0x2945, 0x8c7d, 0xe7be, 0xdf7e, 0x313c, 0xadd9, 0xb63e, 0x5abd, 0xdf9e, 0xdf9f, /* Codes 20-29 */
+ 0x4a52, 0x2950, 0x292f, 0x3176, 0xcf1e, 0xdf5f, 0xadf9, 0x5bf3, 0x5cd8, 0x326c, /* Codes 30-39 */
+ 0xe7df, 0x18af, 0x3153, 0xdf5e, 0xffff, 0x5497, 0x10e4, 0xdf7f, 0x5cb8, 0x8c9d, /* Codes 40-49 */
+ 0x8437, 0x9e1b, 0xef9f, 0x9dfb, 0xb5fe, 0xffdf, 0x41be, 0x53d6, 0x5436, 0x2910, /* Codes 50-59 */
+ 0x3156, 0x7539, 0x39bb, 0x7c16, 0x95fb, 0x28ef, 0x653d, 0xe7bf, 0x188f, 0x397a, /* Codes 60-69 */
+ 0x3977, 0x20d1, 0x8c7e, 0xe79f, 0x9e3b, 0x186e, 0x5416, 0x2930, 0x0801, 0x41de, /* Codes 70-79 */
+ 0x313d, 0x3173, 0x7c36, 0x08e5, 0x549c, 0xd75f, 0x311c, 0x73d6, 0x3150, 0x315d, /* Codes 80-89 */
+ 0x104e, 0x080e, 0x20f0, 0x2912, 0x54da, 0xdf3e, 0x5cfa, 0x3a1c, 0x425c, 0xcefe, /* Codes 90-99 */
+ 0x4bd7, 0x843d, 0x2932, 0x3997, 0xf7df, 0x397d, 0x2936, 0x20ef, 0x315a, 0x20f1, /* Codes 100-109 */
+ 0x0005, 0xd75e, 0x53fa, 0x290f, 0x214b, 0x20cf, 0x4bf6, 0x2919, 0x3212, 0x9ebd, /* Codes 110-119 */
+ 0x28fc, 0x5415, 0x399d, 0x73d5, 0x0804, 0x3187, 0x328d, 0x2a2b, 0x7559, 0xe77f, /* Codes 120-129 */
+ 0xb61c, 0x3186, 0xa598, 0xbebd, 0x73d0, 0x84d5, 0x5cb7, 0x2916, 0x20ce, 0x3a35, /* Codes 130-139 */
+ 0x53fc /* Codes 140-140 */
+};
+
+/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
+ * to lookup an 8-bit value. There is no savings in that! It would be better to just put
+ * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
+ * pointless lookups. But these p;ointless lookups do make the logic compatible with the
+ * 16- and 24-bit types.
+ */
+
+#elif CONFIG_NXWIDGETS_BPP == 8
+# ifdef CONFIG_NXWIDGETS_GREYSCALE
+# define BITMAP_NLUTCODES 116 /* Number of unique greyscale levels in the image */
+
+/* 8-bit Greyscale */
+
+static const uint8_t g_nuttxLut[BITMAP_NLUTCODES] =
+{
+ 0x00, 0x19, 0x8b, 0x46, 0x4a, 0x0b, 0x8d, 0x41, 0x44, 0x27, 0x32, 0x92, 0x59, 0x34, 0x6d, 0xdb, /* Codes 0-15 */
+ 0x3f, 0x26, 0x91, 0xec, 0xe5, 0x39, 0xb4, 0xc0, 0x62, 0xe6, 0x4c, 0x2f, 0x2e, 0x3c, 0xda, 0xe4, /* Codes 16-31 */
+ 0x72, 0x86, 0xed, 0x1d, 0x35, 0xe2, 0xfc, 0xe3, 0x7d, 0x16, 0x97, 0x87, 0xee, 0xb2, 0x42, 0xbc, /* Codes 32-47 */
+ 0xf6, 0x4b, 0x1c, 0x70, 0x90, 0x77, 0x2c, 0xdf, 0x96, 0x29, 0x45, 0x7f, 0x81, 0xb1, 0x28, 0xea, /* Codes 48-63 */
+ 0x40, 0x3d, 0x23, 0x95, 0xe9, 0xd6, 0xb7, 0x2d, 0x02, 0x3a, 0x85, 0x17, 0x82, 0xe7, 0x7b, 0x33, /* Codes 64-79 */
+ 0x0e, 0x25, 0x84, 0xe0, 0x8c, 0x4d, 0x56, 0x1e, 0x3b, 0x6e, 0x31, 0x3e, 0xf3, 0x1a, 0x20, 0x04, /* Codes 80-95 */
+ 0xe1, 0x74, 0x2a, 0x79, 0x21, 0x71, 0xc4, 0x76, 0x48, 0x98, 0xf7, 0x94, 0xe8, 0xbe, 0xac, 0xc9, /* Codes 96-111 */
+ 0x75, 0x8e, 0x49, 0x7a /* Codes 112-115 */
+};
+
+# else /* CONFIG_NXWIDGETS_GREYSCALE */
+# define BITMAP_NLUTCODES 27 /* Number of unique RGB colors in the image */
+
+/* RGB8 (332) Colors */
+
+static const nxgl_mxpixel_t g_nuttxLut[BITMAP_NLUTCODES] =
+{
+ 0x00, 0x25, 0x77, 0x4b, 0x01, 0x47, 0x26, 0x4a, 0x4f, 0x72, 0xdf, 0x93, 0xff, 0x27, 0xbb, 0xdb, /* Codes 0-15 */
+ 0x6f, 0x29, 0x53, 0x97, 0x73, 0x22, 0x05, 0x02, 0x57, 0xbf, 0x4e /* Codes 16-26 */
+};
+
+# endif
+#else
+# error "Unsupport pixel format"
+#endif
+
+#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+
+static const struct SRlePaletteBitmapEntry g_nuttxRleEntries[] =
+{
+ { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */
+ { 75, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 2, 7}, { 3, 4}, { 1, 5}, /* Row 1 */
+ { 75, 0},
+ { 74, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 9}, { 1, 10}, /* Row 2 */
+ { 1, 7}, { 3, 4}, { 1, 5}, { 74, 0},
+ { 73, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 12}, /* Row 3 */
+ { 1, 13}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 73, 0},
+ { 72, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 4 */
+ { 1, 6}, { 1, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 72, 0},
+ { 71, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 5 */
+ { 1, 6}, { 3, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 71, 0},
+ { 70, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 6 */
+ { 1, 6}, { 5, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 70, 0},
+ { 69, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 7 */
+ { 1, 6}, { 7, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 69, 0},
+ { 68, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 8 */
+ { 1, 6}, { 9, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 68, 0},
+ { 67, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 9 */
+ { 1, 6}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 67, 0},
+ { 66, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 10 */
+ { 1, 6}, { 13, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 66, 0},
+ { 65, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 11 */
+ { 1, 6}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 65, 0},
+ { 64, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 12 */
+ { 1, 6}, { 17, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 64, 0},
+ { 63, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 13 */
+ { 1, 6}, { 19, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 63, 0},
+ { 62, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 14 */
+ { 1, 6}, { 21, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 62, 0},
+ { 61, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 15 */
+ { 1, 6}, { 23, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 61, 0},
+ { 60, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 16 */
+ { 1, 6}, { 25, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 60, 0},
+ { 59, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 17 */
+ { 1, 6}, { 27, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 59, 0},
+ { 58, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 18 */
+ { 1, 6}, { 29, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 26, 0},
+ { 1, 17}, { 5, 18}, { 1, 17}, { 25, 0},
+ { 57, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 19 */
+ { 1, 6}, { 10, 4}, { 5, 19}, { 16, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4},
+ { 1, 5}, { 23, 0}, { 1, 20}, { 1, 18}, { 1, 21}, { 5, 18}, { 1, 21}, { 1, 18},
+ { 1, 20}, { 23, 0},
+ { 56, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 20 */
+ { 1, 6}, { 9, 4}, { 1, 19}, { 1, 22}, { 1, 23}, { 3, 24}, { 1, 23}, { 1, 22},
+ { 1, 25}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 22, 0},
+ { 11, 18}, { 1, 20}, { 22, 0},
+ { 23, 0}, { 1, 17}, { 5, 18}, { 1, 26}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 21 */
+ { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 27},
+ { 1, 21}, { 5, 18}, { 1, 21}, { 1, 23}, { 1, 28}, { 15, 4}, { 1, 16}, { 1, 14},
+ { 1, 7}, { 3, 4}, { 1, 5}, { 20, 0}, { 1, 17}, { 1, 21}, { 11, 18}, { 1, 20},
+ { 21, 0},
+ { 21, 0}, { 1, 20}, { 1, 18}, { 1, 21}, { 5, 18}, { 1, 21}, { 1, 18}, { 1, 20}, /* Row 22 */
+ { 22, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 9, 4}, { 1, 19}, { 1, 27}, { 1, 21}, { 8, 18}, { 1, 29}, { 1, 28},
+ { 4, 7}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 19, 0},
+ { 14, 18}, { 21, 0},
+ { 21, 0}, { 11, 18}, { 1, 20}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, /* Row 23 */
+ { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 10, 4}, { 1, 22}, { 1, 21}, { 10, 18},
+ { 1, 30}, { 1, 31}, { 1, 32}, { 1, 33}, { 1, 34}, { 1, 35}, { 1, 7}, { 10, 4},
+ { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 1, 21},
+ { 4, 18}, { 1, 36}, { 2, 37}, { 1, 36}, { 4, 18}, { 1, 21}, { 1, 17}, { 20, 0},
+ { 20, 0}, { 1, 38}, { 1, 21}, { 11, 18}, { 1, 39}, { 4, 40}, { 1, 41}, { 13, 0}, /* Row 24 */
+ { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 10, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 3, 36}, { 5, 18}, { 1, 42}, { 1, 43},
+ { 3, 44}, { 1, 45}, { 1, 7}, { 10, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4},
+ { 1, 5}, { 16, 0}, { 5, 18}, { 1, 37}, { 4, 46}, { 1, 37}, { 4, 18}, { 1, 47},
+ { 1, 48}, { 1, 49}, { 18, 0},
+ { 19, 0}, { 1, 17}, { 1, 21}, { 12, 18}, { 1, 50}, { 1, 48}, { 3, 40}, { 1, 51}, /* Row 25 */
+ { 1, 40}, { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 11, 4}, { 1, 52}, { 1, 21}, { 3, 18}, { 1, 37}, { 3, 46},
+ { 1, 37}, { 4, 18}, { 1, 21}, { 1, 53}, { 4, 44}, { 1, 45}, { 1, 7}, { 10, 4},
+ { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 1, 21},
+ { 3, 18}, { 1, 54}, { 6, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 55}, { 1, 40},
+ { 1, 49}, { 17, 0},
+ { 19, 0}, { 5, 18}, { 1, 54}, { 2, 56}, { 1, 37}, { 5, 18}, { 1, 21}, { 1, 57}, /* Row 26 */
+ { 4, 40}, { 1, 51}, { 1, 41}, { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4},
+ { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 11, 4}, { 1, 58}, { 1, 59}, { 3, 18},
+ { 1, 21}, { 1, 60}, { 4, 46}, { 1, 37}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44},
+ { 1, 45}, { 1, 7}, { 10, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5},
+ { 13, 0}, { 5, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 57}, { 2, 40},
+ { 1, 49}, { 16, 0},
+ { 18, 0}, { 1, 17}, { 1, 21}, { 3, 18}, { 1, 37}, { 4, 46}, { 1, 37}, { 5, 18}, /* Row 27 */
+ { 1, 50}, { 1, 48}, { 5, 40}, { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4},
+ { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 12, 4}, { 1, 19}, { 1, 24}, { 3, 18},
+ { 1, 37}, { 6, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35},
+ { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 11, 0}, { 1, 17},
+ { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 57}, { 3, 40},
+ { 16, 0},
+ { 18, 0}, { 4, 18}, { 1, 54}, { 5, 46}, { 1, 60}, { 1, 36}, { 4, 18}, { 1, 21}, /* Row 28 */
+ { 1, 57}, { 4, 40}, { 1, 51}, { 1, 41}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6},
+ { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 13, 4}, { 1, 19}, { 1, 24},
+ { 3, 18}, { 1, 61}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44},
+ { 1, 34}, { 1, 62}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5},
+ { 10, 0}, { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 55},
+ { 2, 40}, { 1, 51}, { 1, 41}, { 15, 0},
+ { 18, 0}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 29 */
+ { 5, 40}, { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 14, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46},
+ { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 12, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 1, 21}, { 3, 18},
+ { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 4, 40}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 30 */
+ { 4, 40}, { 1, 51}, { 1, 41}, { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4},
+ { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 15, 4}, { 1, 19}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 8, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34},
+ { 1, 62}, { 12, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 7, 0},
+ { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40},
+ { 1, 63}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 31 */
+ { 5, 40}, { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 16, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 9, 46},
+ { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 13, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 1, 21}, { 3, 18},
+ { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 5, 40}, { 1, 41},
+ { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 9, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 32 */
+ { 4, 40}, { 1, 51}, { 1, 41}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8},
+ { 1, 11}, { 1, 15}, { 1, 6}, { 17, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 9, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62},
+ { 13, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 4, 0}, { 5, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 6, 40}, { 1, 63},
+ { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 9, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 33 */
+ { 3, 40}, { 1, 64}, { 1, 65}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 18, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 10, 46},
+ { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 14, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 1, 21}, { 3, 18},
+ { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 10, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 34 */
+ { 2, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 68}, { 1, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 10, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 14, 4},
+ { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 1, 0}, { 5, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 69}, { 1, 70}, { 5, 40}, { 1, 51}, { 1, 41},
+ { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 10, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 35 */
+ { 1, 64}, { 1, 66}, { 1, 67}, { 1, 44}, { 1, 34}, { 1, 71}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 11, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, { 1, 16}, { 1, 14},
+ { 1, 7}, { 3, 4}, { 1, 72}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 50}, { 1, 73}, { 6, 40}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 11, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 36 */
+ { 1, 74}, { 1, 67}, { 3, 44}, { 1, 75}, { 1, 76}, { 1, 6}, { 21, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 11, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43},
+ { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 1, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 11, 46}, { 1, 56}, { 5, 18}, { 1, 77}, { 1, 78}, /* Row 37 */
+ { 4, 44}, { 1, 79}, { 1, 80}, { 22, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 12, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 16, 4},
+ { 1, 16}, { 1, 14}, { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 12, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 38 */
+ { 5, 44}, { 1, 81}, { 22, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 12, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 16, 4},
+ { 1, 16}, { 1, 82}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 12, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 39 */
+ { 4, 44}, { 1, 34}, { 1, 62}, { 21, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 13, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 17, 4},
+ { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50},
+ { 1, 48}, { 6, 40}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 13, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 40 */
+ { 5, 44}, { 1, 35}, { 21, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 13, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 13, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 41 */
+ { 4, 44}, { 1, 34}, { 1, 62}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50},
+ { 1, 48}, { 6, 40}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 14, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 42 */
+ { 5, 44}, { 1, 35}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 14, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 13, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 14, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 43 */
+ { 4, 44}, { 1, 34}, { 1, 62}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 7, 46}, { 1, 61}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44},
+ { 1, 35}, { 13, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 15, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 44 */
+ { 5, 44}, { 1, 35}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46},
+ { 1, 84}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34},
+ { 1, 62}, { 11, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 61}, { 6, 46}, { 1, 56}, { 5, 18}, /* Row 45 */
+ { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 18, 4}, { 1, 19}, { 1, 24},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 11, 4}, { 1, 22}, { 1, 21}, { 3, 18},
+ { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 84}, { 7, 46}, { 1, 54}, { 4, 18}, /* Row 46 */
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 18, 4}, { 1, 19}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 7, 46}, { 1, 36}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 25}, { 1, 23}, { 4, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51},
+ { 1, 41}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 56}, { 6, 46}, { 1, 56}, /* Row 47 */
+ { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 17, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 56}, { 7, 46},
+ { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 9, 4}, { 1, 22},
+ { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48},
+ { 6, 40}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 54}, { 7, 46}, { 1, 54}, /* Row 48 */
+ { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 17, 4}, { 1, 19}, { 1, 24},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 54}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 25},
+ { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 85},
+ { 1, 51}, { 4, 40}, { 1, 51}, { 1, 41}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 18}, { 1, 56}, { 6, 46}, /* Row 49 */
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 16, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 7, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 86}, { 1, 66}, { 1, 64}, { 4, 40}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 18}, { 1, 54}, { 7, 46}, /* Row 50 */
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 16, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 5, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 1, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 1, 51}, { 1, 41},
+ { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 56}, { 6, 46}, /* Row 51 */
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 5, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 2, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 54}, { 7, 46}, /* Row 52 */
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 3, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 4, 44}, { 1, 67}, { 1, 87}, { 1, 41}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 3, 18}, { 1, 56}, { 6, 46}, /* Row 53 */
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 14, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 3, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 5, 44}, { 1, 88}, { 1, 89}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 3, 18}, { 1, 54}, { 7, 46}, /* Row 54 */
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 14, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 6, 44}, { 1, 90}, { 1, 62}, { 1, 5}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 4, 18}, { 1, 56}, { 6, 46}, /* Row 55 */
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 13, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 5, 44}, { 1, 33}, { 1, 91}, { 2, 4}, { 1, 5}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 4, 18}, { 1, 54}, { 7, 46}, /* Row 56 */
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 13, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 92}, { 1, 23},
+ { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44},
+ { 1, 93}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 5, 18}, { 1, 56}, { 6, 46}, /* Row 57 */
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 12, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 94}, { 1, 21},
+ { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 34}, { 1, 62}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 5, 18}, { 1, 54}, { 7, 46}, /* Row 58 */
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 12, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 3, 44}, { 1, 43}, { 1, 42}, { 4, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35},
+ { 2, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 19, 0},
+ { 17, 0}, { 1, 95}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 6, 18}, { 1, 56}, /* Row 59 */
+ { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62},
+ { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 7, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 53},
+ { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43},
+ { 5, 44}, { 1, 34}, { 1, 62}, { 3, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4},
+ { 1, 5}, { 18, 0},
+ { 16, 0}, { 1, 1}, { 1, 96}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, /* Row 60 */
+ { 6, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44},
+ { 1, 35}, { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36},
+ { 2, 18}, { 1, 21}, { 1, 47}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18},
+ { 1, 42}, { 1, 43}, { 1, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46},
+ { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 5, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 17, 0},
+ { 15, 0}, { 1, 1}, { 1, 2}, { 1, 97}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 61 */
+ { 1, 36}, { 7, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43},
+ { 4, 44}, { 1, 34}, { 1, 62}, { 10, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, { 3, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 1, 44}, { 1, 53}, { 1, 21},
+ { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 34}, { 1, 62}, { 6, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5},
+ { 16, 0},
+ { 14, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, /* Row 62 */
+ { 8, 46}, { 1, 36}, { 7, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21},
+ { 1, 53}, { 5, 44}, { 1, 35}, { 10, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100}, { 1, 42}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 101}, { 1, 42}, { 4, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 8, 4},
+ { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 15, 0},
+ { 13, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 102}, { 1, 98}, { 2, 18}, /* Row 63 */
+ { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 21}, { 1, 47}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62},
+ { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 98}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 14, 0},
+ { 12, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 105}, { 1, 106}, /* Row 64 */
+ { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21},
+ { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44},
+ { 1, 35}, { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36},
+ { 2, 18}, { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 9, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53},
+ { 6, 44}, { 1, 35}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5},
+ { 13, 0},
+ { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 108}, /* Row 65 */
+ { 1, 29}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100},
+ { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43},
+ { 4, 44}, { 1, 34}, { 1, 62}, { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36},
+ { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21},
+ { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 7, 18}, { 1, 54}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 12, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 12, 0},
+ { 10, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 66 */
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98},
+ { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18},
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43},
+ { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 7, 18}, { 1, 56}, { 7, 46},
+ { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 14, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 11, 0},
+ { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 67 */
+ { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56},
+ { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 2, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 5, 18},
+ { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34},
+ { 1, 62}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 10, 0},
+ { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 68 */
+ { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46},
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 7, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 2, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 5, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35},
+ { 17, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 9, 0},
+ { 7, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 69 */
+ { 3, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46},
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 6, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98},
+ { 1, 103}, { 3, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 34}, { 1, 62}, { 18, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5},
+ { 8, 0},
+ { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 70 */
+ { 4, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 2, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46},
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 6, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 3, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 3, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35},
+ { 20, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 7, 0},
+ { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 71 */
+ { 5, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 2, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46},
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 5, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98},
+ { 1, 103}, { 4, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 1, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 34}, { 1, 62}, { 21, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5},
+ { 6, 0},
+ { 4, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 72 */
+ { 6, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 3, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46},
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 5, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 4, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 1, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35},
+ { 23, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 5, 0},
+ { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 73 */
+ { 7, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 3, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46},
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 4, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98},
+ { 1, 103}, { 5, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 110},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62},
+ { 24, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 4, 0},
+ { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 74 */
+ { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 4, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46},
+ { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 4, 4}, { 1, 19},
+ { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 43}, { 1, 111}, { 3, 18}, { 1, 54}, { 15, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 26, 4}, { 1, 16}, { 1, 14}, { 1, 7},
+ { 2, 4}, { 1, 5}, { 3, 0},
+ { 1, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 75 */
+ { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 4, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46},
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 3, 4},
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98},
+ { 1, 103}, { 5, 44}, { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 56}, { 13, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 27, 4},
+ { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 2, 0},
+ { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 10, 4}, /* Row 76 */
+ { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98},
+ { 1, 103}, { 5, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54},
+ { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 3, 4}, { 1, 19}, { 1, 24},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 33}, { 1, 112}, { 1, 23}, { 3, 18}, { 1, 54}, { 13, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 29, 4}, { 1, 16}, { 1, 14}, { 1, 7},
+ { 2, 4}, { 1, 5}, { 1, 0},
+ { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 11, 4}, { 1, 19}, /* Row 77 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 43}, { 1, 111}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18},
+ { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 2, 4}, { 1, 19}, { 1, 24},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 33}, { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 56}, { 11, 46}, { 1, 56},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 30, 4}, { 1, 16},
+ { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5},
+ { 1, 3}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 12, 4}, { 1, 19}, { 1, 24}, /* Row 78 */
+ { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18},
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 54}, { 11, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 32, 4}, { 1, 16}, { 1, 14}, { 1, 7},
+ { 2, 4},
+ { 1, 4}, { 1, 113}, { 1, 114}, { 1, 115}, { 13, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 79 */
+ { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 112}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42},
+ { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 4}, { 1, 116}, { 4, 18}, { 1, 56}, { 9, 46}, { 1, 61}, { 4, 18},
+ { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 33, 4}, { 1, 16}, { 1, 14},
+ { 1, 62}, { 1, 4},
+ { 1, 4}, { 1, 7}, { 1, 117}, { 1, 8}, { 13, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 80 */
+ { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18},
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 4}, { 1, 116}, { 4, 18}, { 1, 54}, { 9, 46}, { 1, 37}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 35, 4}, { 1, 118}, { 1, 119}, { 1, 7},
+ { 2, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 81 */
+ { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18},
+ { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 19}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 8, 46}, { 1, 60}, { 1, 21},
+ { 3, 18}, { 1, 98}, { 1, 120}, { 5, 44}, { 1, 33}, { 1, 62}, { 34, 4}, { 1, 8},
+ { 1, 11}, { 1, 76}, { 1, 3},
+ { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 82 */
+ { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54},
+ { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 121}, { 1, 24}, { 2, 18},
+ { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 10, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 33}, { 1, 62}, { 33, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4}, { 1, 19}, { 1, 24}, /* Row 83 */
+ { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 33}, { 1, 7}, { 1, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46},
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 122}, { 1, 24},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 33}, { 1, 112}, { 1, 23}, { 4, 18}, { 1, 56}, { 10, 46}, { 1, 56}, { 4, 18},
+ { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 32, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5},
+ { 1, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, { 1, 19}, /* Row 84 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 123}, { 1, 24},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 12, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 30, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 1, 0},
+ { 2, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 8, 4}, { 1, 19}, /* Row 85 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 124}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 43}, { 1, 111}, { 4, 18}, { 1, 56}, { 12, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 5, 44}, { 1, 35}, { 29, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 2, 0},
+ { 3, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 7, 4}, { 1, 19}, /* Row 86 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 4, 44}, { 1, 103}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 27, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 3, 0},
+ { 4, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 6, 4}, { 1, 19}, /* Row 87 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 3, 44}, { 1, 103}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 4, 44},
+ { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 14, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 5, 44}, { 1, 35}, { 26, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 4, 0},
+ { 5, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 5, 4}, { 1, 19}, /* Row 88 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 103}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 4, 44},
+ { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 16, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 24, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 5, 0},
+ { 6, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 4, 4}, { 1, 19}, /* Row 89 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 2, 44}, { 1, 103}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 3, 44},
+ { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 23, 4}, { 1, 8},
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 6, 0},
+ { 7, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 3, 4}, { 1, 19}, /* Row 90 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 2, 44}, { 1, 103}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 3, 44},
+ { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 1, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62},
+ { 21, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0},
+ { 8, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 2, 4}, { 1, 19}, /* Row 91 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 1, 44}, { 1, 103}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 2, 44},
+ { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 2, 18}, { 1, 54},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 20, 4},
+ { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 8, 0},
+ { 9, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 4}, { 1, 19}, /* Row 92 */
+ { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103},
+ { 5, 44}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 1, 44}, { 1, 103}, { 1, 98},
+ { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 2, 44},
+ { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62},
+ { 18, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 9, 0},
+ { 10, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 121}, { 1, 24}, /* Row 93 */
+ { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44},
+ { 1, 33}, { 1, 7}, { 6, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46},
+ { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 1, 103}, { 1, 98}, { 2, 18}, { 1, 36},
+ { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, { 1, 42},
+ { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 54}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 17, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0},
+ { 11, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 125}, { 1, 24}, { 2, 18}, /* Row 94 */
+ { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33},
+ { 1, 7}, { 7, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54},
+ { 4, 18}, { 1, 21}, { 1, 53}, { 1, 103}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46},
+ { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, { 3, 18},
+ { 1, 54}, { 8, 46}, { 1, 54}, { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 15, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 11, 0},
+ { 12, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 126}, { 1, 98}, { 2, 18}, { 1, 36}, /* Row 95 */
+ { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7},
+ { 7, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18},
+ { 1, 42}, { 1, 100}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18},
+ { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56},
+ { 6, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 35}, { 14, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 12, 0},
+ { 13, 0}, { 1, 5}, { 3, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 96 */
+ { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 8, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21},
+ { 1, 99}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98},
+ { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 7, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34},
+ { 1, 62}, { 12, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 13, 0},
+ { 14, 0}, { 1, 5}, { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 97 */
+ { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 8, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 47},
+ { 1, 21}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100},
+ { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 47}, { 1, 21},
+ { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 35}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 14, 0},
+ { 15, 0}, { 1, 5}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 98 */
+ { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 9, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 8, 18}, { 1, 36},
+ { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 127}, { 1, 42}, { 3, 18}, { 1, 56},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62},
+ { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 15, 0},
+ { 16, 0}, { 1, 5}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, /* Row 99 */
+ { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 25},
+ { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 8, 18}, { 1, 36}, { 7, 46},
+ { 1, 36}, { 2, 18}, { 1, 21}, { 1, 47}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 1, 53}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 8, 4}, { 1, 8},
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0},
+ { 17, 0}, { 1, 128}, { 1, 129}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, /* Row 100 */
+ { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 22}, { 1, 21},
+ { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 7, 18}, { 1, 36}, { 7, 46}, { 1, 36},
+ { 7, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 1, 44},
+ { 1, 43}, { 1, 42}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 6, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 101 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 7, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 7, 18}, { 1, 56},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 2, 44}, { 1, 53}, { 1, 21},
+ { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 35}, { 5, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 102 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 6, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 54},
+ { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 43}, { 1, 42},
+ { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44},
+ { 1, 34}, { 1, 62}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 103 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 6, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 56},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 53}, { 1, 21},
+ { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 35}, { 2, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 104 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 5, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 54},
+ { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 43}, { 1, 42},
+ { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44},
+ { 1, 34}, { 1, 62}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 105 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 5, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 56},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 94}, { 1, 21},
+ { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44},
+ { 1, 93}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 106 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 4, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 54},
+ { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 92},
+ { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53},
+ { 5, 44}, { 1, 88}, { 1, 130}, { 1, 6}, { 1, 4}, { 1, 5}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 107 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 4, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 56},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 1, 4},
+ { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 5, 44}, { 1, 131}, { 1, 7}, { 1, 5}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 108 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 3, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 54},
+ { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62},
+ { 1, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 4, 44}, { 1, 67}, { 1, 132}, { 1, 133}, { 25, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 109 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 3, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 56},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 3, 4},
+ { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 2, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 25, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 110 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 54},
+ { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62},
+ { 3, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 53}, { 1, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 1, 51},
+ { 1, 41}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 111 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 56},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 5, 4},
+ { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 86}, { 1, 66}, { 1, 64}, { 4, 40}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 112 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 1, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 54},
+ { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62},
+ { 5, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18},
+ { 1, 21}, { 1, 85}, { 1, 51}, { 4, 40}, { 1, 51}, { 1, 41}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 113 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 1, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 56},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 7, 4},
+ { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50},
+ { 1, 48}, { 6, 40}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 114 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 54}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 54}, { 8, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 25},
+ { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57},
+ { 5, 40}, { 1, 51}, { 1, 41}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 115 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56},
+ { 6, 46}, { 1, 56}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 56}, { 7, 46}, { 1, 56},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 9, 4}, { 1, 22}, { 1, 21},
+ { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40},
+ { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 134}, /* Row 116 */
+ { 5, 44}, { 1, 33}, { 1, 7}, { 18, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54},
+ { 7, 46}, { 1, 84}, { 7, 46}, { 1, 84}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 25}, { 1, 23}, { 3, 18},
+ { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51},
+ { 1, 41}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 135}, /* Row 117 */
+ { 1, 67}, { 4, 44}, { 1, 33}, { 1, 7}, { 18, 4}, { 1, 25}, { 1, 23}, { 4, 18},
+ { 1, 56}, { 6, 46}, { 1, 61}, { 7, 46}, { 1, 61}, { 7, 46}, { 1, 56}, { 4, 18},
+ { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 11, 4}, { 1, 22}, { 1, 21}, { 2, 18},
+ { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 118 */
+ { 1, 66}, { 1, 67}, { 3, 44}, { 1, 79}, { 1, 136}, { 19, 4}, { 1, 22}, { 1, 21},
+ { 3, 18}, { 1, 54}, { 22, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44},
+ { 1, 34}, { 1, 62}, { 11, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46},
+ { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 119 */
+ { 1, 64}, { 1, 66}, { 1, 67}, { 2, 44}, { 1, 79}, { 1, 45}, { 1, 16}, { 18, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 20, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 6, 44}, { 1, 35}, { 13, 4}, { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54},
+ { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 120 */
+ { 1, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 44}, { 1, 33}, { 1, 137}, { 1, 14},
+ { 1, 16}, { 18, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 20, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 13, 4}, { 1, 138},
+ { 1, 139}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57},
+ { 5, 40}, { 1, 51}, { 1, 41}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 121 */
+ { 2, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 33}, { 2, 7}, { 1, 14}, { 1, 16},
+ { 17, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 18, 46}, { 1, 56}, { 4, 18},
+ { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 13, 4}, { 1, 8}, { 1, 140}, { 1, 141},
+ { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48},
+ { 6, 40}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 122 */
+ { 3, 40}, { 1, 64}, { 1, 66}, { 1, 131}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 14},
+ { 1, 16}, { 17, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 18, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 12, 4}, { 1, 8},
+ { 1, 11}, { 1, 15}, { 1, 142}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 123 */
+ { 4, 40}, { 1, 64}, { 1, 143}, { 1, 144}, { 2, 4}, { 1, 7}, { 1, 14}, { 1, 16},
+ { 16, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 16, 46}, { 1, 56}, { 4, 18},
+ { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 12, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 145}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18},
+ { 1, 50}, { 1, 48}, { 6, 40}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 124 */
+ { 5, 40}, { 1, 64}, { 1, 146}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 16, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 16, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 1, 147}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 125 */
+ { 6, 40}, { 1, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 14, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 6, 44}, { 1, 35}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 126 */
+ { 6, 40}, { 2, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 10, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 127 */
+ { 6, 40}, { 3, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 14, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 12, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 6, 44}, { 1, 35}, { 10, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 128 */
+ { 6, 40}, { 4, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 14, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 12, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 129 */
+ { 6, 40}, { 5, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 10, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 6, 44}, { 1, 35}, { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 130 */
+ { 6, 40}, { 6, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 10, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 8, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54},
+ { 3, 18}, { 1, 21}, { 1, 55}, { 5, 40}, { 1, 51}, { 1, 148}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 131 */
+ { 6, 40}, { 7, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 8, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 6, 44}, { 1, 35}, { 8, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 11, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46},
+ { 1, 56}, { 4, 18}, { 1, 57}, { 6, 40}, { 1, 149}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 132 */
+ { 6, 40}, { 8, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21},
+ { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 8}, { 1, 11}, { 1, 15},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56},
+ { 4, 18}, { 1, 57}, { 7, 40}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 133 */
+ { 6, 40}, { 9, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 42},
+ { 1, 43}, { 6, 44}, { 1, 35}, { 7, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 6, 46},
+ { 1, 56}, { 3, 18}, { 1, 69}, { 1, 150}, { 6, 40}, { 1, 51}, { 1, 148}, { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 134 */
+ { 6, 40}, { 10, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4},
+ { 1, 22}, { 1, 21}, { 3, 18}, { 1, 36}, { 1, 151}, { 4, 46}, { 1, 151}, { 1, 36},
+ { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 6, 4}, { 1, 8},
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 18}, { 1, 56},
+ { 5, 46}, { 1, 54}, { 3, 18}, { 1, 50}, { 1, 73}, { 7, 40}, { 1, 41}, { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 135 */
+ { 6, 40}, { 11, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4},
+ { 1, 25}, { 1, 23}, { 4, 18}, { 1, 36}, { 1, 56}, { 2, 46}, { 1, 56}, { 1, 36},
+ { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 6, 4}, { 1, 8}, { 1, 11},
+ { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 1, 21}, { 2, 18},
+ { 1, 36}, { 1, 56}, { 2, 46}, { 1, 56}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57},
+ { 8, 40}, { 1, 41}, { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 136 */
+ { 6, 40}, { 12, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4},
+ { 1, 22}, { 1, 21}, { 5, 18}, { 2, 36}, { 5, 18}, { 1, 21}, { 1, 53}, { 6, 44},
+ { 1, 34}, { 1, 62}, { 5, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 19, 0}, { 5, 18}, { 2, 36}, { 5, 18}, { 1, 50}, { 1, 48}, { 8, 40},
+ { 1, 63}, { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 137 */
+ { 6, 40}, { 13, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4},
+ { 1, 25}, { 1, 23}, { 12, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 5, 4},
+ { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 20, 0}, { 1, 17},
+ { 1, 21}, { 9, 18}, { 1, 47}, { 1, 70}, { 9, 40}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 138 */
+ { 6, 40}, { 14, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4},
+ { 1, 22}, { 1, 21}, { 10, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62},
+ { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0},
+ { 9, 18}, { 1, 47}, { 1, 70}, { 8, 40}, { 1, 51}, { 1, 41}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 69}, { 2, 47}, { 1, 152}, { 1, 73}, /* Row 139 */
+ { 6, 40}, { 15, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 8, 4},
+ { 1, 19}, { 1, 27}, { 1, 21}, { 8, 18}, { 1, 21}, { 1, 153}, { 1, 103}, { 6, 44},
+ { 1, 35}, { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 23, 0}, { 1, 147}, { 1, 154}, { 1, 18}, { 1, 21}, { 2, 18}, { 1, 21}, { 1, 47},
+ { 1, 155}, { 1, 150}, { 10, 40}, { 15, 0},
+ { 25, 0}, { 5, 48}, { 4, 73}, { 7, 40}, { 16, 0}, { 1, 5}, { 3, 4}, { 1, 7}, /* Row 140 */
+ { 1, 14}, { 1, 16}, { 8, 4}, { 1, 19}, { 1, 22}, { 1, 23}, { 1, 21}, { 4, 18},
+ { 1, 21}, { 1, 42}, { 1, 53}, { 1, 103}, { 6, 44}, { 1, 34}, { 1, 62}, { 3, 4},
+ { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 156},
+ { 1, 17}, { 1, 157}, { 1, 55}, { 1, 48}, { 1, 64}, { 9, 40}, { 1, 51}, { 1, 41},
+ { 15, 0},
+ { 25, 0}, { 16, 40}, { 17, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 141 */
+ { 9, 4}, { 1, 25}, { 1, 22}, { 1, 158}, { 2, 98}, { 1, 77}, { 1, 53}, { 1, 43},
+ { 7, 44}, { 1, 33}, { 1, 136}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 30, 0}, { 1, 63}, { 11, 40}, { 1, 51}, { 1, 40}, { 16, 0},
+ { 25, 0}, { 16, 40}, { 18, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 142 */
+ { 10, 4}, { 1, 19}, { 1, 159}, { 1, 160}, { 1, 103}, { 7, 44}, { 1, 79}, { 1, 161},
+ { 1, 136}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 32, 0}, { 1, 41}, { 1, 51}, { 8, 40}, { 1, 51}, { 1, 40}, { 17, 0},
+ { 25, 0}, { 16, 40}, { 19, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 143 */
+ { 11, 4}, { 1, 62}, { 1, 35}, { 1, 34}, { 5, 33}, { 1, 161}, { 1, 136}, { 1, 7},
+ { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 34, 0},
+ { 8, 40}, { 1, 51}, { 1, 40}, { 18, 0},
+ { 25, 0}, { 16, 40}, { 20, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 144 */
+ { 12, 4}, { 7, 7}, { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 35, 0}, { 1, 49}, { 7, 40}, { 1, 41}, { 19, 0},
+ { 25, 0}, { 16, 40}, { 21, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 145 */
+ { 21, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 64, 0},
+ { 25, 0}, { 16, 40}, { 22, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 146 */
+ { 19, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 65, 0},
+ { 64, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 17, 4}, { 1, 8}, /* Row 147 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 66, 0},
+ { 65, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4}, { 1, 8}, /* Row 148 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 67, 0},
+ { 66, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4}, { 1, 8}, /* Row 149 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 68, 0},
+ { 67, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, { 1, 8}, /* Row 150 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 69, 0},
+ { 68, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, { 1, 8}, /* Row 151 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 70, 0},
+ { 69, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 7, 4}, { 1, 8}, /* Row 152 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 71, 0},
+ { 70, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 5, 4}, { 1, 8}, /* Row 153 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 72, 0},
+ { 71, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 3, 4}, { 1, 8}, /* Row 154 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 73, 0},
+ { 72, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 4}, { 1, 8}, /* Row 155 */
+ { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 74, 0},
+ { 73, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 118}, { 1, 11}, { 1, 15}, /* Row 156 */
+ { 1, 6}, { 1, 4}, { 1, 5}, { 75, 0},
+ { 74, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 162}, { 1, 15}, { 1, 6}, { 1, 4}, /* Row 157 */
+ { 1, 5}, { 76, 0},
+ { 75, 0}, { 1, 5}, { 2, 4}, { 1, 3}, { 1, 163}, { 1, 6}, { 1, 4}, { 1, 5}, /* Row 158 */
+ { 77, 0},
+ { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */
+ };
+
+#elif CONFIG_NXWIDGETS_BPP == 16
+
+static const struct SRlePaletteBitmapEntry g_nuttxRleEntries[] =
+{
+ { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */
+ { 75, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 2, 8}, { 3, 4}, { 1, 5}, /* Row 1 */
+ { 75, 0},
+ { 74, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 10}, { 1, 11}, /* Row 2 */
+ { 1, 8}, { 3, 4}, { 1, 5}, { 74, 0},
+ { 73, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 3 */
+ { 1, 14}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 73, 0},
+ { 72, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 4 */
+ { 1, 6}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 72, 0},
+ { 71, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 5 */
+ { 1, 6}, { 2, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 71, 0},
+ { 70, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 6 */
+ { 1, 6}, { 4, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 70, 0},
+ { 69, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 7 */
+ { 1, 6}, { 6, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 69, 0},
+ { 68, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 8 */
+ { 1, 6}, { 8, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 68, 0},
+ { 67, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 9 */
+ { 1, 6}, { 10, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 67, 0},
+ { 66, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 10 */
+ { 1, 6}, { 12, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 66, 0},
+ { 65, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 11 */
+ { 1, 6}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 65, 0},
+ { 64, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 12 */
+ { 1, 6}, { 16, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 64, 0},
+ { 63, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 13 */
+ { 1, 6}, { 18, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 63, 0},
+ { 62, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 14 */
+ { 1, 6}, { 20, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 62, 0},
+ { 61, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 15 */
+ { 1, 6}, { 22, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 61, 0},
+ { 60, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 16 */
+ { 1, 6}, { 24, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 60, 0},
+ { 59, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 17 */
+ { 1, 6}, { 26, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 59, 0},
+ { 58, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 18 */
+ { 1, 6}, { 28, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 26, 0}, { 1, 17}, { 5, 18}, { 1, 17}, { 25, 0},
+ { 57, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 19 */
+ { 1, 6}, { 10, 4}, { 5, 19}, { 15, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8},
+ { 3, 4}, { 1, 5}, { 23, 0}, { 1, 20}, { 9, 18}, { 1, 20}, { 23, 0},
+ { 56, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 20 */
+ { 1, 6}, { 9, 4}, { 1, 19}, { 1, 21}, { 1, 22}, { 3, 23}, { 1, 22}, { 1, 21},
+ { 1, 24}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 22, 0}, { 11, 18}, { 1, 20}, { 22, 0},
+ { 23, 0}, { 1, 17}, { 5, 18}, { 1, 25}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 21 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 26},
+ { 7, 18}, { 1, 22}, { 1, 27}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8},
+ { 3, 4}, { 1, 5}, { 20, 0}, { 1, 17}, { 12, 18}, { 1, 20}, { 21, 0},
+ { 21, 0}, { 1, 20}, { 9, 18}, { 1, 20}, { 22, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 22 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 26},
+ { 9, 18}, { 1, 28}, { 1, 27}, { 4, 8}, { 1, 7}, { 9, 4}, { 1, 7}, { 1, 16},
+ { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 19, 0}, { 14, 18}, { 21, 0},
+ { 21, 0}, { 11, 18}, { 1, 20}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, /* Row 23 */
+ { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 10, 4}, { 1, 21}, { 11, 18}, { 1, 29},
+ { 1, 30}, { 2, 31}, { 1, 32}, { 1, 33}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16},
+ { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 5, 18}, { 1, 34},
+ { 2, 35}, { 1, 34}, { 5, 18}, { 1, 17}, { 20, 0},
+ { 20, 0}, { 1, 36}, { 12, 18}, { 1, 37}, { 4, 38}, { 1, 39}, { 13, 0}, { 1, 1}, /* Row 24 */
+ { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 10, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 3, 34}, { 5, 18}, { 1, 40}, { 1, 41}, { 3, 31},
+ { 1, 42}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4},
+ { 1, 5}, { 16, 0}, { 5, 18}, { 1, 43}, { 4, 44}, { 1, 43}, { 4, 18}, { 1, 35},
+ { 1, 45}, { 1, 46}, { 18, 0},
+ { 19, 0}, { 1, 17}, { 13, 18}, { 1, 47}, { 1, 45}, { 3, 38}, { 1, 48}, { 1, 38}, /* Row 25 */
+ { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 11, 4}, { 1, 49}, { 4, 18}, { 1, 35}, { 3, 44}, { 1, 43}, { 5, 18},
+ { 1, 50}, { 4, 31}, { 1, 42}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15},
+ { 1, 8}, { 3, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 4, 18}, { 1, 34}, { 6, 44},
+ { 1, 34}, { 4, 18}, { 1, 51}, { 1, 38}, { 1, 46}, { 17, 0},
+ { 19, 0}, { 5, 18}, { 1, 34}, { 2, 52}, { 1, 35}, { 6, 18}, { 1, 53}, { 4, 38}, /* Row 26 */
+ { 1, 48}, { 1, 39}, { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 11, 4}, { 1, 3}, { 1, 54}, { 4, 18}, { 1, 55},
+ { 4, 44}, { 1, 43}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 42}, { 1, 8},
+ { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 13, 0},
+ { 5, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 2, 38}, { 1, 46},
+ { 16, 0},
+ { 18, 0}, { 1, 17}, { 4, 18}, { 1, 43}, { 4, 44}, { 1, 35}, { 5, 18}, { 1, 47}, /* Row 27 */
+ { 1, 45}, { 5, 38}, { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 12, 4}, { 1, 19}, { 1, 23}, { 3, 18}, { 1, 35},
+ { 6, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 11, 0}, { 1, 17},
+ { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 3, 38}, { 16, 0},
+ { 18, 0}, { 4, 18}, { 1, 34}, { 5, 44}, { 1, 55}, { 1, 34}, { 5, 18}, { 1, 53}, /* Row 28 */
+ { 4, 38}, { 1, 48}, { 1, 39}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7},
+ { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 13, 4}, { 1, 19}, { 1, 23}, { 3, 18},
+ { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32},
+ { 1, 56}, { 10, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5},
+ { 10, 0}, { 5, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 51}, { 2, 38},
+ { 1, 48}, { 1, 39}, { 15, 0},
+ { 18, 0}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 29 */
+ { 5, 38}, { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 14, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 7},
+ { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 4, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 4, 38}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 4, 38}, /* Row 30 */
+ { 1, 48}, { 1, 39}, { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 15, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 8, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56},
+ { 11, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 7, 0},
+ { 5, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 1},
+ { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 31 */
+ { 5, 38}, { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 16, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 9, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 7},
+ { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 4, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 5, 38}, { 1, 39},
+ { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 9, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 4, 38}, /* Row 32 */
+ { 1, 48}, { 1, 39}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 17, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 9, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 12, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 4, 0}, { 5, 18},
+ { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 6, 38}, { 1, 1}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 9, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 33 */
+ { 3, 38}, { 1, 48}, { 1, 57}, { 1, 13}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 18, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 10, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 7},
+ { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 4, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 10, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 2, 38}, /* Row 34 */
+ { 1, 48}, { 1, 58}, { 1, 59}, { 1, 60}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 10, 44}, { 1, 52},
+ { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4}, { 1, 7},
+ { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 1, 0}, { 5, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 61}, { 5, 38}, { 1, 48}, { 1, 39}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 10, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 35 */
+ { 1, 48}, { 1, 58}, { 1, 59}, { 1, 31}, { 1, 32}, { 1, 62}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 11, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 7}, { 1, 16},
+ { 1, 15}, { 1, 8}, { 3, 4}, { 1, 63}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52},
+ { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 11, 44}, { 1, 34}, { 5, 18}, { 1, 64}, { 1, 58}, /* Row 36 */
+ { 1, 59}, { 3, 31}, { 1, 65}, { 1, 66}, { 1, 6}, { 21, 4}, { 1, 19}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 11, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31},
+ { 1, 32}, { 1, 56}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 1, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53},
+ { 5, 38}, { 1, 48}, { 1, 39}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 11, 44}, { 1, 52}, { 5, 18}, { 1, 67}, { 1, 68}, /* Row 37 */
+ { 5, 31}, { 1, 69}, { 22, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 12, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 7},
+ { 1, 16}, { 1, 15}, { 1, 8}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52},
+ { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 12, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 38 */
+ { 1, 70}, { 1, 7}, { 21, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 12, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4},
+ { 1, 7}, { 1, 16}, { 1, 71}, { 1, 67}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 12, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 39 */
+ { 4, 31}, { 1, 32}, { 1, 56}, { 21, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 13, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 16, 4},
+ { 1, 72}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45},
+ { 6, 38}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 40 */
+ { 1, 33}, { 1, 7}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 13, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53},
+ { 5, 38}, { 1, 48}, { 1, 39}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 41 */
+ { 4, 31}, { 1, 32}, { 1, 56}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4},
+ { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45},
+ { 6, 38}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 14, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 42 */
+ { 1, 33}, { 1, 7}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 14, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53},
+ { 5, 38}, { 1, 48}, { 1, 39}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 14, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 43 */
+ { 4, 31}, { 1, 32}, { 1, 56}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 73}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33},
+ { 1, 7}, { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18},
+ { 1, 47}, { 1, 45}, { 6, 38}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 15, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 44 */
+ { 1, 33}, { 1, 7}, { 18, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32},
+ { 1, 56}, { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 73}, { 6, 44}, { 1, 52}, { 5, 18}, /* Row 45 */
+ { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 18, 4}, { 1, 19}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18},
+ { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, /* Row 46 */
+ { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 19}, { 1, 23}, { 2, 18},
+ { 1, 34}, { 7, 44}, { 2, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41},
+ { 4, 31}, { 1, 32}, { 1, 56}, { 9, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 52}, { 6, 44}, { 1, 52}, /* Row 47 */
+ { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 17, 4}, { 1, 19},
+ { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 21},
+ { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38},
+ { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 2, 34}, { 7, 44}, { 1, 34}, { 5, 18}, /* Row 48 */
+ { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 19}, { 1, 23}, { 2, 18},
+ { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 24}, { 1, 22},
+ { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 74}, { 1, 48}, { 4, 38},
+ { 1, 48}, { 1, 39}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 6, 44}, /* Row 49 */
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 16, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4},
+ { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 75},
+ { 1, 58}, { 1, 48}, { 4, 38}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 7, 44}, /* Row 50 */
+ { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 19},
+ { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 5, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 1, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 1, 48}, { 1, 39}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 52}, { 6, 44}, /* Row 51 */
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 4, 4},
+ { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41},
+ { 2, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 7, 44}, /* Row 52 */
+ { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 19},
+ { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 3, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 4, 31}, { 1, 59}, { 1, 76}, { 1, 39}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 6, 44}, /* Row 53 */
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 14, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 2, 4},
+ { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41},
+ { 5, 31}, { 1, 77}, { 1, 78}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 7, 44}, /* Row 54 */
+ { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 19},
+ { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 1, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 6, 31}, { 1, 32}, { 1, 56}, { 1, 5}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 52}, { 6, 44}, /* Row 55 */
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 4}, { 1, 21},
+ { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31},
+ { 1, 79}, { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 7, 44}, /* Row 56 */
+ { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 19},
+ { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 80}, { 1, 22},
+ { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 81},
+ { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 52}, { 6, 44}, /* Row 57 */
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 12, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 82}, { 4, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56},
+ { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 7, 44}, /* Row 58 */
+ { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 19},
+ { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 3, 31}, { 1, 41}, { 1, 40}, { 4, 18},
+ { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 2, 7},
+ { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 19, 0},
+ { 17, 0}, { 1, 83}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 6, 18}, { 1, 52}, /* Row 59 */
+ { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56},
+ { 11, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18},
+ { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 3, 31}, { 1, 50}, { 4, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32},
+ { 1, 56}, { 2, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5},
+ { 18, 0},
+ { 16, 0}, { 1, 1}, { 1, 84}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, /* Row 60 */
+ { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33},
+ { 1, 7}, { 10, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 3, 18}, { 1, 85}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 7}, { 1, 16},
+ { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 17, 0},
+ { 15, 0}, { 1, 1}, { 1, 2}, { 1, 86}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 61 */
+ { 1, 34}, { 7, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41},
+ { 4, 31}, { 1, 32}, { 1, 56}, { 10, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, { 1, 52}, { 7, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 1, 88}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 5, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 16, 0},
+ { 14, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 89}, { 1, 23}, { 2, 18}, { 1, 34}, /* Row 62 */
+ { 8, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50},
+ { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, { 1, 40}, { 3, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 91}, { 1, 40}, { 4, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 15, 0},
+ { 13, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 71}, { 1, 29}, { 2, 18}, /* Row 63 */
+ { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 85}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 9, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 29},
+ { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31},
+ { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4},
+ { 1, 5}, { 14, 0},
+ { 12, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 94}, { 1, 95}, /* Row 64 */
+ { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18},
+ { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7},
+ { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52},
+ { 9, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33},
+ { 1, 7}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5},
+ { 13, 0},
+ { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 97}, /* Row 65 */
+ { 1, 28}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90},
+ { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41},
+ { 4, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18},
+ { 1, 52}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 16},
+ { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 12, 0},
+ { 10, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 66 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50},
+ { 5, 31}, { 1, 33}, { 1, 7}, { 7, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40},
+ { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 7, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 7}, { 1, 16},
+ { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 11, 0},
+ { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 67 */
+ { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52},
+ { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 19},
+ { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92},
+ { 2, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56},
+ { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 10, 0},
+ { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 68 */
+ { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 19}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31},
+ { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 5, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 15, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 9, 0},
+ { 7, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 69 */
+ { 3, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 6, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 3, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32},
+ { 1, 56}, { 17, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5},
+ { 8, 0},
+ { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 70 */
+ { 4, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 2, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 19}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31},
+ { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 3, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 18, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 7, 0},
+ { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 71 */
+ { 5, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 2, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 5, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 1, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32},
+ { 1, 56}, { 20, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5},
+ { 6, 0},
+ { 4, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 72 */
+ { 6, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 19}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31},
+ { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 1, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 21, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 5, 0},
+ { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 73 */
+ { 7, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 3, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 4, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 99}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 23, 4},
+ { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 4, 0},
+ { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 74 */
+ { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 19}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31},
+ { 1, 41}, { 1, 67}, { 3, 18}, { 1, 34}, { 15, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 6, 31}, { 1, 33}, { 1, 7}, { 24, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8},
+ { 2, 4}, { 1, 5}, { 3, 0},
+ { 1, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 75 */
+ { 9, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18},
+ { 1, 29}, { 1, 92}, { 4, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 3, 4},
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 72}, { 4, 18}, { 1, 52}, { 13, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 26, 4}, { 1, 7}, { 1, 16},
+ { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 2, 0},
+ { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 10, 4}, /* Row 76 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18},
+ { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18},
+ { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 80},
+ { 1, 22}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31},
+ { 1, 33}, { 1, 7}, { 27, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4},
+ { 1, 5}, { 1, 0},
+ { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 11, 4}, { 1, 19}, /* Row 77 */
+ { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92},
+ { 5, 31}, { 1, 41}, { 1, 67}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18},
+ { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 19}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31},
+ { 1, 8}, { 1, 21}, { 4, 18}, { 1, 52}, { 11, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 29, 4}, { 1, 7}, { 1, 16}, { 1, 15},
+ { 1, 8}, { 2, 4}, { 1, 5},
+ { 1, 3}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 12, 4}, { 1, 19}, { 1, 23}, /* Row 78 */
+ { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31},
+ { 1, 72}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31},
+ { 1, 33}, { 1, 7}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 24}, { 1, 22},
+ { 3, 18}, { 1, 34}, { 11, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33},
+ { 1, 7}, { 30, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4},
+ { 1, 4}, { 1, 33}, { 1, 100}, { 1, 98}, { 13, 4}, { 1, 19}, { 1, 23}, { 2, 18}, /* Row 79 */
+ { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 80},
+ { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41},
+ { 4, 31}, { 1, 32}, { 1, 56}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 4},
+ { 1, 101}, { 4, 18}, { 1, 52}, { 9, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41},
+ { 5, 31}, { 1, 32}, { 1, 56}, { 32, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 56},
+ { 1, 7},
+ { 1, 4}, { 1, 8}, { 1, 102}, { 1, 9}, { 1, 7}, { 12, 4}, { 1, 19}, { 1, 23}, /* Row 80 */
+ { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31},
+ { 1, 8}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50},
+ { 5, 31}, { 1, 33}, { 1, 7}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 4}, { 1, 101},
+ { 4, 18}, { 1, 34}, { 9, 44}, { 1, 35}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33},
+ { 1, 7}, { 33, 4}, { 1, 7}, { 1, 103}, { 1, 10}, { 1, 8},
+ { 2, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 11, 4}, { 1, 19}, { 1, 23}, /* Row 81 */
+ { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31},
+ { 1, 8}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18},
+ { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 1, 19}, { 1, 23}, { 2, 18},
+ { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 8, 44}, { 1, 104}, { 4, 18}, { 1, 29},
+ { 1, 68}, { 6, 31}, { 1, 56}, { 33, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 66},
+ { 1, 3},
+ { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 10, 4}, { 1, 19}, { 1, 23}, /* Row 82 */
+ { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31},
+ { 1, 8}, { 1, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18},
+ { 1, 50}, { 5, 31}, { 1, 33}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 21}, { 4, 18},
+ { 1, 34}, { 10, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 56}, { 32, 4},
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 9, 4}, { 1, 19}, /* Row 83 */
+ { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92},
+ { 6, 31}, { 1, 8}, { 1, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 105}, { 1, 23},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31},
+ { 1, 80}, { 1, 22}, { 4, 18}, { 1, 52}, { 10, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 30, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 1, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 8, 4}, /* Row 84 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 2, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 106}, { 1, 23}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 72}, { 4, 18},
+ { 1, 34}, { 12, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56},
+ { 29, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 1, 0},
+ { 2, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 7, 4}, /* Row 85 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 2, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52},
+ { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 107}, { 1, 29},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31},
+ { 1, 41}, { 1, 67}, { 4, 18}, { 1, 52}, { 12, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 27, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 2, 0},
+ { 3, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 6, 4}, /* Row 86 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 3, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 5, 18}, { 1, 50}, { 4, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18},
+ { 1, 34}, { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56},
+ { 26, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 3, 0},
+ { 4, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 5, 4}, /* Row 87 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 3, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52},
+ { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 3, 31}, { 1, 92}, { 1, 29},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31},
+ { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 14, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 24, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0},
+ { 5, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 4, 4}, /* Row 88 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 4, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 5, 18}, { 1, 50}, { 3, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18},
+ { 1, 34}, { 16, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56},
+ { 23, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 5, 0},
+ { 6, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 3, 4}, /* Row 89 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 4, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52},
+ { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 2, 31}, { 1, 92}, { 1, 29},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31},
+ { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 21, 4},
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 6, 0},
+ { 7, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 2, 4}, /* Row 90 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 5, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 5, 18}, { 1, 50}, { 2, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18},
+ { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18},
+ { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 20, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0},
+ { 8, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 4}, /* Row 91 */
+ { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 6, 31}, { 1, 8}, { 5, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52},
+ { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 1, 31}, { 1, 92}, { 1, 29},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31},
+ { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 2, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7},
+ { 18, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 8, 0},
+ { 9, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 19}, /* Row 92 */
+ { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92},
+ { 6, 31}, { 1, 8}, { 6, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 5, 18}, { 1, 50}, { 1, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31}, { 1, 50}, { 4, 18}, { 1, 34},
+ { 8, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 5, 31}, { 1, 32}, { 1, 56}, { 17, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 9, 0},
+ { 10, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 19}, { 1, 23}, /* Row 93 */
+ { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31},
+ { 1, 8}, { 6, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52},
+ { 5, 18}, { 1, 40}, { 1, 41}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44},
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18},
+ { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0},
+ { 11, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 108}, { 1, 23}, { 2, 18}, /* Row 94 */
+ { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8},
+ { 7, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50},
+ { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18},
+ { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56},
+ { 14, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 11, 0},
+ { 12, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 109}, { 1, 29}, { 2, 18}, { 1, 34}, /* Row 95 */
+ { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 7, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40},
+ { 1, 90}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29},
+ { 1, 92}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 6, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33},
+ { 1, 7}, { 12, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 12, 0},
+ { 13, 0}, { 1, 5}, { 3, 4}, { 1, 89}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 96 */
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 8, 4}, { 1, 21},
+ { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 87}, { 1, 29}, { 2, 18},
+ { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 50}, { 4, 18},
+ { 1, 34}, { 8, 44}, { 1, 34}, { 7, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18},
+ { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0},
+ { 14, 0}, { 1, 5}, { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 97 */
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 8, 4}, { 1, 24},
+ { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 85}, { 3, 18},
+ { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, { 1, 40}, { 4, 18},
+ { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 85}, { 3, 18}, { 1, 34}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4},
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 14, 0},
+ { 15, 0}, { 1, 5}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 98 */
+ { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 9, 4}, { 1, 21},
+ { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 8, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18},
+ { 1, 87}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 5, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 15, 0},
+ { 16, 0}, { 1, 5}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, /* Row 99 */
+ { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 9, 4}, { 1, 24}, { 1, 22},
+ { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 8, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 3, 18}, { 1, 85}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 1, 50}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0},
+ { 17, 0}, { 1, 110}, { 1, 111}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, /* Row 100 */
+ { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34},
+ { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 1, 31}, { 1, 41}, { 1, 40}, { 3, 18},
+ { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56},
+ { 5, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 101 */
+ { 6, 31}, { 1, 8}, { 10, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 52}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 2, 31}, { 1, 50}, { 3, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7},
+ { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5},
+ { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 102 */
+ { 6, 31}, { 1, 8}, { 11, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 34}, { 8, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 3, 31}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 7},
+ { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 103 */
+ { 6, 31}, { 1, 8}, { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 52}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 50}, { 3, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 2, 7},
+ { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 104 */
+ { 6, 31}, { 1, 8}, { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 5, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 8, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 5, 31}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44},
+ { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 105 */
+ { 6, 31}, { 1, 8}, { 12, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 5, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 52}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 82}, { 3, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 81}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 106 */
+ { 6, 31}, { 1, 8}, { 13, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 80}, { 1, 22}, { 3, 18}, { 1, 52},
+ { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 77}, { 1, 112}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 107 */
+ { 6, 31}, { 1, 8}, { 13, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 52}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 4}, { 1, 21},
+ { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31},
+ { 1, 113}, { 1, 8}, { 1, 5}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 108 */
+ { 6, 31}, { 1, 8}, { 14, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 3, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 1, 4}, { 1, 24}, { 1, 22},
+ { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 4, 31}, { 1, 59},
+ { 1, 58}, { 1, 114}, { 25, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 109 */
+ { 6, 31}, { 1, 8}, { 14, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 2, 4},
+ { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41},
+ { 2, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 25, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 110 */
+ { 6, 31}, { 1, 8}, { 15, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 3, 4}, { 1, 24}, { 1, 22},
+ { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 1, 31}, { 1, 59},
+ { 1, 58}, { 1, 48}, { 1, 38}, { 1, 48}, { 1, 39}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 111 */
+ { 6, 31}, { 1, 8}, { 15, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 52}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 4, 4},
+ { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 75},
+ { 1, 58}, { 1, 48}, { 4, 38}, { 24, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 112 */
+ { 6, 31}, { 1, 8}, { 16, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 1, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 8, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 5, 4}, { 1, 24}, { 1, 22},
+ { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 74}, { 1, 48}, { 4, 38},
+ { 1, 48}, { 1, 39}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 113 */
+ { 6, 31}, { 1, 8}, { 16, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 1, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44},
+ { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4},
+ { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45},
+ { 6, 38}, { 23, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 114 */
+ { 6, 31}, { 1, 8}, { 17, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 2, 34},
+ { 7, 44}, { 2, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32},
+ { 1, 56}, { 7, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 115 */
+ { 6, 31}, { 1, 8}, { 17, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44},
+ { 1, 52}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 21}, { 3, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 22, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 115}, /* Row 116 */
+ { 6, 31}, { 1, 8}, { 18, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34},
+ { 7, 44}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32},
+ { 1, 56}, { 9, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 116}, /* Row 117 */
+ { 1, 59}, { 5, 31}, { 1, 8}, { 18, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52},
+ { 6, 44}, { 1, 73}, { 7, 44}, { 1, 73}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 21}, { 3, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 21, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 118 */
+ { 1, 58}, { 1, 59}, { 4, 31}, { 1, 16}, { 1, 7}, { 18, 4}, { 1, 21}, { 4, 18},
+ { 1, 34}, { 22, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56},
+ { 11, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18},
+ { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 119 */
+ { 1, 48}, { 1, 58}, { 1, 59}, { 3, 31}, { 1, 42}, { 1, 16}, { 1, 7}, { 17, 4},
+ { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 20, 44}, { 1, 52}, { 4, 18}, { 1, 40},
+ { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 21}, { 3, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 20, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 120 */
+ { 1, 38}, { 1, 48}, { 1, 58}, { 1, 59}, { 2, 31}, { 1, 56}, { 1, 15}, { 1, 16},
+ { 1, 7}, { 17, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 20, 44}, { 1, 34}, { 4, 18},
+ { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 12, 4}, { 1, 7}, { 1, 117}, { 1, 73},
+ { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48},
+ { 1, 39}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 121 */
+ { 2, 38}, { 1, 48}, { 1, 58}, { 1, 59}, { 1, 31}, { 2, 8}, { 1, 15}, { 1, 16},
+ { 1, 7}, { 16, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 18, 44}, { 1, 52},
+ { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 7},
+ { 1, 9}, { 1, 118}, { 1, 119}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18},
+ { 1, 47}, { 1, 45}, { 6, 38}, { 19, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 122 */
+ { 3, 38}, { 1, 48}, { 1, 58}, { 1, 113}, { 1, 8}, { 1, 4}, { 1, 8}, { 1, 15},
+ { 1, 16}, { 1, 7}, { 16, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 18, 44}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 120}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 123 */
+ { 4, 38}, { 1, 48}, { 1, 121}, { 1, 122}, { 2, 4}, { 1, 8}, { 1, 15}, { 1, 16},
+ { 1, 7}, { 15, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 16, 44}, { 1, 52},
+ { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 7},
+ { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 123}, { 3, 18}, { 1, 34},
+ { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 18, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 124 */
+ { 5, 38}, { 1, 48}, { 1, 124}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 15, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 16, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 6, 31}, { 1, 32}, { 1, 56}, { 10, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 1, 125}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 125 */
+ { 6, 38}, { 1, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 14, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 14, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 3, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 17, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 126 */
+ { 6, 38}, { 2, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 14, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 6, 31}, { 1, 32}, { 1, 56}, { 9, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 127 */
+ { 6, 38}, { 3, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 13, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 12, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 3, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 16, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 128 */
+ { 6, 38}, { 4, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 13, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 12, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 6, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 129 */
+ { 6, 38}, { 5, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 12, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 10, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 7, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 3, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 15, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 130 */
+ { 6, 38}, { 6, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 10, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 6, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34},
+ { 4, 18}, { 1, 51}, { 5, 38}, { 1, 48}, { 1, 126}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 131 */
+ { 6, 38}, { 7, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 8, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 11, 0}, { 1, 17}, { 3, 18},
+ { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 6, 38}, { 1, 127}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 132 */
+ { 6, 38}, { 8, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 11, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50},
+ { 6, 31}, { 1, 32}, { 1, 56}, { 6, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13},
+ { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52},
+ { 4, 18}, { 1, 53}, { 7, 38}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 133 */
+ { 6, 38}, { 9, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 10, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18},
+ { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 3, 18},
+ { 1, 34}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 128}, { 6, 38}, { 1, 48}, { 1, 126},
+ { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 134 */
+ { 6, 38}, { 10, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 1, 55}, { 4, 44}, { 1, 55}, { 1, 34},
+ { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 5, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 18}, { 1, 52},
+ { 5, 44}, { 1, 34}, { 3, 18}, { 1, 47}, { 1, 45}, { 7, 38}, { 1, 39}, { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 135 */
+ { 6, 38}, { 11, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 9, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 34}, { 1, 52}, { 2, 44}, { 1, 52},
+ { 1, 34}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 4, 4},
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0},
+ { 1, 17}, { 3, 18}, { 1, 34}, { 1, 52}, { 2, 44}, { 1, 52}, { 1, 34}, { 4, 18},
+ { 1, 53}, { 8, 38}, { 1, 39}, { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 136 */
+ { 6, 38}, { 12, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 9, 4}, { 1, 21}, { 6, 18}, { 2, 34}, { 6, 18}, { 1, 50}, { 6, 31}, { 1, 32},
+ { 1, 56}, { 4, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 19, 0}, { 5, 18}, { 2, 34}, { 5, 18}, { 1, 47}, { 1, 45}, { 8, 38},
+ { 1, 1}, { 13, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 137 */
+ { 6, 38}, { 13, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 8, 4}, { 1, 24}, { 1, 22}, { 12, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33},
+ { 1, 7}, { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 20, 0}, { 1, 17}, { 10, 18}, { 1, 35}, { 1, 61}, { 9, 38}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 138 */
+ { 6, 38}, { 14, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 8, 4}, { 1, 21}, { 12, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 3, 4},
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0},
+ { 9, 18}, { 1, 35}, { 1, 61}, { 8, 38}, { 1, 48}, { 1, 39}, { 14, 0},
+ { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 18}, { 2, 35}, { 1, 129}, { 1, 45}, /* Row 139 */
+ { 6, 38}, { 15, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7},
+ { 7, 4}, { 1, 19}, { 1, 26}, { 10, 18}, { 1, 130}, { 1, 107}, { 6, 31}, { 1, 33},
+ { 1, 7}, { 2, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 23, 0}, { 1, 131}, { 1, 132}, { 5, 18}, { 1, 35}, { 1, 133}, { 1, 128},
+ { 10, 38}, { 15, 0},
+ { 25, 0}, { 9, 45}, { 7, 38}, { 16, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, /* Row 140 */
+ { 1, 16}, { 1, 7}, { 7, 4}, { 1, 19}, { 1, 21}, { 1, 22}, { 6, 18}, { 1, 40},
+ { 1, 50}, { 1, 107}, { 6, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 7}, { 1, 9},
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 134}, { 1, 17},
+ { 1, 135}, { 1, 51}, { 1, 45}, { 1, 136}, { 9, 38}, { 1, 48}, { 1, 39}, { 15, 0},
+ { 25, 0}, { 16, 38}, { 17, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 141 */
+ { 1, 7}, { 8, 4}, { 1, 24}, { 1, 21}, { 1, 22}, { 2, 29}, { 1, 67}, { 1, 50},
+ { 1, 41}, { 8, 31}, { 1, 16}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 30, 0}, { 1, 1}, { 11, 38}, { 1, 48},
+ { 1, 38}, { 16, 0},
+ { 25, 0}, { 16, 38}, { 18, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 142 */
+ { 1, 7}, { 9, 4}, { 1, 89}, { 1, 137}, { 1, 138}, { 1, 92}, { 8, 31}, { 1, 42},
+ { 1, 16}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 32, 0}, { 1, 39}, { 1, 48}, { 8, 38}, { 1, 48}, { 1, 38},
+ { 17, 0},
+ { 25, 0}, { 16, 38}, { 19, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 143 */
+ { 1, 7}, { 9, 4}, { 1, 7}, { 1, 56}, { 1, 33}, { 1, 32}, { 5, 31}, { 1, 42},
+ { 1, 16}, { 1, 8}, { 2, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6},
+ { 1, 4}, { 1, 5}, { 34, 0}, { 8, 38}, { 1, 48}, { 1, 38}, { 18, 0},
+ { 25, 0}, { 16, 38}, { 20, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 144 */
+ { 1, 7}, { 10, 4}, { 1, 7}, { 7, 8}, { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12},
+ { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 35, 0}, { 1, 46}, { 7, 38}, { 1, 39},
+ { 19, 0},
+ { 25, 0}, { 16, 38}, { 21, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 145 */
+ { 1, 7}, { 19, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 64, 0},
+ { 25, 0}, { 16, 38}, { 22, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 146 */
+ { 1, 7}, { 17, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4},
+ { 1, 5}, { 65, 0},
+ { 64, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 15, 4}, /* Row 147 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 66, 0},
+ { 65, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 13, 4}, /* Row 148 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 67, 0},
+ { 66, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 11, 4}, /* Row 149 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 68, 0},
+ { 67, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 9, 4}, /* Row 150 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 69, 0},
+ { 68, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 7, 4}, /* Row 151 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 70, 0},
+ { 69, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 5, 4}, /* Row 152 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 71, 0},
+ { 70, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 3, 4}, /* Row 153 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 72, 0},
+ { 71, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 4}, /* Row 154 */
+ { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 73, 0},
+ { 72, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 9}, /* Row 155 */
+ { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 74, 0},
+ { 73, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 103}, { 1, 12}, { 1, 13}, /* Row 156 */
+ { 1, 6}, { 1, 4}, { 1, 5}, { 75, 0},
+ { 74, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 139}, { 1, 13}, { 1, 6}, { 1, 4}, /* Row 157 */
+ { 1, 5}, { 76, 0},
+ { 75, 0}, { 1, 5}, { 2, 4}, { 1, 3}, { 1, 140}, { 1, 6}, { 1, 4}, { 1, 5}, /* Row 158 */
+ { 77, 0},
+ { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 8
+# ifdef CONFIG_NXWIDGETS_GREYSCALE
+
+ { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */
+ { 75, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 5, 4}, { 1, 5}, { 75, 0}, /* Row 1 */
+ { 74, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 9}, { 1, 10}, /* Row 2 */
+ { 4, 4}, { 1, 5}, { 74, 0},
+ { 73, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 3 */
+ { 1, 12}, { 1, 13}, { 4, 4}, { 1, 5}, { 73, 0},
+ { 72, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 4 */
+ { 1, 7}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 72, 0},
+ { 71, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 5 */
+ { 1, 7}, { 2, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 71, 0},
+ { 70, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 6 */
+ { 1, 7}, { 4, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 70, 0},
+ { 69, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 7 */
+ { 1, 7}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 69, 0},
+ { 68, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 8 */
+ { 1, 7}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 68, 0},
+ { 67, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 9 */
+ { 1, 7}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 67, 0},
+ { 66, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 10 */
+ { 1, 7}, { 12, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 66, 0},
+ { 65, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 11 */
+ { 1, 7}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 65, 0},
+ { 64, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 12 */
+ { 1, 7}, { 16, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 64, 0},
+ { 63, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 13 */
+ { 1, 7}, { 18, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 63, 0},
+ { 62, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 14 */
+ { 1, 7}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 62, 0},
+ { 61, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 15 */
+ { 1, 7}, { 22, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 61, 0},
+ { 60, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 16 */
+ { 1, 7}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 60, 0},
+ { 59, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 17 */
+ { 1, 7}, { 26, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 59, 0},
+ { 58, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 18 */
+ { 1, 7}, { 28, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 26, 0},
+ { 1, 14}, { 5, 15}, { 1, 14}, { 25, 0},
+ { 57, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 19 */
+ { 1, 7}, { 10, 4}, { 5, 16}, { 15, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4},
+ { 1, 5}, { 23, 0}, { 1, 17}, { 9, 15}, { 1, 17}, { 23, 0},
+ { 56, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 20 */
+ { 1, 7}, { 9, 4}, { 1, 16}, { 1, 18}, { 1, 19}, { 3, 20}, { 1, 19}, { 1, 18},
+ { 1, 21}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 22, 0},
+ { 11, 15}, { 1, 17}, { 22, 0},
+ { 23, 0}, { 1, 14}, { 5, 15}, { 1, 22}, { 25, 0}, { 1, 1}, { 1, 6}, { 1, 7}, /* Row 21 */
+ { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 9, 4}, { 1, 16}, { 1, 23},
+ { 7, 15}, { 1, 19}, { 1, 24}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4},
+ { 1, 5}, { 20, 0}, { 1, 14}, { 12, 15}, { 1, 17}, { 21, 0},
+ { 21, 0}, { 1, 17}, { 9, 15}, { 1, 17}, { 22, 0}, { 1, 1}, { 1, 6}, { 1, 7}, /* Row 22 */
+ { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 9, 4}, { 1, 16}, { 1, 23},
+ { 9, 15}, { 1, 20}, { 1, 24}, { 4, 4}, { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 4, 4}, { 1, 5}, { 19, 0}, { 14, 15}, { 21, 0},
+ { 21, 0}, { 11, 15}, { 1, 17}, { 20, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, /* Row 23 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 10, 4}, { 1, 18}, { 11, 15}, { 1, 25},
+ { 1, 26}, { 2, 27}, { 1, 28}, { 1, 29}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13},
+ { 4, 4}, { 1, 5}, { 17, 0}, { 1, 14}, { 5, 15}, { 1, 30}, { 2, 31}, { 1, 30},
+ { 5, 15}, { 1, 14}, { 20, 0},
+ { 20, 0}, { 1, 22}, { 12, 15}, { 1, 32}, { 4, 33}, { 1, 7}, { 13, 0}, { 1, 1}, /* Row 24 */
+ { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 10, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 3, 30}, { 5, 15}, { 1, 34}, { 1, 35}, { 3, 27},
+ { 1, 36}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 16, 0},
+ { 5, 15}, { 1, 37}, { 4, 38}, { 1, 37}, { 4, 15}, { 1, 39}, { 1, 40}, { 1, 41},
+ { 18, 0},
+ { 19, 0}, { 1, 14}, { 13, 15}, { 1, 31}, { 1, 40}, { 5, 33}, { 11, 0}, { 1, 1}, /* Row 25 */
+ { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 11, 4},
+ { 1, 42}, { 4, 15}, { 1, 31}, { 3, 38}, { 1, 37}, { 5, 15}, { 1, 43}, { 4, 27},
+ { 1, 36}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 14, 0},
+ { 1, 14}, { 4, 15}, { 1, 30}, { 6, 38}, { 1, 30}, { 4, 15}, { 1, 22}, { 1, 33},
+ { 1, 41}, { 17, 0},
+ { 19, 0}, { 5, 15}, { 1, 30}, { 1, 44}, { 1, 34}, { 1, 31}, { 6, 15}, { 1, 45}, /* Row 26 */
+ { 5, 33}, { 1, 7}, { 9, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8},
+ { 1, 7}, { 1, 11}, { 1, 7}, { 11, 4}, { 1, 46}, { 1, 47}, { 4, 15}, { 1, 48},
+ { 4, 38}, { 1, 37}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 36}, { 10, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 13, 0}, { 5, 15}, { 1, 34},
+ { 6, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 2, 33}, { 1, 41}, { 16, 0},
+ { 18, 0}, { 1, 14}, { 4, 15}, { 1, 37}, { 4, 38}, { 1, 31}, { 5, 15}, { 1, 31}, /* Row 27 */
+ { 1, 40}, { 5, 33}, { 8, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8},
+ { 1, 7}, { 1, 11}, { 1, 7}, { 12, 4}, { 1, 16}, { 1, 20}, { 3, 15}, { 1, 31},
+ { 6, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 11, 0}, { 1, 14}, { 4, 15},
+ { 1, 30}, { 7, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 3, 33}, { 16, 0},
+ { 18, 0}, { 4, 15}, { 1, 30}, { 5, 38}, { 1, 48}, { 1, 30}, { 5, 15}, { 1, 45}, /* Row 28 */
+ { 5, 33}, { 1, 7}, { 6, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8},
+ { 1, 7}, { 1, 11}, { 1, 7}, { 13, 4}, { 1, 16}, { 1, 20}, { 3, 15}, { 1, 19},
+ { 6, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49},
+ { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 10, 0}, { 5, 15},
+ { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 22}, { 3, 33}, { 1, 7}, { 15, 0},
+ { 18, 0}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 29 */
+ { 5, 33}, { 5, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 14, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 3},
+ { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 8, 0}, { 1, 14}, { 4, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 4, 33}, { 15, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 5, 33}, /* Row 30 */
+ { 1, 7}, { 3, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 15, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 11, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 7, 0}, { 5, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 5, 33}, { 1, 50}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 31 */
+ { 5, 33}, { 2, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 16, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 9, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 3},
+ { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 5, 0}, { 1, 14}, { 4, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 5, 33}, { 1, 7}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 9, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 5, 33}, /* Row 32 */
+ { 1, 7}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 17, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 9, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 12, 4}, { 1, 3},
+ { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 4, 0}, { 5, 15}, { 1, 34}, { 7, 38},
+ { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 50}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 9, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 33 */
+ { 4, 33}, { 1, 51}, { 1, 52}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 18, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 10, 38}, { 1, 30},
+ { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 4, 4}, { 1, 5}, { 2, 0}, { 1, 14}, { 4, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 15, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 10, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 3, 33}, /* Row 34 */
+ { 1, 53}, { 1, 54}, { 1, 21}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 10, 38}, { 1, 34}, { 4, 15},
+ { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 4, 4}, { 1, 5}, { 1, 0}, { 5, 15}, { 1, 34}, { 7, 38}, { 1, 30},
+ { 3, 15}, { 1, 55}, { 1, 56}, { 6, 33}, { 1, 7}, { 15, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 10, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 35 */
+ { 1, 33}, { 1, 53}, { 1, 57}, { 1, 27}, { 1, 28}, { 1, 58}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 11, 38}, { 1, 30},
+ { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 13, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 4, 4}, { 1, 59}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15},
+ { 1, 31}, { 1, 60}, { 6, 33}, { 16, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 11, 38}, { 1, 30}, { 5, 15}, { 1, 61}, { 1, 53}, /* Row 36 */
+ { 1, 57}, { 3, 27}, { 1, 62}, { 1, 56}, { 1, 7}, { 21, 4}, { 1, 16}, { 1, 20},
+ { 2, 15}, { 1, 30}, { 11, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27},
+ { 1, 28}, { 1, 49}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 2, 4}, { 1, 21},
+ { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33},
+ { 1, 7}, { 16, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 11, 38}, { 1, 34}, { 5, 15}, { 1, 63}, { 1, 35}, /* Row 37 */
+ { 5, 27}, { 1, 64}, { 22, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 12, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, { 1, 3},
+ { 1, 8}, { 1, 13}, { 1, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 17, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 12, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 38 */
+ { 1, 65}, { 1, 3}, { 21, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 12, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4},
+ { 1, 3}, { 1, 8}, { 1, 66}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30},
+ { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 17, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 12, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 39 */
+ { 4, 27}, { 1, 28}, { 1, 49}, { 21, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 13, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 16, 4},
+ { 1, 67}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40},
+ { 6, 33}, { 18, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 40 */
+ { 1, 29}, { 1, 3}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 13, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45},
+ { 6, 33}, { 1, 7}, { 18, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 41 */
+ { 4, 27}, { 1, 28}, { 1, 49}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 14, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40},
+ { 6, 33}, { 19, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 14, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 42 */
+ { 1, 29}, { 1, 3}, { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 14, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45},
+ { 6, 33}, { 1, 7}, { 19, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 14, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 43 */
+ { 4, 27}, { 1, 28}, { 1, 49}, { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 68}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29},
+ { 1, 3}, { 12, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15},
+ { 1, 31}, { 1, 40}, { 6, 33}, { 20, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 15, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 44 */
+ { 1, 29}, { 1, 3}, { 18, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38},
+ { 1, 69}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28},
+ { 1, 49}, { 11, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30},
+ { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 20, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 68}, { 6, 38}, { 1, 34}, { 5, 15}, /* Row 45 */
+ { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 18, 4}, { 1, 16}, { 1, 20},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 18}, { 4, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 21, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 69}, { 7, 38}, { 1, 30}, { 5, 15}, /* Row 46 */
+ { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 17, 4}, { 1, 16}, { 1, 20}, { 2, 15},
+ { 1, 30}, { 7, 38}, { 2, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35},
+ { 4, 27}, { 1, 28}, { 1, 49}, { 9, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 21, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 34}, { 6, 38}, { 1, 34}, /* Row 47 */
+ { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 17, 4}, { 1, 16},
+ { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 18},
+ { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33},
+ { 22, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 2, 30}, { 7, 38}, { 1, 30}, { 5, 15}, /* Row 48 */
+ { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 16, 4}, { 1, 16}, { 1, 20}, { 2, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15},
+ { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 7, 4}, { 1, 21}, { 1, 19},
+ { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 70}, { 6, 33}, { 1, 7},
+ { 22, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 6, 38}, /* Row 49 */
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 16, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 1},
+ { 1, 53}, { 5, 33}, { 23, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 7, 38}, /* Row 50 */
+ { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 15, 4}, { 1, 16},
+ { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 5, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43},
+ { 1, 27}, { 1, 57}, { 1, 53}, { 3, 33}, { 1, 7}, { 23, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 34}, { 6, 38}, /* Row 51 */
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 4, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35},
+ { 2, 27}, { 1, 57}, { 1, 53}, { 2, 33}, { 24, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 7, 38}, /* Row 52 */
+ { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, { 1, 16},
+ { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 3, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43},
+ { 4, 27}, { 1, 57}, { 1, 53}, { 1, 7}, { 24, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 34}, { 6, 38}, /* Row 53 */
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 14, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 2, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35},
+ { 5, 27}, { 1, 71}, { 1, 72}, { 24, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 7, 38}, /* Row 54 */
+ { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 13, 4}, { 1, 16},
+ { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 1, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43},
+ { 6, 27}, { 1, 28}, { 1, 49}, { 1, 5}, { 23, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 34}, { 6, 38}, /* Row 55 */
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 4}, { 1, 18},
+ { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27},
+ { 1, 49}, { 1, 3}, { 1, 4}, { 1, 5}, { 22, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 7, 38}, /* Row 56 */
+ { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 16},
+ { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 73}, { 1, 19},
+ { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 36},
+ { 1, 13}, { 3, 4}, { 1, 5}, { 21, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 6, 38}, /* Row 57 */
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 12, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 74}, { 4, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49},
+ { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 20, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 7, 38}, /* Row 58 */
+ { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 16},
+ { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 3, 27}, { 1, 35}, { 1, 34}, { 4, 15},
+ { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 2, 3},
+ { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 19, 0},
+ { 17, 0}, { 1, 75}, { 1, 55}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 6, 15}, /* Row 59 */
+ { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28},
+ { 1, 49}, { 11, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 3, 27}, { 1, 43},
+ { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27},
+ { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5},
+ { 18, 0},
+ { 16, 0}, { 1, 1}, { 1, 76}, { 1, 37}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, /* Row 60 */
+ { 6, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29},
+ { 1, 3}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 3, 15}, { 1, 37}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30},
+ { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 3, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 3, 4}, { 1, 5}, { 17, 0},
+ { 15, 0}, { 1, 1}, { 1, 6}, { 1, 73}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 61 */
+ { 1, 30}, { 7, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35},
+ { 4, 27}, { 1, 28}, { 1, 49}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 78}, { 4, 15}, { 1, 34}, { 7, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 1, 79}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 5, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 16, 0},
+ { 14, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, /* Row 62 */
+ { 8, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43},
+ { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, { 1, 34}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 80}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 15, 0},
+ { 13, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 9}, { 1, 77}, { 2, 15}, /* Row 63 */
+ { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 37}, { 4, 15}, { 1, 34}, { 6, 38},
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 9, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25},
+ { 1, 81}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 68},
+ { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27},
+ { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5},
+ { 14, 0},
+ { 12, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 82}, { 1, 83}, /* Row 64 */
+ { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 78}, { 4, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3},
+ { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34},
+ { 9, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29},
+ { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 13, 0},
+ { 11, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 85}, /* Row 65 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35},
+ { 4, 27}, { 1, 28}, { 1, 49}, { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, { 1, 43}, { 4, 15},
+ { 1, 34}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15},
+ { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 3, 4}, { 1, 5}, { 12, 0},
+ { 10, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 66 */
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25},
+ { 1, 81}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43},
+ { 5, 27}, { 1, 29}, { 1, 3}, { 7, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34},
+ { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30},
+ { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 3, 4}, { 1, 5}, { 11, 0},
+ { 9, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 67 */
+ { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 7, 4}, { 1, 16},
+ { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 2, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49},
+ { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 10, 0},
+ { 8, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 68 */
+ { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 1, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 16}, { 1, 20},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 2, 27},
+ { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 5, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 15, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 9, 0},
+ { 7, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 69 */
+ { 3, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38},
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 6, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25},
+ { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 3, 15},
+ { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28},
+ { 1, 49}, { 17, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 8, 0},
+ { 6, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 70 */
+ { 4, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 2, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 5, 4}, { 1, 16}, { 1, 20},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27},
+ { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 3, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 18, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 7, 0},
+ { 5, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 71 */
+ { 5, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 2, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38},
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 5, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25},
+ { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 1, 15},
+ { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28},
+ { 1, 49}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 6, 0},
+ { 4, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 72 */
+ { 6, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 16}, { 1, 20},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27},
+ { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 1, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 21, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 5, 0},
+ { 3, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 73 */
+ { 7, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 3, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38},
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 4, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25},
+ { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 69}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 23, 4},
+ { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 4, 0},
+ { 2, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 74 */
+ { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 3, 4}, { 1, 16}, { 1, 20},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27},
+ { 1, 87}, { 1, 34}, { 3, 15}, { 1, 30}, { 15, 38}, { 1, 30}, { 4, 15}, { 1, 43},
+ { 6, 27}, { 1, 29}, { 1, 3}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4},
+ { 1, 5}, { 3, 0},
+ { 1, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 75 */
+ { 9, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 4, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38},
+ { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 3, 4},
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25},
+ { 1, 81}, { 6, 27}, { 1, 67}, { 4, 15}, { 1, 34}, { 13, 38}, { 1, 34}, { 4, 15},
+ { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 26, 4}, { 1, 3}, { 1, 8},
+ { 1, 13}, { 3, 4}, { 1, 5}, { 2, 0},
+ { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 10, 4}, /* Row 76 */
+ { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25},
+ { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15},
+ { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21},
+ { 1, 19}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27},
+ { 1, 29}, { 1, 3}, { 27, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5},
+ { 1, 0},
+ { 1, 2}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 11, 4}, { 1, 16}, /* Row 77 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 5, 27}, { 1, 87}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15},
+ { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 16}, { 1, 20},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27},
+ { 1, 4}, { 1, 18}, { 4, 15}, { 1, 34}, { 11, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 29, 4}, { 1, 3}, { 1, 8}, { 1, 13},
+ { 3, 4}, { 1, 5},
+ { 1, 3}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 12, 4}, { 1, 16}, { 1, 20}, /* Row 78 */
+ { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27},
+ { 1, 67}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27},
+ { 1, 29}, { 1, 3}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38},
+ { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 21}, { 1, 19},
+ { 3, 15}, { 1, 30}, { 11, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29},
+ { 1, 3}, { 30, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4},
+ { 1, 4}, { 1, 88}, { 1, 89}, { 1, 86}, { 13, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 79 */
+ { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21},
+ { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35},
+ { 4, 27}, { 1, 28}, { 1, 49}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, { 1, 6},
+ { 4, 15}, { 1, 34}, { 9, 38}, { 1, 19}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27},
+ { 1, 28}, { 1, 49}, { 32, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 1, 49}, { 1, 3},
+ { 2, 4}, { 1, 90}, { 1, 8}, { 1, 3}, { 12, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 80 */
+ { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27},
+ { 1, 29}, { 1, 3}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, { 1, 6}, { 4, 15}, { 1, 69},
+ { 9, 38}, { 1, 31}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 33, 4},
+ { 1, 3}, { 1, 91}, { 1, 81}, { 1, 4},
+ { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 81 */
+ { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34},
+ { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 21},
+ { 1, 19}, { 4, 15}, { 1, 34}, { 8, 38}, { 1, 92}, { 4, 15}, { 1, 68}, { 1, 93},
+ { 6, 27}, { 1, 49}, { 33, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 56}, { 1, 8},
+ { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 82 */
+ { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27},
+ { 1, 29}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 10, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 49}, { 32, 4}, { 1, 3}, { 1, 8},
+ { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4},
+ { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, { 1, 16}, { 1, 20}, /* Row 83 */
+ { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27},
+ { 2, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15},
+ { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 7}, { 1, 20}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21}, { 1, 19},
+ { 4, 15}, { 1, 34}, { 10, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27},
+ { 1, 29}, { 1, 3}, { 30, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5},
+ { 1, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4}, { 1, 16}, /* Row 84 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 3, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15},
+ { 1, 43}, { 5, 27}, { 1, 10}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 67}, { 4, 15}, { 1, 30}, { 12, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 29, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 1, 0},
+ { 2, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 16}, /* Row 85 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 3, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 81}, { 1, 77}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, { 1, 87}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 12, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27},
+ { 1, 29}, { 1, 3}, { 27, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 2, 0},
+ { 3, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 6, 4}, { 1, 16}, /* Row 86 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 4, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15},
+ { 1, 43}, { 4, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 14, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 26, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 3, 0},
+ { 4, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 5, 4}, { 1, 16}, /* Row 87 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 4, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 5, 15}, { 1, 34}, { 1, 35}, { 3, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, { 1, 35}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 14, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27},
+ { 1, 29}, { 1, 3}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 4, 0},
+ { 5, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 4, 4}, { 1, 16}, /* Row 88 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 5, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15},
+ { 1, 43}, { 3, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 16, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 23, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 5, 0},
+ { 6, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 3, 4}, { 1, 16}, /* Row 89 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 5, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 5, 15}, { 1, 34}, { 1, 35}, { 2, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, { 1, 35}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 1, 69}, { 7, 38}, { 1, 34}, { 4, 15},
+ { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 21, 4}, { 1, 3}, { 1, 8},
+ { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 6, 0},
+ { 7, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 2, 4}, { 1, 16}, /* Row 90 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 6, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15},
+ { 1, 43}, { 2, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30},
+ { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38},
+ { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27},
+ { 1, 28}, { 1, 49}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 7, 0},
+ { 8, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 16}, /* Row 91 */
+ { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81},
+ { 6, 27}, { 6, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 5, 15}, { 1, 34}, { 1, 35}, { 1, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 2, 27}, { 1, 35}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 18, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 8, 0},
+ { 9, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 16}, { 1, 20}, /* Row 92 */
+ { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27},
+ { 7, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43},
+ { 1, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 2, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30},
+ { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28},
+ { 1, 49}, { 17, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4},
+ { 1, 5}, { 9, 0},
+ { 10, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 93 */
+ { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 7, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34},
+ { 1, 35}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15},
+ { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35},
+ { 5, 27}, { 1, 29}, { 1, 3}, { 15, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 1, 4}, { 1, 5}, { 10, 0},
+ { 11, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 73}, { 1, 20}, { 2, 15}, { 1, 30}, /* Row 94 */
+ { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 8, 4}, { 1, 18},
+ { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 1, 81}, { 1, 25},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27},
+ { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 7, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 14, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 11, 0},
+ { 12, 0}, { 1, 5}, { 4, 4}, { 1, 57}, { 1, 77}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 95 */
+ { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 8, 4}, { 1, 21}, { 1, 19},
+ { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 41}, { 1, 25},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 35},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 6, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4},
+ { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 12, 0},
+ { 13, 0}, { 1, 5}, { 3, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 96 */
+ { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 9, 4}, { 1, 18}, { 4, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 78}, { 1, 77}, { 2, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 43}, { 4, 15}, { 1, 30},
+ { 8, 38}, { 1, 30}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43},
+ { 5, 27}, { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 1, 4}, { 1, 5}, { 13, 0},
+ { 14, 0}, { 1, 5}, { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 97 */
+ { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 9, 4}, { 1, 21}, { 1, 19},
+ { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 37}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 37}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 14, 0},
+ { 15, 0}, { 1, 5}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 98 */
+ { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 10, 4}, { 1, 18}, { 4, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 8, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15},
+ { 1, 77}, { 1, 78}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 78},
+ { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27},
+ { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 15, 0},
+ { 16, 0}, { 1, 5}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, /* Row 99 */
+ { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 10, 4}, { 1, 21}, { 1, 19}, { 4, 15},
+ { 1, 34}, { 6, 38}, { 1, 34}, { 8, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15},
+ { 1, 37}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 94},
+ { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35},
+ { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 1, 4}, { 1, 5}, { 16, 0},
+ { 17, 0}, { 1, 95}, { 1, 96}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, /* Row 100 */
+ { 1, 25}, { 1, 81}, { 6, 27}, { 11, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38},
+ { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 8, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 1, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34},
+ { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 5, 4},
+ { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 17, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 101 */
+ { 6, 27}, { 11, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 2, 27}, { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 3, 4},
+ { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 18, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 102 */
+ { 6, 27}, { 12, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 3, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30},
+ { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, { 1, 8},
+ { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 19, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 103 */
+ { 6, 27}, { 12, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 6, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 34}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 2, 3}, { 1, 8},
+ { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 20, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 104 */
+ { 6, 27}, { 13, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 5, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30},
+ { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 1, 8}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 1, 4}, { 1, 5}, { 21, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 105 */
+ { 6, 27}, { 13, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 5, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 74}, { 3, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 36}, { 1, 7}, { 1, 11},
+ { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 106 */
+ { 6, 27}, { 14, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 6, 27}, { 1, 28}, { 1, 73}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38},
+ { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 54}, { 1, 97}, { 1, 7}, { 1, 4},
+ { 1, 5}, { 23, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 107 */
+ { 6, 27}, { 14, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 4}, { 1, 18}, { 3, 15},
+ { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 98},
+ { 1, 4}, { 1, 5}, { 24, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 108 */
+ { 6, 27}, { 15, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 1, 4}, { 1, 21}, { 1, 19}, { 3, 15},
+ { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 4, 27}, { 1, 57}, { 1, 99},
+ { 1, 9}, { 25, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 109 */
+ { 6, 27}, { 15, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 3, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 2, 4}, { 1, 18},
+ { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 2, 27},
+ { 1, 57}, { 1, 53}, { 2, 33}, { 25, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 110 */
+ { 6, 27}, { 16, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 3, 4}, { 1, 21}, { 1, 19}, { 3, 15},
+ { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 1, 27}, { 1, 57}, { 1, 53},
+ { 3, 33}, { 1, 7}, { 24, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 111 */
+ { 6, 27}, { 16, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 34}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 18},
+ { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 1}, { 1, 53},
+ { 5, 33}, { 24, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 112 */
+ { 6, 27}, { 17, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 5, 4}, { 1, 21}, { 1, 19}, { 3, 15},
+ { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 70}, { 6, 33}, { 1, 7}, { 23, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 113 */
+ { 6, 27}, { 17, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 1, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 18},
+ { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33},
+ { 23, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 114 */
+ { 6, 27}, { 18, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 2, 30}, { 7, 38},
+ { 2, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49},
+ { 7, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 45}, { 6, 33}, { 1, 7}, { 22, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 115 */
+ { 6, 27}, { 18, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34},
+ { 1, 30}, { 7, 38}, { 1, 30}, { 1, 34}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 18}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 22, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 100}, /* Row 116 */
+ { 6, 27}, { 19, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 69}, { 7, 38},
+ { 1, 69}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49},
+ { 9, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 45}, { 6, 33}, { 1, 7}, { 21, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 101}, /* Row 117 */
+ { 1, 57}, { 5, 27}, { 19, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38},
+ { 1, 68}, { 7, 38}, { 1, 68}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35},
+ { 6, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 18}, { 3, 15}, { 1, 30}, { 7, 38},
+ { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 21, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 118 */
+ { 1, 53}, { 1, 57}, { 4, 27}, { 1, 8}, { 1, 3}, { 18, 4}, { 1, 18}, { 4, 15},
+ { 1, 30}, { 22, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49},
+ { 11, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 45}, { 6, 33}, { 1, 7}, { 20, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 119 */
+ { 1, 33}, { 1, 53}, { 1, 57}, { 3, 27}, { 1, 36}, { 1, 8}, { 1, 3}, { 17, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 20, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 18}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 20, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 120 */
+ { 2, 33}, { 1, 53}, { 1, 57}, { 2, 27}, { 1, 49}, { 1, 13}, { 1, 8}, { 1, 3},
+ { 17, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 20, 38}, { 1, 30}, { 4, 15}, { 1, 43},
+ { 6, 27}, { 1, 28}, { 1, 49}, { 12, 4}, { 1, 3}, { 1, 79}, { 1, 63}, { 3, 15},
+ { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 19, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 121 */
+ { 3, 33}, { 1, 53}, { 1, 57}, { 1, 27}, { 2, 4}, { 1, 13}, { 1, 8}, { 1, 3},
+ { 16, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 18, 38}, { 1, 34}, { 4, 15},
+ { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 3}, { 1, 8},
+ { 1, 7}, { 1, 102}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31},
+ { 1, 40}, { 6, 33}, { 19, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 122 */
+ { 4, 33}, { 1, 53}, { 1, 62}, { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 16, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 18, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27},
+ { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 79},
+ { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33},
+ { 1, 7}, { 18, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 123 */
+ { 5, 33}, { 1, 103}, { 1, 3}, { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 16, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 53}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34},
+ { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 18, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 124 */
+ { 6, 33}, { 1, 95}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, { 1, 18},
+ { 4, 15}, { 1, 30}, { 16, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28},
+ { 1, 49}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4},
+ { 1, 5}, { 1, 27}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45},
+ { 6, 33}, { 1, 7}, { 17, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 125 */
+ { 6, 33}, { 1, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 14, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 14, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 2, 0}, { 1, 14}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 17, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 126 */
+ { 6, 33}, { 2, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 14, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 14, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27},
+ { 1, 28}, { 1, 49}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 4, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 45}, { 6, 33}, { 1, 7}, { 16, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 127 */
+ { 6, 33}, { 3, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 12, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 5, 0}, { 1, 14}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 16, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 128 */
+ { 6, 33}, { 4, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 12, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27},
+ { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 7, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 45}, { 6, 33}, { 1, 7}, { 15, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 129 */
+ { 6, 33}, { 5, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 12, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 10, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 7, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 8, 0}, { 1, 14}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 15, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 130 */
+ { 6, 33}, { 6, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 12, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 10, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27},
+ { 1, 28}, { 1, 49}, { 7, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 10, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15},
+ { 1, 22}, { 6, 33}, { 1, 104}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 131 */
+ { 6, 33}, { 7, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 8, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 11, 0}, { 1, 14}, { 3, 15}, { 1, 30},
+ { 7, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 65}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 132 */
+ { 6, 33}, { 8, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27},
+ { 1, 28}, { 1, 49}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 13, 0}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 4, 15},
+ { 1, 45}, { 7, 33}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 133 */
+ { 6, 33}, { 9, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 4, 15}, { 1, 34},
+ { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 5, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 14, 0}, { 1, 14}, { 3, 15}, { 1, 30},
+ { 6, 38}, { 1, 44}, { 3, 15}, { 1, 55}, { 1, 105}, { 7, 33}, { 1, 104}, { 13, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 134 */
+ { 6, 33}, { 10, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4},
+ { 1, 18}, { 4, 15}, { 1, 30}, { 1, 106}, { 4, 38}, { 1, 106}, { 1, 30}, { 4, 15},
+ { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 5, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 15}, { 1, 34}, { 5, 38},
+ { 1, 30}, { 3, 15}, { 1, 31}, { 1, 60}, { 7, 33}, { 1, 7}, { 13, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 135 */
+ { 6, 33}, { 11, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4},
+ { 1, 21}, { 1, 19}, { 4, 15}, { 1, 30}, { 1, 34}, { 2, 38}, { 1, 34}, { 1, 30},
+ { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 17, 0}, { 1, 14},
+ { 3, 15}, { 1, 30}, { 1, 34}, { 2, 38}, { 1, 34}, { 1, 30}, { 4, 15}, { 1, 45},
+ { 8, 33}, { 1, 7}, { 13, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 136 */
+ { 6, 33}, { 12, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4},
+ { 1, 18}, { 6, 15}, { 2, 30}, { 6, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49},
+ { 4, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5},
+ { 19, 0}, { 5, 15}, { 2, 30}, { 5, 15}, { 1, 31}, { 1, 40}, { 8, 33}, { 1, 50},
+ { 13, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 137 */
+ { 6, 33}, { 13, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4},
+ { 1, 21}, { 1, 19}, { 12, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3},
+ { 3, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5},
+ { 20, 0}, { 1, 14}, { 10, 15}, { 1, 39}, { 1, 107}, { 9, 33}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 138 */
+ { 6, 33}, { 14, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4},
+ { 1, 18}, { 12, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 3, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0}, { 9, 15},
+ { 1, 39}, { 1, 107}, { 9, 33}, { 1, 7}, { 14, 0},
+ { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 55}, { 2, 96}, { 1, 108}, { 1, 60}, /* Row 139 */
+ { 6, 33}, { 15, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4},
+ { 1, 16}, { 1, 23}, { 10, 15}, { 1, 109}, { 1, 81}, { 6, 27}, { 1, 29}, { 1, 3},
+ { 2, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5},
+ { 23, 0}, { 1, 28}, { 1, 110}, { 5, 15}, { 1, 39}, { 1, 111}, { 1, 105}, { 10, 33},
+ { 15, 0},
+ { 25, 0}, { 1, 59}, { 4, 40}, { 4, 60}, { 7, 33}, { 16, 0}, { 1, 5}, { 4, 4}, /* Row 140 */
+ { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 16}, { 1, 18}, { 1, 19}, { 6, 15},
+ { 1, 34}, { 1, 43}, { 1, 81}, { 6, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3},
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 112},
+ { 1, 14}, { 1, 113}, { 1, 22}, { 1, 40}, { 1, 76}, { 10, 33}, { 1, 7}, { 15, 0},
+ { 25, 0}, { 16, 33}, { 17, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 141 */
+ { 8, 4}, { 1, 21}, { 1, 18}, { 1, 19}, { 1, 77}, { 1, 25}, { 1, 34}, { 1, 43},
+ { 1, 35}, { 8, 27}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 3}, { 1, 8}, { 1, 7},
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 30, 0}, { 1, 50}, { 13, 33}, { 16, 0},
+ { 25, 0}, { 16, 33}, { 18, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 142 */
+ { 9, 4}, { 1, 16}, { 1, 10}, { 1, 66}, { 1, 81}, { 8, 27}, { 1, 36}, { 1, 8},
+ { 1, 3}, { 1, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4},
+ { 1, 5}, { 32, 0}, { 1, 7}, { 11, 33}, { 17, 0},
+ { 25, 0}, { 16, 33}, { 19, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 143 */
+ { 9, 4}, { 1, 3}, { 1, 49}, { 1, 29}, { 1, 28}, { 5, 27}, { 1, 36}, { 1, 8},
+ { 3, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5},
+ { 34, 0}, { 10, 33}, { 18, 0},
+ { 25, 0}, { 16, 33}, { 20, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 144 */
+ { 10, 4}, { 1, 3}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7},
+ { 1, 4}, { 1, 5}, { 35, 0}, { 1, 41}, { 7, 33}, { 1, 7}, { 19, 0},
+ { 25, 0}, { 16, 33}, { 21, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 145 */
+ { 19, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5},
+ { 64, 0},
+ { 25, 0}, { 16, 33}, { 22, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 146 */
+ { 17, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5},
+ { 65, 0},
+ { 64, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, { 1, 3}, /* Row 147 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 66, 0},
+ { 65, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4}, { 1, 3}, /* Row 148 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 67, 0},
+ { 66, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, { 1, 3}, /* Row 149 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 68, 0},
+ { 67, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, { 1, 3}, /* Row 150 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 69, 0},
+ { 68, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 3}, /* Row 151 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 70, 0},
+ { 69, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 5, 4}, { 1, 3}, /* Row 152 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 71, 0},
+ { 70, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 3, 4}, { 1, 3}, /* Row 153 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 72, 0},
+ { 71, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 3}, /* Row 154 */
+ { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 73, 0},
+ { 72, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 8}, { 1, 7}, /* Row 155 */
+ { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 74, 0},
+ { 73, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 91}, { 1, 7}, { 1, 11}, { 1, 7}, /* Row 156 */
+ { 1, 4}, { 1, 5}, { 75, 0},
+ { 74, 0}, { 1, 5}, { 4, 4}, { 1, 114}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, /* Row 157 */
+ { 76, 0},
+ { 75, 0}, { 1, 5}, { 2, 4}, { 1, 8}, { 1, 115}, { 1, 7}, { 1, 4}, { 1, 5}, /* Row 158 */
+ { 77, 0},
+ { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */
+
+# else /* CONFIG_NXWIDGETS_GREYSCALE */
+
+static const struct SRlePaletteBitmapEntry g_nuttxRleEntries[] =
+{
+ { 76, 0}, { 1, 1}, { 1, 2}, { 5, 3}, { 1, 4}, { 76, 0}, /* Row 0 */
+ { 75, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 6, 3}, { 1, 4}, { 75, 0}, /* Row 1 */
+ { 74, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 2, 6}, { 4, 3}, { 1, 4}, /* Row 2 */
+ { 74, 0},
+ { 73, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 8}, /* Row 3 */
+ { 1, 6}, { 4, 3}, { 1, 4}, { 73, 0},
+ { 72, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 4 */
+ { 2, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 72, 0},
+ { 71, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 5 */
+ { 4, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 71, 0},
+ { 70, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 6 */
+ { 6, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 70, 0},
+ { 69, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 7 */
+ { 8, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 69, 0},
+ { 68, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 8 */
+ { 10, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 68, 0},
+ { 67, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 9 */
+ { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 67, 0},
+ { 66, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 10 */
+ { 14, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 66, 0},
+ { 65, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 11 */
+ { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 65, 0},
+ { 64, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 12 */
+ { 18, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 64, 0},
+ { 63, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 13 */
+ { 20, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 63, 0},
+ { 62, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 14 */
+ { 22, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 62, 0},
+ { 61, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 15 */
+ { 24, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 61, 0},
+ { 60, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 16 */
+ { 26, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 60, 0},
+ { 59, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 17 */
+ { 28, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 59, 0},
+ { 58, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 18 */
+ { 30, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 26, 0}, { 1, 9}, { 5, 10}, { 1, 9},
+ { 25, 0},
+ { 57, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 19 */
+ { 10, 3}, { 5, 5}, { 17, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 23, 0}, { 1, 1},
+ { 9, 10}, { 1, 1}, { 23, 0},
+ { 56, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 20 */
+ { 9, 3}, { 1, 5}, { 1, 11}, { 5, 12}, { 1, 11}, { 1, 13}, { 16, 3}, { 1, 6},
+ { 4, 3}, { 1, 4}, { 22, 0}, { 11, 10}, { 1, 1}, { 22, 0},
+ { 23, 0}, { 1, 9}, { 5, 10}, { 1, 14}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 21 */
+ { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 15}, { 7, 10},
+ { 1, 12}, { 1, 16}, { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 20, 0}, { 1, 9},
+ { 12, 10}, { 1, 1}, { 21, 0},
+ { 21, 0}, { 1, 1}, { 9, 10}, { 1, 1}, { 22, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 22 */
+ { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 15}, { 9, 10},
+ { 1, 12}, { 1, 16}, { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 19, 0}, { 14, 10},
+ { 21, 0},
+ { 21, 0}, { 11, 10}, { 1, 1}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, /* Row 23 */
+ { 1, 7}, { 1, 2}, { 1, 5}, { 10, 3}, { 1, 11}, { 11, 10}, { 1, 12}, { 1, 7},
+ { 3, 6}, { 1, 5}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 17, 0}, { 1, 9},
+ { 6, 10}, { 2, 12}, { 6, 10}, { 1, 9}, { 20, 0},
+ { 20, 0}, { 1, 14}, { 12, 10}, { 1, 9}, { 4, 2}, { 1, 17}, { 13, 0}, { 1, 1}, /* Row 24 */
+ { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 10, 3}, { 1, 13},
+ { 1, 12}, { 12, 10}, { 1, 12}, { 5, 6}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4},
+ { 16, 0}, { 5, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 1, 1}, { 18, 0},
+ { 19, 0}, { 1, 9}, { 13, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 11, 0}, { 1, 1}, /* Row 25 */
+ { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 11, 3}, { 1, 19},
+ { 4, 10}, { 5, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 12, 3}, { 1, 6}, { 4, 3},
+ { 1, 4}, { 14, 0}, { 1, 9}, { 5, 10}, { 6, 12}, { 5, 10}, { 1, 14}, { 1, 2},
+ { 1, 1}, { 17, 0},
+ { 19, 0}, { 6, 10}, { 3, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 9, 0}, /* Row 26 */
+ { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 11, 3},
+ { 1, 5}, { 1, 14}, { 4, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 12, 3},
+ { 1, 6}, { 4, 3}, { 1, 4}, { 13, 0}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 14},
+ { 2, 2}, { 1, 1}, { 16, 0},
+ { 18, 0}, { 1, 9}, { 4, 10}, { 6, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, /* Row 27 */
+ { 8, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5},
+ { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 1, 11}, { 5, 6},
+ { 1, 5}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 11, 0}, { 1, 9}, { 5, 10},
+ { 8, 12}, { 4, 10}, { 1, 14}, { 3, 2}, { 16, 0},
+ { 18, 0}, { 5, 10}, { 6, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 6, 0}, /* Row 28 */
+ { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 13, 3},
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 13, 3},
+ { 1, 6}, { 4, 3}, { 1, 4}, { 10, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14},
+ { 3, 2}, { 1, 17}, { 15, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 5, 0}, /* Row 29 */
+ { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 14, 3},
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5},
+ { 13, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 8, 0}, { 1, 9}, { 5, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 1, 18}, { 4, 2}, { 15, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 3, 0}, /* Row 30 */
+ { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 15, 3},
+ { 1, 5}, { 1, 12}, { 3, 10}, { 9, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 14, 3},
+ { 1, 6}, { 4, 3}, { 1, 4}, { 7, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14},
+ { 5, 2}, { 1, 1}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 9, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 2, 0}, /* Row 31 */
+ { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 16, 3},
+ { 1, 5}, { 1, 12}, { 3, 10}, { 9, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5},
+ { 14, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 5, 0}, { 1, 9}, { 5, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 1, 17}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 9, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 1, 1}, /* Row 32 */
+ { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 17, 3}, { 1, 5},
+ { 1, 12}, { 3, 10}, { 10, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 15, 3}, { 1, 6},
+ { 4, 3}, { 1, 4}, { 4, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2},
+ { 1, 1}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 10, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 4, 2}, { 1, 18}, /* Row 33 */
+ { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 18, 3}, { 1, 5},
+ { 1, 12}, { 3, 10}, { 10, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 15, 3},
+ { 1, 6}, { 4, 3}, { 1, 4}, { 2, 0}, { 1, 9}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 1, 18}, { 6, 2}, { 15, 0},
+ { 18, 0}, { 4, 10}, { 10, 12}, { 6, 10}, { 1, 14}, { 3, 2}, { 1, 20}, { 1, 6}, /* Row 34 */
+ { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 19, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 11, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 16, 3}, { 1, 6}, { 4, 3},
+ { 1, 4}, { 1, 0}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 2}, { 1, 17},
+ { 15, 0},
+ { 18, 0}, { 4, 10}, { 11, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 1, 2}, { 1, 20}, /* Row 35 */
+ { 3, 6}, { 1, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 20, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 11, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 16, 3}, { 1, 6},
+ { 4, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 2}, { 16, 0},
+ { 18, 0}, { 4, 10}, { 11, 12}, { 6, 10}, { 1, 14}, { 1, 20}, { 5, 6}, { 1, 2}, /* Row 36 */
+ { 1, 5}, { 21, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 12, 12}, { 4, 10}, { 1, 12},
+ { 6, 6}, { 17, 3}, { 1, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 16, 0},
+ { 18, 0}, { 4, 10}, { 12, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 22, 3}, /* Row 37 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 12, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5},
+ { 17, 3}, { 1, 6}, { 1, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12},
+ { 1, 18}, { 6, 2}, { 17, 0},
+ { 18, 0}, { 4, 10}, { 12, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 22, 3}, /* Row 38 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 13, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 18, 3},
+ { 1, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17},
+ { 17, 0},
+ { 18, 0}, { 4, 10}, { 13, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 22, 3}, { 1, 5}, /* Row 39 */
+ { 1, 12}, { 3, 10}, { 13, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 17, 3},
+ { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 18, 0},
+ { 18, 0}, { 4, 10}, { 13, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 21, 3}, /* Row 40 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 14, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 16, 3},
+ { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17},
+ { 18, 0},
+ { 18, 0}, { 4, 10}, { 14, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 21, 3}, { 1, 5}, /* Row 41 */
+ { 1, 12}, { 3, 10}, { 14, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 15, 3},
+ { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 19, 0},
+ { 18, 0}, { 4, 10}, { 14, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 20, 3}, /* Row 42 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 15, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 14, 3},
+ { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17},
+ { 19, 0},
+ { 18, 0}, { 4, 10}, { 15, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 20, 3}, { 1, 5}, /* Row 43 */
+ { 1, 12}, { 3, 10}, { 15, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 13, 3},
+ { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 20, 0},
+ { 18, 0}, { 4, 10}, { 15, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 19, 3}, /* Row 44 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 4, 10}, { 1, 12},
+ { 6, 6}, { 12, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14},
+ { 6, 2}, { 1, 17}, { 20, 0},
+ { 18, 0}, { 4, 10}, { 16, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 19, 3}, { 1, 5}, /* Row 45 */
+ { 1, 12}, { 3, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 5, 6},
+ { 1, 5}, { 11, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18},
+ { 6, 2}, { 21, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 1, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 46 */
+ { 1, 5}, { 18, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 2, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 6, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 21, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 47 */
+ { 18, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 2, 10}, { 8, 12}, { 5, 10},
+ { 1, 11}, { 5, 6}, { 1, 5}, { 9, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 1, 18}, { 6, 2}, { 22, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 2, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 48 */
+ { 1, 5}, { 17, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 6, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 22, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 49 */
+ { 17, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, { 5, 10},
+ { 1, 11}, { 5, 6}, { 1, 5}, { 7, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 1, 21}, { 1, 20}, { 5, 2}, { 23, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 50 */
+ { 1, 5}, { 16, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 4, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 6, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 11}, { 2, 6}, { 1, 20}, { 3, 2}, { 1, 17}, { 23, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 51 */
+ { 16, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 4, 10}, { 8, 12}, { 5, 10},
+ { 1, 11}, { 5, 6}, { 1, 5}, { 5, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 4, 6}, { 1, 20}, { 2, 2}, { 24, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 4, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 52 */
+ { 1, 5}, { 15, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 6, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 11}, { 5, 6}, { 1, 20}, { 1, 17}, { 24, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 53 */
+ { 15, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 8, 12}, { 5, 10},
+ { 1, 11}, { 5, 6}, { 1, 5}, { 3, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 25, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 54 */
+ { 1, 5}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 6, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 11}, { 7, 6}, { 1, 3}, { 1, 4}, { 23, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 55 */
+ { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 8, 12}, { 5, 10},
+ { 1, 11}, { 5, 6}, { 1, 5}, { 1, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 3, 3}, { 1, 4}, { 22, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 56 */
+ { 1, 5}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 7, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 6, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10},
+ { 1, 11}, { 8, 6}, { 3, 3}, { 1, 4}, { 21, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 57 */
+ { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 7, 10}, { 8, 12}, { 5, 10},
+ { 1, 11}, { 5, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6},
+ { 2, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 20, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 7, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 58 */
+ { 1, 5}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 8, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 6, 6}, { 1, 5}, { 3, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 19, 0},
+ { 17, 0}, { 1, 22}, { 1, 12}, { 3, 10}, { 8, 12}, { 7, 10}, { 8, 12}, { 5, 10}, /* Row 59 */
+ { 1, 12}, { 6, 6}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 8, 10},
+ { 8, 12}, { 5, 10}, { 1, 11}, { 3, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 5, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 18, 0},
+ { 16, 0}, { 1, 1}, { 1, 18}, { 1, 12}, { 3, 10}, { 8, 12}, { 8, 10}, { 7, 12}, /* Row 60 */
+ { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10},
+ { 7, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 3, 6},
+ { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 6, 3},
+ { 1, 6}, { 3, 3}, { 1, 4}, { 17, 0},
+ { 15, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 8, 10}, /* Row 61 */
+ { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10},
+ { 7, 12}, { 3, 10}, { 1, 12}, { 1, 11}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 1, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 8, 3},
+ { 1, 6}, { 3, 3}, { 1, 4}, { 16, 0},
+ { 14, 0}, { 1, 1}, { 1, 2}, { 2, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 9, 10}, /* Row 62 */
+ { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 10, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 1, 23}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 6, 6}, { 1, 5}, { 9, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 15, 0},
+ { 13, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 12}, { 3, 10}, /* Row 63 */
+ { 8, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6},
+ { 10, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 6},
+ { 1, 11}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 11, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 14, 0},
+ { 12, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 24}, { 1, 12}, /* Row 64 */
+ { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10},
+ { 1, 11}, { 5, 6}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12},
+ { 3, 10}, { 1, 12}, { 2, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 9, 10}, { 8, 12},
+ { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 12, 3}, { 1, 6}, { 3, 3}, { 1, 4},
+ { 13, 0},
+ { 11, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 1, 3}, /* Row 65 */
+ { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10},
+ { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 9, 10},
+ { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 6}, { 3, 3}, { 1, 4},
+ { 12, 0},
+ { 10, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 1, 3}, /* Row 66 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 6}, { 1, 11},
+ { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 8, 3}, { 1, 5},
+ { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 7, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 15, 3},
+ { 1, 6}, { 3, 3}, { 1, 4}, { 11, 0},
+ { 9, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 2, 3}, /* Row 67 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 12},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 8, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 11}, { 4, 10}, { 8, 12},
+ { 7, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 6}, { 3, 3},
+ { 1, 4}, { 10, 0},
+ { 8, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 3, 3}, /* Row 68 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 11},
+ { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 7, 3}, { 1, 5},
+ { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 18, 3},
+ { 1, 6}, { 3, 3}, { 1, 4}, { 9, 0},
+ { 7, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 4, 3}, /* Row 69 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 12},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 7, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 11}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 20, 3}, { 1, 6}, { 3, 3},
+ { 1, 4}, { 8, 0},
+ { 6, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 5, 3}, /* Row 70 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 11},
+ { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 6, 3}, { 1, 5},
+ { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 21, 3},
+ { 1, 6}, { 3, 3}, { 1, 4}, { 7, 0},
+ { 5, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 6, 3}, /* Row 71 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 12},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 6, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 11}, { 4, 10}, { 8, 12},
+ { 3, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 23, 3}, { 1, 6}, { 3, 3},
+ { 1, 4}, { 6, 0},
+ { 4, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 7, 3}, /* Row 72 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 11},
+ { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 5, 3}, { 1, 5},
+ { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 24, 3},
+ { 1, 6}, { 3, 3}, { 1, 4}, { 5, 0},
+ { 3, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 8, 3}, /* Row 73 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 12},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 5, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 11}, { 4, 10}, { 8, 12},
+ { 1, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 26, 3}, { 1, 6}, { 3, 3},
+ { 1, 4}, { 4, 0},
+ { 2, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 9, 3}, /* Row 74 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 11},
+ { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 4, 3}, { 1, 5},
+ { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10},
+ { 15, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 27, 3}, { 1, 6}, { 3, 3},
+ { 1, 4}, { 3, 0},
+ { 1, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 10, 3}, /* Row 75 */
+ { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 12},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 4, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 11}, { 4, 10}, { 15, 12},
+ { 4, 10}, { 1, 12}, { 7, 6}, { 29, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 2, 0},
+ { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 11, 3}, { 1, 5}, /* Row 76 */
+ { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 11}, { 5, 10},
+ { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 3, 3}, { 1, 5}, { 1, 12},
+ { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10},
+ { 13, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 30, 3}, { 1, 6}, { 3, 3},
+ { 1, 4}, { 1, 0},
+ { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 12, 3}, { 1, 5}, { 1, 12}, /* Row 77 */
+ { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 12}, { 6, 6}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12},
+ { 3, 10}, { 1, 12}, { 7, 6}, { 1, 3}, { 1, 11}, { 4, 10}, { 13, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 32, 3}, { 1, 6}, { 3, 3}, { 1, 4},
+ { 2, 3}, { 1, 6}, { 1, 2}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 78 */
+ { 3, 10}, { 1, 12}, { 7, 6}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11},
+ { 5, 6}, { 1, 5}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 11, 12}, { 5, 10},
+ { 1, 11}, { 6, 6}, { 1, 5}, { 33, 3}, { 1, 6}, { 3, 3},
+ { 1, 3}, { 1, 5}, { 1, 18}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 79 */
+ { 3, 10}, { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10},
+ { 1, 12}, { 6, 6}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 4, 10}, { 11, 12}, { 4, 10}, { 1, 12},
+ { 7, 6}, { 35, 3}, { 1, 6}, { 2, 3},
+ { 2, 3}, { 1, 6}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 80 */
+ { 1, 12}, { 7, 6}, { 1, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11},
+ { 5, 6}, { 1, 5}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 4, 10}, { 1, 11},
+ { 6, 6}, { 1, 5}, { 35, 3}, { 1, 5}, { 1, 6}, { 1, 3},
+ { 3, 3}, { 1, 6}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 81 */
+ { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10},
+ { 1, 12}, { 6, 6}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 10, 12}, { 4, 10},
+ { 1, 12}, { 1, 21}, { 6, 6}, { 36, 3}, { 1, 7}, { 1, 2}, { 1, 5},
+ { 4, 3}, { 1, 6}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 82 */
+ { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11},
+ { 5, 6}, { 2, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6},
+ { 1, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 35, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 83 */
+ { 3, 10}, { 1, 12}, { 7, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12},
+ { 5, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 12, 12}, { 4, 10}, { 1, 12},
+ { 6, 6}, { 1, 5}, { 33, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4},
+ { 1, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 10, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 84 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 3, 3}, { 1, 11}, { 5, 10}, { 7, 12},
+ { 6, 10}, { 1, 11}, { 5, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 7, 6}, { 1, 11}, { 5, 10}, { 12, 12}, { 5, 10}, { 1, 11}, { 6, 6},
+ { 32, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 1, 0},
+ { 2, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 85 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 3, 3}, { 1, 13}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, { 14, 12}, { 4, 10}, { 1, 12}, { 6, 6},
+ { 1, 5}, { 30, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 2, 0},
+ { 3, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 8, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 86 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 4, 3}, { 1, 11}, { 5, 10}, { 7, 12},
+ { 6, 10}, { 1, 11}, { 5, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12},
+ { 6, 6}, { 1, 11}, { 5, 10}, { 14, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 29, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 3, 0},
+ { 4, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 7, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 87 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 6, 6}, { 1, 12}, { 4, 10}, { 16, 12}, { 4, 10}, { 1, 12}, { 6, 6},
+ { 1, 5}, { 27, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 4, 0},
+ { 5, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 6, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 88 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 5, 3}, { 1, 11}, { 5, 10}, { 7, 12},
+ { 6, 10}, { 1, 11}, { 4, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12},
+ { 5, 6}, { 1, 11}, { 5, 10}, { 16, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 26, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 5, 0},
+ { 6, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 5, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 89 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 5, 3}, { 1, 13}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 1, 12}, { 4, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 1, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 6, 6}, { 1, 5}, { 24, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 6, 0},
+ { 7, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 4, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 90 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 6, 3}, { 1, 11}, { 5, 10}, { 7, 12},
+ { 6, 10}, { 1, 11}, { 3, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12},
+ { 4, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 6, 6}, { 23, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 7, 0},
+ { 8, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 91 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 1, 12}, { 3, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 4, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 3, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 6, 6}, { 1, 5}, { 21, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 8, 0},
+ { 9, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 92 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 7, 3}, { 1, 11}, { 5, 10}, { 7, 12},
+ { 6, 10}, { 1, 11}, { 2, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12},
+ { 3, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 6, 6}, { 20, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 9, 0},
+ { 10, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 93 */
+ { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 7, 3}, { 1, 13}, { 1, 12}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 1, 12}, { 2, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10},
+ { 1, 12}, { 3, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 5, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 6, 6}, { 1, 5}, { 18, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 10, 0},
+ { 11, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 94 */
+ { 3, 10}, { 1, 12}, { 7, 6}, { 8, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10},
+ { 1, 11}, { 1, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6},
+ { 1, 11}, { 5, 10}, { 8, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6},
+ { 17, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 11, 0},
+ { 12, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 95 */
+ { 1, 12}, { 7, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10},
+ { 1, 12}, { 1, 21}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6},
+ { 1, 12}, { 4, 10}, { 9, 12}, { 7, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6},
+ { 1, 5}, { 15, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 12, 0},
+ { 13, 0}, { 1, 4}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 96 */
+ { 1, 12}, { 7, 6}, { 9, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11},
+ { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 6}, { 1, 11}, { 5, 10},
+ { 8, 12}, { 8, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 14, 3}, { 1, 7},
+ { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 13, 0},
+ { 14, 0}, { 1, 4}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 97 */
+ { 1, 12}, { 7, 6}, { 9, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10},
+ { 1, 12}, { 4, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10},
+ { 9, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6},
+ { 1, 5}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 14, 0},
+ { 15, 0}, { 1, 4}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 98 */
+ { 1, 12}, { 7, 6}, { 10, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 10, 10}, { 7, 12},
+ { 3, 10}, { 1, 12}, { 1, 11}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 1, 12},
+ { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 11, 3}, { 1, 7}, { 1, 2},
+ { 1, 5}, { 1, 3}, { 1, 4}, { 15, 0},
+ { 16, 0}, { 1, 4}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, /* Row 99 */
+ { 7, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 9, 10}, { 7, 12},
+ { 4, 10}, { 1, 12}, { 4, 10}, { 9, 12}, { 4, 10}, { 1, 12}, { 1, 6}, { 1, 11},
+ { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 9, 3}, { 1, 7},
+ { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 16, 0},
+ { 17, 0}, { 1, 4}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, /* Row 100 */
+ { 11, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 9, 10}, { 7, 12}, { 9, 10}, { 8, 12},
+ { 5, 10}, { 1, 11}, { 2, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 6, 6}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 17, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 11, 3}, { 1, 13}, /* Row 101 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 8, 10}, { 7, 12}, { 8, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 3, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6},
+ { 1, 5}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 18, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 12, 3}, { 1, 11}, /* Row 102 */
+ { 5, 10}, { 7, 12}, { 8, 10}, { 7, 12}, { 8, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 4, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 5, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 19, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 12, 3}, { 1, 13}, /* Row 103 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 7, 10}, { 7, 12}, { 7, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 5, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6},
+ { 1, 5}, { 3, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 20, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 13, 3}, { 1, 11}, /* Row 104 */
+ { 5, 10}, { 7, 12}, { 7, 10}, { 7, 12}, { 7, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 6, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 2, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 21, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 13, 3}, { 1, 13}, /* Row 105 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 22, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 11}, /* Row 106 */
+ { 5, 10}, { 7, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6},
+ { 1, 18}, { 1, 5}, { 1, 3}, { 1, 4}, { 23, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 13}, /* Row 107 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 7, 12}, { 5, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 1, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 3}, { 1, 4}, { 24, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 15, 3}, { 1, 11}, /* Row 108 */
+ { 5, 10}, { 7, 12}, { 5, 10}, { 7, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 5, 6}, { 1, 20}, { 1, 1}, { 25, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 15, 3}, { 1, 13}, /* Row 109 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 7, 12}, { 4, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 3, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 4, 6}, { 1, 20}, { 2, 2}, { 25, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 16, 3}, { 1, 11}, /* Row 110 */
+ { 5, 10}, { 7, 12}, { 4, 10}, { 7, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 2, 6}, { 1, 20}, { 3, 2}, { 1, 17}, { 24, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 16, 3}, { 1, 13}, /* Row 111 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 5, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 1, 21}, { 1, 20}, { 5, 2}, { 24, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 11}, /* Row 112 */
+ { 5, 10}, { 7, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14},
+ { 6, 2}, { 1, 17}, { 23, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 13}, /* Row 113 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 2, 10}, { 7, 12}, { 2, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 7, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 1, 18}, { 6, 2}, { 23, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 18, 3}, { 1, 11}, /* Row 114 */
+ { 5, 10}, { 7, 12}, { 2, 10}, { 7, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14},
+ { 6, 2}, { 1, 17}, { 22, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 18, 3}, { 1, 13}, /* Row 115 */
+ { 1, 12}, { 4, 10}, { 8, 12}, { 1, 10}, { 7, 12}, { 1, 10}, { 9, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 9, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 1, 18}, { 6, 2}, { 22, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 19, 3}, { 1, 11}, /* Row 116 */
+ { 5, 10}, { 7, 12}, { 1, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14},
+ { 6, 2}, { 1, 17}, { 21, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 18}, { 6, 6}, { 19, 3}, /* Row 117 */
+ { 1, 13}, { 1, 12}, { 4, 10}, { 24, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 1, 5},
+ { 11, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2},
+ { 21, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 2}, { 1, 20}, { 5, 6}, /* Row 118 */
+ { 20, 3}, { 1, 11}, { 5, 10}, { 22, 12}, { 5, 10}, { 1, 11}, { 7, 6}, { 12, 3},
+ { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17},
+ { 20, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 2}, { 1, 20}, { 5, 6}, /* Row 119 */
+ { 19, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 22, 12}, { 4, 10}, { 1, 12}, { 7, 6},
+ { 1, 5}, { 13, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18},
+ { 6, 2}, { 20, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 2}, { 1, 20}, { 3, 6}, /* Row 120 */
+ { 1, 3}, { 1, 6}, { 19, 3}, { 1, 11}, { 5, 10}, { 20, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 14, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14},
+ { 6, 2}, { 1, 17}, { 19, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 2}, { 1, 20}, { 2, 6}, /* Row 121 */
+ { 2, 3}, { 1, 6}, { 18, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 20, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 14, 3}, { 1, 7}, { 1, 25}, { 4, 10}, { 8, 12},
+ { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 19, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 2}, { 1, 20}, { 1, 6}, /* Row 122 */
+ { 3, 3}, { 1, 6}, { 18, 3}, { 1, 11}, { 5, 10}, { 18, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 14, 3}, { 1, 7}, { 1, 2}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12},
+ { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 18, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 2}, { 1, 20}, { 4, 3}, /* Row 123 */
+ { 1, 6}, { 17, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 18, 12}, { 4, 10}, { 1, 12},
+ { 7, 6}, { 1, 5}, { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 20},
+ { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 18, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 1, 0}, { 4, 3}, /* Row 124 */
+ { 1, 6}, { 17, 3}, { 1, 11}, { 5, 10}, { 16, 12}, { 5, 10}, { 1, 11}, { 7, 6},
+ { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 1, 17}, { 4, 10},
+ { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 17, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 1, 0}, { 1, 4}, /* Row 125 */
+ { 4, 3}, { 1, 6}, { 16, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 16, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 2, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18},
+ { 6, 2}, { 17, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 2, 0}, { 1, 4}, /* Row 126 */
+ { 4, 3}, { 1, 6}, { 16, 3}, { 1, 11}, { 5, 10}, { 14, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 4, 0},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 16, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 3, 0}, { 1, 4}, /* Row 127 */
+ { 4, 3}, { 1, 6}, { 15, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 14, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 5, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18},
+ { 6, 2}, { 16, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 4, 0}, { 1, 4}, /* Row 128 */
+ { 4, 3}, { 1, 6}, { 15, 3}, { 1, 11}, { 5, 10}, { 12, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 7, 0},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 15, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 5, 0}, { 1, 4}, /* Row 129 */
+ { 4, 3}, { 1, 6}, { 14, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 12, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 10, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 8, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18},
+ { 6, 2}, { 15, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 6, 0}, { 1, 4}, /* Row 130 */
+ { 4, 3}, { 1, 6}, { 14, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 10, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 10, 0},
+ { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 26}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 7, 0}, { 1, 4}, /* Row 131 */
+ { 4, 3}, { 1, 6}, { 13, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 10, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 11, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 14}, { 6, 2},
+ { 1, 17}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 8, 0}, { 1, 4}, /* Row 132 */
+ { 4, 3}, { 1, 6}, { 13, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 13, 0},
+ { 4, 10}, { 8, 12}, { 4, 10}, { 1, 14}, { 7, 2}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 9, 0}, { 1, 4}, /* Row 133 */
+ { 4, 3}, { 1, 6}, { 12, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 14, 0}, { 1, 9}, { 4, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 19},
+ { 7, 2}, { 1, 26}, { 13, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 10, 0}, { 1, 4}, /* Row 134 */
+ { 4, 3}, { 1, 6}, { 12, 3}, { 1, 11}, { 5, 10}, { 6, 12}, { 5, 10}, { 1, 11},
+ { 7, 6}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 16, 0},
+ { 4, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 8, 2}, { 1, 17}, { 13, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 11, 0}, { 1, 4}, /* Row 135 */
+ { 4, 3}, { 1, 6}, { 11, 3}, { 1, 13}, { 1, 12}, { 5, 10}, { 4, 12}, { 5, 10},
+ { 1, 12}, { 7, 6}, { 1, 5}, { 7, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3},
+ { 1, 4}, { 17, 0}, { 1, 9}, { 4, 10}, { 4, 12}, { 5, 10}, { 1, 14}, { 8, 2},
+ { 1, 17}, { 13, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 12, 0}, { 1, 4}, /* Row 136 */
+ { 4, 3}, { 1, 6}, { 11, 3}, { 1, 11}, { 14, 10}, { 1, 11}, { 7, 6}, { 7, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 19, 0}, { 12, 10}, { 1, 12},
+ { 1, 18}, { 8, 2}, { 1, 1}, { 13, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 13, 0}, { 1, 4}, /* Row 137 */
+ { 4, 3}, { 1, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 12, 10}, { 1, 12}, { 7, 6},
+ { 1, 5}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 20, 0},
+ { 1, 9}, { 10, 10}, { 1, 12}, { 10, 2}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 14, 0}, { 1, 4}, /* Row 138 */
+ { 4, 3}, { 1, 6}, { 10, 3}, { 1, 11}, { 12, 10}, { 1, 11}, { 7, 6}, { 6, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 22, 0}, { 9, 10}, { 1, 12},
+ { 10, 2}, { 1, 17}, { 14, 0},
+ { 18, 0}, { 4, 10}, { 12, 12}, { 7, 2}, { 15, 0}, { 1, 4}, { 4, 3}, { 1, 6}, /* Row 139 */
+ { 9, 3}, { 1, 5}, { 1, 15}, { 10, 10}, { 1, 15}, { 7, 6}, { 1, 5}, { 5, 3},
+ { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 23, 0}, { 1, 17}, { 1, 14},
+ { 5, 10}, { 1, 12}, { 1, 10}, { 1, 19}, { 10, 2}, { 15, 0},
+ { 25, 0}, { 1, 20}, { 4, 18}, { 11, 2}, { 16, 0}, { 1, 4}, { 4, 3}, { 1, 6}, /* Row 140 */
+ { 9, 3}, { 1, 5}, { 1, 11}, { 1, 12}, { 6, 10}, { 1, 12}, { 1, 11}, { 8, 6},
+ { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 27, 0}, { 2, 9},
+ { 1, 19}, { 1, 14}, { 1, 18}, { 11, 2}, { 1, 17}, { 15, 0},
+ { 25, 0}, { 16, 2}, { 17, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 10, 3}, { 1, 13}, /* Row 141 */
+ { 1, 11}, { 4, 12}, { 1, 11}, { 9, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5},
+ { 1, 3}, { 1, 4}, { 30, 0}, { 1, 1}, { 13, 2}, { 16, 0},
+ { 25, 0}, { 16, 2}, { 18, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 5}, /* Row 142 */
+ { 1, 13}, { 11, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4},
+ { 32, 0}, { 1, 17}, { 11, 2}, { 17, 0},
+ { 25, 0}, { 16, 2}, { 19, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 13, 3}, { 1, 5}, /* Row 143 */
+ { 7, 6}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 34, 0},
+ { 10, 2}, { 18, 0},
+ { 25, 0}, { 16, 2}, { 20, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 25, 3}, { 1, 7}, /* Row 144 */
+ { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 35, 0}, { 1, 1}, { 7, 2}, { 1, 17},
+ { 19, 0},
+ { 25, 0}, { 16, 2}, { 21, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 23, 3}, { 1, 7}, /* Row 145 */
+ { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 64, 0},
+ { 25, 0}, { 16, 2}, { 22, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 21, 3}, { 1, 7}, /* Row 146 */
+ { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 65, 0},
+ { 64, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 19, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 147 */
+ { 1, 3}, { 1, 4}, { 66, 0},
+ { 65, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 17, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 148 */
+ { 1, 3}, { 1, 4}, { 67, 0},
+ { 66, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 15, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 149 */
+ { 1, 3}, { 1, 4}, { 68, 0},
+ { 67, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 150 */
+ { 1, 3}, { 1, 4}, { 69, 0},
+ { 68, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 151 */
+ { 1, 3}, { 1, 4}, { 70, 0},
+ { 69, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 152 */
+ { 1, 3}, { 1, 4}, { 71, 0},
+ { 70, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 7, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 153 */
+ { 1, 3}, { 1, 4}, { 72, 0},
+ { 71, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 154 */
+ { 1, 3}, { 1, 4}, { 73, 0},
+ { 72, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 3, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 155 */
+ { 1, 3}, { 1, 4}, { 74, 0},
+ { 73, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 5}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 156 */
+ { 1, 3}, { 1, 4}, { 75, 0},
+ { 74, 0}, { 1, 4}, { 5, 3}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 76, 0}, /* Row 157 */
+ { 75, 0}, { 1, 4}, { 2, 3}, { 1, 5}, { 1, 20}, { 1, 5}, { 1, 3}, { 1, 4}, /* Row 158 */
+ { 77, 0},
+ { 76, 0}, { 1, 4}, { 4, 3}, { 1, 4}, { 78, 0} /* Row 159 */
+};
+
+# endif
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SRlePaletteBitmap NXWidgets::g_nuttxBitmap =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ CONFIG_NXWIDGETS_FMT, // fmt - Color format
+ BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
+ 160, // width - Width in pixels
+ 160, // height - Height in rows
+ g_nuttxLut, // lut - Pointer to the beginning of the Look-Up Table (LUT)
+ g_nuttxRleEntries // data - Pointer to the beginning of the RLE data
+};
diff --git a/NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx b/NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx
new file mode 100644
index 000000000..a9e4d6708
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_radioButtonMuGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_radioButtonMuGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_radioButtonMu =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_radioButtonMuGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx b/NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx
new file mode 100644
index 000000000..029b93896
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_radioButtonOffGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_radioButtonOffGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_radioButtonOff =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_radioButtonOffGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx b/NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx
new file mode 100644
index 000000000..242f6f373
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+# define RGB16_COLOR RGBTO16(216,196,96)
+
+static const uint16_t g_radioButtonOnGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_COLOR, RGB16_COLOR, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_COLOR, RGB16_COLOR, RGB16_COLOR, RGB16_COLOR, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_COLOR, RGB16_COLOR, RGB16_COLOR, RGB16_COLOR, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_COLOR, RGB16_COLOR, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+# define RGB24_COLOR RGBTO24(216,196,96)
+
+static const uint32_t g_radioButtonOnGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_COLOR, RGB24_COLOR, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_COLOR, RGB24_COLOR, RGB24_COLOR, RGB24_COLOR, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_COLOR, RGB24_COLOR, RGB24_COLOR, RGB24_COLOR, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_COLOR, RGB24_COLOR, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_radioButtonOn =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_radioButtonOnGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_return.cxx b/NxWidgets/libnxwidgets/src/glyph_return.cxx
new file mode 100644
index 000000000..47314f65c
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_return.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_return.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_returnGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_returnGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_return =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 7, // width - Width in pixels
+ 10, // height - Height in rows
+ (7*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_returnGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx b/NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx
new file mode 100644
index 000000000..c3f0e15ee
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_screenDepthDownGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_screenDepthDownGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_screenDepthDown =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_screenDepthDownGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx b/NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx
new file mode 100644
index 000000000..e4574a367
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_screenDepthUpGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_screenDepthUpGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_screenDepthUp =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_screenDepthUpGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx b/NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx
new file mode 100644
index 000000000..253ad6afb
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_screenFlipDownGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_screenFlipDownGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_screenFlipDown =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 7, // width - Width in pixels
+ 10, // height - Height in rows
+ (7*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_screenFlipDownGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx b/NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx
new file mode 100644
index 000000000..63b58a4a6
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_screenFlipUpGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_screenFlipUpGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_screenFlipUp =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 7, // width - Width in pixels
+ 10, // height - Height in rows
+ (7*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_screenFlipUpGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_shift.cxx b/NxWidgets/libnxwidgets/src/glyph_shift.cxx
new file mode 100644
index 000000000..193fd1719
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_shift.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_shift.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_shiftGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_shiftGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_shift =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_shiftGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_windowclose.cxx b/NxWidgets/libnxwidgets/src/glyph_windowclose.cxx
new file mode 100644
index 000000000..3a60aa137
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_windowclose.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_windowclose.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_windowCloseGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_windowCloseGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_windowClose =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 6, // width - Width in pixels
+ 10, // height - Height in rows
+ (6*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_windowCloseGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx b/NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx
new file mode 100644
index 000000000..d75b7d676
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx
@@ -0,0 +1,154 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_windowDepthDownGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_windowDepthDownGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_windowDepthDown =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_windowDepthDownGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
diff --git a/NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx b/NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx
new file mode 100644
index 000000000..f5d67e968
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+#include <nuttx/fb.h>
+#include <nuttx/rgbcolors.h>
+
+#include "nxconfig.hxx"
+#include "cbitmap.hxx"
+#include "glyphs.hxx"
+
+#if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Bitmap Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+#if CONFIG_NXWIDGETS_BPP == 16
+# define COLOR_FMT FB_FMT_RGB16_565
+# define RGB16_TRANSP 0x0000
+
+static const uint16_t g_windowDepthUpGlyph[] =
+{
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_WHITE, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
+ RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
+};
+
+#elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
+# define COLOR_FMT FB_FMT_RGB24
+# define RGB24_TRANSP 0x00000000
+
+static const uint32_t g_windowDepthUpGlyph[] =
+{
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_WHITE, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
+ RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
+};
+
+#else
+# warning "Other pixel depths not yet supported"
+#endif
+
+/****************************************************************************
+ * Public Bitmap Structure Defintions
+ ****************************************************************************/
+
+const struct SBitmap NXWidgets::g_windowDepthUp =
+{
+ CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
+ COLOR_FMT, // fmt - Color format
+ 8, // width - Width in pixels
+ 10, // height - Height in rows
+ (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
+ g_windowDepthUpGlyph // data - Pointer to the beginning of pixel data
+};
+
+#endif // CONFIG_NXWIDGETS_BPP != 8
+
+
diff --git a/NxWidgets/libnxwidgets/src/singletons.cxx b/NxWidgets/libnxwidgets/src/singletons.cxx
new file mode 100644
index 000000000..fc5d919e6
--- /dev/null
+++ b/NxWidgets/libnxwidgets/src/singletons.cxx
@@ -0,0 +1,202 @@
+/****************************************************************************
+ * NxWidgets/libnxwidgets/src/singletons.cxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ *
+ * Portions of this package derive from Woopsi (http://woopsi.org/) and
+ * portions are original efforts. It is difficult to determine at this
+ * point what parts are original efforts and which parts derive from Woopsi.
+ * However, in any event, the work of Antony Dzeryn will be acknowledged
+ * in most NxWidget files. Thanks Antony!
+ *
+ * Copyright (c) 2007-2011, Antony Dzeryn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names "Woopsi", "Simian Zombie" nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sched.h>
+#include <debug.h>
+
+#include "nxconfig.hxx"
+#include "cnxserver.hxx"
+#include "cnxstring.hxx"
+#include "cwidgetstyle.hxx"
+#include "cnxfont.hxx"
+#include "singletons.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Global Static Data
+ ****************************************************************************/
+
+using namespace NXWidgets;
+
+CWidgetStyle *NXWidgets::g_defaultWidgetStyle; /**< The default widget style */
+CNxString *NXWidgets::g_nullString; /**< The reusable empty string */
+TNxArray<CNxTimer*> *NXWidgets::g_nxTimers; /**< An array of all timers */
+
+/****************************************************************************
+ * Method Implementations
+ ****************************************************************************/
+
+/**
+ * Setup misc singleton instances. Why is there here? Because it needs to be
+ * done one time before any widgets are created. So why isn't it just the
+ * default style just a statically constructed class? Because not all platforms
+ * will support static class constructions.
+ */
+
+void NXWidgets::instantiateSingletons(void)
+{
+ // Disable pre-emption. Since we are dealing with global resources here we
+ // are not inherently thread-safe.
+
+ sched_lock();
+
+ // Create a global, empty string that may be used whereever a string is
+ // required, but not needed.
+
+ if (!g_nullString)
+ {
+ g_nullString = new CNxString();
+ }
+
+ // Setup the default widget style
+
+ if (!g_defaultWidgetStyle)
+ {
+ // Create the singleton
+
+ g_defaultWidgetStyle = new CWidgetStyle();
+
+ // Default colors
+
+ g_defaultWidgetStyle->colors.background = CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR;
+ g_defaultWidgetStyle->colors.selectedBackground = CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR;
+ g_defaultWidgetStyle->colors.shineEdge = CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR;
+ g_defaultWidgetStyle->colors.shadowEdge = CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR;
+ g_defaultWidgetStyle->colors.highlight = CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR;
+
+ g_defaultWidgetStyle->colors.disabledText = CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR;
+ g_defaultWidgetStyle->colors.enabledText = CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR;
+ g_defaultWidgetStyle->colors.selectedText = CONFIG_NXWIDGETS_DEFAULT_SELECTEDTEXTCOLOR;
+
+ // Default font using the default font ID and the default font colors
+
+ g_defaultWidgetStyle->font = new CNxFont((enum nx_fontid_e)CONFIG_NXWIDGETS_DEFAULT_FONTID,
+ CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR,
+ CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
+ }
+
+ // Create the timer list
+
+ if (!g_nxTimers)
+ {
+ g_nxTimers = new TNxArray<CNxTimer*>();
+ }
+
+ sched_unlock();
+}
+
+/**
+ * Free the singleton instances when the last NX server is destroyed.
+ */
+
+void NXWidgets::freeSingletons(void)
+{
+ // Delete the null string singleton
+
+ if (g_nullString)
+ {
+ delete g_nullString;
+ g_nullString = (CNxString *)NULL;
+ }
+
+ // Delete the default widget style singleton
+
+ if (g_defaultWidgetStyle)
+ {
+ if (g_defaultWidgetStyle->font)
+ {
+ delete g_defaultWidgetStyle->font;
+ }
+
+ delete g_defaultWidgetStyle;
+ g_defaultWidgetStyle = (CWidgetStyle *)NULL;
+ }
+
+ // Free the timer list
+
+ if (g_nxTimers)
+ {
+ delete g_nxTimers;
+ g_nxTimers = (TNxArray<CNxTimer*> *)NULL;
+ }
+
+}
+