NXWidgets  1.19
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
NxWM::CHexCalculator Class Reference

#include <chexcalculator.hxx>

Inheritance diagram for NxWM::CHexCalculator:
Inheritance graph

Classes

struct  SPendingOperation
 

Public Member Functions

 CHexCalculator (CTaskbar *taskbar, CApplicationWindow *window)
 
 ~CHexCalculator (void)
 
IApplicationWindowgetWindow (void) const
 
NXWidgets::IBitmapgetIcon (void)
 
NXWidgets::CNxString getName (void)
 
bool run (void)
 
void stop (void)
 
void destroy (void)
 
void hide (void)
 
void redraw (void)
 
bool isFullScreen (void) const
 
- Public Member Functions inherited from NxWM::IApplication
virtual ~IApplication (void)
 
void setMinimized (bool minimized)
 
void setTopApplication (bool topapp)
 
bool isMinimized (void) const
 
bool isTopApplication (void) const
 

Private Member Functions

void setGeometry (void)
 
bool createCalculator (void)
 
void labelKeypad (void)
 
int64_t evaluateBinaryOperation (uint8_t operation, int64_t value1, int64_t value2)
 
void updateText (void)
 
void minimize (void)
 
void close (void)
 
void handleActionEvent (const NXWidgets::CWidgetEventArgs &e)
 
- Private Member Functions inherited from NXWidgets::CWidgetEventHandler
 CWidgetEventHandler ()
 
virtual ~CWidgetEventHandler ()
 
virtual void handleClickEvent (const CWidgetEventArgs &e)
 
virtual void handleDragEvent (const CWidgetEventArgs &e)
 
virtual void handleDropEvent (const CWidgetEventArgs &e)
 
virtual void handleReleaseEvent (const CWidgetEventArgs &e)
 
virtual void handleReleaseOutsideEvent (const CWidgetEventArgs &e)
 
virtual void handleKeyPressEvent (const CWidgetEventArgs &e)
 
virtual void handleCursorControlEvent (const CWidgetEventArgs &e)
 
virtual void handleFocusEvent (const CWidgetEventArgs &e)
 
virtual void handleBlurEvent (const CWidgetEventArgs &e)
 
virtual void handleCloseEvent (const CWidgetEventArgs &e)
 
virtual void handleHideEvent (const CWidgetEventArgs &e)
 
virtual void handleShowEvent (const CWidgetEventArgs &e)
 
virtual void handleEnableEvent (const CWidgetEventArgs &e)
 
virtual void handleDisableEvent (const CWidgetEventArgs &e)
 
virtual void handleValueChangeEvent (const CWidgetEventArgs &e)
 
virtual void handleResizeEvent (const CWidgetEventArgs &e)
 
virtual void handleMoveEvent (const CWidgetEventArgs &e)
 
virtual void handleScrollEvent (const CWidgetEventArgs &e)
 
virtual void handleDoubleClickEvent (const CWidgetEventArgs &e)
 

Private Attributes

CTaskbarm_taskbar
 
CApplicationWindowm_window
 
NXWidgets::CButtonArraym_keypad
 
NXWidgets::CLabelm_text
 
NXWidgets::CNxFontm_font
 
struct nxgl_size_s m_windowSize
 
struct nxgl_size_s m_keypadSize
 
struct nxgl_size_s m_buttonSize
 
struct nxgl_size_s m_textSize
 
struct nxgl_point_s m_keypadPos
 
struct nxgl_point_s m_textPos
 
int64_t m_accum
 
int64_t m_memory
 
struct SPendingOperation m_low
 
struct SPendingOperation m_high
 
bool m_hexMode
 
bool m_result
 

Additional Inherited Members

- Protected Attributes inherited from NxWM::IApplication
bool m_minimized
 
bool m_topapp
 

Detailed Description

This class implements the NxTerm application.

Definition at line 76 of file chexcalculator.hxx.

Constructor & Destructor Documentation

◆ CHexCalculator()

CHexCalculator::CHexCalculator ( CTaskbar taskbar,
CApplicationWindow window 
)

CHexCalculator constructor

Parameters
window.The application window
taskbar.A pointer to the parent task bar instance
window.The window to be used by this application.

CHexCalculator constructor

Parameters
window.The application window

Definition at line 204 of file chexcalculator.cxx.

◆ ~CHexCalculator()

CHexCalculator::~CHexCalculator ( void  )

CHexCalculator destructor

CHexCalculator destructor

Parameters
window.The application window

Definition at line 248 of file chexcalculator.cxx.

Member Function Documentation

◆ close()

void CHexCalculator::close ( void  )
privatevirtual

Called when the window minimize close is pressed.

Called when the window close button is pressed.

Implements NxWM::IApplicationCallback.

Definition at line 701 of file chexcalculator.cxx.

◆ createCalculator()

bool CHexCalculator::createCalculator ( void  )
inlineprivate

Create the calculator keypad. Only start as part of the applicaiton start method.

Create the calculator widgets. Only start as part of the applicaiton start method.

Definition at line 499 of file chexcalculator.cxx.

◆ destroy()

void CHexCalculator::destroy ( void  )
virtual

Destroy the application and free all of its resources. This method will initiate blocking of messages from the NX server. The server will flush the window message queue and reply with the blocked message. When the block message is received by CWindowMessenger, it will send the destroy message to the start window task which will, finally, safely delete the application.

Implements NxWM::IApplication.

Definition at line 361 of file chexcalculator.cxx.

◆ evaluateBinaryOperation()

int64_t CHexCalculator::evaluateBinaryOperation ( uint8_t  operation,
int64_t  value1,
int64_t  value2 
)
private

Evaluate a binary operation.

Parameters
value1.The first value
value2.The second value
Returns
The result of the operation

Evaluate a binary operation. The result is left in m_accum.

Parameters
value1.The first value
value2.The second value
Returns
The result of the operation

Definition at line 626 of file chexcalculator.cxx.

◆ getIcon()

NXWidgets::IBitmap * CHexCalculator::getIcon ( void  )
virtual

Get the icon associated with the application

Returns
An instance if IBitmap that may be used to rend the application's icon. This is an new IBitmap instance that must be deleted by the caller when it is no long needed.

Implements NxWM::IApplication.

Definition at line 291 of file chexcalculator.cxx.

◆ getName()

NXWidgets::CNxString CHexCalculator::getName ( void  )
virtual

Get the name string associated with the application

Returns
A copy if CNxString that contains the name of the application.

Implements NxWM::IApplication.

Definition at line 305 of file chexcalculator.cxx.

◆ getWindow()

IApplicationWindow * CHexCalculator::getWindow ( void  ) const
virtual

Each implementation of IApplication must provide a method to recover the contained CApplicationWindow instance.

Implements NxWM::IApplication.

Definition at line 278 of file chexcalculator.cxx.

◆ handleActionEvent()

void CHexCalculator::handleActionEvent ( const NXWidgets::CWidgetEventArgs e)
privatevirtual

Handle a widget action event. For CImage, this is a button pre- release event.

Parameters
eThe event data.

Handle a widget action event. For CButtonArray, this is a button pre- release event.

Parameters
eThe event data.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 713 of file chexcalculator.cxx.

◆ hide()

void CHexCalculator::hide ( void  )
virtual

The application window is hidden (either it is minimized or it is maximized, but not at the top of the hierarchy

Implements NxWM::IApplication.

Definition at line 377 of file chexcalculator.cxx.

◆ isFullScreen()

bool CHexCalculator::isFullScreen ( void  ) const
virtual

Report of this is a "normal" window or a full screen window. The primary purpose of this method is so that window manager will know whether or not it show draw the task bar.

Returns
True if this is a full screen window.

Implements NxWM::IApplication.

Definition at line 423 of file chexcalculator.cxx.

◆ labelKeypad()

void CHexCalculator::labelKeypad ( void  )
private

Applies labels to the keys.

Definition at line 574 of file chexcalculator.cxx.

◆ minimize()

void CHexCalculator::minimize ( void  )
privatevirtual

Called when the window minimize button is pressed.

Implements NxWM::IApplicationCallback.

Definition at line 692 of file chexcalculator.cxx.

◆ redraw()

void CHexCalculator::redraw ( void  )
virtual

Redraw the entire window. The application has been maximized or otherwise moved to the top of the hierarchy. This method is call from CTaskbar when the application window must be displayed

Implements NxWM::IApplication.

Definition at line 390 of file chexcalculator.cxx.

◆ run()

bool CHexCalculator::run ( void  )
virtual

Start the application (perhaps in the minimized state).

Returns
True if the application was successfully started.

Implements NxWM::IApplication.

Definition at line 316 of file chexcalculator.cxx.

◆ setGeometry()

void CHexCalculator::setGeometry ( void  )
inlineprivate

Select the geometry of the calculator given the current window size. Only called as part of construction.

Select the geometry of the calculator given the current window size.

Definition at line 432 of file chexcalculator.cxx.

◆ stop()

void CHexCalculator::stop ( void  )
virtual

Stop the application.

Implements NxWM::IApplication.

Definition at line 342 of file chexcalculator.cxx.

◆ updateText()

void CHexCalculator::updateText ( void  )
private

Show the current value of the accumulator.

Definition at line 670 of file chexcalculator.cxx.

Member Data Documentation

◆ m_accum

int64_t NxWM::CHexCalculator::m_accum
private

Calculator computational data. Note: Since we do not support parentheses and support only two levels of operator precedence, it is not necessary to maintain a stack of operations. Within there limitations, there can be at most only one pending low prececence operation and one pending high precedence operation. If you want to support parentheses or more levels of precedence, they you will have to extend the design.The current accumulated value

Definition at line 132 of file chexcalculator.hxx.

◆ m_buttonSize

struct nxgl_size_s NxWM::CHexCalculator::m_buttonSize
private

The size of one calculator button

Definition at line 117 of file chexcalculator.hxx.

◆ m_font

NXWidgets::CNxFont* NxWM::CHexCalculator::m_font
private

The font used in the calculator

Definition at line 108 of file chexcalculator.hxx.

◆ m_hexMode

bool NxWM::CHexCalculator::m_hexMode
private

True if in hex mode

Definition at line 136 of file chexcalculator.hxx.

◆ m_high

struct SPendingOperation NxWM::CHexCalculator::m_high
private

Hight precedence pending operation

Definition at line 135 of file chexcalculator.hxx.

◆ m_keypad

NXWidgets::CButtonArray* NxWM::CHexCalculator::m_keypad
private

WidgetsThe calculator keyboard

Definition at line 106 of file chexcalculator.hxx.

◆ m_keypadPos

struct nxgl_point_s NxWM::CHexCalculator::m_keypadPos
private

The position the calculator keypad

Definition at line 119 of file chexcalculator.hxx.

◆ m_keypadSize

struct nxgl_size_s NxWM::CHexCalculator::m_keypadSize
private

The size the calculator keypad

Definition at line 116 of file chexcalculator.hxx.

◆ m_low

struct SPendingOperation NxWM::CHexCalculator::m_low
private

Low precedence pending operation

Definition at line 134 of file chexcalculator.hxx.

◆ m_memory

int64_t NxWM::CHexCalculator::m_memory
private

The current value saved in memory

Definition at line 133 of file chexcalculator.hxx.

◆ m_result

bool NxWM::CHexCalculator::m_result
private

True if the accumulator holds a previoius result

Definition at line 137 of file chexcalculator.hxx.

◆ m_taskbar

CTaskbar* NxWM::CHexCalculator::m_taskbar
private

Calculator state data. Cached constructor parameters.Reference to the "parent" taskbar

Definition at line 99 of file chexcalculator.hxx.

◆ m_text

NXWidgets::CLabel* NxWM::CHexCalculator::m_text
private

The accumulator text display

Definition at line 107 of file chexcalculator.hxx.

◆ m_textPos

struct nxgl_point_s NxWM::CHexCalculator::m_textPos
private

The position of the calculator textbox

Definition at line 120 of file chexcalculator.hxx.

◆ m_textSize

struct nxgl_size_s NxWM::CHexCalculator::m_textSize
private

The size of the calculator textbox

Definition at line 118 of file chexcalculator.hxx.

◆ m_window

CApplicationWindow* NxWM::CHexCalculator::m_window
private

Reference to the application window

Definition at line 100 of file chexcalculator.hxx.

◆ m_windowSize

struct nxgl_size_s NxWM::CHexCalculator::m_windowSize
private

Calculator geometry. This stuff does not really have to be retained in memory. If you are pinched for memory, get rid of these.The size of the calculator window

Definition at line 115 of file chexcalculator.hxx.


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