NXWidgets  1.19
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NXWidgets::CNxWidget Class Reference

#include <cnxwidget.hxx>

Inheritance diagram for NXWidgets::CNxWidget:
Inheritance graph

Classes

struct  Flags
 
struct  WidgetBorderSize
 

Public Types

enum  WidgetFlagType {
  WIDGET_BORDERLESS = 0x0001, WIDGET_DRAGGABLE = 0x0002, WIDGET_PERMEABLE = 0x0004, WIDGET_DOUBLE_CLICKABLE = 0x0008,
  WIDGET_NO_RAISE_EVENTS = 0x0010
}
 

Public Member Functions

 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)
 
virtual ~CNxWidget (void)
 
nxgl_coord_t getX (void) const
 
nxgl_coord_t getY (void) const
 
nxgl_coord_t getRelativeX (void) const
 
nxgl_coord_t getRelativeY (void) const
 
bool hasFocus (void) const
 
bool isDeleted (void) const
 
bool isDrawingEnabled (void) const
 
bool isHidden (void) const
 
bool isEnabled (void) const
 
bool isPermeable (void) const
 
bool isDoubleClickable (void) const
 
bool isBorderless (void) const
 
bool isClicked (void) const
 
bool isBeingDragged (void) const
 
nxgl_coord_t getWidth (void) const
 
nxgl_coord_t getHeight (void) const
 
void getSize (struct nxgl_size_s &size) const
 
void getPos (struct nxgl_point_s &pos) const
 
CRect getBoundingBox (void)
 
void getBorderSize (WidgetBorderSize &borderSize)
 
CNxWidgetgetParent (void) const
 
CNxWidgetgetFocusedWidget (void)
 
virtual void getPreferredDimensions (CRect &rect) const
 
void getClientRect (CRect &rect) const
 
void getRect (CRect &rect) const
 
CNxFontgetFont (void) const
 
nxgl_mxpixel_t getBackgroundColor (void) const
 
nxgl_mxpixel_t getSelectedBackgroundColor (void) const
 
nxgl_mxpixel_t getShineEdgeColor (void) const
 
nxgl_mxpixel_t getShadowEdgeColor (void) const
 
nxgl_mxpixel_t getHighlightColor (void) const
 
nxgl_mxpixel_t getDisabledTextColor (void) const
 
nxgl_mxpixel_t getEnabledTextColor (void) const
 
nxgl_mxpixel_t getSelectedTextColor (void) const
 
const CWidgetStylegetWidgetStyle () const
 
void setBorderless (bool isBorderless)
 
void setDraggable (bool isDraggable)
 
void setPermeable (bool permeable)
 
void setDoubleClickable (bool doubleClickable)
 
void addWidgetEventHandler (CWidgetEventHandler *eventHandler)
 
void removeWidgetEventHandler (CWidgetEventHandler *eventHandler)
 
int nWidgetEventHandlers (void) const
 
void setRaisesEvents (bool raises)
 
bool raisesEvents (void) const
 
void disableDrawing (void)
 
void enableDrawing (void)
 
void setBackgroundColor (nxgl_mxpixel_t color)
 
void setSelectedBackgroundColor (nxgl_mxpixel_t color)
 
void setShineEdgeColor (nxgl_mxpixel_t color)
 
void setShadowEdgeColor (nxgl_mxpixel_t color)
 
void setHighlightColor (nxgl_mxpixel_t color)
 
void setDisabledTextColor (nxgl_mxpixel_t color)
 
void setEnabledTextColor (nxgl_mxpixel_t color)
 
void setSelectedTextColor (nxgl_mxpixel_t color)
 
virtual void setFont (CNxFont *font)
 
void redraw (void)
 
bool enable (void)
 
bool disable (void)
 
void close (void)
 
bool show (void)
 
bool hide (void)
 
virtual bool click (nxgl_coord_t x, nxgl_coord_t y)
 
virtual bool isDoubleClick (nxgl_coord_t x, nxgl_coord_t y)
 
bool doubleClick (nxgl_coord_t x, nxgl_coord_t y)
 
bool release (nxgl_coord_t x, nxgl_coord_t y)
 
bool drag (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t vX, nxgl_coord_t vY)
 
bool keyPress (nxwidget_char_t key)
 
bool cursorControl (ECursorControl control)
 
bool focus (void)
 
bool blur (void)
 
bool moveTo (nxgl_coord_t x, nxgl_coord_t y)
 
bool resize (nxgl_coord_t width, nxgl_coord_t height)
 
bool changeDimensions (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height)
 
void moveChildToDeleteQueue (CNxWidget *widget)
 
void setFocusedWidget (CNxWidget *widget)
 
virtual bool checkCollision (nxgl_coord_t x, nxgl_coord_t y) const
 
virtual bool checkCollision (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height) const
 
bool checkCollision (CNxWidget *widget) const
 
void addWidget (CNxWidget *widget)
 
void insertWidget (CNxWidget *widget)
 
void setParent (CNxWidget *parent)
 
void destroy (void)
 
bool remove (void)
 
bool removeChild (CNxWidget *widget)
 
const CNxWidgetgetChild (int index) const
 
int getChildCount (void) const
 
void setBorderSize (const WidgetBorderSize &borderSize)
 

Protected Member Functions

void useWidgetStyle (const CWidgetStyle *style)
 
virtual void drawContents (CGraphicsPort *port)
 
virtual void drawBorder (CGraphicsPort *port)
 
void drawChildren (void)
 
void closeChild (CNxWidget *widget)
 
void startDragging (nxgl_coord_t x, nxgl_coord_t y)
 
void stopDragging (nxgl_coord_t x, nxgl_coord_t y)
 
 CNxWidget (const CNxWidget &widget)
 
virtual void onClick (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onDoubleClick (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onPreRelease (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onRelease (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onReleaseOutside (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onDrag (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t vX, nxgl_coord_t vY)
 
virtual void onDragStart (void)
 
virtual void onDragStop (void)
 
virtual void onFocus (void)
 
virtual void onBlur (void)
 
virtual void onEnable (void)
 
virtual void onDisable (void)
 
virtual void onResize (nxgl_coord_t width, nxgl_coord_t height)
 

Protected Attributes

CWidgetControlm_widgetControl
 
CRect m_rect
 
nxgl_coord_t m_grabPointX
 
nxgl_coord_t m_grabPointY
 
nxgl_coord_t m_newX
 
nxgl_coord_t m_newY
 
CWidgetStyle m_style
 
Flags m_flags
 
CWidgetEventHandlerListm_widgetEventHandlers
 
struct timespec m_lastClickTime
 
nxgl_coord_t m_lastClickX
 
nxgl_coord_t m_lastClickY
 
int m_doubleClickBounds
 
CNxWidgetm_parent
 
CNxWidgetm_focusedChild
 
TNxArray< CNxWidget * > m_children
 
WidgetBorderSize m_borderSize
 

Detailed Description

Class providing all the basic functionality of a NxWidget. All other widgets must must inherit from this class.

Definition at line 121 of file cnxwidget.hxx.

Member Enumeration Documentation

◆ WidgetFlagType

enum NXWidgets::CNxWidget::WidgetFlagType

Enum listing flags that can be set in the constructor's "flags" parameter.

Enumerator
WIDGET_BORDERLESS 

Widget has no border

WIDGET_DRAGGABLE 

Widget can be dragged by the user

WIDGET_PERMEABLE 

Widget's children can exceed this widget's edges

WIDGET_DOUBLE_CLICKABLE 

Widget can be double-clicked

WIDGET_NO_RAISE_EVENTS 

Widget does not raise events

Definition at line 129 of file cnxwidget.hxx.

Constructor & Destructor Documentation

◆ CNxWidget() [1/2]

NXWidgets::CNxWidget::CNxWidget ( const CNxWidget widget)
inlineprotected

Copy constructor is protected to prevent usage.

Definition at line 271 of file cnxwidget.hxx.

◆ CNxWidget() [2/2]

NXWidgets::CNxWidget::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 
)

CNxWidget constructor.

Parameters
pWidgetControlThe controllwing widget for the display
xThe x coordinate of the widget.
yThe y coordinate of the widget.
widthThe width of the widget.
heightThe height of the widget.
flagsBitmask specifying some set-up values for the widget.
styleThe style that the button should use. If this is not specified, the button will use the global default widget style.
See also
WidgetFlagType.

◆ ~CNxWidget()

CNxWidget::~CNxWidget ( void  )
virtual

Destructor.

Definition at line 203 of file cnxwidget.cxx.

Member Function Documentation

◆ addWidget()

void CNxWidget::addWidget ( 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.

Parameters
widgetA pointer to the widget to add to the child list.
See also
insertWidget()

Definition at line 1293 of file cnxwidget.cxx.

◆ addWidgetEventHandler()

void NXWidgets::CNxWidget::addWidgetEventHandler ( CWidgetEventHandler eventHandler)
inline

Adds a widget event handler. The event handler will receive all events raised by this widget.

Parameters
eventHandlerA pointer to the event handler.

Definition at line 854 of file cnxwidget.hxx.

◆ blur()

bool CNxWidget::blur ( void  )

Remove focus from the widget.

Returns
True if the widget lost focus correctly.

Definition at line 951 of file cnxwidget.cxx.

◆ changeDimensions()

bool CNxWidget::changeDimensions ( nxgl_coord_t  x,
nxgl_coord_t  y,
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.

Parameters
xThe new x coordinate.
yThe new y coordinate.
widthThe new width.
heightThe new height.
Returns
True if the widget was adjusted successfully.

Definition at line 1151 of file cnxwidget.cxx.

◆ checkCollision() [1/3]

bool CNxWidget::checkCollision ( nxgl_coord_t  x,
nxgl_coord_t  y 
) const
virtual

Checks if the supplied coordinates collide with this widget.

Parameters
xThe x coordinate to check.
yThe y coordinate to check.
Returns
True if a collision occurred.

Definition at line 1229 of file cnxwidget.cxx.

◆ checkCollision() [2/3]

bool CNxWidget::checkCollision ( nxgl_coord_t  x,
nxgl_coord_t  y,
nxgl_coord_t  width,
nxgl_coord_t  height 
) const
virtual

Checks if the supplied rectangle definition collides with this widget.

Parameters
xThe x coordinate of the rectangle to check.
yThe y coordinate of the rectangle to check.
widthThe width of the rectangle to check.
heightThe height of the rectangle to check.
Returns
True if a collision occurred.

Definition at line 1253 of file cnxwidget.cxx.

◆ checkCollision() [3/3]

bool CNxWidget::checkCollision ( CNxWidget widget) const

Checks if the supplied widget collides with this widget.

Parameters
widgetA pointer to another widget to check for collisions with.
Returns
True if a collision occurred.

Definition at line 1275 of file cnxwidget.cxx.

◆ click()

bool CNxWidget::click ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
virtual

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.

Parameters
xX coordinate of the click.
yY coordinate of the click.
Returns
True if the click was successful.

Definition at line 630 of file cnxwidget.cxx.

◆ close()

void CNxWidget::close ( 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.

Definition at line 552 of file cnxwidget.cxx.

◆ closeChild()

void CNxWidget::closeChild ( CNxWidget widget)
protected

Erase and remove the supplied child widget from this widget and send it to the deletion queue.

Parameters
widgetThe widget to close.
See also
close().

Remove the supplied child widget from this widget and send it to the deletion queue.

Parameters
widgetThe widget to close.
See also
close().

Definition at line 1484 of file cnxwidget.cxx.

◆ cursorControl()

bool CNxWidget::cursorControl ( ECursorControl  control)

Send a cursor control event to the widget.

Parameters
controlThe cursor control code to send to the widget.
Returns
True if the cursor control was processed.

Send a cursor control event to the widget.

Parameters
cursorControlThe cursor control code o send to the widget.
Returns
True if the cursor control was processed.

Definition at line 886 of file cnxwidget.cxx.

◆ destroy()

void NXWidgets::CNxWidget::destroy ( void  )
inline

Delete this widget. This should never be called in user code; widget deletion is handled internally.

Definition at line 1294 of file cnxwidget.hxx.

◆ disable()

bool CNxWidget::disable ( void  )

Disabled the widget.

Returns
True if the widget was disabled.

Definition at line 532 of file cnxwidget.cxx.

◆ disableDrawing()

void NXWidgets::CNxWidget::disableDrawing ( void  )
inline

Disabled drawing of this widget. Widgets hidden using this method will still be processed.

Definition at line 908 of file cnxwidget.hxx.

◆ doubleClick()

bool CNxWidget::doubleClick ( 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.

Parameters
xX coordinate of the click.
yY coordinate of the click.
Returns
True if the click was successful.

Definition at line 719 of file cnxwidget.cxx.

◆ drag()

bool CNxWidget::drag ( nxgl_coord_t  x,
nxgl_coord_t  y,
nxgl_coord_t  vX,
nxgl_coord_t  vY 
)

Drag the widget to the supplied coordinates.

Parameters
xThe x coordinate of the mouse.
yThe y coordinate of the mouse.
vXThe horizontal distance that the mouse was dragged.
vYThe vertical distance that the mouse was dragged.
Returns
True if the drag was successful.

Definition at line 835 of file cnxwidget.cxx.

◆ drawBorder()

virtual void NXWidgets::CNxWidget::drawBorder ( CGraphicsPort port)
inlineprotectedvirtual

◆ drawChildren()

void CNxWidget::drawChildren ( void  )
protected

Draw all visible regions of this widget's children.

Definition at line 1468 of file cnxwidget.cxx.

◆ drawContents()

void CNxWidget::drawContents ( CGraphicsPort port)
protectedvirtual

◆ enable()

bool CNxWidget::enable ( void  )

Enables the widget.

Returns
True if the widget was enabled.

Definition at line 512 of file cnxwidget.cxx.

◆ enableDrawing()

void NXWidgets::CNxWidget::enableDrawing ( void  )
inline

Enables drawing of this widget.

Definition at line 917 of file cnxwidget.hxx.

◆ focus()

bool CNxWidget::focus ( void  )

Give the widget focus.

Returns
True if the widget received focus correctly.

Definition at line 913 of file cnxwidget.cxx.

◆ getBackgroundColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getBackgroundColor ( void  ) const
inline

Gets the color used for the normal background fill.

Returns
Background fill color.

Definition at line 716 of file cnxwidget.hxx.

◆ getBorderSize()

void NXWidgets::CNxWidget::getBorderSize ( WidgetBorderSize borderSize)
inline

Get the dimensions of the border

Definition at line 638 of file cnxwidget.hxx.

◆ getBoundingBox()

CRect NXWidgets::CNxWidget::getBoundingBox ( void  )
inline

Get the window bounding box in physical display coordinated.

Returns
This function returns the window handle.

Definition at line 628 of file cnxwidget.hxx.

◆ getChild()

const CNxWidget * CNxWidget::getChild ( int  index) const

Get the child widget at the specified index.

Parameters
indexIndex of the child to retrieve.
Returns
Pointer to the child at the specified index.

Definition at line 1408 of file cnxwidget.cxx.

◆ getChildCount()

int NXWidgets::CNxWidget::getChildCount ( void  ) const
inline

Get the number of child widgets.

Returns
The number of child widgets belonging to this widget.

Definition at line 1337 of file cnxwidget.hxx.

◆ getClientRect()

void CNxWidget::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. All coordinates are relative to this widget.

Parameters
rectReference to a rect to populate with data.

Definition at line 421 of file cnxwidget.cxx.

◆ getDisabledTextColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getDisabledTextColor ( void  ) const
inline

Gets the color used for text in a disabled widget.

Returns
Disabled text color.

Definition at line 771 of file cnxwidget.hxx.

◆ getEnabledTextColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getEnabledTextColor ( void  ) const
inline

Gets the color used for text in a enabled widget.

Returns
Enabled text color.

Definition at line 782 of file cnxwidget.hxx.

◆ getFocusedWidget()

CNxWidget* NXWidgets::CNxWidget::getFocusedWidget ( void  )
inline

Get a pointer to this widget's focused child.

Returns
This widget's focused child.

Definition at line 663 of file cnxwidget.hxx.

◆ getFont()

CNxFont* NXWidgets::CNxWidget::getFont ( void  ) const
inline

Gets a pointer to the widget's font.

Returns
A pointer to the widget's font.

Definition at line 705 of file cnxwidget.hxx.

◆ getHeight()

nxgl_coord_t NXWidgets::CNxWidget::getHeight ( void  ) const
inline

Get the height of the widget.

Returns
The widget height.

Definition at line 593 of file cnxwidget.hxx.

◆ getHighlightColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getHighlightColor ( void  ) const
inline

Gets the color used as the fill in focused window borders.

Returns
Highlight color.

Definition at line 760 of file cnxwidget.hxx.

◆ getParent()

CNxWidget* NXWidgets::CNxWidget::getParent ( void  ) const
inline

Get a pointer to this widget's parent.

Returns
This widget's parent.

Definition at line 652 of file cnxwidget.hxx.

◆ getPos()

void NXWidgets::CNxWidget::getPos ( struct nxgl_point_s &  pos) const
inline

Get the position of the widget

Returns
The widgets's position

Definition at line 616 of file cnxwidget.hxx.

◆ getPreferredDimensions()

void CNxWidget::getPreferredDimensions ( CRect rect) const
virtual

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.

Parameters
rectReference to a rect to populate with data.

Reimplemented in NXWidgets::CScrollingListBox, NXWidgets::CListBox, NXWidgets::CCycleButton, NXWidgets::CLabel, NXWidgets::CButtonArray, NXWidgets::CImage, NXWidgets::CGlyphButton, NXWidgets::CRadioButtonGroup, and NXWidgets::CNumericEdit.

Definition at line 408 of file cnxwidget.cxx.

◆ getRect()

void CNxWidget::getRect ( 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.

Parameters
rectReference to a rect to populate with data.

Definition at line 448 of file cnxwidget.cxx.

◆ getRelativeX()

nxgl_coord_t CNxWidget::getRelativeX ( void  ) const

Get the x coordinate of the widget relative to its parent.

Returns
Parent-space x coordinate.

Definition at line 277 of file cnxwidget.cxx.

◆ getRelativeY()

nxgl_coord_t CNxWidget::getRelativeY ( void  ) const

Get the y coordinate of the widget relative to its parent.

Returns
Parent-space y coordinate.

Definition at line 288 of file cnxwidget.cxx.

◆ getSelectedBackgroundColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getSelectedBackgroundColor ( void  ) const
inline

Gets the color used for the background fill when the widget is selected.

Returns
Dark color.

Definition at line 727 of file cnxwidget.hxx.

◆ getSelectedTextColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getSelectedTextColor ( void  ) const
inline

Gets the color used for text in a clicked widget.

Returns
Selected text color.

Definition at line 793 of file cnxwidget.hxx.

◆ getShadowEdgeColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getShadowEdgeColor ( void  ) const
inline

Gets the color used as the dark edge in bevelled boxes.

Returns
Shadow color.

Definition at line 749 of file cnxwidget.hxx.

◆ getShineEdgeColor()

nxgl_mxpixel_t NXWidgets::CNxWidget::getShineEdgeColor ( void  ) const
inline

Gets the color used as the light edge in bevelled boxes.

Returns
Shine color.

Definition at line 738 of file cnxwidget.hxx.

◆ getSize()

void NXWidgets::CNxWidget::getSize ( struct nxgl_size_s &  size) const
inline

Get the size of the widget

Returns
The widgets's size

Definition at line 604 of file cnxwidget.hxx.

◆ getWidgetStyle()

const CWidgetStyle* NXWidgets::CNxWidget::getWidgetStyle ( ) const
inline

Get the style used by this widget

Returns
Const pointer to CWidgetStyle stored inside this widget.

Definition at line 804 of file cnxwidget.hxx.

◆ getWidth()

nxgl_coord_t NXWidgets::CNxWidget::getWidth ( void  ) const
inline

Get the width of the widget.

Returns
The widget width.

Definition at line 582 of file cnxwidget.hxx.

◆ getX()

nxgl_coord_t CNxWidget::getX ( void  ) const

Get the x coordinate of the widget in "Widget space".

Returns
Widget space x coordinate.

Definition at line 245 of file cnxwidget.cxx.

◆ getY()

nxgl_coord_t CNxWidget::getY ( void  ) const

Get the y coordinate of the widget in "Widget space".

Returns
Widget space y coordinate.

Definition at line 261 of file cnxwidget.cxx.

◆ hasFocus()

bool NXWidgets::CNxWidget::hasFocus ( void  ) const
inline

Is the widget active? A value of true indicates that this widget has focus or is an ancestor of the widget with focus.

Returns
True if active.

Definition at line 472 of file cnxwidget.hxx.

◆ hide()

bool CNxWidget::hide ( void  )

Erases the widget and makes it invisible. Does not re-assign focus to another widget.

Returns
True if the widget was hidden.
See also
show()

Definition at line 607 of file cnxwidget.cxx.

◆ insertWidget()

void CNxWidget::insertWidget ( 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.

Parameters
widgetA pointer to the widget to add to the child list.
See also
addWidget()

Definition at line 1321 of file cnxwidget.cxx.

◆ isBeingDragged()

bool NXWidgets::CNxWidget::isBeingDragged ( void  ) const
inline

Is the widget being dragged?

Returns
True if the widget is currently being dragged.

Definition at line 571 of file cnxwidget.hxx.

◆ isBorderless()

bool NXWidgets::CNxWidget::isBorderless ( void  ) const
inline

Does the widget have a border?

Returns
True if the widget does not have a border.

Definition at line 549 of file cnxwidget.hxx.

◆ isClicked()

bool NXWidgets::CNxWidget::isClicked ( void  ) const
inline

Is the widget clicked?

Returns
True if the widget is currently clicked.

Definition at line 560 of file cnxwidget.hxx.

◆ isDeleted()

bool CNxWidget::isDeleted ( void  ) const

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.

Returns
True if marked for deletion.

Definition at line 304 of file cnxwidget.cxx.

◆ isDoubleClick()

bool CNxWidget::isDoubleClick ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
virtual

Check if the click is a double-click.

Parameters
xX coordinate of the click.
yY coordinate of the click.
Returns
True if the click is a double-click.

Reimplemented in NXWidgets::CListBox.

Definition at line 687 of file cnxwidget.cxx.

◆ isDoubleClickable()

bool NXWidgets::CNxWidget::isDoubleClickable ( void  ) const
inline

IS the widget double-clickable?

Returns
True if the widget watches for double-clicks.

Definition at line 538 of file cnxwidget.hxx.

◆ isDrawingEnabled()

bool CNxWidget::isDrawingEnabled ( 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.

Returns
True if drawing is enabled.

Definition at line 325 of file cnxwidget.cxx.

◆ isEnabled()

bool CNxWidget::isEnabled ( 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.

Returns
True if enabled.

Definition at line 381 of file cnxwidget.cxx.

◆ isHidden()

bool CNxWidget::isHidden ( 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.

Returns
True if hidden.

Definition at line 354 of file cnxwidget.cxx.

◆ isPermeable()

bool NXWidgets::CNxWidget::isPermeable ( void  ) const
inline

Are the widget's edges permeable or solid? Permeable widgets do not enforce their dimensions on the coordinates and dimensions of child widgets.

Returns
True if permeable.

Definition at line 528 of file cnxwidget.hxx.

◆ keyPress()

bool CNxWidget::keyPress ( nxwidget_char_t  key)

Send a keypress to the widget.

Parameters
keyThe keycode to send to the widget.
Returns
True if the keypress was processed.

Definition at line 858 of file cnxwidget.cxx.

◆ moveChildToDeleteQueue()

void CNxWidget::moveChildToDeleteQueue ( CNxWidget widget)

Moves the supplied child widget to the deletion queue. For framework use only.

Parameters
widgetA pointer to the child widget.

Definition at line 1168 of file cnxwidget.cxx.

◆ moveTo()

bool CNxWidget::moveTo ( nxgl_coord_t  x,
nxgl_coord_t  y 
)

Move the widget to the new coordinates. Co-ordinates are relative to the parent widget.

Parameters
xThe new x coordinate.
yThe new y coordinate.
Returns
True if the move was successful.

Definition at line 990 of file cnxwidget.cxx.

◆ nWidgetEventHandlers()

int NXWidgets::CNxWidget::nWidgetEventHandlers ( void  ) const
inline

Return the number of registered event handlers

Returns
The number of registered event handlers

Definition at line 876 of file cnxwidget.hxx.

◆ onBlur()

virtual void NXWidgets::CNxWidget::onBlur ( void  )
inlineprotectedvirtual

Called when the widget loses focus. Override this when creating new widgets if the widget should exhibit additional behaviour when losing focus.

Reimplemented in NXWidgets::CTextBox.

Definition at line 374 of file cnxwidget.hxx.

◆ onClick()

virtual void NXWidgets::CNxWidget::onClick ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
inlineprotectedvirtual

◆ onDisable()

virtual void NXWidgets::CNxWidget::onDisable ( void  )
inlineprotectedvirtual

Called when the widget is disabled. Override this when creating new widgets if the widget should exhibit additional behaviour when disabled.

Definition at line 390 of file cnxwidget.hxx.

◆ onDoubleClick()

virtual void NXWidgets::CNxWidget::onDoubleClick ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
inlineprotectedvirtual

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.

Parameters
xThe x coordinate of the click.
yThe y coordinate of the click.

Reimplemented in NXWidgets::CMultiLineTextBox, NXWidgets::CTextBox, and NXWidgets::CListBox.

Definition at line 295 of file cnxwidget.hxx.

◆ onDrag()

virtual void NXWidgets::CNxWidget::onDrag ( nxgl_coord_t  x,
nxgl_coord_t  y,
nxgl_coord_t  vX,
nxgl_coord_t  vY 
)
inlineprotectedvirtual

Called when the widget is dragged. Override this when creating new widgets if the widget should exhibit additional behaviour when it is dragged.

Parameters
xThe x coordinate of the mouse.
yThe y coordinate of the mouse.
vXX distance dragged.
vYY distance dragged.

Reimplemented in NXWidgets::CGlyphSliderHorizontalGrip, NXWidgets::CSliderHorizontalGrip, NXWidgets::CSliderVerticalGrip, and NXWidgets::CScrollingPanel.

Definition at line 341 of file cnxwidget.hxx.

◆ onDragStart()

virtual void NXWidgets::CNxWidget::onDragStart ( void  )
inlineprotectedvirtual

Called when the widget starts being dragged. Override this when creating new widgets if the widget should exhibit additional behaviour when dragging starts.

Definition at line 350 of file cnxwidget.hxx.

◆ onDragStop()

virtual void NXWidgets::CNxWidget::onDragStop ( void  )
inlineprotectedvirtual

Called when the widget stops being dragged. Override this when creating new widgets if the widget should exhibit additional behaviour when dragging stops.

Definition at line 358 of file cnxwidget.hxx.

◆ onEnable()

virtual void NXWidgets::CNxWidget::onEnable ( void  )
inlineprotectedvirtual

Called when the widget is enabled. Override this when creating new widgets if the widget should exhibit additional behaviour when enabled.

Definition at line 382 of file cnxwidget.hxx.

◆ onFocus()

virtual void NXWidgets::CNxWidget::onFocus ( void  )
inlineprotectedvirtual

Called when the widget gains focus. Override this when creating new widgets if the widget should exhibit additional behaviour when gaining focus.

Definition at line 366 of file cnxwidget.hxx.

◆ onPreRelease()

virtual void NXWidgets::CNxWidget::onPreRelease ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
inlineprotectedvirtual

Called just before the widget is released; the widget will be in the clicked stated. Override this when creating new widgets if the widget should exhibit additional behaviour when it is released.

Parameters
xThe x coordinate of the mouse when released.
yThe y coordinate of the mouse when released.

Reimplemented in NXWidgets::CButton, NXWidgets::CImage, NXWidgets::CGlyphButton, NXWidgets::CCycleButton, and NXWidgets::CButtonArray.

Definition at line 306 of file cnxwidget.hxx.

◆ onRelease()

virtual void NXWidgets::CNxWidget::onRelease ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
inlineprotectedvirtual

Called just after the widget is released; the widget will be in the released stated. Override this when creating new widgets if the widget should exhibit additional behaviour when it is released.

Parameters
xThe x coordinate of the mouse when released.
yThe y coordinate of the mouse when released.

Reimplemented in NXWidgets::CButton, NXWidgets::CImage, NXWidgets::CGlyphButton, NXWidgets::CStickyButton, NXWidgets::CGlyphSliderHorizontalGrip, NXWidgets::CButtonArray, NXWidgets::CSliderHorizontalGrip, NXWidgets::CSliderVerticalGrip, and NXWidgets::CStickyImage.

Definition at line 317 of file cnxwidget.hxx.

◆ onReleaseOutside()

virtual void NXWidgets::CNxWidget::onReleaseOutside ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
inlineprotectedvirtual

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.

Parameters
xThe x coordinate of the mouse when released.
yThe y coordinate of the mouse when released.

Reimplemented in NXWidgets::CButton, NXWidgets::CImage, NXWidgets::CGlyphButton, NXWidgets::CStickyButton, NXWidgets::CCycleButton, NXWidgets::CGlyphSliderHorizontalGrip, NXWidgets::CButtonArray, NXWidgets::CSliderHorizontalGrip, NXWidgets::CSliderVerticalGrip, and NXWidgets::CStickyImage.

Definition at line 328 of file cnxwidget.hxx.

◆ onResize()

virtual void NXWidgets::CNxWidget::onResize ( nxgl_coord_t  width,
nxgl_coord_t  height 
)
inlineprotectedvirtual

Called when the widget is resized. Override this when creating new widgets if the widget should exhibit additional behaviour when resized.

Parameters
widthThe new width.
heightThe new height.

Reimplemented in NXWidgets::CMultiLineTextBox, NXWidgets::CCycleButton, NXWidgets::CLabel, NXWidgets::CSliderVertical, NXWidgets::CSliderHorizontal, NXWidgets::CGlyphSliderHorizontal, NXWidgets::CScrollingListBox, NXWidgets::CGlyphSliderHorizontalGrip, NXWidgets::CScrollingTextBox, NXWidgets::CNumericEdit, NXWidgets::CScrollbarHorizontal, and NXWidgets::CScrollbarVertical.

Definition at line 401 of file cnxwidget.hxx.

◆ raisesEvents()

bool NXWidgets::CNxWidget::raisesEvents ( void  ) const
inline

Check if event handling is enabled for this widget.

Returns
True is event handling is enabled.

Definition at line 898 of file cnxwidget.hxx.

◆ redraw()

void CNxWidget::redraw ( void  )

Draws the visible regions of the widget and the widget's child widgets.

Definition at line 483 of file cnxwidget.cxx.

◆ release()

bool CNxWidget::release ( 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.

Parameters
xX coordinate of the release.
yY coordinate of the release.
Returns
True if the release was successful.

Definition at line 771 of file cnxwidget.cxx.

◆ remove()

bool CNxWidget::remove ( void  )

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.

Returns
True if the widget was successfully removed.

Definition at line 1342 of file cnxwidget.cxx.

◆ removeChild()

bool CNxWidget::removeChild ( CNxWidget widget)

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.

Parameters
widgetPointer to the widget to remove from the hierarchy.
Returns
True if the widget was succesfully removed.

Definition at line 1362 of file cnxwidget.cxx.

◆ removeWidgetEventHandler()

void NXWidgets::CNxWidget::removeWidgetEventHandler ( CWidgetEventHandler eventHandler)
inline

Remove a widget event handler.

Parameters
eventHandlerA pointer to the event handler to remove.

Definition at line 865 of file cnxwidget.hxx.

◆ resize()

bool CNxWidget::resize ( nxgl_coord_t  width,
nxgl_coord_t  height 
)

Resize the widget to the new dimensions.

Parameters
widthThe new width.
heightThe new height.
Returns
True if the resize was successful.

Definition at line 1079 of file cnxwidget.cxx.

◆ setBackgroundColor()

void NXWidgets::CNxWidget::setBackgroundColor ( nxgl_mxpixel_t  color)
inline

Sets the normal background color.

Parameters
colorThe new background color.

Definition at line 928 of file cnxwidget.hxx.

◆ setBorderless()

void CNxWidget::setBorderless ( bool  borderless)

Sets this widget's border state.

Parameters
isBorderlessThe border state.

Definition at line 461 of file cnxwidget.cxx.

◆ setBorderSize()

void CNxWidget::setBorderSize ( const WidgetBorderSize borderSize)

Sets the border size. The border cannot be drawn over in the drawContents() method.

Parameters
borderSizeThe new border size.

Definition at line 1425 of file cnxwidget.cxx.

◆ setDisabledTextColor()

void NXWidgets::CNxWidget::setDisabledTextColor ( nxgl_mxpixel_t  color)
inline

Sets the text color to use when the widget is disabled.

Parameters
colorThe new text color.

Definition at line 983 of file cnxwidget.hxx.

◆ setDoubleClickable()

void NXWidgets::CNxWidget::setDoubleClickable ( bool  doubleClickable)
inline

Sets whether or not the widgets processes double-clicks.

Parameters
doubleClickableThe double-clickable state.

Definition at line 842 of file cnxwidget.hxx.

◆ setDraggable()

void NXWidgets::CNxWidget::setDraggable ( bool  isDraggable)
inline

Sets whether or not this widget can be dragged.

Parameters
isDraggableThe draggable state.

Definition at line 820 of file cnxwidget.hxx.

◆ setEnabledTextColor()

void NXWidgets::CNxWidget::setEnabledTextColor ( nxgl_mxpixel_t  color)
inline

Sets the text color to use when the widget is enabled.

Parameters
colorThe new text color.

Definition at line 994 of file cnxwidget.hxx.

◆ setFocusedWidget()

void CNxWidget::setFocusedWidget ( CNxWidget widget)

Sets the supplied widget as the focused child. The widget must be a child of this widget.

Parameters
widgetA pointer to the child widget.
See also
getFocusedWidget()

Definition at line 1196 of file cnxwidget.cxx.

◆ setFont()

void CNxWidget::setFont ( CNxFont font)
virtual

Sets the font.

Parameters
fontA pointer to the font to use.

NOTE: This font is not deleted when the widget is destroyed!

Reimplemented in NXWidgets::CMultiLineTextBox, NXWidgets::CScrollingListBox, NXWidgets::CLabel, NXWidgets::CButtonArray, NXWidgets::CScrollingTextBox, and NXWidgets::CNumericEdit.

Definition at line 474 of file cnxwidget.cxx.

◆ setHighlightColor()

void NXWidgets::CNxWidget::setHighlightColor ( nxgl_mxpixel_t  color)
inline

Sets the highlight color.

Parameters
colorThe new highlight color.

Definition at line 972 of file cnxwidget.hxx.

◆ setParent()

void NXWidgets::CNxWidget::setParent ( CNxWidget parent)
inline

Set the widget's parent to the widget passed in as a parameter. Called automatically when a widget is added as a child.

Parameters
parentA pointer to the parent widget.

Definition at line 1284 of file cnxwidget.hxx.

◆ setPermeable()

void NXWidgets::CNxWidget::setPermeable ( bool  permeable)
inline

Sets whether or not child widgets can exceed this widget's dimensions.

Parameters
permeableThe permeable state.

Definition at line 831 of file cnxwidget.hxx.

◆ setRaisesEvents()

void NXWidgets::CNxWidget::setRaisesEvents ( bool  raises)
inline

Enables or disables event firing for this widget.

Parameters
raisesTrue to enable events, false to disable.

Definition at line 887 of file cnxwidget.hxx.

◆ setSelectedBackgroundColor()

void NXWidgets::CNxWidget::setSelectedBackgroundColor ( nxgl_mxpixel_t  color)
inline

Sets the background color for a selected widget.

Parameters
colorThe new selected background color.

Definition at line 939 of file cnxwidget.hxx.

◆ setSelectedTextColor()

void NXWidgets::CNxWidget::setSelectedTextColor ( nxgl_mxpixel_t  color)
inline

Sets the text color to use when the widget is highlighted or clicked.

Parameters
colorThe new selected text color.

Definition at line 1005 of file cnxwidget.hxx.

◆ setShadowEdgeColor()

void NXWidgets::CNxWidget::setShadowEdgeColor ( nxgl_mxpixel_t  color)
inline

Sets the shadow edge color.

Parameters
colorThe new shadow edge color.

Definition at line 961 of file cnxwidget.hxx.

◆ setShineEdgeColor()

void NXWidgets::CNxWidget::setShineEdgeColor ( nxgl_mxpixel_t  color)
inline

Sets the shiny edge color.

Parameters
colorThe new shine edge color.

Definition at line 950 of file cnxwidget.hxx.

◆ show()

bool CNxWidget::show ( void  )

Draws the widget and makes it visible. Does not steal focus from other widgets.

Returns
True if the widget was shown.
See also
hide()

Definition at line 585 of file cnxwidget.cxx.

◆ startDragging()

void CNxWidget::startDragging ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
protected

Notify this widget that it is being dragged, and set its drag point.

Parameters
xThe x coordinate of the drag position relative to this widget.
yThe y coordinate of the drag position relative to this widget.

Definition at line 1542 of file cnxwidget.cxx.

◆ stopDragging()

void CNxWidget::stopDragging ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
protected

Notify this widget that it is no longer being dragged.

Definition at line 1561 of file cnxwidget.cxx.

◆ useWidgetStyle()

void CNxWidget::useWidgetStyle ( const CWidgetStyle style)
protected

Use the provided widget style

Definition at line 1437 of file cnxwidget.cxx.

Member Data Documentation

◆ m_borderSize

WidgetBorderSize NXWidgets::CNxWidget::m_borderSize
protected

Size of the widget borders.

Definition at line 208 of file cnxwidget.hxx.

◆ m_children

TNxArray<CNxWidget*> NXWidgets::CNxWidget::m_children
protected

List of child widgets.

Definition at line 204 of file cnxwidget.hxx.

◆ m_doubleClickBounds

int NXWidgets::CNxWidget::m_doubleClickBounds
protected

Area in which a click is assumed to be a double-click.

Definition at line 198 of file cnxwidget.hxx.

◆ m_flags

Flags NXWidgets::CNxWidget::m_flags
protected

Flags struct.

Definition at line 187 of file cnxwidget.hxx.

◆ m_focusedChild

CNxWidget* NXWidgets::CNxWidget::m_focusedChild
protected

Pointer to the child widget that has focus.

Definition at line 203 of file cnxwidget.hxx.

◆ m_grabPointX

nxgl_coord_t NXWidgets::CNxWidget::m_grabPointX
protected

Physical space x coordinate where dragging began.

Definition at line 176 of file cnxwidget.hxx.

◆ m_grabPointY

nxgl_coord_t NXWidgets::CNxWidget::m_grabPointY
protected

Physical space y coordinate where dragging began.

Definition at line 177 of file cnxwidget.hxx.

◆ m_lastClickTime

struct timespec NXWidgets::CNxWidget::m_lastClickTime
protected

System timer when last clicked.

Definition at line 195 of file cnxwidget.hxx.

◆ m_lastClickX

nxgl_coord_t NXWidgets::CNxWidget::m_lastClickX
protected

X coordinate of last click.

Definition at line 196 of file cnxwidget.hxx.

◆ m_lastClickY

nxgl_coord_t NXWidgets::CNxWidget::m_lastClickY
protected

Y coordinate of last click.

Definition at line 197 of file cnxwidget.hxx.

◆ m_newX

nxgl_coord_t NXWidgets::CNxWidget::m_newX
protected

Physical x coordinate where widget is being dragged to.

Definition at line 178 of file cnxwidget.hxx.

◆ m_newY

nxgl_coord_t NXWidgets::CNxWidget::m_newY
protected

Physical y coordinate where widget is being dragged to.

Definition at line 179 of file cnxwidget.hxx.

◆ m_parent

CNxWidget* NXWidgets::CNxWidget::m_parent
protected

Pointer to the widget's parent.

Definition at line 202 of file cnxwidget.hxx.

◆ m_rect

CRect NXWidgets::CNxWidget::m_rect
protected

Rectangle bounding the widget.

Definition at line 172 of file cnxwidget.hxx.

◆ m_style

CWidgetStyle NXWidgets::CNxWidget::m_style
protected

All style information used by a widget.

Definition at line 183 of file cnxwidget.hxx.

◆ m_widgetControl

CWidgetControl* NXWidgets::CNxWidget::m_widgetControl
protected

The controlling widget for the display

Definition at line 171 of file cnxwidget.hxx.

◆ m_widgetEventHandlers

CWidgetEventHandlerList* NXWidgets::CNxWidget::m_widgetEventHandlers
protected

List of event handlers.

Definition at line 191 of file cnxwidget.hxx.


The documentation for this class was generated from the following files: