Update NxWM colors; remove NxWidgets shelving

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4698 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-05-04 02:56:02 +00:00
parent 06393922c3
commit 78ec889980
8 changed files with 23 additions and 374 deletions

View File

@ -22,3 +22,6 @@
need to "rewind" to the beginning of the image. need to "rewind" to the beginning of the image.
* CRlePalettBitmap: Fixe a positioning problem. It was actually losing * CRlePalettBitmap: Fixe a positioning problem. It was actually losing
the last row of every image! the last row of every image!
* CNxWidget: Removed support for "shelving" widgets. I will be removing
some lesser used feature over time in order to reduce the NxWidgets
footprint.

View File

@ -131,8 +131,7 @@ namespace NXWidgets
enum CloseType enum CloseType
{ {
CLOSE_TYPE_CLOSE = 0, /**< Widgets should call the close() method */ CLOSE_TYPE_CLOSE = 0, /**< Widgets should call the close() method */
CLOSE_TYPE_HIDE = 1, /**< Widgets should call the hide() method */ CLOSE_TYPE_HIDE = 1 /**< Widgets should call the hide() method */
CLOSE_TYPE_SHELVE = 2 /**< Widgets should call the shelve() method */
}; };
/** /**
@ -158,7 +157,6 @@ namespace NXWidgets
uint8_t hasFocus : 1; /**< True if the widget has focus. */ uint8_t hasFocus : 1; /**< True if the widget has focus. */
uint8_t dragging : 1; /**< True if the widget is being dragged. */ uint8_t dragging : 1; /**< True if the widget is being dragged. */
uint8_t deleted : 1; /**< True if the widget has been deleted. */ 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 borderless : 1; /**< True if the widget is borderless. */
uint8_t draggable : 1; /**< True if the widget can be dragged. */ uint8_t draggable : 1; /**< True if the widget can be dragged. */
uint8_t drawingEnabled : 1; /**< True if the widget can be drawn. */ uint8_t drawingEnabled : 1; /**< True if the widget can be drawn. */
@ -219,7 +217,6 @@ namespace NXWidgets
CNxWidget *m_parent; /**< Pointer to the widget's parent. */ CNxWidget *m_parent; /**< Pointer to the widget's parent. */
CNxWidget *m_focusedChild; /**< Pointer to the child widget that has focus. */ CNxWidget *m_focusedChild; /**< Pointer to the child widget that has focus. */
TNxArray<CNxWidget*> m_children; /**< List of child widgets. */ TNxArray<CNxWidget*> m_children; /**< List of child widgets. */
TNxArray<CNxWidget*> m_shelvedWidgets; /**< List of shelved child widgets. */
// Visible regions // Visible regions
@ -281,16 +278,6 @@ namespace NXWidgets
void closeChild(CNxWidget *widget); 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 * Redraws all regions of child widgets that fall within the invalidRects
* regions. * regions.
@ -654,17 +641,6 @@ namespace NXWidgets
return m_flags.dragging; 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. * Is the widget modal? Only true if the Widget singleton is also modal.
* *
@ -1171,27 +1147,6 @@ namespace NXWidgets
void close(void); 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. * Draws the widget and makes it visible.
* Does not steal focus from other widgets. * Does not steal focus from other widgets.
@ -1391,31 +1346,6 @@ namespace NXWidgets
void moveChildToDeleteQueue(CNxWidget *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 * Sets the supplied widget as the focused child. The widget must
* be a child of this widget. * be a child of this widget.

View File

@ -269,22 +269,6 @@ namespace NXWidgets
virtual void handleDoubleClickEvent(const CWidgetEventArgs &e) { } 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. * Handle a widget action event.
* *

View File

@ -305,18 +305,6 @@ namespace NXWidgets
void raiseShowEvent(void); 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. * Raise an enable event to the event handler.
*/ */

View File

@ -173,7 +173,6 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
m_flags.drawingEnabled = false; m_flags.drawingEnabled = false;
m_flags.enabled = true; m_flags.enabled = true;
m_flags.erased = true; m_flags.erased = true;
m_flags.shelved = false;
m_flags.visibleRegionCacheInvalid = true; m_flags.visibleRegionCacheInvalid = true;
m_flags.hidden = false; m_flags.hidden = false;
m_flags.modal = false; m_flags.modal = false;
@ -236,13 +235,6 @@ CNxWidget::~CNxWidget(void)
m_children[0]->destroy(); m_children[0]->destroy();
} }
// Delete shelved children
while (m_shelvedWidgets.size() > 0)
{
m_shelvedWidgets[0]->destroy();
}
// Remove ourselve from the controlled widget list // Remove ourselve from the controlled widget list
m_widgetControl->removeControlledWidget(this); m_widgetControl->removeControlledWidget(this);
@ -346,14 +338,14 @@ const bool CNxWidget::isDrawingEnabled(void) const
{ {
if (m_parent->isDrawingEnabled()) if (m_parent->isDrawingEnabled())
{ {
// Drawing is enabled if the widget is drawable, not deleted, and not shelved // Drawing is enabled if the widget is drawable and not deleted
return (m_flags.drawingEnabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden)); return (m_flags.drawingEnabled && (!m_flags.deleted) && (!m_flags.hidden));
} }
} }
else else
{ {
return (m_flags.drawingEnabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden)); return (m_flags.drawingEnabled && (!m_flags.deleted) && (!m_flags.hidden));
} }
return false; return false;
@ -373,14 +365,14 @@ const bool CNxWidget::isHidden(void) const
{ {
if (!m_parent->isHidden()) if (!m_parent->isHidden())
{ {
// Hidden if the widget is deleted, shelved or hidden // Hidden if the widget is deleted or hidden
return (m_flags.deleted || m_flags.shelved || m_flags.hidden); return (m_flags.deleted || m_flags.hidden);
} }
} }
else else
{ {
return (m_flags.deleted || m_flags.shelved || m_flags.hidden); return (m_flags.deleted || m_flags.hidden);
} }
return true; return true;
@ -400,14 +392,14 @@ const bool CNxWidget::isEnabled() const
{ {
if (m_parent->isEnabled()) if (m_parent->isEnabled())
{ {
// Enabled if the widget is enabled, not deleted, not shelved and not hidden // Enabled if the widget is enabled, not deleted and not hidden
return (m_flags.enabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden)); return (m_flags.enabled && (!m_flags.deleted) && (!m_flags.hidden));
} }
} }
else else
{ {
return (m_flags.enabled && (!m_flags.deleted) && (!m_flags.shelved) && (!m_flags.hidden)); return (m_flags.enabled && (!m_flags.deleted) && (!m_flags.hidden));
} }
return false; return false;
@ -682,79 +674,6 @@ void CNxWidget::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 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. * Draws the widget and makes it visible.
* Does not steal focus from other widgets. * Does not steal focus from other widgets.
@ -1495,71 +1414,6 @@ void CNxWidget::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 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 * Sets the supplied widget as the focused child. The widget must
* be a child of this widget. * be a child of this widget.
@ -2037,24 +1891,6 @@ bool CNxWidget::removeChild(CNxWidget *widget)
} }
} }
// 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; return false;
} }
@ -2263,65 +2099,6 @@ void CNxWidget::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 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 * Redraws all regions of child widgets that fall within the invalidRects
* regions. * regions.
* *

View File

@ -436,40 +436,6 @@ void CWidgetEventHandlerList::raiseShowEvent(void)
} }
} }
/**
* 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. * Raise an enable event to the event handler.
*/ */

View File

@ -138,7 +138,7 @@
#endif #endif
#ifndef CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR #ifndef CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR
# define CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR MKRGB(0,0,0) # define CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR MKRGB(35,58,73)
#endif #endif
/** /**
@ -291,11 +291,11 @@
#endif #endif
#ifndef CONFIG_NXWM_NXCONSOLE_WCOLOR #ifndef CONFIG_NXWM_NXCONSOLE_WCOLOR
# define CONFIG_NXWM_NXCONSOLE_WCOLOR MKRGB(192,192,192) # define CONFIG_NXWM_NXCONSOLE_WCOLOR CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR
#endif #endif
#ifndef CONFIG_NXWM_NXCONSOLE_FONTCOLOR #ifndef CONFIG_NXWM_NXCONSOLE_FONTCOLOR
# define CONFIG_NXWM_NXCONSOLE_FONTCOLOR MKRGB(0,0,0) # define CONFIG_NXWM_NXCONSOLE_FONTCOLOR CONFIG_NXWM_DEFAULT_FONTCOLOR
#endif #endif
#ifndef CONFIG_NXWM_NXCONSOLE_FONTID #ifndef CONFIG_NXWM_NXCONSOLE_FONTID

View File

@ -532,8 +532,8 @@ CONFIG_NX_PACKEDMSFIRST=n
CONFIG_NX_MOUSE=y CONFIG_NX_MOUSE=y
CONFIG_NX_KBD=y CONFIG_NX_KBD=y
#CONFIG_NXTK_BORDERWIDTH=4 #CONFIG_NXTK_BORDERWIDTH=4
CONFIG_NXTK_BORDERCOLOR1=0x00a9a9a9 CONFIG_NXTK_BORDERCOLOR1=0x005a96bd
CONFIG_NXTK_BORDERCOLOR2=0x00696969 CONFIG_NXTK_BORDERCOLOR2=0x00233a49
CONFIG_NXTK_AUTORAISE=n CONFIG_NXTK_AUTORAISE=n
CONFIG_NXFONT_SANS22X29=n CONFIG_NXFONT_SANS22X29=n
CONFIG_NXFONT_SANS23X27=y CONFIG_NXFONT_SANS23X27=y
@ -565,6 +565,7 @@ CONFIG_NXWIDGETS_SERVERSTACK=16384
CONFIG_NXWIDGETS_LISTENERSTACK=8192 CONFIG_NXWIDGETS_LISTENERSTACK=8192
CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215) CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215)
CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241) CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241)
CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=MKRGB(35,58,73)
CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_TASKBAR_LEFT=y
CONFIG_NXWM_NXCONSOLE_STACKSIZE=8192 CONFIG_NXWM_NXCONSOLE_STACKSIZE=8192