source: eviacam/trunk/fuentes/src/wmotioncalibrationy.cpp @ 29

Last change on this file since 29 was 29, checked in by mabarracus, 4 years ago

added eviacam content

File size: 5.5 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2// Name:        wmotioncalibrationy.cpp
3// Purpose: 
4// Author:      Cesar Mauri Loba (cesar at crea-si dot com)
5// Modified by:
6// Created:     
7// Copyright:   (C) 2008 Cesar Mauri Loba - CREA Software Systems
8//
9//  This program is free software: you can redistribute it and/or modify
10//  it under the terms of the GNU General Public License as published by
11//  the Free Software Foundation, either version 3 of the License, or
12//  (at your option) any later version.
13//
14//  This program is distributed in the hope that it will be useful,
15//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17//  GNU General Public License for more details.
18//
19//  You should have received a copy of the GNU General Public License
20//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21/////////////////////////////////////////////////////////////////////////////
22
23// For compilers that support precompilation, includes "wx/wx.h".
24#include "wx/wxprec.h"
25
26#ifdef __BORLANDC__
27#pragma hdrstop
28#endif
29
30#ifndef WX_PRECOMP
31#include "wx/wx.h"
32#endif
33
34////@begin includes
35////@end includes
36
37#include "wmotioncalibrationy.h"
38
39////@begin XPM images
40#include "icons/usermovev64.xpm"
41////@end XPM images
42
43
44/*!
45 * WMotionCalibrationY type definition
46 */
47
48IMPLEMENT_DYNAMIC_CLASS( WMotionCalibrationY, wxDialog )
49
50DEFINE_EVENT_TYPE(wxEVT_FACE_NOT_DETECTED)
51DEFINE_EVENT_TYPE(wxEVT_FACE_DETECTED)
52
53/*!
54 * WMotionCalibrationY event table definition
55 */
56
57BEGIN_EVENT_TABLE( WMotionCalibrationY, wxDialog )
58
59////@begin WMotionCalibrationY event table entries
60////@end WMotionCalibrationY event table entries
61EVT_COMMAND  (wxID_ANY, wxEVT_FACE_NOT_DETECTED, WMotionCalibrationY::OnFaceNotDetected)
62EVT_COMMAND  (wxID_ANY, wxEVT_FACE_DETECTED, WMotionCalibrationY::OnFaceDetected)
63
64END_EVENT_TABLE()
65
66
67/*!
68 * WMotionCalibrationY constructors
69 */
70
71WMotionCalibrationY::WMotionCalibrationY()
72{
73    Init();
74}
75
76WMotionCalibrationY::WMotionCalibrationY( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
77{
78    Init();
79    Create(parent, id, caption, pos, size, style);
80}
81
82
83/*!
84 * WMotionCalibrationY creator
85 */
86
87bool WMotionCalibrationY::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
88{
89////@begin WMotionCalibrationY creation
90    SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
91    wxDialog::Create( parent, id, caption, pos, size, style );
92
93    CreateControls();
94    if (GetSizer())
95    {
96        GetSizer()->SetSizeHints(this);
97    }
98    Centre();
99////@end WMotionCalibrationY creation
100    return true;
101}
102
103
104/*!
105 * WMotionCalibrationY destructor
106 */
107
108WMotionCalibrationY::~WMotionCalibrationY()
109{
110////@begin WMotionCalibrationY destruction
111////@end WMotionCalibrationY destruction
112}
113
114
115/*!
116 * Member initialisation
117 */
118
119void WMotionCalibrationY::Init()
120{
121////@begin WMotionCalibrationY member initialisation
122    m_staticText = NULL;
123    m_staticTextFaceNotDetected = NULL;
124////@end WMotionCalibrationY member initialisation
125}
126
127
128/*!
129 * Control creation for WMotionCalibrationY
130 */
131
132void WMotionCalibrationY::CreateControls()
133{   
134////@begin WMotionCalibrationY content construction
135    WMotionCalibrationY* itemDialog1 = this;
136
137    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
138    itemDialog1->SetSizer(itemBoxSizer2);
139
140    wxStaticBitmap* itemStaticBitmap3 = new wxStaticBitmap( itemDialog1, wxID_STATIC, itemDialog1->GetBitmapResource(wxT("icons/usermovev64.xpm")), wxDefaultPosition, wxSize(64, 64), 0 );
141    itemBoxSizer2->Add(itemStaticBitmap3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
142
143    m_staticText = new wxStaticText( itemDialog1, wxID_STATIC, _("Move your head up and down."), wxDefaultPosition, wxDefaultSize, 0 );
144    itemBoxSizer2->Add(m_staticText, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
145
146    m_staticTextFaceNotDetected = new wxStaticText( itemDialog1, wxID_STATIC, _("Your face is not detected. This may produce wrong calibration results."), wxDefaultPosition, wxDefaultSize, 0 );
147    m_staticTextFaceNotDetected->SetForegroundColour(wxColour(128, 0, 0));
148    itemBoxSizer2->Add(m_staticTextFaceNotDetected, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
149
150////@end WMotionCalibrationY content construction
151}
152
153
154/*!
155 * Should we show tooltips?
156 */
157
158bool WMotionCalibrationY::ShowToolTips()
159{
160    return true;
161}
162
163/*!
164 * Get bitmap resources
165 */
166
167wxBitmap WMotionCalibrationY::GetBitmapResource( const wxString& name )
168{
169    // Bitmap retrieval
170////@begin WMotionCalibrationY bitmap retrieval
171    wxUnusedVar(name);
172    if (name == wxT("icons/usermovev64.xpm"))
173    {
174        wxBitmap bitmap(usermovev64);
175        return bitmap;
176    }
177    return wxNullBitmap;
178////@end WMotionCalibrationY bitmap retrieval
179}
180
181/*!
182 * Get icon resources
183 */
184
185wxIcon WMotionCalibrationY::GetIconResource( const wxString& name )
186{
187    // Icon retrieval
188////@begin WMotionCalibrationY icon retrieval
189    wxUnusedVar(name);
190    return wxNullIcon;
191////@end WMotionCalibrationY icon retrieval
192}
193
194void WMotionCalibrationY::OnFaceNotDetected( wxCommandEvent& )
195{
196        m_staticTextFaceNotDetected->Show(true);
197}
198
199void WMotionCalibrationY::OnFaceDetected( wxCommandEvent& )
200{
201        m_staticTextFaceNotDetected->Show(false);
202}
203
204void WMotionCalibrationY::SetFaceDetected( bool isFaceDetected )
205{
206        if (isFaceDetected) {
207                wxCommandEvent event (wxEVT_FACE_DETECTED);
208                wxPostEvent(this, event);
209        } else {
210                wxCommandEvent event (wxEVT_FACE_NOT_DETECTED);
211                wxPostEvent(this, event);
212        }
213}
Note: See TracBrowser for help on using the repository browser.