appkit  1.5.1
RoadNarrows Robotics Application Kit
WinGtk.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_wingtk
8 //
9 // File: WinGtk.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 GTK derived WinGtk window 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_GTK_H
58 #define _RNR_WIN_GTK_H
59 
60 #include <string>
61 #include <map>
62 
63 #include "rnr/rnrconfig.h"
64 
65 #include "opencv2/core/core.hpp"
66 
67 #include <gtk/gtk.h>
68 #include <gdk/gdk.h>
69 #include <pango/pango.h>
70 
71 #include "rnr/appkit/WinLookFeel.h"
72 #include "rnr/appkit/Win.h"
73 
74 /*!
75  * \brief RoadNarrows Robotics
76  */
77 namespace rnr
78 {
79  //...........................................................................
80  // Class WinGtk
81  //...........................................................................
82 
83  /*!
84  * \brief WinGtk window derived class.
85  *
86  * The WinGtk class uses the GTK (GIMP Toolkit) libraries for creating the
87  * graphical user interfaces.
88  */
89  class WinGtk : public Win
90  {
91  public:
92  /*!
93  * \brief Default initialization constructor.
94  *
95  * \param strWinName Window name.
96  * \param nWidth Window width in pixels.
97  * \param nHeight Window height in pixels.
98  * \param bDecorate Do [not] decorate window with title, border,
99  * etc. Windowing system specific.
100  */
101  WinGtk(const std::string &strWinName,
102  int nWidth,
103  int nHeight,
104  bool bDecorate=true);
105 
106  /*!
107  * \brief Destructor.
108  */
109  virtual ~WinGtk();
110 
111  /*!
112  * \brief Get GUI toolkit name.
113  *
114  * \return GUI toolkit identifier string.
115  */
116  virtual const char *getGuiToolkitName()
117  {
118  return "gtk+";
119  }
120 
121  /*!
122  * \brief Set GUI look and feel value.
123  *
124  * \param strKey Key.
125  * \param strVal Value.
126  */
127  virtual void setLookAndFeel(const std::string &strKey,
128  const std::string &strVal);
129 
130  /*!
131  * \brief Get the GUI look and feel GDK color.
132  *
133  * \param strKey Key.
134  *
135  * \return Pointer to GDK color value.
136  */
137  virtual GdkColor *getLookAndFeelGdkColor(const std::string &strKey)
138  {
139  if( m_mapColors.find(strKey) != m_mapColors.end() )
140  {
141  return &m_mapColors[strKey];
142  }
143  else
144  {
145  return &m_mapColors["color_rn_black"];
146  }
147  }
148 
149  /*!
150  * \brief Get the GUI look and feel Pango font description.
151  *
152  * \param strKey Key.
153  *
154  * \return Pointer to pango font description value.
155  */
156  virtual PangoFontDescription *getLookAndFeelFont(const std::string &strKey)
157  {
158  if( m_mapFonts.find(strKey) != m_mapFonts.end() )
159  {
160  return m_mapFonts[strKey];
161  }
162  else
163  {
164  return m_mapFonts["color_rn_black"];
165  }
166  }
167 
168  /*!
169  * \brief Show/refresh all gui widgets in window.
170  */
171  virtual void show()
172  {
173  gtk_widget_show_all(m_wWorkspace);
174  gtk_widget_show(m_wMain);
175  }
176 
177  /*!
178  * \brief Show a OpenCV image on the workspace.
179  *
180  * The workspace must contain a CvImage prior to calling this function.
181  *
182  * \param pImg Pointer to image.
183  * \param uImgIndex Image instance.
184  */
185  virtual void showCvImage(cv::Mat &img, uint_t uImgIndex=0);
186 
187  /*!
188  * \brief Show page reference number.
189  *
190  * \param nPageRef Page reference number.
191  */
192  virtual void showPageRef(int nPageId);
193 
194  /*!
195  * \brief Show page reference.
196  *
197  * \param strPageRef Page reference string.
198  */
199  virtual void showPageRef(const std::string &strPageRef);
200 
201  /*!
202  * \brief Show status message.
203  *
204  * \param sFmt Format string.
205  * \param ... Variable arguments.
206  */
207  virtual void showStatus(const char *sFmt, ...);
208 
209  /*!
210  * \brief Clear status message.
211  */
212  virtual void clearStatus();
213 
214  /*!
215  * \brief Wait for keypress or timeout.
216  *
217  * GTK widgets can be updated during this wait.
218  *
219  * \param delay Timeout delay in millseconds. Set to 0 for no timeout.
220  *
221  * \return Returns code of last key pressed or -1 if timed out.
222  */
223  virtual int waitKey(int delay);
224 
225  /*!
226  * \brief Wait for timeout or registered mouse event.
227  *
228  * Window widgets can be updated during this wait.
229  *
230  * \param delay Timeout delay in millseconds \h_gt 0.
231  */
232  virtual void waitMouse(int delay);
233 
234  /*!
235  * \brief Wait for timeout.
236  *
237  * GTK widgets can be updated during this wait.
238  *
239  * \param delay Timeout delay in millseconds \h_gt 0.
240  */
241  virtual void wait(int delay);
242 
243  /*!
244  * \brief Add a button with an image to window button menu.
245  *
246  * If the image fails to load, the alternate text is display instead.
247  *
248  * \param nBttnId Window unique button id.
249  * \param eAlign Menu item icon alignment. See \ref rnmpwin_align
250  * \param strIconPath Path to icon image file.
251  * \param strAltText Button alternate text.
252  * \param strToolTip Optional button tool tip text.
253  *
254  * \return Returns true on success, false otherwise.
255  */
256  virtual bool addImageButton(int nBttnId,
257  AlignOp eAlign,
258  const std::string &strIconPath,
259  const std::string &strAltText,
260  const std::string &strToolTip="");
261 
262  /*!
263  * \brief Add a button with a GTK image widget to window button menu.
264  *
265  * \param nBttnId Window unique button id.
266  * \param eAlign Menu item icon alignment. See \ref rnmpwin_align
267  * \param wBttnImg Button image widget (GtkWidget *).
268  * \param strAltText Button alternate text.
269  * \param strToolTip Optional button tool tip text.
270  *
271  * \return Returns true on success, false otherwise.
272  */
273  virtual bool addImageButton(int nBttnId,
274  AlignOp eAlign,
275  void *wBttnImg,
276  const std::string &strAltText,
277  const std::string &strToolTip="");
278 
279  /*!
280  * \brief Add a button with a label to window button menu.
281  *
282  * \param nBttnId Window unique button id.
283  * \param eAlign Menu item icon alignment. See \ref rnmpwin_align
284  * \param strLabel Button text label.
285  * \param strToolTip Optional button tool tip text.
286  *
287  * \return Returns true on success, false otherwise.
288  */
289  virtual bool addLabelButton(int nBttnId,
290  AlignOp eAlign,
291  const std::string &strLabel,
292  const std::string &strToolTip="");
293 
294  /*!
295  * \brief Add a GTK button widget to window button menu.
296  *
297  * \param nBttnId Unique button id.
298  * \param eAlign Menu item icon alignment. See \ref rnmpwin_align.
299  * \param wBttn Button widget.
300  */
301  virtual bool addButton(int nBttnId, AlignOp eAlign, GtkWidget *wBttn);
302 
303  /*!
304  * \brief Replace existing button image with new image.
305  *
306  * \param nBttnId Unique button id.
307  * \param strIconPath Path to icon image file.
308  * \param strToolTip Optional button tool tip text. If empty, then the
309  * current tooltip, if any, is used.
310  *
311  * \return Returns true if button image is replaced, false otherwise.
312  */
313  virtual bool replaceButtonImage(int nBttnId,
314  const std::string &strIconPath,
315  const std::string &strToolTip="");
316 
317 
318  /*!
319  * \brief Replace existing button image with new GTK image widget.
320  *
321  * \param nBttnId Unique button id.
322  * \param wBttnImg New button image widget (GtkWidget *).
323  * \param strToolTip Optional button tool tip text. If empty, then the
324  * current tooltip, if any, is used.
325  *
326  * \return Returns true if button image is replaced, false otherwise.
327  */
328  virtual bool replaceButtonImage(int nBttnId,
329  void *wBttnImg,
330  const std::string &strToolTip="");
331 
332  /*!
333  * \brief Replace existing button label with new label.
334  *
335  * \param nBttnId Unique button id.
336  * \param strLabel Button text label.
337  * \param strToolTip Optional button tooltip text. If empty, then the
338  * current tooltip, if any, is used.
339  *
340  * \return Returns true if button label is replaced, false otherwise.
341  */
342  virtual bool replaceButtonLabel(int nBttnId,
343  const std::string &strLabel,
344  const std::string &strToolTip="");
345 
346 
347  /*!
348  * \brief Remove a button from a menu.
349  *
350  * \param nBttnId Unique button id.
351  *
352  * \return Returns true if button is removed, false otherwise.
353  */
354  virtual bool removeButton(int nBttnId);
355 
356  /*!
357  * \brief Remove all buttons from all menus.
358  */
359  virtual void removeAllButtons();
360 
361  /*!
362  * \brief Show a button's widget state.
363  *
364  * \param nBttnId Unique button id.
365  * \param eBttnState New button state. See \ref rnmpwin_itemstate.
366  *
367  * \return Returns true if button state set, false otherwise.
368  */
369  virtual bool showButtonState(int nBttnId, WidgetState eBttnState);
370 
371  /*!
372  * \brief Initialize window's workspace to hold a GTK toolkit
373  * widget tree.
374  *
375  * All previous gui elements are erased.
376  */
377  virtual void initWorkspace()
378  {
380  }
381 
382  /*!
383  * \brief Initialize window's workspace to hold a GTK widget tree.
384  *
385  * All previous gui elements are erased.
386  */
387  virtual void initWorkspaceAsGtk();
388 
389  /*!
390  * \brief Initialize the workspace as a display to show OpenCV images.
391  *
392  * This is a convinience function to use if only one image widget is
393  * contained in the workspace.
394  *
395  * Alternately, for a mixed workspace of GTK widgets and up to
396  * MaxCvImages(4) OpenCV images, the follow functions are available:
397  * \code
398  * initWorkspace() or initWorkSpaceAsGtk()
399  * addWorkspaceCvImageDisplay()
400  * \endcode
401  *
402  * Use \code showCvImage() \endcode to display an OpenCv image.
403  *
404  * All previous gui elements are erased.
405  *
406  * \return Index (handle) to CvImage widget instance.
407  */
408  virtual uint_t initWorkspaceAsCvImage();
409 
410  /*!
411  * \brief Initialize the workspace as a window display to show GStreamer
412  * video/images.
413  *
414  * GStreamer automatically displays video/images via the GTK callback
415  * mechanism, so no show function is required.
416  *
417  * This is a convinience function to use if only one stream is
418  * contained in the workspace.
419  *
420  * All previous gui elements are erased.
421  */
422  virtual void initWorkspaceAsGstWin(const cv::Size &sizeVidWin);
423 
424  /*!
425  * \brief Add an OpenCV display widget to the container widget.
426  *
427  * The container widget must be added to the window workspace by
428  * the application to keep the widget control correct.
429  *
430  * \param wContainer Pointer to (derived) GTK_BOX container widget.
431  *
432  * \return On success, returns index (handle) to CvImage instance.\n
433  * On failure, returns -1.
434  */
435  virtual uint_t addWorkspaceCvImageDisplay(void *wContainer);
436 
437  /*!
438  * \brief Remove OpenCV display widget from workspace.
439  *
440  * \param uImgIndex Image instance.
441  */
442  virtual void removeWorkspaceCvImageDisplay(uint_t uImgIndex);
443 
444  /*!
445  * \brief Show/refresh all gui widgets in workspace.
446  */
447  virtual void showWorkspace()
448  {
449  gtk_widget_show_all(m_wWorkspace);
450  //gtk_widget_show(m_wMain);
451  }
452 
453  /*!
454  * \brief Remove all widgets contained in the window's workspace container.
455  *
456  * \note A widget is actually destroyed iff there are no references to
457  * the widget.
458  */
459  virtual void eraseWorkspace();
460 
461  /*!
462  * \brief Get the top-level main widget.
463  *
464  * \return Pointer to widget.
465  */
466  GtkWidget *getMainWidget()
467  {
468  return m_wMain;
469  }
470 
471  /*!
472  * \brief Get the top-level main window.
473  *
474  * \return Pointer to window widget.
475  */
476  GtkWindow *getMainWindowWidget()
477  {
478  return m_wWindowMain;
479  }
480 
481  /*!
482  * \brief Get the window's workspace top vertical box container widget.
483  *
484  * \return Pointer to GtkVBox widget.
485  */
486  GtkWidget *getWorkspaceVBox()
487  {
488  return m_wWorkspace;
489  }
490 
491  /*!
492  * \brief Get the window's workspace extra vertical box container widget.
493  *
494  * This widget is between the worksapce vertical box and the status line
495  * and is contained within the workspace. It is only visible if the
496  * application adds gui elements to it.
497  *
498  * \return Pointer to GtkVBox widget.
499  */
500  GtkWidget *getExtraVBox()
501  {
502  return m_wExtraVBox;
503  }
504 
505  /*!
506  * \brief Get GStreamer X-Window widget.
507  *
508  * \return Pointer to GStreamer bound widget.
509  */
510  GtkWidget *getGstWin()
511  {
512  return m_wGstWin;
513  }
514 
515  protected:
516  /*!
517  * Internal button information structure
518  */
519  struct BttnInfo_T
520  {
521  int m_nBttnId; ///< unique button id
522  GtkWidget *m_wBttn; ///< button widget
523  WinGtk *m_pWin; ///< this
524  };
525 
526  typedef std::map<int, BttnInfo_T> MapBttns_T; ///< button map type
527  typedef std::map<std::string, GdkColor> MapGdkColor_T; ///< color map type
528  typedef std::map<std::string, PangoFontDescription *> MapPangoFont_T;
529  ///< font map type
530  // GUI Widgets
531  GtkWidget *m_wMain; ///< main widget
532  GtkWindow *m_wWindowMain; ///< main widnow widget
533  GtkWidget *m_wContainer; ///< top container widget (hbox)
535  ///< left menu container widget
536  GtkWidget *m_wWorkspace; ///< middle workspace container widget
537  GtkWidget *m_wExtraVBox; ///< extra vertical box
538  GtkWidget *m_wIcon; ///< workspace identifying icon
539  GtkWidget *m_wStatusFrame; ///< holds page reference and status bar
540  GtkWidget *m_wPageRef; ///< workflow page reference
541  GtkWidget *m_wStatusBar; ///< status message bar
542 
543  // Image/Video Widgets and Data
544  GtkWidget *m_wCvImage[MaxCvImages]; ///< CvImage widgets
545  GtkWidget *m_wCvImageBox[MaxCvImages]; ///< CvImage box containers
546  GtkWidget *m_wGstWin; ///< GstWin container widget
547  CvSize m_sizeCvImage[MaxCvImages]; ///< size of shown CvImage
548  CvPoint m_ptCvImageOrig[MaxCvImages]; ///< origin of shown CvImage
549 
550  // Menu Button Info
552  ///< left/right map of menu buttons.
553 
554  // Look and Feel
555  MapGdkColor_T m_mapColors; ///< look and feel color map
556  MapPangoFont_T m_mapFonts; ///< look and feel font map
557 
558  /*!
559  * \brief Get button menu index from alignment enum.
560  *
561  * \param eAlign Alignment enumuration.
562  *
563  * \return Menu index.
564  */
565  inline int getBttnMenuIdx(AlignOp eAlign)
566  {
567  return eAlign == AlignOpRight? 1: 0;
568  }
569 
570  /*!
571  * \brief Find button.
572  *
573  * \param nBttnId Unique button id.
574  * \param pos Position iterator. Set to end(), if no button found.
575  *
576  * \return Returns true if button found, false otherwise.
577  */
578  bool findBttn(int nBttnId, MapBttns_T::iterator &pos)
579  {
580  if( (pos = m_mapBttns[0].find(nBttnId)) == m_mapBttns[0].end() )
581  {
582  if( (pos = m_mapBttns[1].find(nBttnId)) == m_mapBttns[1].end() )
583  {
584  return false;
585  }
586  }
587  return true;
588  }
589 
590  /*!
591  * \brief Convert Look and Feel defaults to native GTK/GDK values.
592  */
594 
595  /*!
596  * \brief Configure OpenCV image widget.
597  *
598  * \param uImgIndex Image instance.
599  */
600  virtual void configureCvImage(uint_t uImgIndex);
601 
602  /*!
603  * \brief Remove widget callback handler.
604  *
605  * \param w Widget to be removed.
606  * \param user_data Any supplied callback data (parent container widget).
607  */
608  static void onRemoveWidget(GtkWidget *w, gpointer user_data);
609 
610  /*!
611  * \brief Timeout expiry callback handler.
612  *
613  * The supplied user data is set to 1 (true).
614  *
615  * \param user_data Pointer to user supplied expiry flag.
616  *
617  * \return Returns FALSE.
618  */
619  static gboolean onAlarm(gpointer user_data);
620 
621  /*!
622  * \brief Keyboard press event callback handler.
623  *
624  * If registered, the application callback function will be called.
625  *
626  * \param w Widget where keyboard event occurred.
627  * \param event Keyboard event.
628  * \param user_data Supplied user data (this).
629  *
630  * \return Returns FALSE.
631  */
632  static gboolean onKeyPress(GtkWidget *w,
633  GdkEventKey *event,
634  gpointer *user_data);
635 
636  /*!
637  * \brief Mouse event on OpenCV Image widget workspace callback handler.
638  *
639  * The workspace must be set as an CvImage workspace.
640  *
641  * If registered, the application callback function will be called.
642  *
643  * The pixel coordinates are contrained to any shown OpenCv image with the
644  * origin at the image origin. Mouse events outside the image return
645  * nopoint().
646  *
647  * \param w CvImage widget where mouse event occurred.
648  * \param event Mouse event.
649  * \param user_data Supplied user data (this).
650  *
651  * \return Returns FALSE.
652  */
653  static gboolean onMouseCvImage(GtkWidget *w,
654  GdkEventKey *event,
655  gpointer *user_data);
656 
657  /*!
658  * \brief Button press event handler.
659  *
660  * If registered, the application callback function will be called.
661  *
662  * \param w Button widget.
663  * \param user_data Button information
664  */
665  static void onButtonClick(GtkWidget *w, gpointer *user_data);
666 
667  /*!
668  * \brief Realize GStreamer video window callback.
669  *
670  * Once the window has been realized, the X-Window id can be obtained. The
671  * id is critical for rendering gst video and images to the gtk widget.
672  *
673  * \param w Gtk draw widget where video will be overlaied.
674  * \param user_data Supplied user data (this).
675  */
676  static void onRealizeGstWin(GtkWidget *w, gpointer user_data);
677  };
678 
679 } // rnr namespace
680 
681 
682 #endif // _RNR_WIN_GTK_H
static gboolean onKeyPress(GtkWidget *w, GdkEventKey *event, gpointer *user_data)
Keyboard press event callback handler.
Definition: WinGtk.cxx:1002
GtkWidget * m_wBttn
button widget
Definition: WinGtk.h:522
WidgetState
Definition: Win.h:129
static const int MaxCvImages
max workspace images/video
Definition: Win.h:214
GtkWidget * m_wCvImage[MaxCvImages]
CvImage widgets.
Definition: WinGtk.h:544
GtkWidget * m_wGstWin
GstWin container widget.
Definition: WinGtk.h:546
GtkWidget * getExtraVBox()
Get the window&#39;s workspace extra vertical box container widget.
Definition: WinGtk.h:500
GtkWidget * m_wBttnMenu[NumOfButtonMenus]
left menu container widget
Definition: WinGtk.h:534
virtual void initWorkspaceAsGtk()
Initialize window&#39;s workspace to hold a GTK widget tree.
Definition: WinGtk.cxx:794
GtkWindow * m_wWindowMain
main widnow widget
Definition: WinGtk.h:532
virtual bool removeButton(int nBttnId)
Remove a button from a menu.
Definition: WinGtk.cxx:696
virtual void initWorkspaceAsGstWin(const cv::Size &sizeVidWin)
Initialize the workspace as a window display to show GStreamer video/images.
Definition: WinGtk.cxx:839
GtkWidget * getMainWidget()
Get the top-level main widget.
Definition: WinGtk.h:466
rigth alignment
Definition: Win.h:86
virtual void showPageRef(int nPageId)
Show page reference number.
Definition: WinGtk.cxx:357
virtual void showCvImage(cv::Mat &img, uint_t uImgIndex=0)
Show a OpenCV image on the workspace.
Definition: WinGtk.cxx:331
CvSize m_sizeCvImage[MaxCvImages]
size of shown CvImage
Definition: WinGtk.h:547
int m_nBttnId
unique button id
Definition: WinGtk.h:521
virtual void show()
Show/refresh all gui widgets in window.
Definition: WinGtk.h:171
GtkWidget * m_wIcon
workspace identifying icon
Definition: WinGtk.h:538
virtual void removeAllButtons()
Remove all buttons from all menus.
Definition: WinGtk.cxx:735
virtual bool replaceButtonLabel(int nBttnId, const std::string &strLabel, const std::string &strToolTip="")
Replace existing button label with new label.
Definition: WinGtk.cxx:670
RoadNarrows Robotics Win abstract base class interface.
bool findBttn(int nBttnId, MapBttns_T::iterator &pos)
Find button.
Definition: WinGtk.h:578
virtual void waitMouse(int delay)
Wait for timeout or registered mouse event.
Definition: WinGtk.cxx:440
virtual void showWorkspace()
Show/refresh all gui widgets in workspace.
Definition: WinGtk.h:447
static gboolean onAlarm(gpointer user_data)
Timeout expiry callback handler.
Definition: WinGtk.cxx:996
GtkWidget * getWorkspaceVBox()
Get the window&#39;s workspace top vertical box container widget.
Definition: WinGtk.h:486
virtual bool replaceButtonImage(int nBttnId, const std::string &strIconPath, const std::string &strToolTip="")
Replace existing button image with new image.
virtual uint_t addWorkspaceCvImageDisplay(void *wContainer)
Add an OpenCV display widget to the container widget.
Definition: WinGtk.cxx:880
virtual GdkColor * getLookAndFeelGdkColor(const std::string &strKey)
Get the GUI look and feel GDK color.
Definition: WinGtk.h:137
MapPangoFont_T m_mapFonts
look and feel font map
Definition: WinGtk.h:556
virtual uint_t initWorkspaceAsCvImage()
Initialize the workspace as a display to show OpenCV images.
Definition: WinGtk.cxx:800
virtual bool addButton(int nBttnId, AlignOp eAlign, GtkWidget *wBttn)
Add a GTK button widget to window button menu.
Definition: WinGtk.cxx:568
AlignOp
Definition: Win.h:81
WinGtk window derived class.
Definition: WinGtk.h:89
virtual ~WinGtk()
Destructor.
Definition: WinGtk.cxx:263
static gboolean onMouseCvImage(GtkWidget *w, GdkEventKey *event, gpointer *user_data)
Mouse event on OpenCV Image widget workspace callback handler.
Definition: WinGtk.cxx:1037
RoadNarrows top-level look and feel user interface declarations.
GtkWidget * m_wContainer
top container widget (hbox)
Definition: WinGtk.h:533
GtkWidget * getGstWin()
Get GStreamer X-Window widget.
Definition: WinGtk.h:510
virtual bool showButtonState(int nBttnId, WidgetState eBttnState)
Show a button&#39;s widget state.
Definition: WinGtk.cxx:763
WinGtk(const std::string &strWinName, int nWidth, int nHeight, bool bDecorate=true)
Default initialization constructor.
Definition: WinGtk.cxx:94
virtual void eraseWorkspace()
Remove all widgets contained in the window&#39;s workspace container.
Definition: WinGtk.cxx:930
GtkWidget * m_wMain
main widget
Definition: WinGtk.h:531
MapBttns_T m_mapBttns[NumOfButtonMenus]
left/right map of menu buttons.
Definition: WinGtk.h:551
GtkWidget * m_wStatusFrame
holds page reference and status bar
Definition: WinGtk.h:539
static void onRealizeGstWin(GtkWidget *w, gpointer user_data)
Realize GStreamer video window callback.
Definition: WinGtk.cxx:1138
static void onButtonClick(GtkWidget *w, gpointer *user_data)
Button press event handler.
Definition: WinGtk.cxx:1127
std::map< std::string, GdkColor > MapGdkColor_T
color map type
Definition: WinGtk.h:527
virtual void initWorkspace()
Initialize window&#39;s workspace to hold a GTK toolkit widget tree.
Definition: WinGtk.h:377
static const int NumOfButtonMenus
left and right menus
Definition: Win.h:215
RNR Win window abstract base class.
Definition: Win.h:211
virtual PangoFontDescription * getLookAndFeelFont(const std::string &strKey)
Get the GUI look and feel Pango font description.
Definition: WinGtk.h:156
MapGdkColor_T m_mapColors
look and feel color map
Definition: WinGtk.h:555
GtkWindow * getMainWindowWidget()
Get the top-level main window.
Definition: WinGtk.h:476
virtual void setLookAndFeel(const std::string &strKey, const std::string &strVal)
Set GUI look and feel value.
Definition: WinGtk.cxx:276
int getBttnMenuIdx(AlignOp eAlign)
Get button menu index from alignment enum.
Definition: WinGtk.h:565
GtkWidget * m_wCvImageBox[MaxCvImages]
CvImage box containers.
Definition: WinGtk.h:545
static void onRemoveWidget(GtkWidget *w, gpointer user_data)
Remove widget callback handler.
Definition: WinGtk.cxx:990
WinGtk * m_pWin
this
Definition: WinGtk.h:523
virtual bool addLabelButton(int nBttnId, AlignOp eAlign, const std::string &strLabel, const std::string &strToolTip="")
Add a button with a label to window button menu.
Definition: WinGtk.cxx:539
virtual bool addImageButton(int nBttnId, AlignOp eAlign, const std::string &strIconPath, const std::string &strAltText, const std::string &strToolTip="")
Add a button with an image to window button menu.
virtual void clearStatus()
Clear status message.
Definition: WinGtk.cxx:396
virtual void wait(int delay)
Wait for timeout.
Definition: WinGtk.cxx:464
GtkWidget * m_wWorkspace
middle workspace container widget
Definition: WinGtk.h:536
void convertLookAndFeelDefaults()
Convert Look and Feel defaults to native GTK/GDK values.
Definition: WinGtk.cxx:950
GtkWidget * m_wPageRef
workflow page reference
Definition: WinGtk.h:540
std::map< std::string, PangoFontDescription * > MapPangoFont_T
font map type
Definition: WinGtk.h:528
std::map< int, BttnInfo_T > MapBttns_T
button map type
Definition: WinGtk.h:526
RoadNarrows Robotics.
Definition: Camera.h:74
virtual void configureCvImage(uint_t uImgIndex)
Configure OpenCV image widget.
Definition: WinGtk.cxx:971
virtual int waitKey(int delay)
Wait for keypress or timeout.
Definition: WinGtk.cxx:402
CvPoint m_ptCvImageOrig[MaxCvImages]
origin of shown CvImage
Definition: WinGtk.h:548
virtual void removeWorkspaceCvImageDisplay(uint_t uImgIndex)
Remove OpenCV display widget from workspace.
Definition: WinGtk.cxx:918
GtkWidget * m_wStatusBar
status message bar
Definition: WinGtk.h:541
virtual void showStatus(const char *sFmt,...)
Show status message.
Definition: WinGtk.cxx:378
virtual const char * getGuiToolkitName()
Get GUI toolkit name.
Definition: WinGtk.h:116
GtkWidget * m_wExtraVBox
extra vertical box
Definition: WinGtk.h:537