NXWidgets  1.19
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NXWidgets::CImage Class Reference

#include <cimage.hxx>

Inheritance diagram for NXWidgets::CImage:
Inheritance graph

Public Member Functions

 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)
 
virtual ~CImage ()
 
FAR IBitmapgetBitmap () const
 
void setBitmap (FAR IBitmap *bitmap)
 
void getPreferredDimensions (CRect &rect) const
 
void setImageLeft (nxgl_coord_t column)
 
void alignHorizontalLeft (void)
 
void alignHorizontalCenter (void)
 
void alignHorizontalRight (void)
 
void setImageTop (nxgl_coord_t row)
 
void alignVerticalTop (void)
 
void alignVerticalCenter (void)
 
void alignVerticalBottom (void)
 
void highlight (bool highlightOn)
 
- Public Member Functions inherited from 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)
 
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)
 
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 drawContents (CGraphicsPort *port, bool selected)
 
virtual void drawContents (CGraphicsPort *port)
 
void drawBorder (CGraphicsPort *port, bool selected)
 
virtual void drawBorder (CGraphicsPort *port)
 
virtual void onClick (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)
 
 CImage (const CImage &label)
 
- Protected Member Functions inherited from NXWidgets::CNxWidget
void useWidgetStyle (const CWidgetStyle *style)
 
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 onDoubleClick (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

FAR IBitmapm_bitmap
 
struct nxgl_point_s m_origin
 
bool m_highlighted
 
- Protected Attributes inherited from NXWidgets::CNxWidget
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
 

Additional Inherited Members

- Public Types inherited from NXWidgets::CNxWidget
enum  WidgetFlagType {
  WIDGET_BORDERLESS = 0x0001, WIDGET_DRAGGABLE = 0x0002, WIDGET_PERMEABLE = 0x0004, WIDGET_DOUBLE_CLICKABLE = 0x0008,
  WIDGET_NO_RAISE_EVENTS = 0x0010
}
 

Detailed Description

Simple image widget for present static images in the widget framework.

Definition at line 109 of file cimage.hxx.

Constructor & Destructor Documentation

◆ CImage() [1/2]

NXWidgets::CImage::CImage ( const CImage label)
inlineprotected

Copy constructor is protected to prevent usage.

Definition at line 197 of file cimage.hxx.

◆ CImage() [2/2]

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 = (CWidgetStyle *)NULL 
)

Constructor for an image.

Parameters
pWidgetControlThe controlling widget for the display
xThe x coordinate of the image box, relative to its parent.
yThe y coordinate of the image box, relative to its parent.
widthThe width of the textbox.
heightThe height of the textbox.
bitmapThe source bitmap image.
styleThe style that the widget should use. If this is not specified, the button will use the global default widget style.

Constructor for a label containing a string.

Parameters
pWidgetControlThe controlling widget for the display
xThe x coordinate of the image box, relative to its parent.
yThe y coordinate of the image box, relative to its parent.
widthThe width of the textbox.
heightThe height of the textbox.
bitmapThe source bitmap image.
styleThe style that the widget should use. If this is not specified, the button will use the global default widget style.

Definition at line 112 of file cimage.cxx.

◆ ~CImage()

virtual NXWidgets::CImage::~CImage ( )
inlinevirtual

Destructor.

NOTE: That the contained bitmap image is not destroyed when the image container is destroyed.

Definition at line 226 of file cimage.hxx.

Member Function Documentation

◆ alignHorizontalCenter()

void CImage::alignHorizontalCenter ( void  )

Align the image at the left of the widget region.

NOTE: The CImage widget does not support any persistent alignment attribute (at least not at the moment). As a result, this alignment can be lost if the image is changed or if the widget is resized.

Definition at line 505 of file cimage.cxx.

◆ alignHorizontalLeft()

void NXWidgets::CImage::alignHorizontalLeft ( void  )
inline

Align the image at the left of the widget region.

NOTE: The CImage widget does not support any persistent alignment attribute (at least not at the moment). As a result, this alignment can be lost if the image is changed or if the widget is resized.

Definition at line 267 of file cimage.hxx.

◆ alignHorizontalRight()

void CImage::alignHorizontalRight ( void  )

Align the image at the left of the widget region.

NOTE: The CImage widget does not support any persistent alignment attribute (at least not at the moment). As a result, this alignment can be lost if the image is changed or if the widget is resized.

Definition at line 525 of file cimage.cxx.

◆ alignVerticalBottom()

void CImage::alignVerticalBottom ( void  )

Align the image at the left of the widget region.

NOTE: The CImage widget does not support any persistent alignment attribute (at least not at the moment). As a result, this alignment can be lost if the image is changed or if the widget is resized.

Definition at line 589 of file cimage.cxx.

◆ alignVerticalCenter()

void CImage::alignVerticalCenter ( void  )

Align the image at the middle of the widget region.

NOTE: The CImage widget does not support any persistent alignment attribute (at least not at the moment). As a result, this alignment can be lost if the image is changed or if the widget is resized.

Definition at line 569 of file cimage.cxx.

◆ alignVerticalTop()

void NXWidgets::CImage::alignVerticalTop ( void  )
inline

Align the image at the top of the widget region.

NOTE: The CImage widget does not support any persistent alignment attribute (at least not at the moment). As a result, this alignment can be lost if the image is changed or if the widget is resized.

Definition at line 309 of file cimage.hxx.

◆ drawBorder() [1/2]

void CImage::drawBorder ( CGraphicsPort port,
bool  selected 
)
protected

Draw the border of this widget. Called by the indirectly via drawBoard(port) and also by classes that inherit from CImage.

Parameters
portThe CGraphicsPort to draw to.
See also
redraw()

Definition at line 367 of file cimage.cxx.

◆ drawBorder() [2/2]

void CImage::drawBorder ( CGraphicsPort port)
protectedvirtual

Draw the border of this widget. Called by the redraw() function to draw all visible regions.

Parameters
portThe CGraphicsPort to draw to.
See also
redraw()

Reimplemented from NXWidgets::CNxWidget.

Reimplemented in NXWidgets::CStickyImage.

Definition at line 407 of file cimage.cxx.

◆ drawContents() [1/2]

void CImage::drawContents ( CGraphicsPort port,
bool  selected 
)
protected

Draw the area of this widget that falls within the clipping region. Called by the drawContents(port) and by classes that inherit from CImage.

Parameters
portThe CGraphicsPort to draw to.
See also
redraw()

Definition at line 175 of file cimage.cxx.

◆ drawContents() [2/2]

void CImage::drawContents ( CGraphicsPort port)
protectedvirtual

Draw the area of this widget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters
portThe CGraphicsPort to draw to.
See also
redraw()

Reimplemented from NXWidgets::CNxWidget.

Reimplemented in NXWidgets::CStickyImage.

Definition at line 354 of file cimage.cxx.

◆ getBitmap()

FAR IBitmap* NXWidgets::CImage::getBitmap ( ) const
inline

Get pointer to the bitmap that this image contains.

Definition at line 232 of file cimage.hxx.

◆ getPreferredDimensions()

void CImage::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 from NXWidgets::CNxWidget.

Definition at line 139 of file cimage.cxx.

◆ highlight()

void CImage::highlight ( bool  highlightOn)

Control the highlight state.

Parameters
highlightOnTrue(1), the image will be highlighted

Definition at line 418 of file cimage.cxx.

◆ onClick()

void CImage::onClick ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
protectedvirtual

Redraws the button.

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

Reimplemented from NXWidgets::CNxWidget.

Reimplemented in NXWidgets::CGlyphSliderHorizontalGrip, and NXWidgets::CStickyImage.

Definition at line 434 of file cimage.cxx.

◆ onPreRelease()

void CImage::onPreRelease ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
protectedvirtual

Raises an action.

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

Reimplemented from NXWidgets::CNxWidget.

Definition at line 446 of file cimage.cxx.

◆ onRelease()

void CImage::onRelease ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
protectedvirtual

Redraws the image.

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

Reimplemented from NXWidgets::CNxWidget.

Reimplemented in NXWidgets::CGlyphSliderHorizontalGrip, and NXWidgets::CStickyImage.

Definition at line 458 of file cimage.cxx.

◆ onReleaseOutside()

void CImage::onReleaseOutside ( nxgl_coord_t  x,
nxgl_coord_t  y 
)
protectedvirtual

Redraws the image.

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

Reimplemented from NXWidgets::CNxWidget.

Reimplemented in NXWidgets::CGlyphSliderHorizontalGrip, and NXWidgets::CStickyImage.

Definition at line 470 of file cimage.cxx.

◆ setBitmap()

void NXWidgets::CImage::setBitmap ( FAR IBitmap bitmap)
inline

Set the bitmap that this image contains.

Definition at line 238 of file cimage.hxx.

◆ setImageLeft()

void CImage::setImageLeft ( nxgl_coord_t  column)

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

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

REVISIT: m_origin.x should be permitted to go negative.

Definition at line 484 of file cimage.cxx.

◆ setImageTop()

void CImage::setImageTop ( nxgl_coord_t  row)

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

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

REVISIT: m_origin.y should be permitted to go negative.

Definition at line 546 of file cimage.cxx.

Member Data Documentation

◆ m_bitmap

FAR IBitmap* NXWidgets::CImage::m_bitmap
protected

Source bitmap image

Definition at line 112 of file cimage.hxx.

◆ m_highlighted

bool NXWidgets::CImage::m_highlighted
protected

Image is highlighted

Definition at line 114 of file cimage.hxx.

◆ m_origin

struct nxgl_point_s NXWidgets::CImage::m_origin
protected

Origin for offset image display position

Definition at line 113 of file cimage.hxx.


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