appkit  1.5.1
RoadNarrows Robotics Application Kit
Win.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Robotics Application Tool Kit
4 //
5 // Link: https://github.com/roadnarrows-robotics/rnr-sdk
6 //
7 // Library: librnr_win
8 //
9 // File: Win.h
10 //
11 /*! \file
12  *
13  * $LastChangedDate: 2013-05-03 07:45:13 -0600 (Fri, 03 May 2013) $
14  * $Rev: 2904 $
15  *
16  * \brief RoadNarrows Robotics Win abstract base class interface.
17  *
18  * \author Robin Knight (robin.knight@roadnarrows.com)
19  * \author Daniel Packard (daniel@roadnarrows.com)
20  *
21  * \par Copyright
22  * \h_copy 2011-2017. RoadNarrows LLC.\n
23  * http://www.roadnarrows.com\n
24  * All Rights Reserved
25  */
26 /*
27  * @EulaBegin@
28  *
29  * Permission is hereby granted, without written agreement and without
30  * license or royalty fees, to use, copy, modify, and distribute this
31  * software and its documentation for any purpose, provided that
32  * (1) The above copyright notice and the following two paragraphs
33  * appear in all copies of the source code and (2) redistributions
34  * including binaries reproduces these notices in the supporting
35  * documentation. Substantial modifications to this software may be
36  * copyrighted by their authors and need not follow the licensing terms
37  * described here, provided that the new terms are clearly indicated in
38  * all files where they apply.
39  *
40  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
41  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
42  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
43  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
44  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
45  * THE POSSIBILITY OF SUCH DAMAGE.
46  *
47  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
48  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
49  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
50  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
51  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
52  *
53  * @EulaEnd@
54  */
55 ////////////////////////////////////////////////////////////////////////////////
56 
57 #ifndef _RNR_WIN_H
58 #define _RNR_WIN_H
59 
60 #include <string>
61 #include <map>
62 
63 #include "rnr/rnrconfig.h"
64 
65 #include "opencv2/core/core.hpp"
66 
67 #include "rnr/appkit/WinLookFeel.h"
68 
69 /*!
70  * \brief RoadNarrows Robotics
71  */
72 namespace rnr
73 {
74  /*!
75  * \ingroup rnrwin_h
76  * \defgroup rnrwin_align Alignment Transformation Directives
77  *
78  * Window widget, image, or video alignment.
79  * \{
80  */
81  enum AlignOp
82  {
83  AlignOpDefault, ///< default alignment (left)
84  AlignOpLeft, ///< left alignment
85  AlignOpCenter, ///< center alignment
86  AlignOpRight ///< rigth alignment
87  };
88  /*! \} */
89 
90  /*!
91  * \ingroup rnrwin_h
92  * \defgroup rnrwin_rot Rotation Transformation Directives
93  *
94  * Window widget, image, or video rotation.
95  * \{
96  */
97  enum RotOp
98  {
99  RotOp0, ///< 0\h_deg rotation (none)
100  RotOp90, ///< 90\h_get rotation
101  RotOp180, ///< 180\h_get rotation (flip verically)
102  RotOp270 ///< 270\h_get rotation (-90\h_deg)
103  };
104  /*! \} */
105 
106  /*!
107  * \ingroup rnrwin_h
108  * \defgroup rnrwin_uievent User Interface Reserved Events
109  *
110  * Reserved events. User defined events must be after these values.
111  * \{
112  */
113  enum UIEvent
114  {
115  UIEventNone, ///< no action
116  UIEventClick, ///< mouse click
117  UIEventDragStart, ///< start of mouse drag
118  UIEventDragging, ///< dragging mouse
119  UIEventDragEnd, ///< end of mouse drag
120  UIEventNumOf ///< number of reserved actions
121  };
122  /*! \} */
123 
124  /*!
125  * \ingroup rnrwin_h
126  * \defgroup rnrwin_widgetstate GUI Widget State
127  * \{
128  */
130  {
131  WidgetStateNormal, ///< normal - enabled but not selected
132  WidgetStateActive, ///< selected
133  WidgetStateDisabled, ///< disabled
134  WidgetStateNumOf ///< number of states
135  };
136  /*! \} */
137 
138  /*!
139  * \brief Mouse Callback Function Type.
140  *
141  * User-supplied callback function. The callback is called on mouse events
142  * focused on an OpenCV image widget.
143  *
144  * Typical user-defined mouse events are select a region, drag, and draw.
145  *
146  * \param cv_event OpenCv defined events. See CV_EVENT_*.
147  * \param x Mouse x pixel coordinate relative to upper left image
148  * widget.
149  * \param y Mouse y pixel coordinate relative to upper left image
150  * widget.
151  * \param Windowing system specific flags.
152  * \param user_data User-supplied data.
153  */
154  typedef void (*MouseCbFunc_T)(int cv_event,
155  int x,
156  int y,
157  int flags,
158  void *user_data);
159 
160  /*!
161  * \brief Keyboard Callback Function Type.
162  *
163  * User-supplied callback function on keyboard events.
164  *
165  * \param code Keyboard code.
166  * \param state Keyboard state.
167  * \param user_data User-supplied data.
168  */
169  typedef void (*KeyCbFunc_T)(int code, int state, void *user_data);
170 
171  /*!
172  * \brief Menu button Callback Function Type.
173  *
174  * User-supplied callback function on menu button pushes.
175  *
176  * \param nButtnId Button id.
177  * \param user_data User-supplied data.
178  */
179  typedef void (*BttnCbFunc_T)(int nBttnId, void *user_data);
180 
181 
182  //...........................................................................
183  // Class Win
184  //...........................................................................
185 
186  /*!
187  * \brief RNR Win window abstract base class.
188  *
189  * An instance of a derived Win class divides the screen into three vertical
190  * regions above, and two regions below.
191  *
192  * \verbatim
193  * -----------------------------------------------
194  * | | | |
195  * | | | |
196  * |Left | |Right|
197  * |Menu | Workspace | Menu|
198  * |Box | | Box|
199  * | | | |
200  * | | | |
201  * -----------------------------------------------
202  * | ref | status message |
203  * -----------------------------------------------
204  * \endverbatim
205  *
206  * The left and right menu boxes hold on-screen buttons. The workspace can
207  * hold a collection of application specific widgets, including OpenCV image
208  * matrices and GStreamer video. Below, the reference box displays workflow
209  * context, while the status line displays prompts, errors, and info messages.
210  */
211  class Win
212  {
213  public:
214  static const int MaxCvImages = 4; ///< max workspace images/video
215  static const int NumOfButtonMenus = 2; ///< left and right menus
216 
217  /*!
218  * \brief Windowing class initialization constructor.
219  *
220  * \param strWinName Window name.
221  * \param nWidth Window width in pixels.
222  * \param nHeight Window height in pixels.
223  * \param bDecorate Do [not] decorate window with title, border,
224  * etc. Windowing system specific.
225  */
226  Win(const std::string &strWinName,
227  int nWidth,
228  int nHeight,
229  bool bDecorate=true);
230 
231  /*!
232  * \brief Destructor.
233  */
234  virtual ~Win() { }
235 
236  /*!
237  * \brief Get GUI toolkit name.
238  *
239  * \return GUI toolkit identifier string.
240  */
241  virtual const char *getGuiToolkitName()
242  {
243  return "abstract";
244  }
245 
246  /*!
247  * \brief Set GUI look and feel value.
248  *
249  * A look and feel value can be a color, font, line spacing, etc. There is
250  * a standard set which can be extended for application-specific needs.
251  *
252  * Standard set:
253  * \termblock
254  * \term \b key \termdata \b description \endterm
255  * \term color_win_bg \termdata window background color \endterm
256  * \term color_status_fg \termdata status bar foreground color \endterm
257  * \term color_status_bg \termdata status bar background color \endterm
258  * \term color_status_border \termdata status bar border color \endterm
259  * \term color_button_bg \termdata button background color \endterm
260  * \term color_text_fg \termdata default text foreground color \endterm
261  * \term color_text_bg \termdata default text background color \endterm
262  * \term color_image_bg \termdata default image background color \endterm
263  * \term color_rn_black \termdata RoadNarrows black \endterm
264  * \term color_rn_white \termdata RoadNarrows black \endterm
265  * \term color_rn_red \termdata RoadNarrows black \endterm
266  * \term color_rn_yellow \termdata RoadNarrows black \endterm
267  * \term font_text \termdata default text font \endterm
268  * \term font_status \termdata status bar font \endterm
269  * \term font_large \termdata large font \endterm
270  * \term font_medium \termdata medium font \endterm
271  * \term font_small \termdata small font \endterm
272  * \term font_tiny \termdata tiny font \endterm
273  * \endtermblock
274  *
275  * \param strKey Key.
276  * \param strVal Value.
277  */
278  virtual void setLookAndFeel(const std::string &strKey,
279  const std::string &strVal)
280  {
281  m_mapLookFeel[strKey] = strVal;
282  }
283 
284  /*!
285  * \brief Get the GUI look and feel value.
286  *
287  * \param strKey Key.
288  *
289  * \return Value.
290  */
291  virtual std::string getLookAndFeel(const std::string &strKey)
292  {
293  std::string strVal;
294 
295  if( m_mapLookFeel.find(strKey) != m_mapLookFeel.end() )
296  {
297  strVal = m_mapLookFeel[strKey];
298  }
299  return strVal;
300  }
301 
302  /*!
303  * \brief Show/refresh all gui widgets in window.
304  */
305  virtual void show() = 0;
306 
307  /*!
308  * \brief Show a OpenCv image on the workspace.
309  *
310  * \param img Pointer to image.
311  * \param uImgIndex Image instance.
312  */
313  virtual void showCvImage(cv::Mat &img, uint_t uImgIndex=0) = 0;
314 
315  /*!
316  * \brief Show page reference number.
317  *
318  * \param nPageRef Page reference number.
319  */
320  virtual void showPageRef(int nPageRef) = 0;
321 
322  /*!
323  * \brief Show page reference string.
324  *
325  * \param strPageRef Page reference string.
326  */
327  virtual void showPageRef(const std::string &strPageRef) = 0;
328 
329  /*!
330  * \brief Show status message.
331  *
332  * \param sFmt Format string.
333  * \param ... Variable arguments.
334  */
335  virtual void showStatus(const char *sFmt, ...) = 0;
336 
337  /*!
338  * \brief Clear status message.
339  */
340  virtual void clearStatus() = 0;
341 
342  /*!
343  * \brief Wait for keypress or timeout.
344  *
345  * Window widgets can be updated during this wait.
346  *
347  * \param delay Timeout delay in millseconds. Set to 0 for no timeout.
348  *
349  * \return Returns code of last key pressed or -1 if timed out.
350  */
351  virtual int waitKey(int delay) = 0;
352 
353  /*!
354  * \brief Wait for timeout or registered mouse event.
355  *
356  * Window widgets can be updated during this wait.
357  *
358  * \param delay Timeout delay in millseconds \h_gt 0.
359  */
360  virtual void waitMouse(int delay) = 0;
361 
362  /*!
363  * \brief Wait for timeout.
364  *
365  * Window widgets can be updated during this wait.
366  *
367  * \param delay Timeout delay in millseconds \h_gt 0.
368  */
369  virtual void wait(int delay) = 0;
370 
371  /*!
372  * \brief Add a button with an image to window button menu.
373  *
374  * If the image fails to load, the alternate text is display instead.
375  *
376  * \param nBttnId Window unique button id.
377  * \param eAlign Menu item icon alignment. See \ref rnmpwin_align
378  * \param strIconPath Path to icon image file.
379  * \param strAltText Button alternate text.
380  * \param strToolTip Optional button tool tip text.
381  *
382  * \return Returns true on success, false otherwise.
383  */
384  virtual bool addImageButton(int nBttnId,
385  AlignOp eAlign,
386  const std::string &strIconPath,
387  const std::string &strAltText,
388  const std::string &strToolTip="") = 0;
389 
390  /*!
391  * \brief Add a button with an image widget to window button menu.
392  *
393  * \param nBttnId Window unique button id.
394  * \param eAlign Menu item icon alignment. See \ref rnmpwin_align
395  * \param wBttnImg Pointer to button image widget
396  * (gui toolkit specific).
397  * \param strAltText Button alternate text.
398  * \param strToolTip Optional button tool tip text.
399  *
400  * \return Returns true on success, false otherwise.
401  */
402  virtual bool addImageButton(int nBttnId,
403  AlignOp eAlign,
404  void *wBttnImg,
405  const std::string &strAltText,
406  const std::string &strToolTip="") = 0;
407 
408  /*!
409  * \brief Add a button with a label to window button menu.
410  *
411  * \param nBttnId Window unique button id.
412  * \param eAlign Menu item icon alignment. See \ref rnmpwin_align
413  * \param strLabel Button text label.
414  * \param strToolTip Optional button tool tip text.
415  *
416  * \return Returns true on success, false otherwise.
417  */
418  virtual bool addLabelButton(int nBttnId,
419  AlignOp eAlign,
420  const std::string &strLabel,
421  const std::string &strToolTip="") = 0;
422 
423  /*!
424  * \brief Replace existing button image with new image.
425  *
426  * \param nBttnId Unique button id.
427  * \param strIconPath Path to icon image file.
428  * \param strToolTip Optional button tool tip text. If empty, then the
429  * current tooltip, if any, is used.
430  *
431  * \return Returns true if button image is replaced, false otherwise.
432  */
433  virtual bool replaceButtonImage(int nBttnId,
434  const std::string &strIconPath,
435  const std::string &strToolTip="") = 0;
436 
437  /*!
438  * \brief Replace existing button image with new GTK image widget.
439  *
440  * \param nBttnId Unique button id.
441  * \param wBttnImg Pointer to new button image widget
442  * (gui toolkit specific).
443  * \param strToolTip Optional button tool tip text. If empty, then the
444  * current tooltip, if any, is used.
445  *
446  * \return Returns true if button image is replaced, false otherwise.
447  */
448  virtual bool replaceButtonImage(int nBttnId,
449  void *wBttnImg,
450  const std::string &strToolTip="") = 0;
451 
452  /*!
453  * \brief Replace existing button label with new label.
454  *
455  * \param nBttnId Unique button id.
456  * \param strLabel Button text label.
457  * \param strToolTip Optional button tooltip text. If empty, then the
458  * current tooltip, if any, is used.
459  *
460  * \return Returns true if button label is replaced, false otherwise.
461  */
462  virtual bool replaceButtonLabel(int nBttnId,
463  const std::string &strLabel,
464  const std::string &strToolTip="") = 0;
465 
466  /*!
467  * \brief Remove a button from a menu.
468  *
469  * \param nBttnId Unique button id.
470  *
471  * \return Returns true if button is removed, false otherwise.
472  */
473  virtual bool removeButton(int nBttnId) = 0;
474 
475  /*!
476  * \brief Remove all buttons from all menus.
477  */
478  virtual void removeAllButtons() = 0;
479 
480  /*!
481  * \brief Show a button's widget state.
482  *
483  * \param nBttnId Unique button id.
484  * \param eBttnState New button state. See \ref rnmpwin_itemstate.
485  *
486  * \return Returns true if button state set, false otherwise.
487  */
488  virtual bool showButtonState(int nBttnId, WidgetState eBttnState) = 0;
489 
490  /*!
491  * \brief Get the window's workspace size.
492  *
493  * \return Size of workspace.
494  */
495  cv::Size getWorkspaceSize()
496  {
497  return cv::Size(m_rectWorkspace.width, m_rectWorkspace.height);
498  }
499 
500  /*!
501  * \brief Initialize window's workspace to hold a native GUI toolkit
502  * widget tree.
503  *
504  * All previous gui elements are erased.
505  */
506  virtual void initWorkspace() = 0;
507 
508  /*!
509  * \brief Initialize the workspace as a display to show OpenCV images.
510  *
511  * This is a convinience function to use if only one image gui element is
512  * contained in the workspace.
513  *
514  * Use \code showCvImage() \endcode to display an OpenCv image.
515  *
516  * All previous gui elements are erased.
517  *
518  * \return Index (handle) to CvImage widget instance.
519  */
520  virtual uint_t initWorkspaceAsCvImage() = 0;
521 
522  /*!
523  * \brief Initialize the workspace as a window display to show GStreamer
524  * video/images.
525  *
526  * GStreamer automatically displays video/images via the GTK callback
527  * mechanism, so no show function is required.
528  *
529  * This is a convinience function to use if only one stream is
530  * contained in the workspace.
531  *
532  * All previous gui elements are erased.
533  */
534  virtual void initWorkspaceAsGstWin(const cv::Size &sizeVidWin) = 0;
535 
536  /*!
537  * \brief Add an OpenCV display widget to the container widget.
538  *
539  * The container widget must be added to the window workspace by
540  * the application to keep the widget control correct.
541  *
542  * \param wContainer Pointer to the container widget.
543  * (gui toolkit specific).
544  *
545  * \return On success, returns index (handle) to CvImage instance.\n
546  * On failure, returns -1.
547  */
548  virtual uint_t addWorkspaceCvImageDisplay(void *wContainer) = 0;
549 
550  /*!
551  * \brief Remove OpenCV display widget from workspace.
552  *
553  * \param uImgIndex Image instance.
554  */
555  virtual void removeWorkspaceCvImageDisplay(uint_t uImgIndex) = 0;
556 
557  /*!
558  * \brief Show/refresh all gui widgets in workspace.
559  */
560  virtual void showWorkspace() = 0;
561 
562  /*!
563  * \brief Remove all widgets contained in the window's workspace container.
564  */
565  virtual void eraseWorkspace() = 0;
566 
567  /*!
568  * \brief Get GStreamer X-Window id.
569  *
570  * \return Xid.
571  */
572  ulong_t getGstXid()
573  {
574  return m_uGstWinXid;
575  }
576 
577  /*!
578  * \brief Register application mouse event callback.
579  *
580  * \param funcCb Mouse callback function.
581  * \param param User provided data given on callback.
582  * \param uImgIndex Image instance.
583  */
585  void *param,
586  uint_t uImgIndex=0)
587  {
588  if( uImgIndex < MaxCvImages )
589  {
590  m_funcMouseCb[uImgIndex] = funcCb;
591  m_dataMouseCb[uImgIndex] = param;
592  }
593  }
594 
595  /*!
596  * \brief Unregister application mouse event callback.
597  *
598  * \param uImgIndex Image instance.
599  */
600  void unregisterCvImageMouseCallback(uint_t uImgIndex=0)
601  {
602  if( uImgIndex < MaxCvImages )
603  {
604  m_funcMouseCb[uImgIndex] = NULL;
605  m_dataMouseCb[uImgIndex] = NULL;
606  }
607  }
608 
609  /*!
610  * \brief Register application keyboard press event callback.
611  *
612  * \param funcCb Keyboard callback function.
613  * \param param User provided data given on callback.
614  */
615  void registerKeyboardCallback(KeyCbFunc_T funcCb, void *param)
616  {
617  m_funcKeyCb = funcCb;
618  m_dataKeyCb = param;
619  }
620 
621  /*!
622  * \brief Unregister application keyboard press event callback.
623  */
625  {
626  m_funcKeyCb = NULL;
627  m_dataKeyCb = NULL;
628  }
629 
630  /*!
631  * \brief Register application button click event callback.
632  *
633  * \param funcCb Button click callback function.
634  * \param param User provided data given on callback.
635  */
636  void registerButtonClickCallback(BttnCbFunc_T funcCb, void *param)
637  {
638  m_funcBttnCb = funcCb;
639  m_dataBttnCb = param;
640  }
641 
642  /*!
643  * \brief Unregister application button click event callback.
644  */
646  {
647  m_funcBttnCb = NULL;
648  m_dataBttnCb = NULL;
649  }
650 
651  protected:
652  typedef std::map<std::string, std::string> MapLookFeel_T;
653 
654  std::string m_strWinName; ///< window name (and title)
655  int m_nWinWidth; ///< window width
656  int m_nWinHeight; ///< window height
657  bool m_bDecorate; ///< do [not] decorate window
658  CvRect m_rectWorkspace; ///< workspace bounding rectangle
659  ulong_t m_uGstWinXid; ///< GstWin container X window id
660  uint_t m_uLastKey; ///< last pressed keyboard code
661  bool m_bMouseEvent; ///< was a mouse event (click, drag, etc)
662  MouseCbFunc_T m_funcMouseCb[MaxCvImages]; ///< registered mouse cb func
663  void *m_dataMouseCb[MaxCvImages]; ///< registered mouse cb data
664  KeyCbFunc_T m_funcKeyCb; ///< registered keyboard callback func
665  void *m_dataKeyCb; ///< registered keyboard callback data
666  BttnCbFunc_T m_funcBttnCb; ///< registered menu button callback func
667  void *m_dataBttnCb; ///< registered menu button callback data
668  MapLookFeel_T m_mapLookFeel; ///< look and feel map
669 
670  /*!
671  * \brief Set look and feel standard set defaults.
672  */
673  void setLookAndFeelDefaults();
674  };
675 
676 } // rnr namespace
677 
678 
679 #endif // _RNR_WIN_H
WidgetState
Definition: Win.h:129
180 rotation (flip verically)
Definition: Win.h:101
void registerButtonClickCallback(BttnCbFunc_T funcCb, void *param)
Register application button click event callback.
Definition: Win.h:636
static const int MaxCvImages
max workspace images/video
Definition: Win.h:214
void setLookAndFeelDefaults()
Set look and feel standard set defaults.
Definition: Win.cxx:100
virtual int waitKey(int delay)=0
Wait for keypress or timeout.
RotOp
Definition: Win.h:97
cv::Size getWorkspaceSize()
Get the window&#39;s workspace size.
Definition: Win.h:495
number of reserved actions
Definition: Win.h:120
void unregisterCvImageMouseCallback(uint_t uImgIndex=0)
Unregister application mouse event callback.
Definition: Win.h:600
virtual void setLookAndFeel(const std::string &strKey, const std::string &strVal)
Set GUI look and feel value.
Definition: Win.h:278
ulong_t getGstXid()
Get GStreamer X-Window id.
Definition: Win.h:572
270 rotation (-90 &deg;)
Definition: Win.h:102
rigth alignment
Definition: Win.h:86
virtual void removeAllButtons()=0
Remove all buttons from all menus.
virtual void showCvImage(cv::Mat &img, uint_t uImgIndex=0)=0
Show a OpenCv image on the workspace.
MouseCbFunc_T m_funcMouseCb[MaxCvImages]
registered mouse cb func
Definition: Win.h:662
void unregisterKeyboardCallback()
Unregister application keyboard press event callback.
Definition: Win.h:624
virtual bool replaceButtonImage(int nBttnId, const std::string &strIconPath, const std::string &strToolTip="")=0
Replace existing button image with new image.
void(* BttnCbFunc_T)(int nBttnId, void *user_data)
Menu button Callback Function Type.
Definition: Win.h:179
dragging mouse
Definition: Win.h:118
virtual std::string getLookAndFeel(const std::string &strKey)
Get the GUI look and feel value.
Definition: Win.h:291
virtual void initWorkspace()=0
Initialize window&#39;s workspace to hold a native GUI toolkit widget tree.
start of mouse drag
Definition: Win.h:117
virtual void clearStatus()=0
Clear status message.
bool m_bDecorate
do [not] decorate window
Definition: Win.h:657
void * m_dataMouseCb[MaxCvImages]
registered mouse cb data
Definition: Win.h:663
std::string m_strWinName
window name (and title)
Definition: Win.h:654
Win(const std::string &strWinName, int nWidth, int nHeight, bool bDecorate=true)
Windowing class initialization constructor.
Definition: Win.cxx:69
uint_t m_uLastKey
last pressed keyboard code
Definition: Win.h:660
no action
Definition: Win.h:115
void unregisterButtonClickCallback()
Unregister application button click event callback.
Definition: Win.h:645
left alignment
Definition: Win.h:84
KeyCbFunc_T m_funcKeyCb
registered keyboard callback func
Definition: Win.h:664
AlignOp
Definition: Win.h:81
RoadNarrows top-level look and feel user interface declarations.
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.
virtual uint_t initWorkspaceAsCvImage()=0
Initialize the workspace as a display to show OpenCV images.
normal - enabled but not selected
Definition: Win.h:131
virtual bool removeButton(int nBttnId)=0
Remove a button from a menu.
mouse click
Definition: Win.h:116
ulong_t m_uGstWinXid
GstWin container X window id.
Definition: Win.h:659
void * m_dataKeyCb
registered keyboard callback data
Definition: Win.h:665
int m_nWinHeight
window height
Definition: Win.h:656
BttnCbFunc_T m_funcBttnCb
registered menu button callback func
Definition: Win.h:666
90 rotation
Definition: Win.h:100
virtual uint_t addWorkspaceCvImageDisplay(void *wContainer)=0
Add an OpenCV display widget to the container widget.
static const int NumOfButtonMenus
left and right menus
Definition: Win.h:215
RNR Win window abstract base class.
Definition: Win.h:211
virtual void wait(int delay)=0
Wait for timeout.
virtual void show()=0
Show/refresh all gui widgets in window.
void(* KeyCbFunc_T)(int code, int state, void *user_data)
Keyboard Callback Function Type.
Definition: Win.h:169
virtual bool showButtonState(int nBttnId, WidgetState eBttnState)=0
Show a button&#39;s widget state.
0 &deg; rotation (none)
Definition: Win.h:99
MapLookFeel_T m_mapLookFeel
look and feel map
Definition: Win.h:668
selected
Definition: Win.h:132
number of states
Definition: Win.h:134
virtual void showWorkspace()=0
Show/refresh all gui widgets in workspace.
void registerCvImageMouseCallback(MouseCbFunc_T funcCb, void *param, uint_t uImgIndex=0)
Register application mouse event callback.
Definition: Win.h:584
virtual void showPageRef(int nPageRef)=0
Show page reference number.
void registerKeyboardCallback(KeyCbFunc_T funcCb, void *param)
Register application keyboard press event callback.
Definition: Win.h:615
virtual void removeWorkspaceCvImageDisplay(uint_t uImgIndex)=0
Remove OpenCV display widget from workspace.
virtual ~Win()
Destructor.
Definition: Win.h:234
virtual void eraseWorkspace()=0
Remove all widgets contained in the window&#39;s workspace container.
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.
bool m_bMouseEvent
was a mouse event (click, drag, etc)
Definition: Win.h:661
void(* MouseCbFunc_T)(int cv_event, int x, int y, int flags, void *user_data)
Mouse Callback Function Type.
Definition: Win.h:154
virtual void showStatus(const char *sFmt,...)=0
Show status message.
int m_nWinWidth
window width
Definition: Win.h:655
virtual void initWorkspaceAsGstWin(const cv::Size &sizeVidWin)=0
Initialize the workspace as a window display to show GStreamer video/images.
void * m_dataBttnCb
registered menu button callback data
Definition: Win.h:667
RoadNarrows Robotics.
Definition: Camera.h:74
default alignment (left)
Definition: Win.h:83
CvRect m_rectWorkspace
workspace bounding rectangle
Definition: Win.h:658
virtual bool replaceButtonLabel(int nBttnId, const std::string &strLabel, const std::string &strToolTip="")=0
Replace existing button label with new label.
virtual const char * getGuiToolkitName()
Get GUI toolkit name.
Definition: Win.h:241
virtual void waitMouse(int delay)=0
Wait for timeout or registered mouse event.
UIEvent
Definition: Win.h:113
end of mouse drag
Definition: Win.h:119
center alignment
Definition: Win.h:85