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 /bundles/org.eclipse.swt/Eclipse SWT/win32
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 'bundles/org.eclipse.swt/Eclipse SWT/win32')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java
index 5b61b7a51f..bb6982f98b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.swt.widgets;
-import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.win32.*;
/**
* Instances of this class are selectable user interface
@@ -25,7 +25,7 @@ import org.eclipse.swt.graphics.*;
* </p>
* <dl>
* <dt><b>Styles:</b></dt>
- * <dd>DATE, TIME, CALENDAR, SHORT, MEDIUM, LONG, DROP_DOWN</dd>
+ * <dd>DATE, TIME, CALENDAR, SHORT, MEDIUM, LONG, DROP_DOWN, CALENDAR_WEEKNUMBERS</dd>
* <dt><b>Events:</b></dt>
* <dd>DefaultSelection, Selection</dd>
* </dl>
@@ -149,6 +149,7 @@ public class DateTime extends Composite {
* @see SWT#DATE
* @see SWT#TIME
* @see SWT#CALENDAR
+ * @see SWT#CALENDAR_WEEKNUMBERS
* @see SWT#SHORT
* @see SWT#MEDIUM
* @see SWT#LONG
@@ -233,6 +234,12 @@ protected void checkSubclass () {
width = rect.right;
height = rect.bottom;
} else {
+ // customize the style of the drop-down calendar, to get the correct size
+ if ((style & SWT.CALENDAR_WEEKNUMBERS) != 0) {
+ // get current style and add week numbers to the calendar drop-down
+ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ OS.SendMessage(handle, OS.DTM_SETMCSTYLE, 0, bits | OS.MCS_WEEKNUMBERS);
+ }
SIZE size = new SIZE ();
OS.SendMessage(handle, OS.DTM_GETIDEALSIZE, 0, size);
width = size.cx;
@@ -701,6 +708,9 @@ public void setYear (int year) {
@Override
int widgetStyle () {
int bits = super.widgetStyle () | OS.WS_TABSTOP;
+ if ((style & SWT.CALENDAR_WEEKNUMBERS) != 0) {
+ bits |= OS.MCS_WEEKNUMBERS;
+ }
if ((style & SWT.CALENDAR) != 0) return bits | OS.MCS_NOTODAY;
/*
* Bug in Windows: When WS_CLIPCHILDREN is set in a

Back to the top