File: tqslvalidator.h

package info (click to toggle)
trustedqsl 2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 29,116 kB
  • ctags: 3,577
  • sloc: cpp: 24,858; xml: 5,344; ansic: 626; sh: 88; python: 18; makefile: 11
file content (78 lines) | stat: -rw-r--r-- 2,271 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/***************************************************************************
                          tqslvalidator.h  -  description
                             -------------------
    begin                : Sun Dec 8 2002
    copyright            : (C) 2002 by ARRL
    author               : Jon Bloom
    email                : jbloom@arrl.org
    revision             : $Id$
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include "sysconfig.h"
#endif

#ifndef TQSLVALIDATOR_H
#define TQSLVALIDATOR_H

#include "wx/wxprec.h"

#ifdef __BORLANDC__
	#pragma hdrstop
#endif

#ifndef WX_PRECOMP
	#include "wx/wx.h"
#endif

#include "tqsllib.h"

#include "wx/grid.h"

#include <wx/validate.h>

/** Classes work with wxWindows wxTextCtrl to validate TQSL Date/Time entries.
  *
  *@author Jon Bloom
  */

class TQSLValidator : public wxValidator {
 public:
	explicit TQSLValidator(void *objp);
	TQSLValidator(const TQSLValidator& val) { Copy(val); }
	virtual ~TQSLValidator() {}
	virtual bool Copy(const TQSLValidator&);
	virtual bool Validate(wxWindow* win);
	virtual bool TransferToWindow();
	virtual bool TransferFromWindow();
	virtual wxString ToString() = 0;
	virtual void FromString(const wxString&) = 0;
	virtual bool IsValid(const wxString&) = 0;
 protected:
	wxString _type;
	void *_objp;
};

class TQSLDateValidator : public TQSLValidator {
 public:
	explicit TQSLDateValidator(tQSL_Date *date) : TQSLValidator(date) { _type = _("Date"); }
	TQSLDateValidator(const TQSLDateValidator& val) : TQSLValidator(val) {}
	virtual ~TQSLDateValidator() {}
	virtual wxObject *Clone() const { return new TQSLDateValidator(*this); }
	virtual wxString ToString();
	virtual void FromString(const wxString&);
	virtual bool IsValid(const wxString&);
};

class TQSLTimeValidator : public TQSLValidator {
 public:
	explicit TQSLTimeValidator(tQSL_Time *time) : TQSLValidator(time) { _type = _("Time"); }
	TQSLTimeValidator(const TQSLTimeValidator& val) : TQSLValidator(val) {}
	virtual ~TQSLTimeValidator() {}
	virtual wxObject *Clone() const { return new TQSLTimeValidator(*this); }
	virtual wxString ToString();
	virtual void FromString(const wxString&);
	virtual bool IsValid(const wxString&);
};

#endif	// TQSLVALIDATOR_H