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

#include <cnxtkwindow.hxx>

Inheritance diagram for NXWidgets::CNxTkWindow:
Inheritance graph

Public Member Functions

 CNxTkWindow (NXHANDLE hNxServer, CWidgetControl *widgetControl)
 
 ~CNxTkWindow (void)
 
bool open (void)
 
CWidgetControlgetWidgetControl (void) const
 
CNxToolbaropenToolbar (nxgl_coord_t height, CWidgetControl *widgetControl=(CWidgetControl *) 0)
 
void detachToolbar (void)
 
bool requestPosition (void)
 
bool getPosition (FAR struct nxgl_point_s *pos)
 
bool getSize (FAR struct nxgl_size_s *size)
 
bool setPosition (FAR const struct nxgl_point_s *pos)
 
bool setSize (FAR const struct nxgl_size_s *size)
 
bool raise (void)
 
bool lower (void)
 
void redirectNxTerm (NXTERM handle)
 
bool setPixel (FAR const struct nxgl_point_s *pos, nxgl_mxpixel_t color)
 
bool fill (FAR const struct nxgl_rect_s *pRect, nxgl_mxpixel_t color)
 
void getRectangle (FAR const struct nxgl_rect_s *rect, struct SBitmap *dest)
 
bool fillTrapezoid (FAR const struct nxgl_rect_s *pClip, FAR const struct nxgl_trapezoid_s *pTrap, nxgl_mxpixel_t color)
 
bool drawLine (FAR struct nxgl_vector_s *vector, nxgl_coord_t width, nxgl_mxpixel_t color, enum ELineCaps caps)
 
bool drawFilledCircle (struct nxgl_point_s *center, nxgl_coord_t radius, nxgl_mxpixel_t color)
 
bool move (FAR const struct nxgl_rect_s *pRect, FAR const struct nxgl_point_s *pOffset)
 
bool bitmap (FAR const struct nxgl_rect_s *pDest, FAR const void *pSrc, FAR const struct nxgl_point_s *pOrigin, unsigned int stride)
 
- Public Member Functions inherited from NXWidgets::INxWindow
virtual ~INxWindow (void)
 

Protected Attributes

NXHANDLE m_hNxServer
 
NXTKWINDOW m_hNxTkWindow
 
CWidgetControlm_widgetControl
 
CNxToolbarm_toolbar
 
nxgl_coord_t m_toolbarHeight
 

Additional Inherited Members

- Public Types inherited from NXWidgets::INxWindow
enum  ELineCaps { LINECAP_NONE = NX_LINECAP_NONE, LINECAP_PT1 = NX_LINECAP_PT1, LINECAP_PT2 = NX_LINECAP_PT2, LINECAP_BOTH = NX_LINECAP_BOTH }
 
- Protected Types inherited from NXWidgets::INxWindow
enum  ELineCaps { LINECAP_NONE = NX_LINECAP_NONE, LINECAP_PT1 = NX_LINECAP_PT1, LINECAP_PT2 = NX_LINECAP_PT2, LINECAP_BOTH = NX_LINECAP_BOTH }
 
- Protected Member Functions inherited from NXWidgets::CCallback
 CCallback (CWidgetControl *widgetControl)
 
 ~CCallback (void)
 
FAR struct nx_callback_s * getCallbackVTable (void)
 
void setNxTerm (NXTERM handle)
 
- Protected Member Functions inherited from NXWidgets::INxWindow
virtual ~INxWindow (void)
 

Detailed Description

This class defines operations on a framed NX window. There are three instances that represent an NX window from the perspective of NXWidgets.

There a various kinds of of window instances, but each inherits (1) CCallback and dispatches the Windows callbacks and (2) INxWindow that describes the common window behavior.

Definition at line 84 of file cnxtkwindow.hxx.

Constructor & Destructor Documentation

◆ CNxTkWindow()

CNxTkWindow::CNxTkWindow ( NXHANDLE  hNxServer,
CWidgetControl widgetControl 
)

Constructor. Creates an uninitialized instance of the CNxTkWindow object. The open() method must be called to initialize the instance.

The general steps to create any window include: 1) Create a dumb CWigetControl instance 2) Pass the dumb CWidgetControl instance to the window constructor that inherits from INxWindow. 3) The window constructor call CWidgetControl methods to "smarten" the CWidgetControl instance with window-specific knowledge. 4) Call the open() method on the window to display the window. 5) After that, the fully smartened CWidgetControl instance can be used to generate additional widgets. 6) After that, the fully smartened CWidgetControl instance can be used to generate additional widgets by passing it to the widget constructor

Parameters
hNxServerHandle to the NX server.
widgetControlControlling widget for this window.

Constructor.

Parameters
hNxServerHandle to the NX server.
widgetControlControlling widget for this window.

Definition at line 69 of file cnxtkwindow.cxx.

◆ ~CNxTkWindow()

CNxTkWindow::~CNxTkWindow ( void  )

Destructor.

Definition at line 92 of file cnxtkwindow.cxx.

Member Function Documentation

◆ bitmap()

bool CNxTkWindow::bitmap ( FAR const struct nxgl_rect_s *  pDest,
FAR const void *  pSrc,
FAR const struct nxgl_point_s *  pOrigin,
unsigned int  stride 
)
virtual

Copy a rectangular region of a larger image into the rectangle in the specified window.

Parameters
pDestDescribes the rectangular on the display that will receive the bitmap.
pSrcThe start of the source image.
pOriginthe pOrigin of the upper, left-most corner of the full bitmap. Both pDest and pOrigin are in window coordinates, however, pOrigin may lie outside of the display.
strideThe width of the full source image in bytes.
Returns
True on success; false on failure.

Copy a rectangular region of a larger image into the rectangle in the specified window. The source image is treated as an opaque image.

Parameters
pDestDescribes the rectangular on the display that will receive the bitmap.
pSrcThe start of the source image.
pOriginthe pOrigin of the upper, left-most corner of the full bitmap. Both pDest and pOrigin are in window coordinates, however, pOrigin may lie outside of the display.
strideThe width of the full source image in bytes.
Returns
True on success; false on failure.

Implements NXWidgets::INxWindow.

Definition at line 506 of file cnxtkwindow.cxx.

◆ detachToolbar()

void NXWidgets::CNxTkWindow::detachToolbar ( void  )
inline

Detach the toolbar. This should ONLY be called by the toolbar instance itself. If this is called by end-user logic, it will screw things up miserably.

Definition at line 163 of file cnxtkwindow.hxx.

◆ drawFilledCircle()

bool CNxTkWindow::drawFilledCircle ( struct nxgl_point_s *  center,
nxgl_coord_t  radius,
nxgl_mxpixel_t  color 
)
virtual

Draw a filled circle at the specified position, size, and color.

Parameters
centerThe window-relative coordinates of the circle center.
radiusThe radius of the rectangle in pixels.
colorThe color of the rectangle.

Implements NXWidgets::INxWindow.

Definition at line 468 of file cnxtkwindow.cxx.

◆ drawLine()

bool CNxTkWindow::drawLine ( FAR struct nxgl_vector_s *  vector,
nxgl_coord_t  width,
nxgl_mxpixel_t  color,
enum ELineCaps  caps 
)
virtual

Fill the specified line in the window with the specified color.

Parameters
vector- Describes the line to be drawn
width- The width of the line
color- The color to use to fill the line
caps- Draw a circular cap on the ends of the line to support better line joins
Returns
True on success; false on failure.

Fill the specified line in the window with the specified color.

Parameters
vector- Describes the line to be drawn
width- The width of the line
color- The color to use to fill the line
caps- Draw a circular cap on both ends of the line to support better line joins
Returns
True on success; false on failure.

Implements NXWidgets::INxWindow.

Definition at line 451 of file cnxtkwindow.cxx.

◆ fill()

bool CNxTkWindow::fill ( FAR const struct nxgl_rect_s *  pRect,
nxgl_mxpixel_t  color 
)
virtual

Fill the specified rectangle in the window with the specified color.

Parameters
pRectThe location to be filled.
colorThe color to use in the fill.
Returns
True on success; false on failure.

Implements NXWidgets::INxWindow.

Definition at line 393 of file cnxtkwindow.cxx.

◆ fillTrapezoid()

bool CNxTkWindow::fillTrapezoid ( FAR const struct nxgl_rect_s *  pClip,
FAR const struct nxgl_trapezoid_s *  pTrap,
nxgl_mxpixel_t  color 
)
virtual

Fill the specified trapezoidal region in the window with the specified color.

Parameters
pClipClipping rectangle relative to window (may be null).
pTrapThe trapezoidal region to be filled.
colorThe color to use in the fill.
Returns
True on success; false on failure.

Implements NXWidgets::INxWindow.

Definition at line 430 of file cnxtkwindow.cxx.

◆ getPosition()

bool CNxTkWindow::getPosition ( FAR struct nxgl_point_s *  pos)
virtual

Get the position of the window (as reported by the NX callback).

Returns
True on success, false on any failure.

Get the position of the window in the physical display coordinates (as reported by the NX callback).

Returns
The position.

Implements NXWidgets::INxWindow.

Definition at line 289 of file cnxtkwindow.cxx.

◆ getRectangle()

void CNxTkWindow::getRectangle ( FAR const struct nxgl_rect_s *  rect,
struct SBitmap dest 
)
virtual

Get the raw contents of graphic memory within a rectangular region. NOTE: Since raw graphic memory is returned, the returned memory content may be the memory of windows above this one and may not necessarily belong to this window unless you assure that this is the top window.

Parameters
rectThe location to be copied
dest- The describes the destination bitmap to receive the graphics data.

Implements NXWidgets::INxWindow.

Definition at line 412 of file cnxtkwindow.cxx.

◆ getSize()

bool CNxTkWindow::getSize ( FAR struct nxgl_size_s *  size)
virtual

Get the size of the window (as reported by the NX callback).

Returns
The size.

Get the size of the window drawable region.

Returns
The size.

Implements NXWidgets::INxWindow.

Definition at line 300 of file cnxtkwindow.cxx.

◆ getWidgetControl()

CWidgetControl * CNxTkWindow::getWidgetControl ( void  ) const
virtual

Each implementation of INxWindow must provide a method to recover the contained CWidgetControl instance.

Returns
The contained CWidgetControl instance

Implements NXWidgets::INxWindow.

Definition at line 135 of file cnxtkwindow.cxx.

◆ lower()

bool CNxTkWindow::lower ( void  )
virtual

Lower the window to the bottom of the display.

Returns
True on success, false on any failure.

Implements NXWidgets::INxWindow.

Definition at line 355 of file cnxtkwindow.cxx.

◆ move()

bool CNxTkWindow::move ( FAR const struct nxgl_rect_s *  pRect,
FAR const struct nxgl_point_s *  pOffset 
)
virtual

Move a rectangular region within the window.

Parameters
pRectDescribes the rectangular region to move.
pOffsetThe offset to move the region.
Returns
True on success; false on failure.

Implements NXWidgets::INxWindow.

Definition at line 483 of file cnxtkwindow.cxx.

◆ open()

bool CNxTkWindow::open ( void  )
virtual

Creates a new window. Window creation is separate from object instantiation so that failures can be reported.

Returns
True if the window was successfully opened.

Creates a new framed window. Window creation is separate from object instantiation so that failures can be reported.

Returns
True if the framed window was successfully created.

Implements NXWidgets::INxWindow.

Definition at line 115 of file cnxtkwindow.cxx.

◆ openToolbar()

CNxToolbar * CNxTkWindow::openToolbar ( nxgl_coord_t  height,
CWidgetControl widgetControl = (CWidgetControl *)0 
)

Open a toolbar on the framed window. This method both instantiates the toolbar object AND calls the INxWindow::open() method to create the toolbar. The toolbar is ready for use upon return.

Parameters
height.The height in rows of the tool bar
widgetControl.The controlling widget for this window. If none is provided, then a new, vanilla CWidgetControl will be created for the tool bar.
Returns
True if the toolbar was successfully created.

Open a toolbar on the framed window. This method both instantiates the toolbar object AND calls the INxWindow::open() method to create the toolbar. The toolbar is ready for use upon return.

Parameters
height.The height in rows of the tool bar
widgetControl.The controlling widget for this window. If none is provided, then a new, vanilla CWidgetControl will be created for the tool bar.
heightHeight of the toolbar

Definition at line 152 of file cnxtkwindow.cxx.

◆ raise()

bool CNxTkWindow::raise ( void  )
virtual

Bring the window to the top of the display.

Returns
True on success, false on any failure.

Implements NXWidgets::INxWindow.

Definition at line 342 of file cnxtkwindow.cxx.

◆ redirectNxTerm()

void NXWidgets::CNxTkWindow::redirectNxTerm ( NXTERM  handle)
inlinevirtual

Each window implementation also inherits from CCallback. CCallback, by default, forwards NX keyboard input to the various widgets residing in the window. But NxTerm is a different usage model; In this case, keyboard input needs to be directed to the NxTerm character driver. This method can be used to enable (or disable) redirection of NX keyboard input from the window widgets to the NxTerm

Parameters
handle.The NXTERM handle. If non-NULL, NX keyboard input will be directed to the NxTerm driver using this handle; If NULL (the default), NX keyboard input will be directed to the widgets within the window.

Implements NXWidgets::INxWindow.

Definition at line 245 of file cnxtkwindow.hxx.

◆ requestPosition()

bool CNxTkWindow::requestPosition ( void  )
virtual

Request the position and size information of the window. The values will be returned asynchronously through the client callback method. The GetPosition() method may than be called to obtain the positional data as provided by the callback.

Returns
True on success, false on any failure.

Implements NXWidgets::INxWindow.

Definition at line 275 of file cnxtkwindow.cxx.

◆ setPixel()

bool CNxTkWindow::setPixel ( FAR const struct nxgl_point_s *  pos,
nxgl_mxpixel_t  color 
)
virtual

Set an individual pixel in the window with the specified color.

Parameters
posThe location of the pixel to be filled.
colorThe color to use in the fill.
Returns
True on success; false on failure.

Implements NXWidgets::INxWindow.

Definition at line 371 of file cnxtkwindow.cxx.

◆ setPosition()

bool CNxTkWindow::setPosition ( FAR const struct nxgl_point_s *  pos)
virtual

Set the position and size of the window.

Parameters
posThe new position of the window.
Returns
True on success, false on any failure.

Implements NXWidgets::INxWindow.

Definition at line 315 of file cnxtkwindow.cxx.

◆ setSize()

bool CNxTkWindow::setSize ( FAR const struct nxgl_size_s *  size)
virtual

Set the size of the selected window.

Parameters
sizeThe new size of the window.
Returns
True on success, false on any failure.

Implements NXWidgets::INxWindow.

Definition at line 329 of file cnxtkwindow.cxx.

Member Data Documentation

◆ m_hNxServer

NXHANDLE NXWidgets::CNxTkWindow::m_hNxServer
protected

Handle to the NX server.

Definition at line 87 of file cnxtkwindow.hxx.

◆ m_hNxTkWindow

NXTKWINDOW NXWidgets::CNxTkWindow::m_hNxTkWindow
protected

Handle to the NX raw window

Definition at line 88 of file cnxtkwindow.hxx.

◆ m_toolbar

CNxToolbar* NXWidgets::CNxTkWindow::m_toolbar
protected

Child toolbar

Definition at line 90 of file cnxtkwindow.hxx.

◆ m_toolbarHeight

nxgl_coord_t NXWidgets::CNxTkWindow::m_toolbarHeight
protected

The height of the toolbar

Definition at line 91 of file cnxtkwindow.hxx.

◆ m_widgetControl

CWidgetControl* NXWidgets::CNxTkWindow::m_widgetControl
protected

Controlling widget for the window

Definition at line 89 of file cnxtkwindow.hxx.


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