appkit  1.5.1
RoadNarrows Robotics Application Kit
Win.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Robotics Application Tool Kit
4 //
5 // Library: librnr_win
6 //
7 // File: Win.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2013-05-03 07:45:13 -0600 (Fri, 03 May 2013) $
12  * $Rev: 2904 $
13  *
14  * \brief RoadNarrows Robotics Win abstract base class implementation.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  * \author Daniel Packard (daniel@roadnarrows.com)
18  *
19  * \par Copyright
20  * \h_copy 2011-2017. RoadNarrows LLC.\n
21  * http://www.roadnarrows.com\n
22  * All Rights Reserved
23  */
24 /*
25  * @EulaBegin@
26  *
27  * Permission is hereby granted, without written agreement and without
28  * license or royalty fees, to use, copy, modify, and distribute this
29  * software and its documentation for any purpose, provided that
30  * (1) The above copyright notice and the following two paragraphs
31  * appear in all copies of the source code and (2) redistributions
32  * including binaries reproduces these notices in the supporting
33  * documentation. Substantial modifications to this software may be
34  * copyrighted by their authors and need not follow the licensing terms
35  * described here, provided that the new terms are clearly indicated in
36  * all files where they apply.
37  *
38  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
39  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
40  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
41  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
42  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
43  * THE POSSIBILITY OF SUCH DAMAGE.
44  *
45  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
46  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
47  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
48  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
49  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
50  *
51  * @EulaEnd@
52  */
53 ////////////////////////////////////////////////////////////////////////////////
54 
55 #include <string>
56 #include <map>
57 
58 #include "rnr/rnrconfig.h"
59 
60 #include "opencv2/core/core.hpp"
61 
62 #include "rnr/appkit/WinLookFeel.h"
63 #include "rnr/appkit/Win.h"
64 
65 using namespace std;
66 using namespace cv;
67 using namespace rnr;
68 
69 Win::Win(const string &strWinName,
70  int nWidth,
71  int nHeight,
72  bool bDecorate) :
73  m_strWinName(strWinName),
74  m_nWinWidth(nWidth),
75  m_nWinHeight(nHeight),
76  m_bDecorate(bDecorate)
77 {
78  if( m_strWinName.empty() )
79  {
80  m_strWinName = "Main";
81  }
82 
83  for(int i=0; i<MaxCvImages; ++i)
84  {
85  m_funcMouseCb[i] = NULL;
86  m_dataMouseCb[i] = NULL;
87  }
88 
89  m_funcKeyCb = NULL;
90  m_dataKeyCb = NULL;
91  m_funcBttnCb = NULL;
92  m_dataBttnCb = NULL;
93  m_uGstWinXid = 0;
94  m_uLastKey = 0;
95  m_bMouseEvent = false;
96 
98 }
99 
101 {
102  m_mapLookFeel["color_win_bg"] = GuiStrColorWinBg;
103  m_mapLookFeel["color_status_fg"] = GuiStrColorStatusFg;
104  m_mapLookFeel["color_status_bg"] = GuiStrColorStatusBg;
105  m_mapLookFeel["color_status_border"] = GuiStrColorStatusBorder;
106  m_mapLookFeel["color_button_bg"] = GuiStrColorBttnBg;
107  m_mapLookFeel["color_text_fg"] = GuiStrColorTextFg;
108  m_mapLookFeel["color_text_bg"] = GuiStrColorTextBg;
109  m_mapLookFeel["color_image_bg"] = GuiStrColorImageBg;
110  m_mapLookFeel["color_rn_black"] = GuiStrColorRNBlack;
111  m_mapLookFeel["color_rn_white"] = GuiStrColorRNWhite;
112  m_mapLookFeel["color_rn_red"] = GuiStrColorRNRed;
113  m_mapLookFeel["color_rn_yellow"] = GuiStrColorRNYellow;
114  m_mapLookFeel["font_text"] = GuiStrFontSmall;
115  m_mapLookFeel["font_status"] = GuiStrFontSmall;
116  m_mapLookFeel["font_large"] = GuiStrFontLarge;
117  m_mapLookFeel["font_medium"] = GuiStrFontMedium;
118  m_mapLookFeel["font_small"] = GuiStrFontSmall;
119  m_mapLookFeel["font_tiny"] = GuiStrFontTiny;
120 }
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
const char *const GuiStrColorRNWhite
RN white.
Definition: WinLookFeel.h:86
const char *const GuiStrColorRNYellow
RN yellow.
Definition: WinLookFeel.h:87
const char *const GuiStrColorStatusBg
status bg color
Definition: WinLookFeel.h:77
const char *const GuiStrColorRNBlack
RN black.
Definition: WinLookFeel.h:85
const char *const GuiStrFontLarge
large font
Definition: WinLookFeel.h:89
MouseCbFunc_T m_funcMouseCb[MaxCvImages]
registered mouse cb func
Definition: Win.h:662
RoadNarrows Robotics Win abstract base class interface.
const char *const GuiStrFontMedium
medium font
Definition: WinLookFeel.h:90
void * m_dataMouseCb[MaxCvImages]
registered mouse cb data
Definition: Win.h:663
std::string m_strWinName
window name (and title)
Definition: Win.h:654
uint_t m_uLastKey
last pressed keyboard code
Definition: Win.h:660
KeyCbFunc_T m_funcKeyCb
registered keyboard callback func
Definition: Win.h:664
const char *const GuiStrColorStatusFg
status fg color
Definition: WinLookFeel.h:76
RoadNarrows top-level look and feel user interface declarations.
ulong_t m_uGstWinXid
GstWin container X window id.
Definition: Win.h:659
void * m_dataKeyCb
registered keyboard callback data
Definition: Win.h:665
const char *const GuiStrFontTiny
tiny font
Definition: WinLookFeel.h:92
const char *const GuiStrColorRNRed
RN red.
Definition: WinLookFeel.h:84
BttnCbFunc_T m_funcBttnCb
registered menu button callback func
Definition: Win.h:666
const char *const GuiStrColorImageBg
image bg color
Definition: WinLookFeel.h:82
const char *const GuiStrColorBttnBg
button bg color
Definition: WinLookFeel.h:79
MapLookFeel_T m_mapLookFeel
look and feel map
Definition: Win.h:668
const char *const GuiStrColorTextFg
text fg color
Definition: WinLookFeel.h:80
const char *const GuiStrFontSmall
small font
Definition: WinLookFeel.h:91
bool m_bMouseEvent
was a mouse event (click, drag, etc)
Definition: Win.h:661
const char *const GuiStrColorStatusBorder
status border
Definition: WinLookFeel.h:78
void * m_dataBttnCb
registered menu button callback data
Definition: Win.h:667
RoadNarrows Robotics.
Definition: Camera.h:74
const char *const GuiStrColorTextBg
text bg color
Definition: WinLookFeel.h:81
const char *const GuiStrColorWinBg
window bg color
Definition: WinLookFeel.h:75