summaryrefslogtreecommitdiff
path: root/support/dktools/DkClockData.h
blob: 38bfd0b13ad1aea2eb1ff12bd37ecc685699b1be (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
Copyright (C) 2017-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: DkClockData.cpt
*/

/**	@file DkClockData.h Header file for the DkClockData module.
*/

#ifndef DKCLOCKDATA_H_INCLUDED
/** Avoid multiple inclusions. */
#define DKCLOCKDATA_H_INCLUDED 1


#line 7 "DkClockData.cpt"

/**	Data of interest for the DkClockView class.
*/
typedef struct {
  int		h;	/**< Current hour. */
  int		m;	/**< Current minute. */
  int		s;	/**< Current second. */
  int		a;	/**< Flag: In alert. */
} clockview_data_t;

/**	Data for DkClock.
*/
class DkClockData
{
  protected:

    /**	Protect data against concurrent access.
    */
    wxMutex		mxProtectData;

    /**	Current time.
    */
    dk3_tm_t		tmCurrent;

    /**	Output data structure.
    */
    clockview_data_t	clvd;

    /**	Hour of alert.
    */
    int			iAlertHour;

    /**	Minute of alert.
    */
    int			iAlertMinute;

    /**	Flag: Alert enabled.
    */
    int			iAlertEnabled;

    /**	Alert state (0=before alert, 1=in alert, 2=after alert).
    */
    int			iAlertState;

  public:

    /**	Constructor.
    */
    DkClockData();

    /**	Retrieve data from object into buffer.
    	@param	dptr	Buffer pointer.
    */
    void getData(clockview_data_t *dptr);

    /**	Get alert settings.
    	@param	en	Pointer to enabled variable.
	@param	h	Pointer to hour variable.
	@param	m	Pointer to minute variable.
    */
    void getAlertData(int *en, int *h, int *m);

    /**	Set new current time.
    	@param	ct	Current time.
	@return	1 to maximize and raise the window, 0 to do nothing.
    */
    int setTime(dk3_time_t *ct);

    /**	Enable or disable alert, set time when enabling.
    	@param	flag	Flag to enable or disable alert.
	@param	hour	Hour of alert.
	@param	min	Minute of alert.
    */
    void setAlert(bool flag, int hour, int min);

    /**	End a running alert.
    */
    void	endAlert(void);
};


#endif