/* LTHintBox.cpp
**
** This file is part of wxLaserTank.
**
** Copyright © 2002, 2009 Gary Harris
**
** Based on LaserTank ver 4.1.2 by Jim Kindley.
**
** wxLaserTank is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file docs\gpl.txt.
** If not, write to the Free Software Foundation, Inc.,
** 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Gary Harris
** garyjharris@sourceforge.net
*/
// ---- Hint Box Dialog Procedure ----
// The editor uses this proc to Display & Edit the Hint. If the text is modified
// the 'Modified' varable is set.
// For compilers that support pre-compilation, includes "wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
// Include your minimal set of headers here, or wx.h
#include <wx/wx.h>
#endif
#include <wx/xrc/xmlres.h>
#include "LTHintBox.h"
// the application icon
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
#include "LaserTank.xpm"
#endif
BEGIN_EVENT_TABLE(HintBoxDialog, wxDialog)
EVT_BUTTON(XRCID("wxID_OK"), HintBoxDialog::OnOk)
EVT_BUTTON(XRCID("btnCancel"), HintBoxDialog::OnCancel)
END_EVENT_TABLE()
HintBoxDialog::HintBoxDialog(wxWindow *parent)
// Don't call the base class here because we'll be loading from the XRC.
{
wxXmlResource::Get()->LoadDialog(this, parent, wxT("HintBox"));
CentreOnParent(); // Centre the dialogue.
wxIcon LTicon(wxICON(LaserTank)); // Paint icon.
if(LTicon.Ok()){
(void)new wxStaticBitmap(this, wxID_ANY, LTicon, wxPoint(15, 116));
}
m_textctrlHint = (wxTextCtrl *)FindWindow(XRCID("txtHint")); // Get Hint text control.
// Set max length to 255 as TLEVEL Hint = char[256].
m_textctrlHint->SetMaxLength(255);
}
void HintBoxDialog::OnOk(wxCommandEvent& event)
{
EndModal(wxID_OK);
}
void HintBoxDialog::OnCancel(wxCommandEvent& event)
{
EndModal(wxID_CANCEL );
}
void HintBoxDialog::SetHint(wxString sHint)
{
m_textctrlHint->WriteText(sHint); // Write hint text.
}
wxString HintBoxDialog::GetHint()
{
return m_textctrlHint->GetValue(); // Get hint text.
}
bool HintBoxDialog::IsModified()
{
if(m_textctrlHint->IsModified()){
return true;
}
else{
return false;
}
}