@Override long /*int*/ gtk_day_selected (long /*int*/ widget) { sendSelectionEvent (); return 0; }
@Override long /*int*/ gtk_day_selected_double_click (long /*int*/ widget) { sendSelectionEvent (SWT.DefaultSelection); return 0; }
@Override int /*long*/ gtk_day_selected (int /*long*/ widget) { sendSelectionEvent (); return 0; }
@Override int /*long*/ gtk_day_selected_double_click (int /*long*/ widget) { sendSelectionEvent (SWT.DefaultSelection); return 0; }
@Override int /*long*/ gtk_day_selected (int /*long*/ widget) { sendSelectionEvent (); return 0; }
@Override int /*long*/ gtk_day_selected_double_click (int /*long*/ widget) { sendSelectionEvent (SWT.DefaultSelection); return 0; }
@Override long /*int*/ gtk_month_changed (long /*int*/ widget) { /* * Feature in GTK. "month-changed" signal is emitted when the * calendar is displayed though the day/month is not changed. * The popup has to remain when the month/year is changed * through the arrow keys, and the popup has to be called-off * only when the day is selected. The fix is to detect the * difference between the user changing the month/year, or * choosing the day. */ if (calendarDisplayed) calendarDisplayed = false; else monthChanged = true; sendSelectionEvent (); return 0; }
@Override int /*long*/ gtk_month_changed (int /*long*/ widget) { /* * Feature in GTK. "month-changed" signal is emitted when the * calendar is displayed though the day/month is not changed. * The popup has to remain when the month/year is changed * through the arrow keys, and the popup has to be called-off * only when the day is selected. The fix is to detect the * difference between the user changing the month/year, or * choosing the day. */ if (calendarDisplayed) calendarDisplayed = false; else monthChanged = true; sendSelectionEvent (); return 0; }
@Override int /*long*/ gtk_month_changed (int /*long*/ widget) { /* * Feature in GTK. "month-changed" signal is emitted when the * calendar is displayed though the day/month is not changed. * The popup has to remain when the month/year is changed * through the arrow keys, and the popup has to be called-off * only when the day is selected. The fix is to detect the * difference between the user changing the month/year, or * choosing the day. */ if (calendarDisplayed) calendarDisplayed = false; else monthChanged = true; sendSelectionEvent (); return 0; }
void setFieldOfInternalDataStructure (int fieldName, int value) { if (calendar.get (fieldName) == value) return; if (fieldName == Calendar.AM_PM) { calendar.roll (Calendar.HOUR_OF_DAY, 12); // TODO: needs more work for setFormat and locale } calendar.set (fieldName, value); //When dealing with months with 31 days and have days set to 31, then if you change the month //to one that has 30 (or less) days, then in calendar only the day is changed but the month stays. //e.g 10.31.2014 -> decrement month, becomes: // 10.01.2014. //To get around this behaviour, we set the field again. if (calendar.get (fieldName) != value) { calendar.set (fieldName, value); } sendSelectionEvent (SWT.Selection); }
void setFieldOfInternalDataStructure (int fieldName, int value) { if (calendar.get (fieldName) == value) return; if (fieldName == Calendar.AM_PM) { calendar.roll (Calendar.HOUR_OF_DAY, 12); // TODO: needs more work for setFormat and locale } calendar.set (fieldName, value); //When dealing with months with 31 days and have days set to 31, then if you change the month //to one that has 30 (or less) days, then in calendar only the day is changed but the month stays. //e.g 10.31.2014 -> decrement month, becomes: // 10.01.2014. //To get around this behaviour, we set the field again. if (calendar.get (fieldName) != value) { calendar.set (fieldName, value); } sendSelectionEvent (SWT.Selection); }
void sendSelection () { NSEvent event = NSApplication.sharedApplication().currentEvent(); if (event != null && (style & SWT.CALENDAR) != 0) { if (event.clickCount() == 2) { sendSelectionEvent (SWT.DefaultSelection); } else if (event.type() == OS.NSLeftMouseUp) { sendSelectionEvent (SWT.Selection); } } else { // SWT.DATE or SWT.TIME sendSelectionEvent (SWT.Selection); } }
void setFieldOfInternalDataStructure (int fieldName, int value) { if (calendar.get (fieldName) == value) return; if (fieldName == Calendar.AM_PM) { calendar.roll (Calendar.HOUR_OF_DAY, 12); // TODO: needs more work for setFormat and locale } calendar.set (fieldName, value); //When dealing with months with 31 days and have days set to 31, then if you change the month //to one that has 30 (or less) days, then in calendar only the day is changed but the month stays. //e.g 10.31.2014 -> decrement month, becomes: // 10.01.2014. //To get around this behaviour, we set the field again. if (calendar.get (fieldName) != value) { calendar.set (fieldName, value); } sendSelectionEvent (SWT.Selection); }
@Override LRESULT WM_CHAR (int /*long*/ wParam, int /*long*/ lParam) { LRESULT result = super.WM_CHAR (wParam, lParam); if (result != null) return result; /* * Feature in Windows. For some reason, when the * user presses tab, return or escape, Windows beeps. * The fix is to look for these keys and not call * the window proc. */ switch ((int)/*64*/wParam) { case SWT.CR: sendSelectionEvent (SWT.DefaultSelection); // FALL THROUGH case SWT.TAB: case SWT.ESC: return LRESULT.ZERO; } return result; }
@Override LRESULT WM_LBUTTONUP (int /*long*/ wParam, int /*long*/ lParam) { LRESULT result = super.WM_LBUTTONUP (wParam, lParam); if (isDisposed ()) return LRESULT.ZERO; if (doubleClick) sendSelectionEvent (SWT.DefaultSelection); doubleClick = false; return result; }
void sendSelectionEvent () { int [] y = new int [1]; int [] m = new int [1]; int [] d = new int [1]; OS.gtk_calendar_get_date (calendarHandle, y, m, d); //TODO: hours, minutes, seconds? if (d[0] != day || m[0] != month || y[0] != year) { year = y[0]; month = m[0]; day = d[0]; /* Highlight the current (today) date */ if (year == Calendar.getInstance ().get (Calendar.YEAR) && month == Calendar.getInstance ().get (Calendar.MONTH)) { OS.gtk_calendar_mark_day (calendarHandle, Calendar.getInstance ().get (Calendar.DAY_OF_MONTH)); } else { OS.gtk_calendar_clear_marks (calendarHandle); } sendSelectionEvent (SWT.Selection); } }
void sendSelectionEvent () { int [] y = new int [1]; int [] m = new int [1]; int [] d = new int [1]; OS.gtk_calendar_get_date (calendarHandle, y, m, d); //TODO: hours, minutes, seconds? if (d[0] != day || m[0] != month || y[0] != year) { year = y[0]; month = m[0]; day = d[0]; /* Highlight the current (today) date */ if (year == Calendar.getInstance ().get (Calendar.YEAR) && month == Calendar.getInstance ().get (Calendar.MONTH)) { OS.gtk_calendar_mark_day (calendarHandle, Calendar.getInstance ().get (Calendar.DAY_OF_MONTH)); } else { OS.gtk_calendar_clear_marks (calendarHandle); } sendSelectionEvent (SWT.Selection); } }
void sendSelectionEvent () { int [] y = new int [1]; int [] m = new int [1]; int [] d = new int [1]; OS.gtk_calendar_get_date (calendarHandle, y, m, d); //TODO: hours, minutes, seconds? if (d[0] != day || m[0] != month || y[0] != year) { year = y[0]; month = m[0]; day = d[0]; /* Highlight the current (today) date */ if (year == Calendar.getInstance ().get (Calendar.YEAR) && month == Calendar.getInstance ().get (Calendar.MONTH)) { OS.gtk_calendar_mark_day (calendarHandle, Calendar.getInstance ().get (Calendar.DAY_OF_MONTH)); } else { OS.gtk_calendar_clear_marks (calendarHandle); } sendSelectionEvent (SWT.Selection); } }
boolean sendKeyEvent (NSEvent nsEvent, int type) { boolean result = super.sendKeyEvent (nsEvent, type); if (!result) return result; if (type != SWT.KeyDown) return result; if ((style & SWT.CALENDAR) == 0) { short keyCode = nsEvent.keyCode (); switch (keyCode) { case 76: /* KP Enter */ case 36: /* Return */ if ((style & SWT.DROP_DOWN) != 0) { hideCalendar (); } sendSelectionEvent (SWT.DefaultSelection); } } return result; }
SYSTEMTIME systime = new SYSTEMTIME (); OS.SendMessage (handle, OS.MCM_GETCURSEL, 0, systime); sendSelectionEvent (SWT.Selection); break; OS.SendMessage (handle, OS.DTM_GETSYSTEMTIME, 0, systime); if (lastSystemTime == null || systime.wDay != lastSystemTime.wDay || systime.wMonth != lastSystemTime.wMonth || systime.wYear != lastSystemTime.wYear) { sendSelectionEvent (SWT.Selection); if ((style & SWT.TIME) == 0) lastSystemTime = systime;