Squashed commit of the following:

apps/graphics/twm4nx:  Adds some colors and better style control to support the CONTEMPORARY theme.  Still getting a few artifacts on the display.

    apps/graphics/twm4nx:  Use custom CWidgetStyle to force Icon background to match selected desktop background.

    apps/graphics/nxglyphs:  Add more modern looking button images for the Twm4Nx CONTEMPORARY theme

    apps/graphics/twm4nx:  Add some definitions to support Themes.  Background image is now optional.
This commit is contained in:
Gregory Nutt 2019-05-21 14:48:01 -06:00
parent 5cad41c973
commit 0a00a9950c
27 changed files with 1628 additions and 40 deletions

View file

@ -108,7 +108,9 @@ namespace NXWidgets
extern const struct SRlePaletteBitmap g_calibrationBitmap;
extern const struct SRlePaletteBitmap g_cmdBitmap;
extern const struct SRlePaletteBitmap g_menuBitmap;
extern const struct SRlePaletteBitmap g_menu2Bitmap;
extern const struct SRlePaletteBitmap g_resizeBitmap;
extern const struct SRlePaletteBitmap g_resize2Bitmap;
extern const struct SRlePaletteBitmap g_nxiconBitmap;
// Used by NxWM meda player
@ -120,8 +122,10 @@ namespace NXWidgets
extern const struct SRlePaletteBitmap g_mplayerRewBitmap;
extern const struct SRlePaletteBitmap g_mplayerVolBitmap;
extern const struct SRlePaletteBitmap g_minimizeBitmap;
extern const struct SRlePaletteBitmap g_minimize2Bitmap;
extern const struct SRlePaletteBitmap g_playBitmap;
extern const struct SRlePaletteBitmap g_stopBitmap;
extern const struct SRlePaletteBitmap g_stop2Bitmap;
}
#endif // __cplusplus

View file

@ -125,8 +125,8 @@ namespace NXWidgets
class CWidgetStyle
{
public:
CWidgetColors colors; /**< Default widget colors */
CNxFont *font; /**< Default font */
CWidgetColors colors; /**< Default widget colors */
CNxFont *font; /**< Default font */
};
}

View file

@ -128,11 +128,19 @@
// Colors
#ifndef CONFIG_TWM4NX_NXTERM_WCOLOR
# define CONFIG_TWM4NX_NXTERM_WCOLOR CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_NXTERM_WCOLOR CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
# else
# define CONFIG_TWM4NX_NXTERM_WCOLOR MKRGB(188,152,106)
# endif
#endif
#ifndef CONFIG_TWM4NX_NXTERM_FONTCOLOR
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
# else
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR MKRGB(112,70,14)
# endif
#endif
// Font ID

View file

@ -79,7 +79,9 @@ namespace Twm4Nx
FAR CTwm4Nx *m_twm4nx; /**< Cached CTwm4Nx instance */
mqd_t m_eventq; /**< NxWidget event message queue */
FAR NXWidgets::CBgWindow *m_backWindow; /**< The background window */
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
FAR NXWidgets::CImage *m_backImage; /**< The background image */
#endif
/**
* Create the background window.
@ -96,6 +98,7 @@ namespace Twm4Nx
bool createBackgroundWidget(void);
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
/**
* Create the background image.
*
@ -104,6 +107,7 @@ namespace Twm4Nx
*/
bool createBackgroundImage(FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap);
#endif
/**
* Release resources held by the background.

View file

@ -173,6 +173,7 @@ namespace Twm4Nx
// Toolbar
FAR NXWidgets::CNxToolbar *m_toolbar; /**< The tool bar sub-window */
FAR NXWidgets::CWidgetStyle m_tbStyle; /**< The tool bar widget style */
FAR NXWidgets::CLabel *m_tbTitle; /**< Toolbar title widget */
nxgl_coord_t m_tbHeight; /**< Height of the toolbar */
nxgl_coord_t m_tbLeftX; /**< Rightmost position of left buttons */

View file

@ -86,12 +86,18 @@
/**
* CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
* MKRGB(148,189,215)
* CONFIG_TWM4NX_BACKGROUND_HASIMAGE - True if the background has an image
* CONFIG_TWM4NX_BACKGROUND_IMAGE - The name of the image to use in the
* background window. Default:NXWidgets::g_nuttxBitmap160x160
*/
#ifndef CONFIG_TWM4NX_BACKGROUND_IMAGE
# define CONFIG_TWM4NX_BACKGROUND_IMAGE NXWidgets::g_nuttxBitmap160x160
#ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_BACKGROUND_HASIMAGE 1
# ifndef CONFIG_TWM4NX_BACKGROUND_IMAGE
# define CONFIG_TWM4NX_BACKGROUND_IMAGE NXWidgets::g_nuttxBitmap160x160
# endif
#else
# undef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
#endif
// Windows //////////////////////////////////////////////////////////////////
@ -111,19 +117,35 @@
*/
#ifndef CONFIG_TWM4NX_MENU_IMAGE
# define CONFIG_TWM4NX_MENU_IMAGE NXWidgets::g_menuBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_MENU_IMAGE NXWidgets::g_menuBitmap
# else
# define CONFIG_TWM4NX_MENU_IMAGE NXWidgets::g_menu2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_MINIMIZE_IMAGE
# define CONFIG_TWM4NX_MINIMIZE_IMAGE NXWidgets::g_minimizeBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_MINIMIZE_IMAGE NXWidgets::g_minimizeBitmap
# else
# define CONFIG_TWM4NX_MINIMIZE_IMAGE NXWidgets::g_minimize2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_RESIZE_IMAGE
# define CONFIG_TWM4NX_RESIZE_IMAGE NXWidgets::g_resizeBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_RESIZE_IMAGE NXWidgets::g_resizeBitmap
# else
# define CONFIG_TWM4NX_RESIZE_IMAGE NXWidgets::g_resize2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_TERMINATE_IMAGE
# define CONFIG_TWM4NX_TERMINATE_IMAGE NXWidgets::g_stopBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_TERMINATE_IMAGE NXWidgets::g_stopBitmap
# else
# define CONFIG_TWM4NX_TERMINATE_IMAGE NXWidgets::g_stop2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_ICONMGR_IMAGE
@ -174,23 +196,56 @@
* CONFIG_TWM4NX_MENU_IMAGE. Menu image (see toolbar icons)
*/
// Themes ///////////////////////////////////////////////////////////////////
/**
* CONFIG_TWM4NX_CLASSIC. Strong bordered windows with dark primary colors.
* Reminiscent of Windows 98.
* CONFIG_TWM4NX_CONTEMPORARY. Border-less windows in pastel shades for a
* more contemporary look
*
* Selecting a theme selects default colors, button images, and icons. For
* a given theme to work correctly, it may depend on other configuration
* settings outside of Twm4Nx.
*/
#if defined(CONFIG_TWM4NX_CONTEMPORARY) && CONFIG_NXTK_BORDERWIDTH != 0
# warning Contemporary theme needs border-less windows (CONFIG_NXTK_BORDERWIDTH == 0)
#endif
// Colors ///////////////////////////////////////////////////////////////////
/**
* Color configuration
*
* CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
* MKRGB(148,189,215)
* CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR - Normal background color. Defaults:
* Classic Theme: MKRGB(148,189,215)
* Contemporary Theme: MKRGB(101,157,189)
* CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR - Select background color.
* Default: MKRGB(206,227,241)
* Defaults:
* Classic Theme: MKRGB(206,227,241)
* Contemporary Theme: MKRGB(143,191,219)
* CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR - Normal toolbar background color. Defaults:
* Classic Theme: MKRGB(148,189,215)
* Contemporary Theme: MKRGB(193,167,79)
* CONFIG_TWM4NX_DEFAULT_SELECTTOOLBARCOLOR - Select toolbar color.
* Defaults:
* Classic Theme: MKRGB(206,227,241)
* Contemporary Theme: MKRGB(251,238,193)
* CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR - Color of the bright edge of a border.
* Default: MKRGB(255,255,255)
* Defaults:
* Classic Theme: MKRGB(255,255,255)
* Contemporary Theme: MKRGB(251,240,199)
* CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR - Color of the shadowed edge of a border.
* Default: MKRGB(0,0,0)
* CONFIG_TWM4NX_DEFAULT_FONTCOLOR - Default font color. Default:
* MKRGB(0,0,0)
* CONFIG_TWM4NX_TRANSPARENT_COLOR - The "transparent" color. Default:
* MKRGB(0,0,0)
* Defaults:
* Classic Theme: MKRGB(0,0,0)
* Contemporary Theme: MKRGB(201,165,116)
* CONFIG_TWM4NX_DEFAULT_FONTCOLOR - Default font color. Defaults:
* Classic Theme: MKRGB(255,255,255)
* Contemporary Theme: MKRGB(255,255,255)
* CONFIG_TWM4NX_TRANSPARENT_COLOR - The "transparent" color. Defaults:
* Classic Theme: MKRGB(0,0,0)
* Contemporary Theme: MKRGB(0,0,0)
*/
/**
@ -198,7 +253,11 @@
*/
#ifndef CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
# define CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR MKRGB(148,189,215)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR MKRGB(148,189,215)
# else
# define CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR MKRGB(101,148,188)
# endif
#endif
/**
@ -206,7 +265,35 @@
*/
#ifndef CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR
# define CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(206,227,241)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(206,227,241)
# else
# define CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(158,193,211)
# endif
#endif
/**
* Normal toolbar background color
*/
#ifndef CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR MKRGB(148,189,215)
# else
# define CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR MKRGB(193,167,79)
# endif
#endif
/**
* Default selected toolbar background color
*/
#ifndef CONFIG_TWM4NX_DEFAULT_SELECTEDTOOLBARCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SELECTEDTOOLBARCOLOR MKRGB(206,227,241)
# else
# define CONFIG_TWM4NX_DEFAULT_SELECTEDTOOLBARCOLOR MKRGB(251,238,193)
# endif
#endif
/**
@ -214,11 +301,19 @@
*/
#ifndef CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR
# define CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR MKRGB(248,248,248)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR MKRGB(248,248,248)
# else
# define CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR MKRGB(251,240,199)
# endif
#endif
#ifndef CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR
# define CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR MKRGB(35,58,73)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR MKRGB(35,58,73)
# else
# define CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR MKRGB(201,165,116)
# endif
#endif
/**
@ -314,27 +409,23 @@
// Font Colors
#ifndef CONFIG_TWM4NX_TITLE_FONTCOLOR
# define CONFIG_TWM4NX_TITLE_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_TITLE_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_MENU_FONTCOLOR
# define CONFIG_TWM4NX_MENU_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_MENU_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_ICON_FONTCOLOR
# define CONFIG_TWM4NX_ICON_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_ICON_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_SIZE_FONTCOLOR
# define CONFIG_TWM4NX_SIZE_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_SIZE_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_ICONMGR_FONTCOLOR
# define CONFIG_TWM4NX_ICONMGR_FONTCOLOR MKRGB(0,64,0)
#endif
#ifndef CONFIG_TWM4NX_DEFAULT_FONTCOLOR
# define CONFIG_TWM4NX_DEFAULT_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_ICONMGR_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
// Input Devices /////////////////////////////////////////////////////////////