sptk2 logo
SPTK Home Page
CDateIntervalInput.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29#include <sptk5/sptk.h>
30
31#include <sptk5/DateTime.h>
32#include <sptk5/gui/CControl.h>
33#include <sptk5/gui/CInput.h>
34
35namespace sptk {
36
42class CPopupCalendar;
43
44class CDateControl;
45
51class SP_EXPORT CDateIntervalInput
52 : public CInput
53{
54 using inherited = class CInput;
55
59 CDateControl* m_firstDateInput;
60
64 CDateControl* m_secondDateInput;
65
69 String m_separator;
70
74 CPopupCalendar* m_calendarWindow;
75
76
80 void ctor_init();
81
85 static void intervalCalendarButtonPressed(Fl_Widget* btn, void* data);
86
87protected:
92 void showCalendar(Fl_Widget* btn);
93
94public:
101 explicit CDateIntervalInput(const char* label = nullptr, int layoutSize = 10,
102 CLayoutAlign layoutAlign = CLayoutAlign::TOP);
103
104#ifdef __COMPATIBILITY_MODE__
113 CDateIntervalInput(int x, int y, int w, int h, const char* label = 0);
114#endif
115
120 void separator(const String& s);
121
126 {
127 return m_separator;
128 }
129
134
140
145
151
156 CControlKind kind() const override
157 {
159 }
160
164 String className() const override
165 {
166 return "date_interval_input";
167 }
168
172 Variant data() const override;
173
177 void data(const Variant& v) override;
178
186 void resize(int x, int y, int w, int h) override;
187
192 bool valid() const override;
193
197 static CLayoutClient* creator(const xdoc::SNode& node);
198};
202} // namespace sptk
Date input widget.
Definition: CDateControl.h:48
Date interval input widget.
Definition: CDateIntervalInput.h:53
Variant data() const override
Universal data connection, returns data from control.
void resize(int x, int y, int w, int h) override
Resizes the control and inside widgets.
CDateIntervalInput(const char *label=nullptr, int layoutSize=10, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
Constructor in SPTK style.
static CLayoutClient * creator(const xdoc::SNode &node)
Creates a widget based on the XML node information.
bool valid() const override
Returns true if the control state is valid, and the data is inside the limits if applicable.
void showCalendar(Fl_Widget *btn)
Shows drop-down calendar for the particular date input that owns the button btn.
void endOfInterval(DateTime dt)
String separator() const
Returns the separator between date inputs.
Definition: CDateIntervalInput.h:125
CControlKind kind() const override
Returns the control kind, SPTK-style RTTI.
Definition: CDateIntervalInput.h:156
String className() const override
Returns the control class name, SPTK-style RTTI.
Definition: CDateIntervalInput.h:164
void beginOfInterval(DateTime dt)
Sets the date in the first date input - the beginning of interval.
void separator(const String &s)
Sets the separator to display between date inputs.
DateTime beginOfInterval() const
Returns the date from the first date input - the beginning of interval.
void data(const Variant &v) override
Universal data connection, sets data from control.
DateTime endOfInterval() const
Returns the date from the second date input - the end of interval.
Definition: CInput.h:197
Definition: CLayoutClient.h:82
Popup Calendar.
Definition: CCalendar.h:150
Definition: DateTime.h:86
Definition: String.h:49
Definition: Variant.h:372
CControlKind
Control kind is the constant to report the internal SPTK RTTI.
Definition: CControl.h:50
CLayoutAlign
Definition: CLayoutClient.h:44
@ TOP
Align to the right.

Fri Oct 14 2022 09:58:31: SPTK 5.4.1