#include "GuiCommonTemplates.h"
#include "GuiThemeStyleFactory.h"
#include "../ListControlPackage/GuiComboControls.h"
#include "../ListControlPackage/GuiTextListControls.h"
#include "../../GraphicsComposition/GuiGraphicsTableComposition.h"
#include "../../GraphicsComposition/GuiGraphicsSpecializedComposition.h"
namespace
{
namespace
{
namespace
{
using
namespace
elements
;
using
namespace
compositions
;
using
namespace
templates
;
using
namespace
controls
;
using
namespace
theme
;
(
,
)
{
bool
= (
%
100
==
0
) ? (
%
400
==
0
) : (
%
4
==
0
);
switch
(
)
{
case
1
:
case
3
:
case
5
:
case
7
:
case
8
:
case
10
:
case
12
:
return
31
;
case
4
:
case
6
:
case
9
:
case
11
:
return
30
;
default
:
return
isLeapYear
?
29
:
28
;
}
}
void
(
&
,
&
)
{
if
(
==
1
)
{
--;
=
12
;
}
else
{
--;
}
}
void
(
&
,
&
)
{
if
(
==
12
)
{
++;
=
1
;
}
else
{
++;
}
}
void
::
(
const
&
,
&
,
)
{
]
;
*
=
];
label
->
(
(
.
));
label
->
(
==
0
?
:
);
wchar_t
[] =
L"D00"
;
if
(
== -
1
)
alt
[
0
] =
L'C'
;
else
if
(
==
1
)
alt
[
0
] =
L'E'
;
alt
[
1
] = (
wchar_t
)(
L'0'
+
.
/
10
);
alt
[
2
] = (
wchar_t
)(
L'0'
+
.
%
10
);
]->
(
alt
);
++;
}
void
::
comboYearMonth_SelectedIndexChanged
(
compositions
::
*
,
compositions
::
&
)
{
if
(!
)
{
if
(
->
() != -
1
&&
->
() != -
1
)
{
=
->
() +
;
=
->
() +
1
;
(
::
(
year
,
month
,
1
));
(
this
);
.
(
arguments
);
->
();
->
();
}
}
}
void
::
(
compositions
::
*
,
compositions
::
&
)
{
if
(!
)
{
*
=
dynamic_cast
<
*>(
->
());
if
(
button
->
())
{
=
.
(
button
);
if
(
index
!= -
1
)
{
=
index
];
if
(
day
.
!=
.
||
day
.
!=
.
)
{
(
day
);
}
else
{
day
;
}
(
this
);
.
(
arguments
);
->
();
->
();
}
}
}
}
void
::
(
,
)
{
if
(
<=
&&
<=
&&
1
<=
&&
<=
12
)
{
=
true
;
->
(
-
);
->
(
-
1
);
=
false
;
}
=
,
=
,
=
,
=
;
(
yearPrev
,
monthPrev
);
(
yearNext
,
monthNext
);
=
(
yearPrev
,
monthPrev
);
=
(
,
);
=
(
yearNext
,
monthNext
);
=
::
(
,
,
1
);
=
firstDay
.
;
if
(
showPrev
==
0
)
showPrev
=
;
=
count
;
=
*
-
showPrev
-
show
;
=
0
;
for
(
=
0
;
i
<
showPrev
;
i
++)
{
=
::
(
yearPrev
,
monthPrev
,
countPrev
- (
showPrev
-
i
-
1
));
(
day
,
index
, -
1
);
}
for
(
=
0
;
i
<
show
;
i
++)
{
=
::
(
,
,
i
+
1
);
(
day
,
index
,
0
);
}
for
(
=
0
;
i
<
showNext
;
i
++)
{
=
::
(
yearNext
,
monthNext
,
i
+
1
);
(
day
,
index
,
1
);
}
}
void
::
(
)
{
for
(
=
0
;
i
<
.
();
i
++)
{
const
&
=
i
];
if
(
dt
.
==
.
&&
dt
.
==
.
&&
dt
.
==
)
{
=
true
;
i
]->
(
true
);
=
false
;
break
;
}
}
}
::
(
,
,
)
:backgroundColor(
)
, primaryTextColor(
)
, secondaryTextColor(
)
{
.
(
this
);
(
::
LimitToElementAndChildren
);
*
=
0
;
*
=
0
;
{
=
new
(
theme
::
::
);
->
SetHorizontalAlwaysVisible
(
false
);
for
(
=
;
i
<=
;
i
++)
{
->
().
(
new
list
::
(
(
i
)));
}
=
new
(
theme
::
::
,
);
->
(
L"Y"
);
->
()->
(
(
0
,
0
,
2
,
0
));
->
.
(
this
, &
::
comboYearMonth_SelectedIndexChanged
);
}
{
=
new
(
theme
::
::
);
->
SetHorizontalAlwaysVisible
(
false
);
=
new
(
theme
::
::
,
);
->
(
L"M"
);
->
()->
(
(
2
,
0
,
0
,
0
));
->
.
(
this
, &
::
comboYearMonth_SelectedIndexChanged
);
}
{
monthTable
=
new
;
monthTable
->
(
(
0
,
0
,
0
,
0
));
monthTable
->
(
::
LimitToElementAndChildren
);
monthTable
->
(
1
,
2
);
monthTable
->
(
0
,
::
());
monthTable
->
(
0
,
::
(
0.5
));
monthTable
->
(
1
,
::
(
0.5
));
{
*
=
new
;
monthTable
->
(
cell
);
cell
->
(
0
,
0
,
1
,
1
);
cell
->
(
->
());
}
{
*
=
new
;
monthTable
->
(
cell
);
cell
->
(
0
,
1
,
1
,
1
);
cell
->
(
->
());
}
}
{
dayTable
=
new
;
dayTable
->
(
::
LimitToElementAndChildren
);
dayTable
->
(
4
);
dayTable
->
(
+
,
);
for
(
=
0
;
i
<
;
i
++)
{
dayTable
->
(
i
,
::
());
}
for
(
=
0
;
i
<
;
i
++)
{
dayTable
->
(
i
+
,
::
(
1.0
));
}
for
(
=
0
;
i
<
;
i
++)
{
dayTable
->
(
i
,
::
(
1.0
));
}
{
*
=
new
;
dayTable
->
(
cell
);
cell
->
(
0
,
0
,
1
,
);
cell
->
(
monthTable
);
}
.
(
7
);
for
(
=
0
;
i
<
;
i
++)
{
*
=
new
;
dayTable
->
(
cell
);
cell
->
(
1
,
i
,
1
,
1
);
*
=
::
();
element
->
(
::
,
::
);
element
->
(
);
i
] =
element
;
cell
->
(
element
);
}
.
(
*
);
.
(
*
);
.
(
*
);
auto
=
new
::
;
(
dayMutexController
);
for
(
=
0
;
i
<
;
i
++)
{
for
(
=
0
;
j
<
;
j
++)
{
*
=
new
;
dayTable
->
(
cell
);
cell
->
(
j
+
,
i
,
1
,
1
);
*
=
new
(
theme
::
::
);
button
->
()->
(
(
0
,
0
,
0
,
0
));
button
->
(
dayMutexController
);
button
->
.
(
this
, &
::
buttonDay_SelectedChanged
);
cell
->
(
button
->
());
j
*
+
i
] =
button
;
*
=
::
();
element
->
(
::
,
::
);
element
->
(
L"0"
);
j
*
+
i
] =
element
;
*
=
new
;
elementBounds
->
(
element
);
elementBounds
->
(
(
0
,
0
,
0
,
0
));
elementBounds
->
(
::
);
button
->
()->
(
elementBounds
);
}
}
}
{
GuiSolidBackgroundElement
*
=
GuiSolidBackgroundElement
::
();
element
->
(
);
dayTable
->
(
element
);
}
dayTable
->
(
(
0
,
0
,
0
,
0
));
(
dayTable
);
(
::
LimitToElementAndChildren
);
(
);
}
::
()
{
FinalizeInstanceRecursively
(
this
);
}
controls
::
IDatePickerCommandExecutor
*
::
()
{
return
;
}
void
::
(
controls
::
IDatePickerCommandExecutor
*
)
{
=
;
}
<
GuiSelectableButtonTemplate
>
::
()
{
return
;
}
void
::
(
const
<
GuiSelectableButtonTemplate
>&
)
{
;
FOREACH(GuiSelectableButton*, button, buttonDays)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
*>&
= ::
vl
::
collections
::
(
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
*
;
__foreach_iterator__
.
(
button
);)
{
button
->
(
);
}
}
<
>
::
()
{
return
;
}
void
::
(
const
<
>&
)
{
;
->
(
);
->
(
);
}
<
>
::
()
{
return
;
}
void
::
(
const
<
>&
)
{
;
->
(
);
->
(
);
}
const
&
::
()
{
return
;
}
void
::
(
const
&
)
{
if
(
)
{
;
for
(
=
0
;
i
<
;
i
++)
{
i
]->
(
.
(
i
));
}
->
().
();
for
(
=
1
;
i
<=
12
;
i
++)
{
->
().
(
new
list
::
(
.
(
i
)));
}
(
);
}
}
const
&
::
()
{
return
;
}
void
::
(
const
&
)
{
;
(
.
,
.
);
(
.
);
}
const
&
::
()
{
return
;
}
void
::
(
const
&
)
{
if
(
)
{
;
->
(
);
->
(
);
->
(
);
->
(
);
FOREACH(GuiSolidLabelElement*, label, From(labelDaysOfWeek).Concat(labelDays))
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
*>&
= ::
vl
::
collections
::
(
(
).Concat(
));
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
*
;
__foreach_iterator__
.
(
label
);)
{
label
->
(
);
}
}
}
void
::
()
{
if
(
->
())
{
->
(
1
,
::
(
));
}
else
{
->
(
1
,
::
(
0
));
}
if
(
->
())
{
->
(
1
,
::
(
));
}
else
{
->
(
1
,
::
(
0
));
}
->
();
}
void
::
(
compositions
::
*
,
compositions
::
&
)
{
();
}
void
::
(
compositions
::
*
,
compositions
::
&
)
{
();
}
::
(
)
:defaultScrollSize(
)
{
(
::
LimitToElementAndChildren
);
=
new
(
theme
::
::
);
->
()->
(
(
0
,
0
,
0
,
0
));
->
(
false
);
->
(
false
);
=
new
(
theme
::
::
);
->
()->
(
(
0
,
0
,
0
,
0
));
->
(
false
);
->
(
false
);
=
new
;
(
);
->
(
(
0
,
0
,
0
,
0
));
->
(
2
,
2
);
->
(
0
,
::
(
1.0
));
->
(
1
,
::
());
->
(
0
,
::
(
1.0
));
->
(
1
,
::
());
();
{
*
=
new
;
->
(
cell
);
cell
->
(
1
,
0
,
1
,
1
);
cell
->
(
->
());
}
{
*
=
new
;
->
(
cell
);
cell
->
(
0
,
1
,
1
,
1
);
cell
->
(
->
());
}
=
new
;
->
(
);
->
(
0
,
0
,
1
,
1
);
=
new
;
->
(
(
0
,
0
,
0
,
0
));
->
(
);
->
.
(
this
, &
::
);
->
.
(
this
, &
::
);
();
}
::
()
{
}
controls
::
*
::
()
{
return
;
}
controls
::
*
::
()
{
return
;
}
compositions
::
*
::
()
{
return
;
}
<
>
::
()
{
return
;
}
void
::
(
const
<
>&
)
{
;
->
(
);
}
<
>
::
()
{
return
;
}
void
::
(
const
<
>&
)
{
;
->
(
);
}
void
::
(
,
)
{
=
->
();
double
= (
double
)
/
;
= (
)
(
ratio
*
totalSize
);
= (
)
(((
double
)
newPosition
/
totalSize
) *
);
= (
)
(((
double
)(
newPosition
+
1
)) /
totalSize
*
);
=
offset1
-
;
=
offset2
-
;
if
(
delta1
<
0
) {
delta1
= -
delta1
; }
if
(
delta2
<
0
) {
delta2
= -
delta2
; }
if
(
delta1
<
delta2
)
{
->
()->
(
newPosition
);
}
else
{
->
()->
(
newPosition
+
1
);
}
}
void
::
(
compositions
::
*
)
{
->
()->
.
([=](
*,
&
)
{
if
(
->
())
{
=
true
;
.
=
arguments
.
;
.
=
arguments
.
;
}
});
->
()->
.
([=](
*,
&)
{
if
(
->
())
{
=
false
;
}
});
}
::
()
{
}
::
()
{
}
void
::
(
*
)
{
=
;
}
void
::
(
controls
::
*
)
{
->
.
([=](
*,
&)
{
->
()->
();
});
}
void
::
(
controls
::
*
)
{
->
.
([=](
*,
&)
{
->
()->
();
});
}
void
::
(
compositions
::
GuiPartialViewComposition
*
)
{
->
()->
()->
.
([=](
*,
&
)
{
if
(
->
())
{
if
(
arguments
.
<
->
().
)
{
->
()->
();
}
else
if
(
arguments
.
>=
->
().
)
{
->
()->
();
}
}
});
AttachHorizontalTrackerHandle
(
);
}
void
::
(
compositions
::
GuiPartialViewComposition
*
)
{
->
()->
()->
.
([=](
*,
&
)
{
if
(
->
())
{
if
(
arguments
.
<
->
().
)
{
->
()->
();
}
else
if
(
arguments
.
>=
->
().
)
{
->
()->
();
}
}
});
AttachVerticalTrackerHandle
(
);
}
void
::
(
compositions
::
GuiPartialViewComposition
*
)
{
->
()->
.
([=](
*,
&
)
{
if
(
)
{
auto
=
->
()->
();
=
bounds
.
-
bounds
.
;
=
->
().
;
=
currentOffset
+ (
arguments
.
-
.
);
(
totalPixels
,
newOffset
);
}
});
(
);
}
void
::
(
compositions
::
GuiPartialViewComposition
*
)
{
->
()->
.
([=](
*,
&
)
{
if
(
)
{
auto
=
->
()->
();
=
bounds
.
-
bounds
.
;
=
->
().
;
=
currentOffset
+ (
arguments
.
-
.
);
(
totalPixels
,
newOffset
);
}
});
(
);
}
::
(
compositions
::
*
,
,
,
)
{
=
->
()->
().
() -
->
().
();
=
-
;
return
max
==
0
?
0
:
width
*
/
max
;
}
::
(
compositions
::
*
,
,
,
)
{
=
->
()->
().
() -
->
().
();
=
-
;
return
max
==
0
?
0
:
height
*
/
max
;
}
}
}
}