summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets/include/nxconfig.hxx
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 /NxWidgets/libnxwidgets/include/nxconfig.hxx
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
Diffstat (limited to 'NxWidgets/libnxwidgets/include/nxconfig.hxx')
-rw-r--r--NxWidgets/libnxwidgets/include/nxconfig.hxx444
1 files changed, 444 insertions, 0 deletions
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