void WCalendar::create() { selectionMode_ = SingleSelection; singleClickSelect_ = false; horizontalHeaderFormat_ = ShortDayNames; firstDayOfWeek_ = 1; cellClickMapper_ = 0; cellDblClickMapper_ = 0; WDate currentDay = WDate::currentDate(); currentYear_ = currentDay.year(); currentMonth_ = currentDay.month(); WStringStream text; text << "<table class=\"days ${table-class}\" cellspacing=\"0\" cellpadding=\"0\">" """<tr>" "" "<th class=\"caption\">${nav-prev}</th>" "" "<th class=\"caption\"colspan=\"5\">${month} ${year}</th>" "" "<th class=\"caption\">${nav-next}</th>" """</tr>" """<tr>"; for (int j = 0; j < 7; ++j) text << "<th title=\"${t" << j << "}\" scope=\"col\">${d" << j << "}</th>"; text << "</tr>"; for (int i = 0; i < 6; ++i) { text << "<tr>"; for (int j = 0; j < 7; ++j) text << "<td>${c" << (i * 7 + j) << "}</td>"; text << "</tr>"; } text << "</table>"; setImplementation(impl_ = new WTemplate()); impl_->setTemplateText(WString::fromUTF8(text.str()), XHTMLUnsafeText); impl_->setStyleClass("Wt-cal"); setSelectable(false); WText *prevMonth = new WText(tr("Wt.WCalendar.PrevMonth")); prevMonth->setStyleClass("Wt-cal-navbutton"); prevMonth->clicked().connect(this, &WCalendar::browseToPreviousMonth); WText *nextMonth = new WText(tr("Wt.WCalendar.NextMonth")); nextMonth->setStyleClass("Wt-cal-navbutton"); nextMonth->clicked().connect(this, &WCalendar::browseToNextMonth); monthEdit_ = new WComboBox(); monthEdit_->setInline(true); for (unsigned i = 0; i < 12; ++i) monthEdit_->addItem(WDate::longMonthName(i+1)); monthEdit_->activated().connect(this, &WCalendar::monthChanged); monthEdit_->setDisabled(!WApplication::instance()->environment().ajax()); yearEdit_ = new WInPlaceEdit(""); yearEdit_->setButtonsEnabled(false); yearEdit_->lineEdit()->setTextSize(4); yearEdit_->setStyleClass("Wt-cal-year"); yearEdit_->valueChanged().connect(this, &WCalendar::yearChanged); impl_->bindWidget("nav-prev", prevMonth); impl_->bindWidget("nav-next", nextMonth); impl_->bindWidget("month", monthEdit_); impl_->bindWidget("year", yearEdit_); setHorizontalHeaderFormat(horizontalHeaderFormat_); setFirstDayOfWeek(firstDayOfWeek_); }
int QCalendarWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: selectionChanged(); break; case 1: clicked((*reinterpret_cast< const QDate(*)>(_a[1]))); break; case 2: activated((*reinterpret_cast< const QDate(*)>(_a[1]))); break; case 3: currentPageChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 4: setSelectedDate((*reinterpret_cast< const QDate(*)>(_a[1]))); break; case 5: setDateRange((*reinterpret_cast< const QDate(*)>(_a[1])),(*reinterpret_cast< const QDate(*)>(_a[2]))); break; case 6: setCurrentPage((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 7: setGridVisible((*reinterpret_cast< bool(*)>(_a[1]))); break; case 8: setNavigationBarVisible((*reinterpret_cast< bool(*)>(_a[1]))); break; case 9: showNextMonth(); break; case 10: showPreviousMonth(); break; case 11: showNextYear(); break; case 12: showPreviousYear(); break; case 13: showSelectedDate(); break; case 14: showToday(); break; case 15: d_func()->_q_slotShowDate((*reinterpret_cast< const QDate(*)>(_a[1]))); break; case 16: d_func()->_q_slotChangeDate((*reinterpret_cast< const QDate(*)>(_a[1]))); break; case 17: d_func()->_q_slotChangeDate((*reinterpret_cast< const QDate(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 18: d_func()->_q_editingFinished(); break; case 19: d_func()->_q_prevMonthClicked(); break; case 20: d_func()->_q_nextMonthClicked(); break; case 21: d_func()->_q_yearEditingFinished(); break; case 22: d_func()->_q_yearClicked(); break; case 23: d_func()->_q_monthChanged((*reinterpret_cast< QAction*(*)>(_a[1]))); break; default: ; } _id -= 24; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QDate*>(_v) = selectedDate(); break; case 1: *reinterpret_cast< QDate*>(_v) = minimumDate(); break; case 2: *reinterpret_cast< QDate*>(_v) = maximumDate(); break; case 3: *reinterpret_cast< Qt::DayOfWeek*>(_v) = firstDayOfWeek(); break; case 4: *reinterpret_cast< bool*>(_v) = isGridVisible(); break; case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break; case 6: *reinterpret_cast< HorizontalHeaderFormat*>(_v) = horizontalHeaderFormat(); break; case 7: *reinterpret_cast< VerticalHeaderFormat*>(_v) = verticalHeaderFormat(); break; case 8: *reinterpret_cast< bool*>(_v) = isHeaderVisible(); break; case 9: *reinterpret_cast< bool*>(_v) = isNavigationBarVisible(); break; case 10: *reinterpret_cast< bool*>(_v) = isDateEditEnabled(); break; case 11: *reinterpret_cast< int*>(_v) = dateEditAcceptDelay(); break; } _id -= 12; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSelectedDate(*reinterpret_cast< QDate*>(_v)); break; case 1: setMinimumDate(*reinterpret_cast< QDate*>(_v)); break; case 2: setMaximumDate(*reinterpret_cast< QDate*>(_v)); break; case 3: setFirstDayOfWeek(*reinterpret_cast< Qt::DayOfWeek*>(_v)); break; case 4: setGridVisible(*reinterpret_cast< bool*>(_v)); break; case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break; case 6: setHorizontalHeaderFormat(*reinterpret_cast< HorizontalHeaderFormat*>(_v)); break; case 7: setVerticalHeaderFormat(*reinterpret_cast< VerticalHeaderFormat*>(_v)); break; case 8: setHeaderVisible(*reinterpret_cast< bool*>(_v)); break; case 9: setNavigationBarVisible(*reinterpret_cast< bool*>(_v)); break; case 10: setDateEditEnabled(*reinterpret_cast< bool*>(_v)); break; case 11: setDateEditAcceptDelay(*reinterpret_cast< int*>(_v)); break; } _id -= 12; } else if (_c == QMetaObject::ResetProperty) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 12; } #endif // QT_NO_PROPERTIES return _id; }
void WCalendar::setDayOfWeekLength(int chars) { setHorizontalHeaderFormat(chars == 3 ? ShortDayNames : SingleLetterDayNames); }
int QCalendarWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 24) qt_static_metacall(this, _c, _id, _a); _id -= 24; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QDate*>(_v) = selectedDate(); break; case 1: *reinterpret_cast< QDate*>(_v) = minimumDate(); break; case 2: *reinterpret_cast< QDate*>(_v) = maximumDate(); break; case 3: *reinterpret_cast< Qt::DayOfWeek*>(_v) = firstDayOfWeek(); break; case 4: *reinterpret_cast< bool*>(_v) = isGridVisible(); break; case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break; case 6: *reinterpret_cast< HorizontalHeaderFormat*>(_v) = horizontalHeaderFormat(); break; case 7: *reinterpret_cast< VerticalHeaderFormat*>(_v) = verticalHeaderFormat(); break; case 8: *reinterpret_cast< bool*>(_v) = isHeaderVisible(); break; case 9: *reinterpret_cast< bool*>(_v) = isNavigationBarVisible(); break; case 10: *reinterpret_cast< bool*>(_v) = isDateEditEnabled(); break; case 11: *reinterpret_cast< int*>(_v) = dateEditAcceptDelay(); break; } _id -= 12; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSelectedDate(*reinterpret_cast< QDate*>(_v)); break; case 1: setMinimumDate(*reinterpret_cast< QDate*>(_v)); break; case 2: setMaximumDate(*reinterpret_cast< QDate*>(_v)); break; case 3: setFirstDayOfWeek(*reinterpret_cast< Qt::DayOfWeek*>(_v)); break; case 4: setGridVisible(*reinterpret_cast< bool*>(_v)); break; case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break; case 6: setHorizontalHeaderFormat(*reinterpret_cast< HorizontalHeaderFormat*>(_v)); break; case 7: setVerticalHeaderFormat(*reinterpret_cast< VerticalHeaderFormat*>(_v)); break; case 8: setHeaderVisible(*reinterpret_cast< bool*>(_v)); break; case 9: setNavigationBarVisible(*reinterpret_cast< bool*>(_v)); break; case 10: setDateEditEnabled(*reinterpret_cast< bool*>(_v)); break; case 11: setDateEditAcceptDelay(*reinterpret_cast< int*>(_v)); break; } _id -= 12; } else if (_c == QMetaObject::ResetProperty) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 12; } #endif // QT_NO_PROPERTIES return _id; }