![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
RNR Win window abstract base class. More...
#include <Win.h>
Public Member Functions | |
| Win (const std::string &strWinName, int nWidth, int nHeight, bool bDecorate=true) | |
| Windowing class initialization constructor. More... | |
| virtual | ~Win () |
| Destructor. | |
| virtual const char * | getGuiToolkitName () |
| Get GUI toolkit name. More... | |
| virtual void | setLookAndFeel (const std::string &strKey, const std::string &strVal) |
| Set GUI look and feel value. More... | |
| virtual std::string | getLookAndFeel (const std::string &strKey) |
| Get the GUI look and feel value. More... | |
| virtual void | show ()=0 |
| Show/refresh all gui widgets in window. | |
| virtual void | showCvImage (cv::Mat &img, uint_t uImgIndex=0)=0 |
| Show a OpenCv image on the workspace. More... | |
| virtual void | showPageRef (int nPageRef)=0 |
| Show page reference number. More... | |
| virtual void | showPageRef (const std::string &strPageRef)=0 |
| Show page reference string. More... | |
| virtual void | showStatus (const char *sFmt,...)=0 |
| Show status message. More... | |
| virtual void | clearStatus ()=0 |
| Clear status message. | |
| virtual int | waitKey (int delay)=0 |
| Wait for keypress or timeout. More... | |
| virtual void | waitMouse (int delay)=0 |
| Wait for timeout or registered mouse event. More... | |
| virtual void | wait (int delay)=0 |
| Wait for timeout. More... | |
| virtual bool | addImageButton (int nBttnId, AlignOp eAlign, const std::string &strIconPath, const std::string &strAltText, const std::string &strToolTip="")=0 |
| Add a button with an image to window button menu. More... | |
| virtual bool | addImageButton (int nBttnId, AlignOp eAlign, void *wBttnImg, const std::string &strAltText, const std::string &strToolTip="")=0 |
| Add a button with an image widget to window button menu. More... | |
| virtual bool | addLabelButton (int nBttnId, AlignOp eAlign, const std::string &strLabel, const std::string &strToolTip="")=0 |
| Add a button with a label to window button menu. More... | |
| virtual bool | replaceButtonImage (int nBttnId, const std::string &strIconPath, const std::string &strToolTip="")=0 |
| Replace existing button image with new image. More... | |
| virtual bool | replaceButtonImage (int nBttnId, void *wBttnImg, const std::string &strToolTip="")=0 |
| Replace existing button image with new GTK image widget. More... | |
| virtual bool | replaceButtonLabel (int nBttnId, const std::string &strLabel, const std::string &strToolTip="")=0 |
| Replace existing button label with new label. More... | |
| virtual bool | removeButton (int nBttnId)=0 |
| Remove a button from a menu. More... | |
| virtual void | removeAllButtons ()=0 |
| Remove all buttons from all menus. | |
| virtual bool | showButtonState (int nBttnId, WidgetState eBttnState)=0 |
| Show a button's widget state. More... | |
| cv::Size | getWorkspaceSize () |
| Get the window's workspace size. More... | |
| virtual void | initWorkspace ()=0 |
| Initialize window's workspace to hold a native GUI toolkit widget tree. More... | |
| virtual uint_t | initWorkspaceAsCvImage ()=0 |
| Initialize the workspace as a display to show OpenCV images. More... | |
| virtual void | initWorkspaceAsGstWin (const cv::Size &sizeVidWin)=0 |
| Initialize the workspace as a window display to show GStreamer video/images. More... | |
| virtual uint_t | addWorkspaceCvImageDisplay (void *wContainer)=0 |
| Add an OpenCV display widget to the container widget. More... | |
| virtual void | removeWorkspaceCvImageDisplay (uint_t uImgIndex)=0 |
| Remove OpenCV display widget from workspace. More... | |
| virtual void | showWorkspace ()=0 |
| Show/refresh all gui widgets in workspace. | |
| virtual void | eraseWorkspace ()=0 |
| Remove all widgets contained in the window's workspace container. | |
| ulong_t | getGstXid () |
| Get GStreamer X-Window id. More... | |
| void | registerCvImageMouseCallback (MouseCbFunc_T funcCb, void *param, uint_t uImgIndex=0) |
| Register application mouse event callback. More... | |
| void | unregisterCvImageMouseCallback (uint_t uImgIndex=0) |
| Unregister application mouse event callback. More... | |
| void | registerKeyboardCallback (KeyCbFunc_T funcCb, void *param) |
| Register application keyboard press event callback. More... | |
| void | unregisterKeyboardCallback () |
| Unregister application keyboard press event callback. | |
| void | registerButtonClickCallback (BttnCbFunc_T funcCb, void *param) |
| Register application button click event callback. More... | |
| void | unregisterButtonClickCallback () |
| Unregister application button click event callback. | |
Static Public Attributes | |
| static const int | MaxCvImages = 4 |
| max workspace images/video | |
| static const int | NumOfButtonMenus = 2 |
| left and right menus | |
Protected Types | |
| typedef std::map< std::string, std::string > | MapLookFeel_T |
Protected Member Functions | |
| void | setLookAndFeelDefaults () |
| Set look and feel standard set defaults. | |
Protected Attributes | |
| std::string | m_strWinName |
| window name (and title) | |
| int | m_nWinWidth |
| window width | |
| int | m_nWinHeight |
| window height | |
| bool | m_bDecorate |
| do [not] decorate window | |
| CvRect | m_rectWorkspace |
| workspace bounding rectangle | |
| ulong_t | m_uGstWinXid |
| GstWin container X window id. | |
| uint_t | m_uLastKey |
| last pressed keyboard code | |
| bool | m_bMouseEvent |
| was a mouse event (click, drag, etc) | |
| MouseCbFunc_T | m_funcMouseCb [MaxCvImages] |
| registered mouse cb func | |
| void * | m_dataMouseCb [MaxCvImages] |
| registered mouse cb data | |
| KeyCbFunc_T | m_funcKeyCb |
| registered keyboard callback func | |
| void * | m_dataKeyCb |
| registered keyboard callback data | |
| BttnCbFunc_T | m_funcBttnCb |
| registered menu button callback func | |
| void * | m_dataBttnCb |
| registered menu button callback data | |
| MapLookFeel_T | m_mapLookFeel |
| look and feel map | |
RNR Win window abstract base class.
An instance of a derived Win class divides the screen into three vertical regions above, and two regions below.
* ----------------------------------------------- * | | | | * | | | | * |Left | |Right| * |Menu | Workspace | Menu| * |Box | | Box| * | | | | * | | | | * ----------------------------------------------- * | ref | status message | * ----------------------------------------------- *
The left and right menu boxes hold on-screen buttons. The workspace can hold a collection of application specific widgets, including OpenCV image matrices and GStreamer video. Below, the reference box displays workflow context, while the status line displays prompts, errors, and info messages.
| Win::Win | ( | const std::string & | strWinName, |
| int | nWidth, | ||
| int | nHeight, | ||
| bool | bDecorate = true |
||
| ) |
Windowing class initialization constructor.
| strWinName | Window name. |
| nWidth | Window width in pixels. |
| nHeight | Window height in pixels. |
| bDecorate | Do [not] decorate window with title, border, etc. Windowing system specific. |
Definition at line 69 of file Win.cxx.
References m_bMouseEvent, m_dataBttnCb, m_dataKeyCb, m_dataMouseCb, m_funcBttnCb, m_funcKeyCb, m_funcMouseCb, m_strWinName, m_uGstWinXid, m_uLastKey, MaxCvImages, and setLookAndFeelDefaults().
|
pure virtual |
Add a button with an image to window button menu.
If the image fails to load, the alternate text is display instead.
| nBttnId | Window unique button id. |
| eAlign | Menu item icon alignment. See rnmpwin_align |
| strIconPath | Path to icon image file. |
| strAltText | Button alternate text. |
| strToolTip | Optional button tool tip text. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Add a button with an image widget to window button menu.
| nBttnId | Window unique button id. |
| eAlign | Menu item icon alignment. See rnmpwin_align |
| wBttnImg | Pointer to button image widget (gui toolkit specific). |
| strAltText | Button alternate text. |
| strToolTip | Optional button tool tip text. |
Implemented in rnr::WinGtk.
|
pure virtual |
Add a button with a label to window button menu.
| nBttnId | Window unique button id. |
| eAlign | Menu item icon alignment. See rnmpwin_align |
| strLabel | Button text label. |
| strToolTip | Optional button tool tip text. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Add an OpenCV display widget to the container widget.
The container widget must be added to the window workspace by the application to keep the widget control correct.
| wContainer | Pointer to the container widget. (gui toolkit specific). |
Implemented in rnr::WinGtk.
Referenced by getWorkspaceSize().
|
inline |
Get GStreamer X-Window id.
Definition at line 572 of file Win.h.
References m_uGstWinXid.
|
inlinevirtual |
|
inlinevirtual |
Get the GUI look and feel value.
| strKey | Key. |
Definition at line 291 of file Win.h.
References addImageButton(), addLabelButton(), clearStatus(), m_mapLookFeel, removeAllButtons(), removeButton(), replaceButtonImage(), replaceButtonLabel(), show(), showButtonState(), showCvImage(), showPageRef(), showStatus(), wait(), waitKey(), and waitMouse().
|
inline |
Get the window's workspace size.
Definition at line 495 of file Win.h.
References addWorkspaceCvImageDisplay(), eraseWorkspace(), initWorkspace(), initWorkspaceAsCvImage(), initWorkspaceAsGstWin(), m_rectWorkspace, removeWorkspaceCvImageDisplay(), and showWorkspace().
|
pure virtual |
Initialize window's workspace to hold a native GUI toolkit widget tree.
All previous gui elements are erased.
Implemented in rnr::WinGtk.
Referenced by getWorkspaceSize().
|
pure virtual |
Initialize the workspace as a display to show OpenCV images.
This is a convinience function to use if only one image gui element is contained in the workspace.
Use
to display an OpenCv image.
All previous gui elements are erased.
Implemented in rnr::WinGtk.
Referenced by getWorkspaceSize().
|
pure virtual |
Initialize the workspace as a window display to show GStreamer video/images.
GStreamer automatically displays video/images via the GTK callback mechanism, so no show function is required.
This is a convinience function to use if only one stream is contained in the workspace.
All previous gui elements are erased.
Implemented in rnr::WinGtk.
Referenced by getWorkspaceSize().
|
inline |
Register application button click event callback.
| funcCb | Button click callback function. |
| param | User provided data given on callback. |
Definition at line 636 of file Win.h.
References m_dataBttnCb, and m_funcBttnCb.
|
inline |
Register application mouse event callback.
| funcCb | Mouse callback function. |
| param | User provided data given on callback. |
| uImgIndex | Image instance. |
Definition at line 584 of file Win.h.
References m_dataMouseCb, and m_funcMouseCb.
|
inline |
Register application keyboard press event callback.
| funcCb | Keyboard callback function. |
| param | User provided data given on callback. |
Definition at line 615 of file Win.h.
References m_dataKeyCb, and m_funcKeyCb.
|
pure virtual |
Remove a button from a menu.
| nBttnId | Unique button id. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Remove OpenCV display widget from workspace.
| uImgIndex | Image instance. |
Implemented in rnr::WinGtk.
Referenced by getWorkspaceSize().
|
pure virtual |
Replace existing button image with new image.
| nBttnId | Unique button id. |
| strIconPath | Path to icon image file. |
| strToolTip | Optional button tool tip text. If empty, then the current tooltip, if any, is used. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Replace existing button image with new GTK image widget.
| nBttnId | Unique button id. |
| wBttnImg | Pointer to new button image widget (gui toolkit specific). |
| strToolTip | Optional button tool tip text. If empty, then the current tooltip, if any, is used. |
Implemented in rnr::WinGtk.
|
pure virtual |
Replace existing button label with new label.
| nBttnId | Unique button id. |
| strLabel | Button text label. |
| strToolTip | Optional button tooltip text. If empty, then the current tooltip, if any, is used. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
inlinevirtual |
Set GUI look and feel value.
A look and feel value can be a color, font, line spacing, etc. There is a standard set which can be extended for application-specific needs.
Standard set:
| key | description |
| color_win_bg | window background color |
| color_status_fg | status bar foreground color |
| color_status_bg | status bar background color |
| color_status_border | status bar border color |
| color_button_bg | button background color |
| color_text_fg | default text foreground color |
| color_text_bg | default text background color |
| color_image_bg | default image background color |
| color_rn_black | RoadNarrows black |
| color_rn_white | RoadNarrows black |
| color_rn_red | RoadNarrows black |
| color_rn_yellow | RoadNarrows black |
| font_text | default text font |
| font_status | status bar font |
| font_large | large font |
| font_medium | medium font |
| font_small | small font |
| font_tiny | tiny font |
| strKey | Key. |
| strVal | Value. |
Reimplemented in rnr::WinGtk.
Definition at line 278 of file Win.h.
References m_mapLookFeel.
Referenced by rnr::WinGtk::setLookAndFeel().
|
pure virtual |
Show a button's widget state.
| nBttnId | Unique button id. |
| eBttnState | New button state. See rnmpwin_itemstate. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Show a OpenCv image on the workspace.
| img | Pointer to image. |
| uImgIndex | Image instance. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Show page reference number.
| nPageRef | Page reference number. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
|
pure virtual |
Show status message.
| sFmt | Format string. |
| ... | Variable arguments. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
inline |
Unregister application mouse event callback.
| uImgIndex | Image instance. |
Definition at line 600 of file Win.h.
References m_dataMouseCb, and m_funcMouseCb.
|
pure virtual |
Wait for timeout.
Window widgets can be updated during this wait.
| delay | Timeout delay in millseconds > 0. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Wait for keypress or timeout.
Window widgets can be updated during this wait.
| delay | Timeout delay in millseconds. Set to 0 for no timeout. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().
|
pure virtual |
Wait for timeout or registered mouse event.
Window widgets can be updated during this wait.
| delay | Timeout delay in millseconds > 0. |
Implemented in rnr::WinGtk.
Referenced by getLookAndFeel().