NXWidgets: NxWM::CTaskbar Class Reference

NXWidgets 1.19

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NxWM::CTaskbar Class Reference

`#include <ctaskbar.hxx>`

Inheritance diagram for NxWM::CTaskbar:

## Classes
struct | STaskbarSlot

## Public Member Functions
| CTaskbar (void)
| ~CTaskbar (void)
bool | connect (void)
void | disconnect (void)
bool | initWindowManager (void)
bool | startWindowManager (void)
CApplicationWindow * | openApplicationWindow (uint8_t flags=0)
CFullScreenWindow * | openFullScreenWindow (void)
bool | startApplication (IApplication *app, bool minimized)
bool | topApplication (IApplication *app)
bool | maximizeApplication (IApplication *app)
bool | minimizeApplication (IApplication *app)
bool | stopApplication (IApplication *app)
void | getDisplaySize (FAR struct nxgl_size_s &size)
void | redraw ()
void | clickIcon (int index, bool click)
Public Member Functions inherited from NXWidgets::CNxServer
| CNxServer (void)
| ~CNxServer (void)
NXHANDLE | getServer (void)
bool | connected (void)
bool | setBackgroundColor (nxgl_mxpixel_t color)
CNxWindow * | createRawWindow (CWidgetControl *widgetControl)
CNxTkWindow * | createFramedWindow (CWidgetControl *widgetControl)
CBgWindow * | getBgWindow (CWidgetControl *widgetControl)

## Protected Member Functions
NXWidgets::CNxWindow * | openRawWindow (void)
NXWidgets::CNxTkWindow * | openFramedWindow (void)
void | setApplicationGeometry (NXWidgets::INxWindow *window, bool fullscreen)
virtual bool | createTaskbarWindow (void)
virtual bool | createBackgroundWindow (void)
virtual bool | createBackgroundImage (void)
virtual bool | redrawTaskbarWindow (void)
virtual bool | redrawTopApplication (void)
void | raiseTopApplication (void)
virtual bool | redrawBackgroundWindow (void)
bool | redrawApplicationWindow (IApplication *app)
void | hideApplicationWindow (IApplication *app)
void | handleActionEvent (const NXWidgets::CWidgetEventArgs &e)
Protected 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)

## Protected Attributes
NXWidgets::CNxWindow * | m_taskbar
NXWidgets::CNxWindow * | m_background
NXWidgets::CImage * | m_backImage
IApplication * | m_topApp
TNxArray< struct STaskbarSlot > | m_slots
bool | m_started

## Detailed Description

This class describes the NX window manager's task bar. That task bar is, of course, used to dock active applications. But in NxWM, it is also the heart of the window manager: It inherits for CNxServer and, hence, represents the NX server itself. It also then serves as the NxWM window factory.

Why do it this way? The only reason is so that if you have an instance of CTaskbar, you have everything you need to manage new applications. It might have been a better decision to separate the window factory into a separate class instead of making the task bar of such central importance (and I may still do that someday)

Definition at line 85 of file ctaskbar.hxx.

## Constructor & Destructor Documentation

## ◆ CTaskbar()

CTaskbar::CTaskbar | ( | void |  | ) |

CTaskbar Constructor

Parameters

  hWnd | - NX server handle

Definition at line 70 of file ctaskbar.cxx.

## ◆ ~CTaskbar()

CTaskbar::~CTaskbar | ( | void |  | ) |

CTaskbar Destructor

Definition at line 83 of file ctaskbar.cxx.

## Member Function Documentation

## ◆ clickIcon()

void CTaskbar::clickIcon | ( | int | index,
|  | bool | click
| ) |  |

Simulate a mouse click or release on the icon at index. This method is only available during automated testing of NxWM.

Parameters

  index. | Selects the icon in the start window
  click. | True to click and false to release

Definition at line 758 of file ctaskbar.cxx.

## ◆ connect()

bool CTaskbar::connect | ( | void |  | ) |
| virtual

Connect to the server

Reimplemented from NXWidgets::CNxServer.

Definition at line 95 of file ctaskbar.cxx.

## ◆ createBackgroundImage()

bool CTaskbar::createBackgroundImage | ( | void |  | ) |
| protectedvirtual

Create the background image.

Returns
  true on success

Definition at line 1036 of file ctaskbar.cxx.

## ◆ createBackgroundWindow()

bool CTaskbar::createBackgroundWindow | ( | void |  | ) |
| protectedvirtual

Create the background window.

Returns
  true on success

Definition at line 1014 of file ctaskbar.cxx.

## ◆ createTaskbarWindow()

bool CTaskbar::createTaskbarWindow | ( | void |  | ) |
| protectedvirtual

Create the task bar window.

Returns
  true on success

Definition at line 950 of file ctaskbar.cxx.

## ◆ disconnect()

void CTaskbar::disconnect | ( | void |  | ) |
| virtual

Disconnect from the server

Disconnect from the server. This method restores the taskbar to the same state that it was in when it was constructed.

Reimplemented from NXWidgets::CNxServer.

Definition at line 118 of file ctaskbar.cxx.

## ◆ getDisplaySize()

void CTaskbar::getDisplaySize | ( | FAR struct nxgl_size_s & | size | ) |

Get the size of the physical display device as it is known to the task bar.

Returns
  The size of the display

Definition at line 733 of file ctaskbar.cxx.

## ◆ handleActionEvent()

void CTaskbar::handleActionEvent | ( | const NXWidgets::CWidgetEventArgs & | e | ) |
| protectedvirtual

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

Parameters

  e | The event data.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 1452 of file ctaskbar.cxx.

## ◆ hideApplicationWindow()

void CTaskbar::hideApplicationWindow | ( | IApplication * | app | ) |
| protected

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

Parameters

  app. | The application to hide

Definition at line 1415 of file ctaskbar.cxx.

## ◆ initWindowManager()

bool CTaskbar::initWindowManager | ( | void |  | ) |

Initialize task bar. Task bar initialization is separate from object instantiation so that failures can be reported. The window manager start-up sequence is:

1. Create the CTaskbar instance,
2. Call the CTaskbar::connect() method to connect to the NX server (CTaskbar inherits the connect method from CNxServer),
3. Call the CTaskbar::initWindowManager() method to initialize the task bar.
4. Call CTaskBar::startApplication repeatedly to add applications to the task bar
5. Call CTaskBar::startWindowManager() to start the display with applications in place

CTaskbar::initWindowManager() prepares the task bar to receive applications. CTaskBar::startWindowManager() brings the window manager up with those applications in place.

Returns
  True if the window was successfully initialized.

Initialize task bar. Task bar initialization is separate from object instantiation so that failures can be reported. The window manager start-up sequence is:

1. Create the CTaskbar instance,
2. Call the CTaskbar::connect() method to connect to the NX server (CTaskbar inherits the connect method from CNxServer),
3. Call the CTaskbar::initWindowManager() method to initialize the task bar.
4. Call CTaskBar::startApplication repeatedly to add applications to the task bar
5. Call CTaskBar::startWindowManager to start the display with applications in place

CTaskbar::initWindowManager() prepares the task bar to receive applications. CTaskBar::startWindowManager() brings the window manager up with those applications in place.

Returns
  True if the window was successfully initialized.

Definition at line 206 of file ctaskbar.cxx.

## ◆ maximizeApplication()

bool CTaskbar::maximizeApplication | ( | IApplication * | app | ) |

Maximize an application by moving its window to the top of the hierarchy and re-drawing it. If the application was already maximized, then this method is equivalent to topApplication().

Parameters

  app. | The new application to add to the task bar

Returns
  true on success

Definition at line 620 of file ctaskbar.cxx.

## ◆ minimizeApplication()

bool CTaskbar::minimizeApplication | ( | IApplication * | app | ) |

Minimize an application by moving its window to the bottom of the and redrawing the next visible appliation.

Parameters

  app. | The new application to add to the task bar

Returns
  true on success

Definition at line 639 of file ctaskbar.cxx.

## ◆ openApplicationWindow()

CApplicationWindow * CTaskbar::openApplicationWindow | ( | uint8_t | flags = `0` | ) |

Create an normal application window. Creating a normal application in the start window requires three steps:

1. Call CTaskBar::openApplicationWindow to create a window for the application,
2. Instantiate the application, providing the window to the application's constructor,
3. Then call CStartWindow::addApplication to add the application to the start window.

When the application is selected from the start window:

1. Call CTaskBar::startApplication start the application and bring its window to the top.

Parameters

  flags. | CApplicationWindow flugs for window customization.

Definition at line 365 of file ctaskbar.cxx.

## ◆ openFramedWindow()

NXWidgets::CNxTkWindow * CTaskbar::openFramedWindow | ( | void |  | ) |
| protected

Create a framed application window

This may be used to provide the window parater to the IApplication constructor

Returns
  A partially initialized application window instance.

Definition at line 845 of file ctaskbar.cxx.

## ◆ openFullScreenWindow()

CFullScreenWindow * CTaskbar::openFullScreenWindow | ( | void |  | ) |

Create a full screen application window. Creating a new full screen application requires three steps:

1. Call CTaskBar::FullScreenWindow to create a window for the application,
2. Instantiate the application, providing the window to the application's constructor,
3. Then call CStartWindow::addApplication to add the application to the start window.

When the application is selected from the start window:

1. Call CTaskBar::startApplication start the application and bring its window to the top.

Definition at line 406 of file ctaskbar.cxx.

## ◆ openRawWindow()

NXWidgets::CNxWindow * CTaskbar::openRawWindow | ( | void |  | ) |
| protected

Create a raw window.

1) Create a dumb NXWidgets::CWidgetControl instance (See not). 2) Pass the dumb NXWidgets::CWindowMessenger instance to the window constructor that inherits from INxWindow. This will "smarten" the NXWidgets::CWidgetControl instance with some window knowlede 3) Call the open() method on the window to display the window. 4) After that, the fully smartened NXWidgets::CWidgetControl instance can be used to generate additional widgets by passing it to the widget constructor

NOTE: Actually, NxWM uses the CWindowMessenger class that inherits from CWidgetControl. That class just adds some unrelated messaging capability; It cohabitates with CWidgetControl only becuase it needs the CWidgetControl this point.

Create a raw window.

1) Create a dumb CWigetControl instance (see note below) 2) Pass the dumb CWidgetControl instance to the window constructor that inherits from INxWindow. This will "smarten" the CWidgetControl instance with some window knowlede 3) Call the open() method on the window to display the window. 4) After that, the fully smartened CWidgetControl instance can be used to generate additional widgets by passing it to the widget constructor

NOTE: Actually, NxWM uses the CWindowMessenger class that inherits from CWidgetControl. That class just adds some unrelated messaging capability; It cohabitates with CWidgetControl only becuase it needs the CWidgetControl this point.

Definition at line 808 of file ctaskbar.cxx.

## ◆ raiseTopApplication()

void CTaskbar::raiseTopApplication | ( | void |  | ) |
| protected

Raise the top window to the top of the NXheirarchy.

Returns
  true on success

Definition at line 1299 of file ctaskbar.cxx.

## ◆ redraw()

void NxWM::CTaskbar::redraw | ( | void |  | ) |
| inline

Force a redraw of the taskbar and current application. This should only be necessary if the display loses state due to e.g. powerdown or other manual intervention.

Definition at line 419 of file ctaskbar.hxx.

## ◆ redrawApplicationWindow()

bool CTaskbar::redrawApplicationWindow | ( | IApplication * | app | ) |
| protected

Redraw the last application in the list of application maintained by the task bar.

Parameters

  app. | The new top application to draw

Returns
  true on success

Definition at line 1375 of file ctaskbar.cxx.

## ◆ redrawBackgroundWindow()

bool CTaskbar::redrawBackgroundWindow | ( | void |  | ) |
| protectedvirtual

(Re-)draw the background window.

Returns
  true on success

Definition at line 1323 of file ctaskbar.cxx.

## ◆ redrawTaskbarWindow()

bool CTaskbar::redrawTaskbarWindow | ( | void |  | ) |
| protectedvirtual

(Re-)draw the task bar window.

Returns
  true on success

Definition at line 1113 of file ctaskbar.cxx.

## ◆ redrawTopApplication()

bool CTaskbar::redrawTopApplication | ( | void |  | ) |
| protectedvirtual

Redraw the window at the top of the heirarchy.

Returns
  true on success

Definition at line 1255 of file ctaskbar.cxx.

## ◆ setApplicationGeometry()

void CTaskbar::setApplicationGeometry | ( | NXWidgets::INxWindow * | window,
|  | bool | fullscreen
| ) |  |
| protected

Set size and position of a window in the application area.

Parameters

  window. | The window to be resized and repositioned
  fullscreen. | True: Use full screen

Set size and position of a window in the application area.

Parameters

  window. | The window to be resized and repositioned
  fullscreen. | True: Use full screen

Returns
  true on success

Definition at line 882 of file ctaskbar.cxx.

## ◆ startApplication()

bool CTaskbar::startApplication | ( | IApplication * | app,
|  | bool | minimized
| ) |  |

Start an application and add its icon to the taskbar. The applications's window is brought to the top. Creating a new application in the start window requires three steps:

1. Call CTaskBar::openApplicationWindow to create a window for the application,
2. Instantiate the application, providing the window to the application's constructor,
3. Then call CStartWindow::addApplication to add the application to the start window.

When the application is selected from the start window:

1. Call CTaskBar::startApplication start the application and bring its window to the top.

Parameters

  app. | The new application to add to the task bar
  minimized. | The new application starts in the minimized state

Returns
  true on success

Start an application and add its icon to the taskbar. The applications's window is brought to the top. Creating a new application in the start window requires three steps:

1. Create the CTaskbar instance,
2. Call startApplication repeatedly to add applications to the task bar
3. Call startWindowManager to start the display with applications in place

When the application is selected from the start window:

1. Call startApplication start the application and bring its window to the top.

Parameters

  app. | The new application to add to the task bar
  minimized. | The new application starts in the minimized state

Returns
  true on success

Definition at line 450 of file ctaskbar.cxx.

## ◆ startWindowManager()

bool CTaskbar::startWindowManager | ( | void |  | ) |

Start the window manager and present the initial displays. The window manager start-up sequence is:

1. Create the CTaskbar instance,
2. Call the CTaskbar::connect() method to connect to the NX server (CTaskbar inherits the connect method from CNxServer),
3. Call the CTaskbar::initWindowManager() method to initialize the task bar.
4. Call CTaskBar::startApplication repeatedly to add applications to the task bar
5. Call CTaskBar::startWindowManager to start the display with applications in place

CTaskbar::initWindowManager() prepares the task bar to receive applications. CTaskBar::startWindowManager() brings the window manager up with those applications in place.

CTaskBar::startWindowManager() will present the task bar and the background image. The The initial taskbar will contain only the start window icon.

Returns
  true on success

Start the window manager and present the initial displays. The window manager start-up sequence is:

1. Create the CTaskbar instance,
2. Call startApplication repeatedly to add applications to the task bar
3. Call startWindowManager to start the display with applications in place

CTaskbar::initWindowManager() prepares the task bar to receive applications. CTaskBar::startWindowManager() brings the window manager up with those applications in place.

startWindowManager will present the task bar and the background image. The initial taskbar will contain only the start window icon.

Returns
  true on success

Definition at line 250 of file ctaskbar.cxx.

## ◆ stopApplication()

bool CTaskbar::stopApplication | ( | IApplication * | app | ) |

Destroy an application. Move its window to the bottom and remove its icon from the task bar.

Parameters

  app. | The new application to remove from the task bar

Returns
  true on success

Definition at line 667 of file ctaskbar.cxx.

## ◆ topApplication()

bool CTaskbar::topApplication | ( | IApplication * | app | ) |

Move window to the top of the hierarchy and re-draw it. This method does nothing if the application is minimized.

Parameters

  app. | The new application to show

Returns
  true on success

Definition at line 586 of file ctaskbar.cxx.

## Member Data Documentation

## ◆ m_background

NXWidgets::CNxWindow* NxWM::CTaskbar::m_background
| protected

The background window

Definition at line 104 of file ctaskbar.hxx.

## ◆ m_backImage

NXWidgets::CImage* NxWM::CTaskbar::m_backImage
| protected

The background image

Definition at line 105 of file ctaskbar.hxx.

## ◆ m_slots

TNxArray<struct STaskbarSlot> NxWM::CTaskbar::m_slots
| protected

List of application slots in the task bar

Definition at line 107 of file ctaskbar.hxx.

## ◆ m_started

bool NxWM::CTaskbar::m_started
| protected

True if window manager has been started

Definition at line 108 of file ctaskbar.hxx.

## ◆ m_taskbar

NXWidgets::CNxWindow* NxWM::CTaskbar::m_taskbar
| protected

Taskbar stateThe task bar window

Definition at line 103 of file ctaskbar.hxx.

## ◆ m_topApp

IApplication* NxWM::CTaskbar::m_topApp
| protected

The top application in the hierarchy

Definition at line 106 of file ctaskbar.hxx.

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

- ctaskbar.hxx
- ctaskbar.cxx