57 #ifndef _RNR_WIN_GTK_H 58 #define _RNR_WIN_GTK_H 63 #include "rnr/rnrconfig.h" 65 #include "opencv2/core/core.hpp" 69 #include <pango/pango.h> 101 WinGtk(
const std::string &strWinName,
104 bool bDecorate=
true);
128 const std::string &strVal);
185 virtual void showCvImage(cv::Mat &img, uint_t uImgIndex=0);
199 virtual void showPageRef(
const std::string &strPageRef);
207 virtual void showStatus(
const char *sFmt, ...);
223 virtual int waitKey(
int delay);
241 virtual void wait(
int delay);
258 const std::string &strIconPath,
259 const std::string &strAltText,
260 const std::string &strToolTip=
"");
276 const std::string &strAltText,
277 const std::string &strToolTip=
"");
291 const std::string &strLabel,
292 const std::string &strToolTip=
"");
314 const std::string &strIconPath,
315 const std::string &strToolTip=
"");
330 const std::string &strToolTip=
"");
343 const std::string &strLabel,
344 const std::string &strToolTip=
"");
578 bool findBttn(
int nBttnId, MapBttns_T::iterator &pos)
580 if( (pos = m_mapBttns[0].find(nBttnId)) == m_mapBttns[0].end() )
582 if( (pos = m_mapBttns[1].find(nBttnId)) == m_mapBttns[1].end() )
619 static gboolean
onAlarm(gpointer user_data);
634 gpointer *user_data);
655 gpointer *user_data);
665 static void onButtonClick(GtkWidget *w, gpointer *user_data);
682 #endif // _RNR_WIN_GTK_H static gboolean onKeyPress(GtkWidget *w, GdkEventKey *event, gpointer *user_data)
Keyboard press event callback handler.
GtkWidget * m_wBttn
button widget
static const int MaxCvImages
max workspace images/video
GtkWidget * m_wCvImage[MaxCvImages]
CvImage widgets.
GtkWidget * m_wGstWin
GstWin container widget.
GtkWidget * getExtraVBox()
Get the window's workspace extra vertical box container widget.
GtkWidget * m_wBttnMenu[NumOfButtonMenus]
left menu container widget
virtual void initWorkspaceAsGtk()
Initialize window's workspace to hold a GTK widget tree.
GtkWindow * m_wWindowMain
main widnow widget
virtual bool removeButton(int nBttnId)
Remove a button from a menu.
virtual void initWorkspaceAsGstWin(const cv::Size &sizeVidWin)
Initialize the workspace as a window display to show GStreamer video/images.
GtkWidget * getMainWidget()
Get the top-level main widget.
virtual void showPageRef(int nPageId)
Show page reference number.
virtual void showCvImage(cv::Mat &img, uint_t uImgIndex=0)
Show a OpenCV image on the workspace.
CvSize m_sizeCvImage[MaxCvImages]
size of shown CvImage
int m_nBttnId
unique button id
virtual void show()
Show/refresh all gui widgets in window.
GtkWidget * m_wIcon
workspace identifying icon
virtual void removeAllButtons()
Remove all buttons from all menus.
virtual bool replaceButtonLabel(int nBttnId, const std::string &strLabel, const std::string &strToolTip="")
Replace existing button label with new label.
RoadNarrows Robotics Win abstract base class interface.
bool findBttn(int nBttnId, MapBttns_T::iterator &pos)
Find button.
virtual void waitMouse(int delay)
Wait for timeout or registered mouse event.
virtual void showWorkspace()
Show/refresh all gui widgets in workspace.
static gboolean onAlarm(gpointer user_data)
Timeout expiry callback handler.
GtkWidget * getWorkspaceVBox()
Get the window's workspace top vertical box container widget.
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.
virtual GdkColor * getLookAndFeelGdkColor(const std::string &strKey)
Get the GUI look and feel GDK color.
MapPangoFont_T m_mapFonts
look and feel font map
virtual uint_t initWorkspaceAsCvImage()
Initialize the workspace as a display to show OpenCV images.
virtual bool addButton(int nBttnId, AlignOp eAlign, GtkWidget *wBttn)
Add a GTK button widget to window button menu.
WinGtk window derived class.
virtual ~WinGtk()
Destructor.
static gboolean onMouseCvImage(GtkWidget *w, GdkEventKey *event, gpointer *user_data)
Mouse event on OpenCV Image widget workspace callback handler.
RoadNarrows top-level look and feel user interface declarations.
GtkWidget * m_wContainer
top container widget (hbox)
GtkWidget * getGstWin()
Get GStreamer X-Window widget.
virtual bool showButtonState(int nBttnId, WidgetState eBttnState)
Show a button's widget state.
WinGtk(const std::string &strWinName, int nWidth, int nHeight, bool bDecorate=true)
Default initialization constructor.
virtual void eraseWorkspace()
Remove all widgets contained in the window's workspace container.
GtkWidget * m_wMain
main widget
MapBttns_T m_mapBttns[NumOfButtonMenus]
left/right map of menu buttons.
GtkWidget * m_wStatusFrame
holds page reference and status bar
static void onRealizeGstWin(GtkWidget *w, gpointer user_data)
Realize GStreamer video window callback.
static void onButtonClick(GtkWidget *w, gpointer *user_data)
Button press event handler.
std::map< std::string, GdkColor > MapGdkColor_T
color map type
virtual void initWorkspace()
Initialize window's workspace to hold a GTK toolkit widget tree.
static const int NumOfButtonMenus
left and right menus
RNR Win window abstract base class.
virtual PangoFontDescription * getLookAndFeelFont(const std::string &strKey)
Get the GUI look and feel Pango font description.
MapGdkColor_T m_mapColors
look and feel color map
GtkWindow * getMainWindowWidget()
Get the top-level main window.
virtual void setLookAndFeel(const std::string &strKey, const std::string &strVal)
Set GUI look and feel value.
int getBttnMenuIdx(AlignOp eAlign)
Get button menu index from alignment enum.
GtkWidget * m_wCvImageBox[MaxCvImages]
CvImage box containers.
static void onRemoveWidget(GtkWidget *w, gpointer user_data)
Remove widget callback handler.
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.
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.
virtual void wait(int delay)
Wait for timeout.
GtkWidget * m_wWorkspace
middle workspace container widget
void convertLookAndFeelDefaults()
Convert Look and Feel defaults to native GTK/GDK values.
GtkWidget * m_wPageRef
workflow page reference
std::map< std::string, PangoFontDescription * > MapPangoFont_T
font map type
std::map< int, BttnInfo_T > MapBttns_T
button map type
virtual void configureCvImage(uint_t uImgIndex)
Configure OpenCV image widget.
virtual int waitKey(int delay)
Wait for keypress or timeout.
CvPoint m_ptCvImageOrig[MaxCvImages]
origin of shown CvImage
virtual void removeWorkspaceCvImageDisplay(uint_t uImgIndex)
Remove OpenCV display widget from workspace.
GtkWidget * m_wStatusBar
status message bar
virtual void showStatus(const char *sFmt,...)
Show status message.
virtual const char * getGuiToolkitName()
Get GUI toolkit name.
GtkWidget * m_wExtraVBox
extra vertical box