Warning, /education/gcompris/src/activities/calendar/MonthGridDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - MonthGridDelegate.qml 0002 * 0003 * SPDX-FileCopyrightText: 2022 Johnny Jazeix <jazeix@gmail.com> 0004 * 0005 * Authors: 0006 * Johnny Jazeix <jazeix@gmail.com> 0007 * 0008 * SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 0011 import QtQuick 2.12 0012 import QtQuick.Controls 2.12 0013 import QtQuick.Layouts 1.12 0014 import GCompris 1.0 0015 import "../../core" 0016 0017 ColumnLayout { 0018 id: root 0019 0020 property int visibleMonth 0021 0022 readonly property color sameMonthDateTextColor: "#373737" 0023 readonly property color selectedDateColor: "#3778d0" 0024 readonly property color selectedDateTextColor: "white" 0025 readonly property color differentMonthDateTextColor: "#bbb" 0026 readonly property color invalidDateColor: "#dddddd" 0027 0028 property bool selected: calendar.selectedDay == day && month == root.visibleMonth 0029 Rectangle { 0030 id: caseBox 0031 color: selected ? selectedDateColor : "#F2F2F2" 0032 width: root.width 0033 height: root.height 0034 radius: 2 0035 border.width: 1 0036 border.color: "lightgray" 0037 MouseArea { 0038 anchors.fill: parent 0039 onClicked: { 0040 if(month == root.visibleMonth) { 0041 calendar.selectedDay = day; 0042 } 0043 else if((month < root.visibleMonth && (root.visibleMonth != 11 || month != 0)) || (root.visibleMonth == 0 && month == 11)) { 0044 calendar.showPreviousMonth(); 0045 } 0046 else if(month > root.visibleMonth || (root.visibleMonth == 11 && month == 0)) { 0047 calendar.showNextMonth(); 0048 } 0049 } 0050 } 0051 0052 Label { 0053 id: dayText 0054 text: day 0055 anchors.centerIn: parent 0056 font.family: GCSingletonFontLoader.fontLoader.name 0057 font.pixelSize: Math.min(parent.height/3, parent.width/3) 0058 color: { 0059 var theColor = invalidDateColor; 0060 // Date is within the valid range. 0061 theColor = (month == root.visibleMonth) ? sameMonthDateTextColor : differentMonthDateTextColor; 0062 if (root.selected) 0063 theColor = selectedDateTextColor; 0064 return theColor; 0065 } 0066 Layout.fillWidth: true 0067 } 0068 } 0069 }