Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Luder2018-07-12 07:03:33 -0400
committerAlexander Kurtakov2018-07-18 06:24:21 -0400
commitf52c1ef6cd579938729028029e412ebe7cc5b6b1 (patch)
treecbbb74956311efe605f570920015b8326a59ccab /examples
parent5685d5b505a4f711d6f35b7ef1c9caaa7b904456 (diff)
downloadeclipse.platform.swt-f52c1ef6cd579938729028029e412ebe7cc5b6b1.tar.gz
eclipse.platform.swt-f52c1ef6cd579938729028029e412ebe7cc5b6b1.tar.xz
eclipse.platform.swt-f52c1ef6cd579938729028029e412ebe7cc5b6b1.zip
Bug 536024 [Win32][GTK] Show calendar week in SWT.CALENDAR Added
SWT.CALENDAR_WEEKNUMBERS constant ControlExample-DateTime: added checkbox to enable week numbers Snippet250: Adapted to show week numbers [GTK] DateTime - set GTK_CALENDAR_SHOW_WEEK_NUMBERS, if SWT.CALENDAR_WEEKNUMBERS is set [win32] DateTime - set MCS_WEEKNUMBERS style, if SWT.CALENDAR_WEEKNUMBERS is set - added OS.DTM_SETMCSTYLE (sets the style of the date and time picker) Change-Id: I5c35de0df3706d0fedae7374d67d6e7fe2f10c94 Signed-off-by: Christoph Luder <christoph.luder@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DateTimeTab.java11
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.java4
2 files changed, 12 insertions, 3 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DateTimeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DateTimeTab.java
index 3baf54fb44..f3d4ea6e2a 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DateTimeTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DateTimeTab.java
@@ -25,7 +25,7 @@ class DateTimeTab extends Tab {
Group dateTimeGroup;
/* Style widgets added to the "Style" group */
- Button dateButton, timeButton, calendarButton, shortButton, mediumButton, longButton, dropDownButton;
+ Button dateButton, timeButton, calendarButton, shortButton, mediumButton, longButton, dropDownButton, weekNumbersButton;
/**
* Creates the Tab within a given instance of ControlExample.
@@ -63,6 +63,7 @@ class DateTimeTab extends Tab {
if (mediumButton.getSelection ()) style |= SWT.MEDIUM;
if (longButton.getSelection ()) style |= SWT.LONG;
if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN;
+ if (weekNumbersButton.getSelection ()) style |= SWT.CALENDAR_WEEKNUMBERS;
/* Create the example widgets */
dateTime1 = new DateTime (dateTimeGroup, style);
@@ -92,6 +93,8 @@ class DateTimeTab extends Tab {
longButton.setText("SWT.LONG");
dropDownButton = new Button(styleGroup, SWT.CHECK);
dropDownButton.setText("SWT.DROP_DOWN");
+ weekNumbersButton = new Button(styleGroup, SWT.CHECK);
+ weekNumbersButton.setText("SWT.CALENDAR_WEEKNUMBERS");
borderButton = new Button(styleGroup, SWT.CHECK);
borderButton.setText("SWT.BORDER");
}
@@ -148,6 +151,12 @@ class DateTimeTab extends Tab {
dropDownButton.setSelection(false);
dropDownButton.setEnabled(false);
}
+ if ((dateTime1.getStyle() & SWT.CALENDAR) != 0 || (dateTime1.getStyle() & SWT.DROP_DOWN) != 0) {
+ weekNumbersButton.setEnabled(true);
+ } else {
+ weekNumbersButton.setEnabled(false);
+ weekNumbersButton.setSelection(false);
+ }
borderButton.setEnabled(false);
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.java
index 30741a2579..f2252768d9 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.java
@@ -31,10 +31,10 @@ public static void main (String [] args) {
Shell shell = new Shell (display);
shell.setLayout (new RowLayout ());
- DateTime calendar = new DateTime (shell, SWT.CALENDAR);
+ DateTime calendar = new DateTime (shell, SWT.CALENDAR | SWT.CALENDAR_WEEKNUMBERS);
calendar.addSelectionListener (widgetSelectedAdapter(e -> System.out.println ("calendar date changed")));
- DateTime calendarDropDown = new DateTime (shell, SWT.DROP_DOWN);
+ DateTime calendarDropDown = new DateTime (shell, SWT.DROP_DOWN | SWT.CALENDAR_WEEKNUMBERS);
calendarDropDown.addSelectionListener (
widgetSelectedAdapter(e -> System.out.println ("calendar date changed via drop-down")));

Back to the top