ReactOS  0.4.14-dev-1036-g3c5b10f
datetime.c File Reference
#include <math.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for datetime.c:

Go to the source code of this file.

Classes

struct  DATETIME_INFO
 

Macros

#define DT_END_FORMAT   0
 
#define ONEDIGITDAY   0x01
 
#define TWODIGITDAY   0x02
 
#define THREECHARDAY   0x03
 
#define FULLDAY   0x04
 
#define ONEDIGIT12HOUR   0x11
 
#define TWODIGIT12HOUR   0x12
 
#define ONEDIGIT24HOUR   0x21
 
#define TWODIGIT24HOUR   0x22
 
#define ONEDIGITMINUTE   0x31
 
#define TWODIGITMINUTE   0x32
 
#define ONEDIGITMONTH   0x41
 
#define TWODIGITMONTH   0x42
 
#define THREECHARMONTH   0x43
 
#define FULLMONTH   0x44
 
#define ONEDIGITSECOND   0x51
 
#define TWODIGITSECOND   0x52
 
#define ONELETTERAMPM   0x61
 
#define TWOLETTERAMPM   0x62
 
#define ONEDIGITYEAR   0x71
 
#define TWODIGITYEAR   0x72
 
#define INVALIDFULLYEAR   0x73 /* FIXME - yyy is not valid - we'll treat it as yyyy */
 
#define FULLYEAR   0x74
 
#define FORMATCALLBACK   0x81 /* -> maximum of 0x80 callbacks possible */
 
#define FORMATCALLMASK   0x80
 
#define DT_STRING   0x0100
 
#define DTHT_DATEFIELD   0xff /* for hit-testing */
 
#define DTHT_NONE   0x1000
 
#define DTHT_CHECKBOX   0x2000 /* these should end at '00' , to make */
 
#define DTHT_MCPOPUP   0x3000 /* & DTHT_DATEFIELD 0 when DATETIME_KeyDown */
 
#define DTHT_GOTFOCUS   0x4000 /* tests for date-fields */
 
#define DTHT_NODATEMASK   0xf000 /* to mask check and drop down from others */
 

Typedefs

typedef struct DATETIME_INFOLPDATETIME_INFO
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (datetime)
 
int MONTHCAL_MonthLength (int month, int year)
 
int MONTHCAL_CalculateDayOfWeek (SYSTEMTIME *date, BOOL inplace)
 
static BOOL DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code)
 
static BOOL DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr)
 
static DWORD DATETIME_GetSystemTime (const DATETIME_INFO *infoPtr, SYSTEMTIME *systime)
 
static BOOL DATETIME_IsDateInValidRange (const DATETIME_INFO *infoPtr, const SYSTEMTIME *date)
 
static BOOL DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *systime)
 
static void DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
 
static BOOL DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR format)
 
static BOOL DATETIME_SetFormatA (DATETIME_INFO *infoPtr, LPCSTR lpszFormat)
 
static void DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
 
static int wrap (int val, int delta, int minVal, int maxVal)
 
static void DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta)
 
static void DATETIME_ReturnFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *width)
 
static void DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
 
static INT DATETIME_HitTest (const DATETIME_INFO *infoPtr, POINT pt)
 
static int DATETIME_GetPrevDateField (const DATETIME_INFO *infoPtr, int i)
 
static void DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr)
 
static void DATETIME_SetSelectedField (DATETIME_INFO *infoPtr, int select)
 
static LRESULT DATETIME_LButtonDown (DATETIME_INFO *infoPtr, INT x, INT y)
 
static LRESULT DATETIME_LButtonUp (DATETIME_INFO *infoPtr)
 
static LRESULT DATETIME_Paint (DATETIME_INFO *infoPtr, HDC hdc)
 
static LRESULT DATETIME_Button_Command (DATETIME_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT DATETIME_Command (DATETIME_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT DATETIME_Enable (DATETIME_INFO *infoPtr, BOOL bEnable)
 
static LRESULT DATETIME_EraseBackground (const DATETIME_INFO *infoPtr, HDC hdc)
 
static LRESULT DATETIME_Notify (DATETIME_INFO *infoPtr, const NMHDR *lpnmh)
 
static LRESULT DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode)
 
static LRESULT DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode)
 
static LRESULT DATETIME_VScroll (DATETIME_INFO *infoPtr, WORD wScroll)
 
static LRESULT DATETIME_KillFocus (DATETIME_INFO *infoPtr, HWND lostFocus)
 
static LRESULT DATETIME_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs)
 
static LRESULT DATETIME_SetFocus (DATETIME_INFO *infoPtr, HWND lostFocus)
 
static LRESULT DATETIME_Size (DATETIME_INFO *infoPtr, INT width, INT height)
 
static LRESULT DATETIME_StyleChanging (DATETIME_INFO *infoPtr, WPARAM wStyleType, STYLESTRUCT *lpss)
 
static LRESULT DATETIME_StyleChanged (DATETIME_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 
static LRESULT DATETIME_SetFont (DATETIME_INFO *infoPtr, HFONT font, BOOL repaint)
 
static LRESULT DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 
static LRESULT DATETIME_Destroy (DATETIME_INFO *infoPtr)
 
static INT DATETIME_GetText (const DATETIME_INFO *infoPtr, INT count, LPWSTR dst)
 
static LRESULT WINAPI DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void DATETIME_Register (void)
 
void DATETIME_Unregister (void)
 

Variables

static const WCHAR allowedformatchars [] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', 0}
 
static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1}
 
static const SYSTEMTIME max_allowed_date = { 9999, 12, 0, 31 }
 
static const SYSTEMTIME min_allowed_date = { 1752, 9, 0, 14 }
 

Macro Definition Documentation

◆ DT_END_FORMAT

#define DT_END_FORMAT   0

Definition at line 93 of file datetime.c.

◆ DT_STRING

#define DT_STRING   0x0100

Definition at line 118 of file datetime.c.

◆ DTHT_CHECKBOX

#define DTHT_CHECKBOX   0x2000 /* these should end at '00' , to make */

Definition at line 123 of file datetime.c.

◆ DTHT_DATEFIELD

#define DTHT_DATEFIELD   0xff /* for hit-testing */

Definition at line 120 of file datetime.c.

◆ DTHT_GOTFOCUS

#define DTHT_GOTFOCUS   0x4000 /* tests for date-fields */

Definition at line 125 of file datetime.c.

◆ DTHT_MCPOPUP

#define DTHT_MCPOPUP   0x3000 /* & DTHT_DATEFIELD 0 when DATETIME_KeyDown */

Definition at line 124 of file datetime.c.

◆ DTHT_NODATEMASK

#define DTHT_NODATEMASK   0xf000 /* to mask check and drop down from others */

Definition at line 126 of file datetime.c.

◆ DTHT_NONE

#define DTHT_NONE   0x1000

Definition at line 122 of file datetime.c.

◆ FORMATCALLBACK

#define FORMATCALLBACK   0x81 /* -> maximum of 0x80 callbacks possible */

Definition at line 116 of file datetime.c.

◆ FORMATCALLMASK

#define FORMATCALLMASK   0x80

Definition at line 117 of file datetime.c.

◆ FULLDAY

#define FULLDAY   0x04

Definition at line 97 of file datetime.c.

◆ FULLMONTH

#define FULLMONTH   0x44

Definition at line 107 of file datetime.c.

◆ FULLYEAR

#define FULLYEAR   0x74

Definition at line 115 of file datetime.c.

◆ INVALIDFULLYEAR

#define INVALIDFULLYEAR   0x73 /* FIXME - yyy is not valid - we'll treat it as yyyy */

Definition at line 114 of file datetime.c.

◆ ONEDIGIT12HOUR

#define ONEDIGIT12HOUR   0x11

Definition at line 98 of file datetime.c.

◆ ONEDIGIT24HOUR

#define ONEDIGIT24HOUR   0x21

Definition at line 100 of file datetime.c.

◆ ONEDIGITDAY

#define ONEDIGITDAY   0x01

Definition at line 94 of file datetime.c.

◆ ONEDIGITMINUTE

#define ONEDIGITMINUTE   0x31

Definition at line 102 of file datetime.c.

◆ ONEDIGITMONTH

#define ONEDIGITMONTH   0x41

Definition at line 104 of file datetime.c.

◆ ONEDIGITSECOND

#define ONEDIGITSECOND   0x51

Definition at line 108 of file datetime.c.

◆ ONEDIGITYEAR

#define ONEDIGITYEAR   0x71

Definition at line 112 of file datetime.c.

◆ ONELETTERAMPM

#define ONELETTERAMPM   0x61

Definition at line 110 of file datetime.c.

◆ THREECHARDAY

#define THREECHARDAY   0x03

Definition at line 96 of file datetime.c.

◆ THREECHARMONTH

#define THREECHARMONTH   0x43

Definition at line 106 of file datetime.c.

◆ TWODIGIT12HOUR

#define TWODIGIT12HOUR   0x12

Definition at line 99 of file datetime.c.

◆ TWODIGIT24HOUR

#define TWODIGIT24HOUR   0x22

Definition at line 101 of file datetime.c.

◆ TWODIGITDAY

#define TWODIGITDAY   0x02

Definition at line 95 of file datetime.c.

◆ TWODIGITMINUTE

#define TWODIGITMINUTE   0x32

Definition at line 103 of file datetime.c.

◆ TWODIGITMONTH

#define TWODIGITMONTH   0x42

Definition at line 105 of file datetime.c.

◆ TWODIGITSECOND

#define TWODIGITSECOND   0x52

Definition at line 109 of file datetime.c.

◆ TWODIGITYEAR

#define TWODIGITYEAR   0x72

Definition at line 113 of file datetime.c.

◆ TWOLETTERAMPM

#define TWOLETTERAMPM   0x62

Definition at line 111 of file datetime.c.

Typedef Documentation

◆ LPDATETIME_INFO

Function Documentation

◆ DATETIME_ApplySelectedField()

static void DATETIME_ApplySelectedField ( DATETIME_INFO infoPtr)
static

Definition at line 833 of file datetime.c.

834 {
835  int fieldNum = infoPtr->select & DTHT_DATEFIELD;
836  int i, val = 0;
837  BOOL clamp_day = FALSE;
838  SYSTEMTIME date = infoPtr->date;
839  int oldyear;
840 
841  if (infoPtr->select == -1 || infoPtr->nCharsEntered == 0)
842  return;
843 
844  if ((infoPtr->fieldspec[fieldNum] == ONELETTERAMPM) ||
845  (infoPtr->fieldspec[fieldNum] == TWOLETTERAMPM))
846  val = infoPtr->charsEntered[0];
847  else {
848  for (i=0; i<infoPtr->nCharsEntered; i++)
849  val = val * 10 + infoPtr->charsEntered[i] - '0';
850  }
851 
852  infoPtr->nCharsEntered = 0;
853 
854  switch (infoPtr->fieldspec[fieldNum]) {
855  case ONEDIGITYEAR:
856  case TWODIGITYEAR:
857  oldyear = date.wYear;
858  date.wYear = date.wYear - (date.wYear%100) + val;
859 
860  if (DATETIME_IsDateInValidRange(infoPtr, &date))
861  clamp_day = TRUE;
862  else
863  date.wYear = oldyear;
864 
865  break;
866  case INVALIDFULLYEAR:
867  case FULLYEAR:
868  oldyear = date.wYear;
869  date.wYear = val;
870 
871  if (DATETIME_IsDateInValidRange(infoPtr, &date))
872  clamp_day = TRUE;
873  else
874  date.wYear = oldyear;
875 
876  break;
877  case ONEDIGITMONTH:
878  case TWODIGITMONTH:
879  date.wMonth = val;
880  clamp_day = TRUE;
881  break;
882  case ONEDIGITDAY:
883  case TWODIGITDAY:
884  date.wDay = val;
885  break;
886  case ONEDIGIT12HOUR:
887  case TWODIGIT12HOUR:
888  if (val >= 24)
889  val -= 20;
890 
891  if (val >= 13)
892  date.wHour = val;
893  else if (val != 0) {
894  if (date.wHour >= 12) /* preserve current AM/PM state */
895  date.wHour = (val == 12 ? 12 : val + 12);
896  else
897  date.wHour = (val == 12 ? 0 : val);
898  }
899  break;
900  case ONEDIGIT24HOUR:
901  case TWODIGIT24HOUR:
902  date.wHour = val;
903  break;
904  case ONEDIGITMINUTE:
905  case TWODIGITMINUTE:
906  date.wMinute = val;
907  break;
908  case ONEDIGITSECOND:
909  case TWODIGITSECOND:
910  date.wSecond = val;
911  break;
912  case ONELETTERAMPM:
913  case TWOLETTERAMPM:
914  if (val == 'a' || val == 'A') {
915  if (date.wHour >= 12)
916  date.wHour -= 12;
917  } else if (val == 'p' || val == 'P') {
918  if (date.wHour < 12)
919  date.wHour += 12;
920  }
921  break;
922  }
923 
924  if (clamp_day && date.wDay > MONTHCAL_MonthLength(date.wMonth, date.wYear))
925  date.wDay = MONTHCAL_MonthLength(date.wMonth, date.wYear);
926 
927  if (DATETIME_SetSystemTime(infoPtr, GDT_VALID, &date))
929 }
int * fieldspec
Definition: datetime.c:74
#define TRUE
Definition: types.h:120
#define DTHT_DATEFIELD
Definition: datetime.c:120
#define TWODIGITYEAR
Definition: datetime.c:113
#define TWODIGITMONTH
Definition: datetime.c:105
#define TWODIGITDAY
Definition: datetime.c:95
static BOOL DATETIME_SendDateTimeChangeNotify(const DATETIME_INFO *infoPtr)
Definition: datetime.c:1336
#define TWOLETTERAMPM
Definition: datetime.c:111
#define ONEDIGITMONTH
Definition: datetime.c:104
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FULLYEAR
Definition: datetime.c:115
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ONEDIGIT24HOUR
Definition: datetime.c:100
GLuint GLfloat * val
Definition: glext.h:7180
#define TWODIGIT24HOUR
Definition: datetime.c:101
int MONTHCAL_MonthLength(int month, int year)
Definition: monthcal.c:217
int nCharsEntered
Definition: datetime.c:69
static BOOL DATETIME_SetSystemTime(DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *systime)
Definition: datetime.c:190
WCHAR charsEntered[4]
Definition: datetime.c:68
static BOOL DATETIME_IsDateInValidRange(const DATETIME_INFO *infoPtr, const SYSTEMTIME *date)
Definition: datetime.c:163
#define TWODIGIT12HOUR
Definition: datetime.c:99
#define ONEDIGIT12HOUR
Definition: datetime.c:98
#define TWODIGITMINUTE
Definition: datetime.c:103
#define ONEDIGITSECOND
Definition: datetime.c:108
#define GDT_VALID
Definition: commctrl.h:4456
#define ONELETTERAMPM
Definition: datetime.c:110
__u16 date
Definition: mkdosfs.c:366
#define INVALIDFULLYEAR
Definition: datetime.c:114
#define ONEDIGITYEAR
Definition: datetime.c:112
SYSTEMTIME date
Definition: datetime.c:58
#define TWODIGITSECOND
Definition: datetime.c:109
#define ONEDIGITMINUTE
Definition: datetime.c:102
#define ONEDIGITDAY
Definition: datetime.c:94

Referenced by DATETIME_Char(), and DATETIME_SetSelectedField().

◆ DATETIME_Button_Command()

static LRESULT DATETIME_Button_Command ( DATETIME_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1052 of file datetime.c.

1053 {
1054  if( HIWORD(wParam) == BN_CLICKED) {
1056  infoPtr->dateValid = (state == BST_CHECKED);
1057  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1058  }
1059  return 0;
1060 }
BOOL dateValid
Definition: datetime.c:59
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
#define BM_GETCHECK
Definition: winuser.h:1900
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define BN_CLICKED
Definition: winuser.h:1907
unsigned long DWORD
Definition: ntddk_ex.h:95
static int state
Definition: maze.c:121
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
#define HIWORD(l)
Definition: typedefs.h:247
LPARAM lParam
Definition: combotst.c:139

Referenced by DATETIME_Command().

◆ DATETIME_Char()

static LRESULT DATETIME_Char ( DATETIME_INFO infoPtr,
WPARAM  vkCode 
)
static

Definition at line 1213 of file datetime.c.

1214 {
1215  int fieldNum, fieldSpec;
1216 
1217  fieldNum = infoPtr->select & DTHT_DATEFIELD;
1218  fieldSpec = infoPtr->fieldspec[fieldNum];
1219 
1220  if (fieldSpec == ONELETTERAMPM || fieldSpec == TWOLETTERAMPM) {
1221  infoPtr->charsEntered[0] = vkCode;
1222  infoPtr->nCharsEntered = 1;
1223 
1224  DATETIME_ApplySelectedField(infoPtr);
1225  } else if (vkCode >= '0' && vkCode <= '9') {
1226  int maxChars;
1227 
1228  infoPtr->charsEntered[infoPtr->nCharsEntered++] = vkCode;
1229 
1230  if (fieldSpec == INVALIDFULLYEAR || fieldSpec == FULLYEAR)
1231  maxChars = 4;
1232  else
1233  maxChars = 2;
1234 
1235  if ((fieldSpec == ONEDIGIT12HOUR ||
1236  fieldSpec == TWODIGIT12HOUR ||
1237  fieldSpec == ONEDIGIT24HOUR ||
1238  fieldSpec == TWODIGIT24HOUR) &&
1239  (infoPtr->nCharsEntered == 1))
1240  {
1241  if (vkCode >= '3')
1242  maxChars = 1;
1243  }
1244 
1245  if (maxChars == infoPtr->nCharsEntered)
1246  DATETIME_ApplySelectedField(infoPtr);
1247  }
1248 
1249  return 0;
1250 }
int * fieldspec
Definition: datetime.c:74
#define DTHT_DATEFIELD
Definition: datetime.c:120
#define TWOLETTERAMPM
Definition: datetime.c:111
#define FULLYEAR
Definition: datetime.c:115
#define ONEDIGIT24HOUR
Definition: datetime.c:100
static void DATETIME_ApplySelectedField(DATETIME_INFO *infoPtr)
Definition: datetime.c:833
#define TWODIGIT24HOUR
Definition: datetime.c:101
int nCharsEntered
Definition: datetime.c:69
WCHAR charsEntered[4]
Definition: datetime.c:68
#define TWODIGIT12HOUR
Definition: datetime.c:99
#define ONEDIGIT12HOUR
Definition: datetime.c:98
#define ONELETTERAMPM
Definition: datetime.c:110
#define INVALIDFULLYEAR
Definition: datetime.c:114

Referenced by DATETIME_WindowProc().

◆ DATETIME_Command()

static LRESULT DATETIME_Command ( DATETIME_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1065 of file datetime.c.

1066 {
1067  TRACE("hwndbutton = %p\n", infoPtr->hwndCheckbut);
1068  if(infoPtr->hwndCheckbut == (HWND)lParam)
1069  return DATETIME_Button_Command(infoPtr, wParam, lParam);
1070  return 0;
1071 }
static LRESULT DATETIME_Button_Command(DATETIME_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: datetime.c:1052
WPARAM wParam
Definition: combotst.c:138
HWND hwndCheckbut
Definition: datetime.c:60
#define TRACE(s)
Definition: solgame.cpp:4
LPARAM lParam
Definition: combotst.c:139

Referenced by DATETIME_WindowProc().

◆ DATETIME_Create()

static LRESULT DATETIME_Create ( HWND  hwnd,
const CREATESTRUCTW lpcs 
)
static

Definition at line 1466 of file datetime.c.

1467 {
1468  DATETIME_INFO *infoPtr = Alloc (sizeof(DATETIME_INFO));
1469  STYLESTRUCT ss = { 0, lpcs->style };
1470 
1471  if (!infoPtr) return -1;
1472 
1473  infoPtr->hwndSelf = hwnd;
1474  infoPtr->dwStyle = lpcs->style;
1475 
1476  infoPtr->nrFieldsAllocated = 32;
1477  infoPtr->fieldspec = Alloc (infoPtr->nrFieldsAllocated * sizeof(int));
1478  infoPtr->fieldRect = Alloc (infoPtr->nrFieldsAllocated * sizeof(RECT));
1479  infoPtr->buflen = Alloc (infoPtr->nrFieldsAllocated * sizeof(int));
1480  infoPtr->hwndNotify = lpcs->hwndParent;
1481  infoPtr->select = -1; /* initially, nothing is selected */
1482  infoPtr->bDropdownEnabled = TRUE;
1483 
1484  DATETIME_StyleChanged(infoPtr, GWL_STYLE, &ss);
1485  DATETIME_SetFormatW (infoPtr, 0);
1486 
1487  /* create the monthcal control */
1489  0, 0, 0, 0, infoPtr->hwndSelf, 0, 0, 0);
1490 
1491  /* initialize info structure */
1492  GetLocalTime (&infoPtr->date);
1493  infoPtr->dateValid = TRUE;
1495 
1496  SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
1497 
1498  return 0;
1499 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
BOOL dateValid
Definition: datetime.c:59
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int * fieldspec
Definition: datetime.c:74
#define TRUE
Definition: types.h:120
static BOOL DATETIME_SetFormatW(DATETIME_INFO *infoPtr, LPCWSTR format)
Definition: datetime.c:318
#define MONTHCAL_CLASSW
Definition: commctrl.h:4171
HWND hwndNotify
Definition: datetime.c:55
HFONT hFont
Definition: datetime.c:70
HWND hMonthCal
Definition: datetime.c:54
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
int nrFieldsAllocated
Definition: datetime.c:71
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
uint32_t DWORD_PTR
Definition: typedefs.h:64
int * buflen
Definition: datetime.c:76
#define GWL_STYLE
Definition: winuser.h:846
#define WS_BORDER
Definition: pedump.c:625
HWND hwndSelf
Definition: datetime.c:53
#define WS_POPUP
Definition: pedump.c:616
BOOL bDropdownEnabled
Definition: datetime.c:66
SYSTEMTIME date
Definition: datetime.c:58
static LRESULT DATETIME_StyleChanged(DATETIME_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: datetime.c:1423
#define SetWindowLongPtrW
Definition: winuser.h:5321
RECT * fieldRect
Definition: datetime.c:75
#define ss
Definition: i386-dis.c:432
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_WindowProc().

◆ DATETIME_Destroy()

static LRESULT DATETIME_Destroy ( DATETIME_INFO infoPtr)
static

Definition at line 1504 of file datetime.c.

1505 {
1506  if (infoPtr->hwndCheckbut)
1507  DestroyWindow(infoPtr->hwndCheckbut);
1508  if (infoPtr->hUpdown)
1509  DestroyWindow(infoPtr->hUpdown);
1510  if (infoPtr->hMonthCal)
1511  DestroyWindow(infoPtr->hMonthCal);
1512  SetWindowLongPtrW( infoPtr->hwndSelf, 0, 0 ); /* clear infoPtr */
1513  Free (infoPtr->buflen);
1514  Free (infoPtr->fieldRect);
1515  Free (infoPtr->fieldspec);
1516  Free (infoPtr);
1517  return 0;
1518 }
int * fieldspec
Definition: datetime.c:74
HWND hMonthCal
Definition: datetime.c:54
BOOL WINAPI DestroyWindow(_In_ HWND)
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
HWND hwndCheckbut
Definition: datetime.c:60
HWND hUpdown
Definition: datetime.c:56
int * buflen
Definition: datetime.c:76
HWND hwndSelf
Definition: datetime.c:53
#define SetWindowLongPtrW
Definition: winuser.h:5321
RECT * fieldRect
Definition: datetime.c:75

Referenced by DATETIME_WindowProc().

◆ DATETIME_Enable()

static LRESULT DATETIME_Enable ( DATETIME_INFO infoPtr,
BOOL  bEnable 
)
static

Definition at line 1075 of file datetime.c.

1076 {
1077  TRACE("%p %s\n", infoPtr, bEnable ? "TRUE" : "FALSE");
1078  if (bEnable)
1079  infoPtr->dwStyle &= ~WS_DISABLED;
1080  else
1081  infoPtr->dwStyle |= WS_DISABLED;
1082 
1083  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1084 
1085  return 0;
1086 }
#define WS_DISABLED
Definition: pedump.c:621
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
_In_ BOOL bEnable
Definition: winddi.h:3426
HWND hwndSelf
Definition: datetime.c:53
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_WindowProc().

◆ DATETIME_EraseBackground()

static LRESULT DATETIME_EraseBackground ( const DATETIME_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 1090 of file datetime.c.

1091 {
1092  HBRUSH hBrush, hSolidBrush = NULL;
1093  RECT rc;
1094 
1095  if (infoPtr->dwStyle & WS_DISABLED)
1096  hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrBtnFace);
1097  else
1098  {
1099  hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLOREDIT,
1100  (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
1101  if (!hBrush)
1102  hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrWindow);
1103  }
1104 
1105  GetClientRect (infoPtr->hwndSelf, &rc);
1106 
1107  FillRect (hdc, &rc, hBrush);
1108 
1109  if (hSolidBrush)
1110  DeleteObject(hSolidBrush);
1111 
1112  return -1;
1113 }
#define WS_DISABLED
Definition: pedump.c:621
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HWND hwndNotify
Definition: datetime.c:55
UINT_PTR WPARAM
Definition: windef.h:207
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
COLORREF clrBtnFace
Definition: comctl32.h:161
#define WM_CTLCOLOREDIT
Definition: winuser.h:1749
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
COLORREF clrWindow
Definition: comctl32.h:169
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_WindowProc().

◆ DATETIME_GetPrevDateField()

static int DATETIME_GetPrevDateField ( const DATETIME_INFO infoPtr,
int  i 
)
static

Definition at line 823 of file datetime.c.

824 {
825  for(--i; i >= 0; i--)
826  {
827  if (infoPtr->fieldspec[i] & DTHT_DATEFIELD) return i;
828  }
829  return -1;
830 }
int * fieldspec
Definition: datetime.c:74
#define DTHT_DATEFIELD
Definition: datetime.c:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by DATETIME_LButtonDown().

◆ DATETIME_GetSystemTime()

static DWORD DATETIME_GetSystemTime ( const DATETIME_INFO infoPtr,
SYSTEMTIME systime 
)
static

Definition at line 138 of file datetime.c.

139 {
140  if (!systime) return GDT_NONE;
141 
142  if ((infoPtr->dwStyle & DTS_SHOWNONE) &&
143  (SendMessageW (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0) == BST_UNCHECKED))
144  return GDT_NONE;
145 
146  *systime = infoPtr->date;
147 
148  return GDT_VALID;
149 }
HWND hwndCheckbut
Definition: datetime.c:60
#define BM_GETCHECK
Definition: winuser.h:1900
#define GDT_NONE
Definition: commctrl.h:4457
#define BST_UNCHECKED
Definition: winuser.h:199
#define GDT_VALID
Definition: commctrl.h:4456
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DTS_SHOWNONE
Definition: commctrl.h:4354
SYSTEMTIME date
Definition: datetime.c:58
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_WindowProc().

◆ DATETIME_GetText()

static INT DATETIME_GetText ( const DATETIME_INFO infoPtr,
INT  count,
LPWSTR  dst 
)
static

Definition at line 1522 of file datetime.c.

1523 {
1524  WCHAR buf[80];
1525  int i;
1526 
1527  if (!dst || (count <= 0)) return 0;
1528 
1529  dst[0] = 0;
1530  for (i = 0; i < infoPtr->nrFields; i++)
1531  {
1532  DATETIME_ReturnTxt(infoPtr, i, buf, ARRAY_SIZE(buf));
1533  if ((strlenW(dst) + strlenW(buf)) < count)
1534  strcatW(dst, buf);
1535  else break;
1536  }
1537  return strlenW(dst);
1538 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void DATETIME_ReturnTxt(const DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
Definition: datetime.c:361
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ARRAY_SIZE(a)
Definition: main.h:24
GLenum GLenum dst
Definition: glext.h:6340
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
int nrFields
Definition: datetime.c:72

Referenced by DATETIME_WindowProc().

◆ DATETIME_HitTest()

static INT DATETIME_HitTest ( const DATETIME_INFO infoPtr,
POINT  pt 
)
static

Definition at line 805 of file datetime.c.

806 {
807  int i;
808 
809  TRACE ("%s\n", wine_dbgstr_point(&pt));
810 
811  if (PtInRect (&infoPtr->calbutton, pt)) return DTHT_MCPOPUP;
812  if (PtInRect (&infoPtr->checkbox, pt)) return DTHT_CHECKBOX;
813 
814  for (i = 0; i < infoPtr->nrFields; i++) {
815  if (PtInRect (&infoPtr->fieldRect[i], pt)) return i;
816  }
817 
818  return DTHT_NONE;
819 }
#define pt(x, y)
Definition: drawing.c:79
RECT calbutton
Definition: datetime.c:64
#define DTHT_NONE
Definition: datetime.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const char * wine_dbgstr_point(const POINT *guid)
#define TRACE(s)
Definition: solgame.cpp:4
#define DTHT_MCPOPUP
Definition: datetime.c:124
RECT checkbox
Definition: datetime.c:63
int nrFields
Definition: datetime.c:72
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
RECT * fieldRect
Definition: datetime.c:75
#define DTHT_CHECKBOX
Definition: datetime.c:123

Referenced by DATETIME_LButtonDown().

◆ DATETIME_IncreaseField()

static void DATETIME_IncreaseField ( DATETIME_INFO infoPtr,
int  number,
int  delta 
)
static

Definition at line 497 of file datetime.c.

498 {
499  SYSTEMTIME *date = &infoPtr->date;
500  SYSTEMTIME range[2];
501  DWORD limits;
502  BOOL min;
503 
504  TRACE ("%d\n", number);
505  if ((number > infoPtr->nrFields) || (number < 0)) return;
506 
507  if ((infoPtr->fieldspec[number] & DTHT_DATEFIELD) == 0) return;
508 
509  switch (infoPtr->fieldspec[number]) {
510  case ONEDIGITYEAR:
511  case TWODIGITYEAR:
512  case FULLYEAR:
513  if (delta == INT_MIN)
514  date->wYear = 1752;
515  else if (delta == INT_MAX)
516  date->wYear = 9999;
517  else
518  date->wYear = max(min(date->wYear + delta, 9999), 1752);
519 
520  if (date->wDay > MONTHCAL_MonthLength(date->wMonth, date->wYear))
521  /* This can happen when moving away from a leap year. */
522  date->wDay = MONTHCAL_MonthLength(date->wMonth, date->wYear);
524  break;
525  case ONEDIGITMONTH:
526  case TWODIGITMONTH:
527  case THREECHARMONTH:
528  case FULLMONTH:
529  date->wMonth = wrap(date->wMonth, delta, 1, 12);
531  delta = 0;
532  /* fall through */
533  case ONEDIGITDAY:
534  case TWODIGITDAY:
535  case THREECHARDAY:
536  case FULLDAY:
537  date->wDay = wrap(date->wDay, delta, 1, MONTHCAL_MonthLength(date->wMonth, date->wYear));
539  break;
540  case ONELETTERAMPM:
541  case TWOLETTERAMPM:
542  delta *= 12;
543  /* fall through */
544  case ONEDIGIT12HOUR:
545  case TWODIGIT12HOUR:
546  case ONEDIGIT24HOUR:
547  case TWODIGIT24HOUR:
548  date->wHour = wrap(date->wHour, delta, 0, 23);
549  break;
550  case ONEDIGITMINUTE:
551  case TWODIGITMINUTE:
552  date->wMinute = wrap(date->wMinute, delta, 0, 59);
553  break;
554  case ONEDIGITSECOND:
555  case TWODIGITSECOND:
556  date->wSecond = wrap(date->wSecond, delta, 0, 59);
557  break;
558  case FORMATCALLBACK:
559  FIXME ("Not implemented\n");
560  break;
561  }
562 
563  /* FYI: On 1752/9/14 the calendar changed and England and the
564  * American colonies changed to the Gregorian calendar. This change
565  * involved having September 14th follow September 2nd. So no date
566  * algorithm works before that date.
567  */
568  if (10000 * date->wYear + 100 * date->wMonth + date->wDay < 17520914) {
569  date->wYear = 1752;
570  date->wMonth = 9;
571  date->wDay = 14;
572  date->wSecond = 0;
573  date->wMinute = 0;
574  date->wHour = 0;
575  }
576 
577  /* Ensure time is within bounds */
578  limits = SendMessageW (infoPtr->hMonthCal, MCM_GETRANGE, 0, (LPARAM)range);
579  min = delta < 0;
580 
581  if (limits & (min ? GDTR_MIN : GDTR_MAX))
582  {
583  int i = (min ? 0 : 1);
584 
585  if (MONTHCAL_CompareSystemTime(date, &range[i]) == (min ? -1 : 1))
586  {
587  date->wYear = range[i].wYear;
588  date->wMonth = range[i].wMonth;
589  date->wDayOfWeek = range[i].wDayOfWeek;
590  date->wDay = range[i].wDay;
591  date->wHour = range[i].wHour;
592  date->wMinute = range[i].wMinute;
593  date->wSecond = range[i].wSecond;
594  date->wMilliseconds = range[i].wMilliseconds;
595  }
596  }
597 }
#define max(a, b)
Definition: svc.c:63
int * fieldspec
Definition: datetime.c:74
#define TRUE
Definition: types.h:120
#define FULLMONTH
Definition: datetime.c:107
#define DTHT_DATEFIELD
Definition: datetime.c:120
#define INT_MAX
Definition: limits.h:40
#define TWODIGITYEAR
Definition: datetime.c:113
#define TWODIGITMONTH
Definition: datetime.c:105
#define TWODIGITDAY
Definition: datetime.c:95
#define THREECHARDAY
Definition: datetime.c:96
#define MCM_GETRANGE
Definition: commctrl.h:4258
#define FULLDAY
Definition: datetime.c:97
#define TWOLETTERAMPM
Definition: datetime.c:111
HWND hMonthCal
Definition: datetime.c:54
int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace)
Definition: monthcal.c:470
#define ONEDIGITMONTH
Definition: datetime.c:104
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FULLYEAR
Definition: datetime.c:115
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ONEDIGIT24HOUR
Definition: datetime.c:100
static size_t double number
Definition: printf.c:69
#define FIXME(fmt,...)
Definition: debug.h:110
LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) DECLSPEC_HIDDEN
Definition: monthcal.c:305
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
#define TWODIGIT24HOUR
Definition: datetime.c:101
int MONTHCAL_MonthLength(int month, int year)
Definition: monthcal.c:217
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GDTR_MAX
Definition: commctrl.h:4453
#define GDTR_MIN
Definition: commctrl.h:4452
#define TWODIGIT12HOUR
Definition: datetime.c:99
#define ONEDIGIT12HOUR
Definition: datetime.c:98
GLenum GLint * range
Definition: glext.h:7539
#define TWODIGITMINUTE
Definition: datetime.c:103
#define INT_MIN
Definition: limits.h:39
#define ONEDIGITSECOND
Definition: datetime.c:108
#define ONELETTERAMPM
Definition: datetime.c:110
__u16 date
Definition: mkdosfs.c:366
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define FORMATCALLBACK
Definition: datetime.c:116
#define min(a, b)
Definition: monoChain.cc:55
int nrFields
Definition: datetime.c:72
#define ONEDIGITYEAR
Definition: datetime.c:112
SYSTEMTIME date
Definition: datetime.c:58
#define TWODIGITSECOND
Definition: datetime.c:109
#define THREECHARMONTH
Definition: datetime.c:106
#define ONEDIGITMINUTE
Definition: datetime.c:102
static int wrap(int val, int delta, int minVal, int maxVal)
Definition: datetime.c:488
#define ONEDIGITDAY
Definition: datetime.c:94

Referenced by DATETIME_KeyDown(), and DATETIME_VScroll().

◆ DATETIME_IsDateInValidRange()

static BOOL DATETIME_IsDateInValidRange ( const DATETIME_INFO infoPtr,
const SYSTEMTIME date 
)
static

Definition at line 163 of file datetime.c.

164 {
165  SYSTEMTIME range[2];
166  DWORD limits;
167 
170  return FALSE;
171 
172  limits = SendMessageW (infoPtr->hMonthCal, MCM_GETRANGE, 0, (LPARAM)range);
173 
174  if (limits & GDTR_MAX)
175  {
176  if (MONTHCAL_CompareSystemTime(date, &range[1]) == 1)
177  return FALSE;
178  }
179 
180  if (limits & GDTR_MIN)
181  {
182  if (MONTHCAL_CompareSystemTime(date, &range[0]) == -1)
183  return FALSE;
184  }
185 
186  return TRUE;
187 }
#define TRUE
Definition: types.h:120
#define MCM_GETRANGE
Definition: commctrl.h:4258
HWND hMonthCal
Definition: datetime.c:54
LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) DECLSPEC_HIDDEN
Definition: monthcal.c:305
LONG_PTR LPARAM
Definition: windef.h:208
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GDTR_MAX
Definition: commctrl.h:4453
#define GDTR_MIN
Definition: commctrl.h:4452
GLenum GLint * range
Definition: glext.h:7539
__u16 date
Definition: mkdosfs.c:366
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const SYSTEMTIME max_allowed_date
Definition: datetime.c:134
static const SYSTEMTIME min_allowed_date
Definition: datetime.c:135

Referenced by DATETIME_ApplySelectedField(), and DATETIME_SetSystemTime().

◆ DATETIME_KeyDown()

static LRESULT DATETIME_KeyDown ( DATETIME_INFO infoPtr,
DWORD  vkCode 
)
static

Definition at line 1143 of file datetime.c.

1144 {
1145  int fieldNum = infoPtr->select & DTHT_DATEFIELD;
1146  int wrap = 0;
1147  int new;
1148 
1149  if (!(infoPtr->haveFocus)) return 0;
1150  if ((fieldNum==0) && (infoPtr->select)) return 0;
1151 
1152  if (infoPtr->select & FORMATCALLMASK) {
1153  FIXME ("Callbacks not implemented yet\n");
1154  }
1155 
1156  switch (vkCode) {
1157  case VK_ADD:
1158  case VK_UP:
1159  infoPtr->nCharsEntered = 0;
1160  DATETIME_IncreaseField (infoPtr, fieldNum, 1);
1162  break;
1163  case VK_SUBTRACT:
1164  case VK_DOWN:
1165  infoPtr->nCharsEntered = 0;
1166  DATETIME_IncreaseField (infoPtr, fieldNum, -1);
1168  break;
1169  case VK_HOME:
1170  infoPtr->nCharsEntered = 0;
1171  DATETIME_IncreaseField (infoPtr, fieldNum, INT_MIN);
1173  break;
1174  case VK_END:
1175  infoPtr->nCharsEntered = 0;
1176  DATETIME_IncreaseField (infoPtr, fieldNum, INT_MAX);
1178  break;
1179  case VK_LEFT:
1180  new = infoPtr->select;
1181  do {
1182  if (new == 0) {
1183  new = new - 1;
1184  wrap++;
1185  } else {
1186  new--;
1187  }
1188  } while ((infoPtr->fieldspec[new] & DT_STRING) && (wrap<2));
1189  if (new != infoPtr->select)
1190  DATETIME_SetSelectedField(infoPtr, new);
1191  break;
1192  case VK_RIGHT:
1193  new = infoPtr->select;
1194  do {
1195  new++;
1196  if (new==infoPtr->nrFields) {
1197  new = 0;
1198  wrap++;
1199  }
1200  } while ((infoPtr->fieldspec[new] & DT_STRING) && (wrap<2));
1201  if (new != infoPtr->select)
1202  DATETIME_SetSelectedField(infoPtr, new);
1203  break;
1204  }
1205 
1206  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1207 
1208  return 0;
1209 }
#define VK_SUBTRACT
Definition: winuser.h:2227
int * fieldspec
Definition: datetime.c:74
#define TRUE
Definition: types.h:120
#define DTHT_DATEFIELD
Definition: datetime.c:120
#define INT_MAX
Definition: limits.h:40
static BOOL DATETIME_SendDateTimeChangeNotify(const DATETIME_INFO *infoPtr)
Definition: datetime.c:1336
#define DT_STRING
Definition: datetime.c:118
#define FORMATCALLMASK
Definition: datetime.c:117
#define VK_ADD
Definition: winuser.h:2225
#define VK_LEFT
Definition: winuser.h:2199
#define VK_DOWN
Definition: winuser.h:2202
static void DATETIME_IncreaseField(DATETIME_INFO *infoPtr, int number, int delta)
Definition: datetime.c:497
#define VK_HOME
Definition: winuser.h:2198
#define VK_UP
Definition: winuser.h:2200
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
int haveFocus
Definition: datetime.c:73
static void DATETIME_SetSelectedField(DATETIME_INFO *infoPtr, int select)
Definition: datetime.c:932
int nCharsEntered
Definition: datetime.c:69
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define VK_RIGHT
Definition: winuser.h:2201
#define INT_MIN
Definition: limits.h:39
HWND hwndSelf
Definition: datetime.c:53
int nrFields
Definition: datetime.c:72
#define VK_END
Definition: winuser.h:2197
static int wrap(int val, int delta, int minVal, int maxVal)
Definition: datetime.c:488

Referenced by DATETIME_WindowProc().

◆ DATETIME_KillFocus()

static LRESULT DATETIME_KillFocus ( DATETIME_INFO infoPtr,
HWND  lostFocus 
)
static

Definition at line 1278 of file datetime.c.

1279 {
1280  TRACE("lost focus to %p\n", lostFocus);
1281 
1282  if (infoPtr->haveFocus) {
1284  infoPtr->haveFocus = 0;
1285  DATETIME_SetSelectedField (infoPtr, -1);
1286  }
1287 
1288  InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
1289 
1290  return 0;
1291 }
#define NM_KILLFOCUS
Definition: commctrl.h:136
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
int haveFocus
Definition: datetime.c:73
static BOOL DATETIME_SendSimpleNotify(const DATETIME_INFO *infoPtr, UINT code)
Definition: datetime.c:1353
static void DATETIME_SetSelectedField(DATETIME_INFO *infoPtr, int select)
Definition: datetime.c:932
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hwndSelf
Definition: datetime.c:53

Referenced by DATETIME_WindowProc().

◆ DATETIME_LButtonDown()

static LRESULT DATETIME_LButtonDown ( DATETIME_INFO infoPtr,
INT  x,
INT  y 
)
static

Definition at line 941 of file datetime.c.

942 {
943  POINT pt;
944  int new;
945 
946  pt.x = x;
947  pt.y = y;
948  new = DATETIME_HitTest (infoPtr, pt);
949 
950  SetFocus(infoPtr->hwndSelf);
951 
952  if (!(new & DTHT_NODATEMASK) || (new == DTHT_NONE))
953  {
954  if (new == DTHT_NONE)
955  new = infoPtr->nrFields - 1;
956  else
957  {
958  /* hitting string part moves selection to next date field to left */
959  if (infoPtr->fieldspec[new] & DT_STRING)
960  {
961  new = DATETIME_GetPrevDateField(infoPtr, new);
962  if (new == -1) return 0;
963  }
964  /* never select full day of week */
965  if (infoPtr->fieldspec[new] == FULLDAY) return 0;
966  }
967  }
968 
969  DATETIME_SetSelectedField(infoPtr, new);
970 
971  if (infoPtr->select == DTHT_MCPOPUP) {
972  RECT rcMonthCal;
973  POINT pos;
974  SendMessageW(infoPtr->hMonthCal, MCM_GETMINREQRECT, 0, (LPARAM)&rcMonthCal);
975 
976  /* FIXME: button actually is only depressed during dropdown of the */
977  /* calendar control and when the mouse is over the button window */
978  infoPtr->bCalDepressed = TRUE;
979 
980  /* recalculate the position of the monthcal popup */
981  if(infoPtr->dwStyle & DTS_RIGHTALIGN)
982  pos.x = infoPtr->calbutton.left - (rcMonthCal.right - rcMonthCal.left);
983  else
984  /* FIXME: this should be after the area reserved for the checkbox */
985  pos.x = infoPtr->rcDraw.left;
986 
987  pos.y = infoPtr->rcClient.bottom;
988  OffsetRect( &rcMonthCal, pos.x, pos.y );
989  MapWindowPoints( infoPtr->hwndSelf, 0, (POINT *)&rcMonthCal, 2 );
990  SetWindowPos(infoPtr->hMonthCal, 0, rcMonthCal.left, rcMonthCal.top,
991  rcMonthCal.right - rcMonthCal.left, rcMonthCal.bottom - rcMonthCal.top, 0);
992 
993  if(IsWindowVisible(infoPtr->hMonthCal)) {
994  ShowWindow(infoPtr->hMonthCal, SW_HIDE);
995  infoPtr->bDropdownEnabled = FALSE;
997  } else {
998  const SYSTEMTIME *lprgSysTimeArray = &infoPtr->date;
999  TRACE("update calendar %04d/%02d/%02d\n",
1000  lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay);
1001  SendMessageW(infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
1002 
1003  if (infoPtr->bDropdownEnabled) {
1004  ShowWindow(infoPtr->hMonthCal, SW_SHOW);
1006  }
1007  infoPtr->bDropdownEnabled = TRUE;
1008  }
1009 
1010  TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p\n",
1011  infoPtr->hwndSelf, infoPtr->hMonthCal, infoPtr->hwndNotify, GetDesktopWindow ());
1012  }
1013 
1014  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1015 
1016  return 0;
1017 }
int * fieldspec
Definition: datetime.c:74
#define TRUE
Definition: types.h:120
#define DTN_DROPDOWN
Definition: commctrl.h:4449
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
WORD wMonth
Definition: winbase.h:878
#define MCM_GETMINREQRECT
Definition: commctrl.h:4196
#define pt(x, y)
Definition: drawing.c:79
#define SW_HIDE
Definition: winuser.h:762
RECT calbutton
Definition: datetime.c:64
#define DTHT_NONE
Definition: datetime.c:122
#define DT_STRING
Definition: datetime.c:118
#define FULLDAY
Definition: datetime.c:97
LONG top
Definition: windef.h:307
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND hwndNotify
Definition: datetime.c:55
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:308
BOOL bCalDepressed
Definition: datetime.c:65
HWND hMonthCal
Definition: datetime.c:54
RECT rcClient
Definition: datetime.c:61
WORD wYear
Definition: winbase.h:877
#define DTHT_NODATEMASK
Definition: datetime.c:126
static int DATETIME_GetPrevDateField(const DATETIME_INFO *infoPtr, int i)
Definition: datetime.c:823
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
#define MCM_SETCURSEL
Definition: commctrl.h:4182
static BOOL DATETIME_SendSimpleNotify(const DATETIME_INFO *infoPtr, UINT code)
Definition: datetime.c:1353
static void DATETIME_SetSelectedField(DATETIME_INFO *infoPtr, int select)
Definition: datetime.c:932
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define DTS_RIGHTALIGN
Definition: commctrl.h:4360
RECT rcDraw
Definition: datetime.c:62
#define DTHT_MCPOPUP
Definition: datetime.c:124
WORD wDay
Definition: winbase.h:880
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
int nrFields
Definition: datetime.c:72
static INT DATETIME_HitTest(const DATETIME_INFO *infoPtr, POINT pt)
Definition: datetime.c:805
#define DTN_CLOSEUP
Definition: commctrl.h:4450
BOOL bDropdownEnabled
Definition: datetime.c:66
BOOL WINAPI IsWindowVisible(_In_ HWND)
SYSTEMTIME date
Definition: datetime.c:58
LONG bottom
Definition: windef.h:309
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_WindowProc().

◆ DATETIME_LButtonUp()

static LRESULT DATETIME_LButtonUp ( DATETIME_INFO infoPtr)
static

Definition at line 1021 of file datetime.c.

1022 {
1023  if(infoPtr->bCalDepressed) {
1024  infoPtr->bCalDepressed = FALSE;
1025  InvalidateRect(infoPtr->hwndSelf, &(infoPtr->calbutton), TRUE);
1026  }
1027 
1028  return 0;
1029 }
#define TRUE
Definition: types.h:120
RECT calbutton
Definition: datetime.c:64
BOOL bCalDepressed
Definition: datetime.c:65
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hwndSelf
Definition: datetime.c:53

Referenced by DATETIME_WindowProc().

◆ DATETIME_NCCreate()

static LRESULT DATETIME_NCCreate ( HWND  hwnd,
const CREATESTRUCTW lpcs 
)
static

Definition at line 1295 of file datetime.c.

1296 {
1297  DWORD dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
1298  /* force control to have client edge */
1299  dwExStyle |= WS_EX_CLIENTEDGE;
1300  SetWindowLongW(hwnd, GWL_EXSTYLE, dwExStyle);
1301 
1302  return DefWindowProcW(hwnd, WM_NCCREATE, 0, (LPARAM)lpcs);
1303 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define GWL_EXSTYLE
Definition: winuser.h:845
#define WM_NCCREATE
Definition: winuser.h:1665
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
LONG_PTR LPARAM
Definition: windef.h:208
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384

Referenced by DATETIME_WindowProc().

◆ DATETIME_Notify()

static LRESULT DATETIME_Notify ( DATETIME_INFO infoPtr,
const NMHDR lpnmh 
)
static

Definition at line 1117 of file datetime.c.

1118 {
1119  TRACE ("Got notification %x from %p\n", lpnmh->code, lpnmh->hwndFrom);
1120  TRACE ("info: %p %p %p\n", infoPtr->hwndSelf, infoPtr->hMonthCal, infoPtr->hUpdown);
1121 
1122  if (lpnmh->code == MCN_SELECT) {
1123  ShowWindow(infoPtr->hMonthCal, SW_HIDE);
1124  infoPtr->dateValid = TRUE;
1125  SendMessageW (infoPtr->hMonthCal, MCM_GETCURSEL, 0, (LPARAM)&infoPtr->date);
1126  TRACE("got from calendar %04d/%02d/%02d day of week %d\n",
1127  infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay, infoPtr->date.wDayOfWeek);
1129  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1132  }
1133  if ((lpnmh->hwndFrom == infoPtr->hUpdown) && (lpnmh->code == UDN_DELTAPOS)) {
1134  const NM_UPDOWN *lpnmud = (const NM_UPDOWN*)lpnmh;
1135  TRACE("Delta pos %d\n", lpnmud->iDelta);
1136  infoPtr->pendingUpdown = lpnmud->iDelta;
1137  }
1138  return 0;
1139 }
BOOL dateValid
Definition: datetime.c:59
#define MCN_SELECT
Definition: commctrl.h:4301
#define TRUE
Definition: types.h:120
WORD wMonth
Definition: winbase.h:878
#define SW_HIDE
Definition: winuser.h:762
WORD wDayOfWeek
Definition: winbase.h:879
static BOOL DATETIME_SendDateTimeChangeNotify(const DATETIME_INFO *infoPtr)
Definition: datetime.c:1336
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HWND hMonthCal
Definition: datetime.c:54
UINT code
Definition: winuser.h:3134
WORD wYear
Definition: winbase.h:877
#define MCM_GETCURSEL
Definition: commctrl.h:4180
HWND hwndCheckbut
Definition: datetime.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL DATETIME_SendSimpleNotify(const DATETIME_INFO *infoPtr, UINT code)
Definition: datetime.c:1353
#define BM_SETCHECK
Definition: winuser.h:1903
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hUpdown
Definition: datetime.c:56
#define UDN_DELTAPOS
Definition: commctrl.h:2165
#define NM_UPDOWN
Definition: commctrl.h:2156
HWND hwndFrom
Definition: winuser.h:3132
int pendingUpdown
Definition: datetime.c:79
WORD wDay
Definition: winbase.h:880
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
#define DTN_CLOSEUP
Definition: commctrl.h:4450
SYSTEMTIME date
Definition: datetime.c:58

Referenced by DATETIME_WindowProc().

◆ DATETIME_Paint()

static LRESULT DATETIME_Paint ( DATETIME_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 1033 of file datetime.c.

1034 {
1035  if (!hdc) {
1036  PAINTSTRUCT ps;
1037  hdc = BeginPaint (infoPtr->hwndSelf, &ps);
1038  DATETIME_Refresh (infoPtr, hdc);
1039  EndPaint (infoPtr->hwndSelf, &ps);
1040  } else {
1041  DATETIME_Refresh (infoPtr, hdc);
1042  }
1043 
1044  /* Not a click on the dropdown box, enabled it */
1045  infoPtr->bDropdownEnabled = TRUE;
1046 
1047  return 0;
1048 }
#define TRUE
Definition: types.h:120
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
HDC hdc
Definition: main.c:9
HWND hwndSelf
Definition: datetime.c:53
BOOL bDropdownEnabled
Definition: datetime.c:66
static void DATETIME_Refresh(DATETIME_INFO *infoPtr, HDC hdc)
Definition: datetime.c:729

Referenced by DATETIME_WindowProc().

◆ DATETIME_Refresh()

static void DATETIME_Refresh ( DATETIME_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 729 of file datetime.c.

730 {
731  TRACE("\n");
732 
733  if (infoPtr->dateValid) {
734  int i, prevright;
735  RECT *field;
736  RECT *rcDraw = &infoPtr->rcDraw;
737  SIZE size;
738  COLORREF oldTextColor;
739  SHORT fieldWidth = 0;
740  HFONT oldFont = SelectObject (hdc, infoPtr->hFont);
741  INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
742  WCHAR txt[80];
743 
744  DATETIME_ReturnTxt (infoPtr, 0, txt, ARRAY_SIZE(txt));
745  GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
746  rcDraw->bottom = size.cy + 2;
747 
748  prevright = infoPtr->checkbox.right = ((infoPtr->dwStyle & DTS_SHOWNONE) ? 18 : 2);
749 
750  for (i = 0; i < infoPtr->nrFields; i++) {
751  DATETIME_ReturnTxt (infoPtr, i, txt, ARRAY_SIZE(txt));
752  GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
753  DATETIME_ReturnFieldWidth (infoPtr, hdc, i, &fieldWidth);
754  field = &infoPtr->fieldRect[i];
755  field->left = prevright;
756  field->right = prevright + fieldWidth;
757  field->top = rcDraw->top;
758  field->bottom = rcDraw->bottom;
759  prevright = field->right;
760 
761  if (infoPtr->dwStyle & WS_DISABLED)
762  oldTextColor = SetTextColor (hdc, comctl32_color.clrGrayText);
763  else if ((infoPtr->haveFocus) && (i == infoPtr->select)) {
764  RECT selection;
765 
766  /* fill if focused */
768 
769  if (infoPtr->nCharsEntered)
770  {
771  memcpy(txt, infoPtr->charsEntered, infoPtr->nCharsEntered * sizeof(WCHAR));
772  txt[infoPtr->nCharsEntered] = 0;
773  GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
774  }
775 
776  SetRect(&selection, 0, 0, size.cx, size.cy);
777  /* center rectangle */
778  OffsetRect(&selection, (field->right + field->left - size.cx)/2,
779  (field->bottom - size.cy)/2);
780 
781  FillRect(hdc, &selection, hbr);
782  DeleteObject (hbr);
783  oldTextColor = SetTextColor (hdc, comctl32_color.clrWindow);
784  }
785  else
786  oldTextColor = SetTextColor (hdc, comctl32_color.clrWindowText);
787 
788  /* draw the date text using the colour set above */
790  SetTextColor (hdc, oldTextColor);
791  }
792  SetBkMode (hdc, oldBkMode);
793  SelectObject (hdc, oldFont);
794  }
795 
796  if (!(infoPtr->dwStyle & DTS_UPDOWN)) {
798  DFCS_SCROLLDOWN | (infoPtr->bCalDepressed ? DFCS_PUSHED : 0) |
799  (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
800  }
801 }
#define WS_DISABLED
Definition: pedump.c:621
BOOL dateValid
Definition: datetime.c:59
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
RECT calbutton
Definition: datetime.c:64
#define DFCS_INACTIVE
Definition: winuser.h:502
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
LONG right
Definition: windef.h:308
HFONT hFont
Definition: datetime.c:70
BOOL bCalDepressed
Definition: datetime.c:65
int32_t INT
Definition: typedefs.h:57
int selection
Definition: ctm.c:92
COLORREF clrWindowText
Definition: comctl32.h:170
#define DFCS_PUSHED
Definition: winuser.h:503
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
COLORREF clrActiveCaption
Definition: comctl32.h:172
short SHORT
Definition: pedump.c:59
static void DATETIME_ReturnTxt(const DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
Definition: datetime.c:361
#define TRANSPARENT
Definition: wingdi.h:949
#define DT_VCENTER
Definition: winuser.h:543
#define DFCS_SCROLLDOWN
Definition: winuser.h:490
int haveFocus
Definition: datetime.c:73
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: parser.c:43
DWORD COLORREF
Definition: windef.h:300
int nCharsEntered
Definition: datetime.c:69
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
WCHAR charsEntered[4]
Definition: datetime.c:68
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
RECT rcDraw
Definition: datetime.c:62
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
RECT checkbox
Definition: datetime.c:63
#define DT_SINGLELINE
Definition: winuser.h:540
COLORREF clrGrayText
Definition: comctl32.h:171
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DTS_SHOWNONE
Definition: commctrl.h:4354
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define DFC_SCROLL
Definition: winuser.h:475
int nrFields
Definition: datetime.c:72
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:309
#define DT_CENTER
Definition: winuser.h:527
RECT * fieldRect
Definition: datetime.c:75
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
COLORREF clrWindow
Definition: comctl32.h:169
#define DTS_UPDOWN
Definition: commctrl.h:4353
static void DATETIME_ReturnFieldWidth(const DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *width)
Definition: datetime.c:600
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_Paint().

◆ DATETIME_Register()

void DATETIME_Register ( void  )

Definition at line 1666 of file datetime.c.

1667 {
1668  WNDCLASSW wndClass;
1669 
1670  ZeroMemory (&wndClass, sizeof(WNDCLASSW));
1671  wndClass.style = CS_GLOBALCLASS;
1672  wndClass.lpfnWndProc = DATETIME_WindowProc;
1673  wndClass.cbClsExtra = 0;
1674  wndClass.cbWndExtra = sizeof(DATETIME_INFO *);
1675  wndClass.hCursor = LoadCursorW (0, (LPCWSTR)IDC_ARROW);
1676  wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
1678 
1679  RegisterClassW (&wndClass);
1680 }
UINT style
Definition: winuser.h:3151
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ZeroMemory
Definition: winbase.h:1642
int cbClsExtra
Definition: winuser.h:3153
#define COLOR_WINDOW
Definition: winuser.h:908
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
WNDPROC lpfnWndProc
Definition: winuser.h:3152
LPCWSTR lpszClassName
Definition: winuser.h:3160
int cbWndExtra
Definition: winuser.h:3154
#define CS_GLOBALCLASS
Definition: winuser.h:647
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
static LRESULT WINAPI DATETIME_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: datetime.c:1542
HCURSOR hCursor
Definition: winuser.h:3157
#define DATETIMEPICK_CLASSW
Definition: commctrl.h:4318
HBRUSH hbrBackground
Definition: winuser.h:3158
#define IDC_ARROW
Definition: winuser.h:682

Referenced by DllMain().

◆ DATETIME_ReturnFieldWidth()

static void DATETIME_ReturnFieldWidth ( const DATETIME_INFO infoPtr,
HDC  hdc,
int  count,
SHORT width 
)
static

Definition at line 600 of file datetime.c.

601 {
602  /* fields are a fixed width, determined by the largest possible string */
603  /* presumably, these widths should be language dependent */
604  static const WCHAR fld_d1W[] = { '2', 0 };
605  static const WCHAR fld_d2W[] = { '2', '2', 0 };
606  static const WCHAR fld_d4W[] = { '2', '2', '2', '2', 0 };
607  static const WCHAR fld_am1[] = { 'A', 0 };
608  static const WCHAR fld_am2[] = { 'A', 'M', 0 };
609  int spec;
610  WCHAR buffer[80];
611  LPCWSTR bufptr;
612  SIZE size;
613 
614  TRACE ("%d,%d\n", infoPtr->nrFields, count);
615  if (count>infoPtr->nrFields || count < 0) {
616  WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count);
617  return;
618  }
619 
620  if (!infoPtr->fieldspec) return;
621 
622  spec = infoPtr->fieldspec[count];
623  if (spec & DT_STRING) {
624  int txtlen = infoPtr->buflen[count];
625 
626  if (txtlen > 79)
627  txtlen = 79;
628  memcpy (buffer, infoPtr->textbuf + (spec &~ DT_STRING), txtlen * sizeof(WCHAR));
629  buffer[txtlen] = 0;
630  bufptr = buffer;
631  }
632  else {
633  switch (spec) {
634  case ONEDIGITDAY:
635  case ONEDIGIT12HOUR:
636  case ONEDIGIT24HOUR:
637  case ONEDIGITSECOND:
638  case ONEDIGITMINUTE:
639  case ONEDIGITMONTH:
640  case ONEDIGITYEAR:
641  /* these seem to use a two byte field */
642  case TWODIGITDAY:
643  case TWODIGIT12HOUR:
644  case TWODIGIT24HOUR:
645  case TWODIGITSECOND:
646  case TWODIGITMINUTE:
647  case TWODIGITMONTH:
648  case TWODIGITYEAR:
649  bufptr = fld_d2W;
650  break;
651  case INVALIDFULLYEAR:
652  case FULLYEAR:
653  bufptr = fld_d4W;
654  break;
655  case THREECHARMONTH:
656  case FULLMONTH:
657  case THREECHARDAY:
658  case FULLDAY:
659  {
660  static const WCHAR fld_day[] = {'W','e','d','n','e','s','d','a','y',0};
661  static const WCHAR fld_abbrday[] = {'W','e','d',0};
662  static const WCHAR fld_mon[] = {'S','e','p','t','e','m','b','e','r',0};
663  static const WCHAR fld_abbrmon[] = {'D','e','c',0};
664 
665  const WCHAR *fall;
666  LCTYPE lctype;
667  INT i, max_count;
668  LONG cx;
669 
670  /* choose locale data type and fallback string */
671  switch (spec) {
672  case THREECHARDAY:
673  fall = fld_abbrday;
674  lctype = LOCALE_SABBREVDAYNAME1;
675  max_count = 7;
676  break;
677  case FULLDAY:
678  fall = fld_day;
679  lctype = LOCALE_SDAYNAME1;
680  max_count = 7;
681  break;
682  case THREECHARMONTH:
683  fall = fld_abbrmon;
684  lctype = LOCALE_SABBREVMONTHNAME1;
685  max_count = 12;
686  break;
687  default: /* FULLMONTH */
688  fall = fld_mon;
689  lctype = LOCALE_SMONTHNAME1;
690  max_count = 12;
691  break;
692  }
693 
694  cx = 0;
695  for (i = 0; i < max_count; i++)
696  {
697  if(GetLocaleInfoW(LOCALE_USER_DEFAULT, lctype + i,
699  {
701  if (size.cx > cx) cx = size.cx;
702  }
703  else /* locale independent fallback on failure */
704  {
705  GetTextExtentPoint32W(hdc, fall, lstrlenW(fall), &size);
706  cx = size.cx;
707  break;
708  }
709  }
710  *width = cx;
711  return;
712  }
713  case ONELETTERAMPM:
714  bufptr = fld_am1;
715  break;
716  case TWOLETTERAMPM:
717  bufptr = fld_am2;
718  break;
719  default:
720  bufptr = fld_d1W;
721  break;
722  }
723  }
725  *width = size.cx;
726 }
GLint GLint GLsizei width
Definition: gl.h:1546
int * fieldspec
Definition: datetime.c:74
#define FULLMONTH
Definition: datetime.c:107
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define LOCALE_SABBREVMONTHNAME1
Definition: winnls.h:104
static unsigned int bufptr
Definition: tncon.cpp:77
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TWODIGITYEAR
Definition: datetime.c:113
#define TWODIGITMONTH
Definition: datetime.c:105
#define TWODIGITDAY
Definition: datetime.c:95
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:84
#define LOCALE_USER_DEFAULT
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define THREECHARDAY
Definition: datetime.c:96
#define DT_STRING
Definition: datetime.c:118
#define FULLDAY
Definition: datetime.c:97
#define TWOLETTERAMPM
Definition: datetime.c:111
GLuint buffer
Definition: glext.h:5915
#define lstrlenW
Definition: compat.h:415
int32_t INT
Definition: typedefs.h:57
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define LOCALE_SDAYNAME1
Definition: winnls.h:77
#define ONEDIGITMONTH
Definition: datetime.c:104
DWORD LCTYPE
Definition: winnls.h:514
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LOCALE_SMONTHNAME1
Definition: winnls.h:91
#define FULLYEAR
Definition: datetime.c:115
#define ONEDIGIT24HOUR
Definition: datetime.c:100
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TWODIGIT24HOUR
Definition: datetime.c:101
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TWODIGIT12HOUR
Definition: datetime.c:99
int * buflen
Definition: datetime.c:76
#define ONEDIGIT12HOUR
Definition: datetime.c:98
#define TWODIGITMINUTE
Definition: datetime.c:103
#define ONEDIGITSECOND
Definition: datetime.c:108
#define ONELETTERAMPM
Definition: datetime.c:110
int nrFields
Definition: datetime.c:72
_Out_opt_ int * cx
Definition: commctrl.h:581
#define INVALIDFULLYEAR
Definition: datetime.c:114
#define ONEDIGITYEAR
Definition: datetime.c:112
#define TWODIGITSECOND
Definition: datetime.c:109
#define THREECHARMONTH
Definition: datetime.c:106
#define ONEDIGITMINUTE
Definition: datetime.c:102
WCHAR textbuf[256]
Definition: datetime.c:77
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define ONEDIGITDAY
Definition: datetime.c:94

Referenced by DATETIME_Refresh().

◆ DATETIME_ReturnTxt()

static void DATETIME_ReturnTxt ( const DATETIME_INFO infoPtr,
int  count,
LPWSTR  result,
int  resultSize 
)
static

Definition at line 361 of file datetime.c.

362 {
363  static const WCHAR fmt_dW[] = { '%', 'd', 0 };
364  static const WCHAR fmt__2dW[] = { '%', '.', '2', 'd', 0 };
365  static const WCHAR fmt__3sW[] = { '%', '.', '3', 's', 0 };
366  SYSTEMTIME date = infoPtr->date;
367  int spec;
368  WCHAR buffer[80];
369 
370  *result=0;
371  TRACE ("%d,%d\n", infoPtr->nrFields, count);
372  if (count>infoPtr->nrFields || count < 0) {
373  WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count);
374  return;
375  }
376 
377  if (!infoPtr->fieldspec) return;
378 
379  spec = infoPtr->fieldspec[count];
380  if (spec & DT_STRING) {
381  int txtlen = infoPtr->buflen[count];
382 
383  if (txtlen > resultSize)
384  txtlen = resultSize - 1;
385  memcpy (result, infoPtr->textbuf + (spec &~ DT_STRING), txtlen * sizeof(WCHAR));
386  result[txtlen] = 0;
387  TRACE ("arg%d=%x->[%s]\n", count, infoPtr->fieldspec[count], debugstr_w(result));
388  return;
389  }
390 
391 
392  switch (spec) {
393  case DT_END_FORMAT:
394  *result = 0;
395  break;
396  case ONEDIGITDAY:
397  wsprintfW (result, fmt_dW, date.wDay);
398  break;
399  case TWODIGITDAY:
400  wsprintfW (result, fmt__2dW, date.wDay);
401  break;
402  case THREECHARDAY:
404  /*wsprintfW (result,"%.3s",days[date.wDayOfWeek]);*/
405  break;
406  case FULLDAY:
407  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDAYNAME1+(date.wDayOfWeek+6)%7, result, resultSize);
408  break;
409  case ONEDIGIT12HOUR:
410  if (date.wHour == 0) {
411  result[0] = '1';
412  result[1] = '2';
413  result[2] = 0;
414  }
415  else
416  wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0));
417  break;
418  case TWODIGIT12HOUR:
419  if (date.wHour == 0) {
420  result[0] = '1';
421  result[1] = '2';
422  result[2] = 0;
423  }
424  else
425  wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0));
426  break;
427  case ONEDIGIT24HOUR:
428  wsprintfW (result, fmt_dW, date.wHour);
429  break;
430  case TWODIGIT24HOUR:
431  wsprintfW (result, fmt__2dW, date.wHour);
432  break;
433  case ONEDIGITSECOND:
434  wsprintfW (result, fmt_dW, date.wSecond);
435  break;
436  case TWODIGITSECOND:
437  wsprintfW (result, fmt__2dW, date.wSecond);
438  break;
439  case ONEDIGITMINUTE:
440  wsprintfW (result, fmt_dW, date.wMinute);
441  break;
442  case TWODIGITMINUTE:
443  wsprintfW (result, fmt__2dW, date.wMinute);
444  break;
445  case ONEDIGITMONTH:
446  wsprintfW (result, fmt_dW, date.wMonth);
447  break;
448  case TWODIGITMONTH:
449  wsprintfW (result, fmt__2dW, date.wMonth);
450  break;
451  case THREECHARMONTH:
453  wsprintfW (result, fmt__3sW, buffer);
454  break;
455  case FULLMONTH:
457  result, resultSize);
458  break;
459  case ONELETTERAMPM:
460  result[0] = (date.wHour < 12 ? 'A' : 'P');
461  result[1] = 0;
462  break;
463  case TWOLETTERAMPM:
464  result[0] = (date.wHour < 12 ? 'A' : 'P');
465  result[1] = 'M';
466  result[2] = 0;
467  break;
468  case FORMATCALLBACK:
469  FIXME ("Not implemented\n");
470  result[0] = 'x';
471  result[1] = 0;
472  break;
473  case ONEDIGITYEAR:
474  wsprintfW (result, fmt_dW, date.wYear-10* (int) floor(date.wYear/10));
475  break;
476  case TWODIGITYEAR:
477  wsprintfW (result, fmt__2dW, date.wYear-100* (int) floor(date.wYear/100));
478  break;
479  case INVALIDFULLYEAR:
480  case FULLYEAR:
481  wsprintfW (result, fmt_dW, date.wYear);
482  break;
483  }
484 
485  TRACE ("arg%d=%x->[%s]\n", count, infoPtr->fieldspec[count], debugstr_w(result));
486 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
int * fieldspec
Definition: datetime.c:74
#define FULLMONTH
Definition: datetime.c:107
#define TWODIGITYEAR
Definition: datetime.c:113
#define TWODIGITMONTH
Definition: datetime.c:105
#define TWODIGITDAY
Definition: datetime.c:95
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:84
#define LOCALE_USER_DEFAULT
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define THREECHARDAY
Definition: datetime.c:96
#define DT_STRING
Definition: datetime.c:118
#define FULLDAY
Definition: datetime.c:97
#define TWOLETTERAMPM
Definition: datetime.c:111
GLuint buffer
Definition: glext.h:5915
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define LOCALE_SDAYNAME1
Definition: winnls.h:77
#define ONEDIGITMONTH
Definition: datetime.c:104
#define LOCALE_SMONTHNAME1
Definition: winnls.h:91
#define FULLYEAR
Definition: datetime.c:115
#define ONEDIGIT24HOUR
Definition: datetime.c:100
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TWODIGIT24HOUR
Definition: datetime.c:101
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TWODIGIT12HOUR
Definition: datetime.c:99
int * buflen
Definition: datetime.c:76
#define ONEDIGIT12HOUR
Definition: datetime.c:98
#define TWODIGITMINUTE
Definition: datetime.c:103
#define ONEDIGITSECOND
Definition: datetime.c:108
#define ONELETTERAMPM
Definition: datetime.c:110
#define ARRAY_SIZE(a)
Definition: main.h:24
__u16 date
Definition: mkdosfs.c:366
#define FORMATCALLBACK
Definition: datetime.c:116
int nrFields
Definition: datetime.c:72
#define INVALIDFULLYEAR
Definition: datetime.c:114
#define ONEDIGITYEAR
Definition: datetime.c:112
SYSTEMTIME date
Definition: datetime.c:58
#define TWODIGITSECOND
Definition: datetime.c:109
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
#define THREECHARMONTH
Definition: datetime.c:106
GLuint64EXT * result
Definition: glext.h:11304
#define ONEDIGITMINUTE
Definition: datetime.c:102
WCHAR textbuf[256]
Definition: datetime.c:77
#define DT_END_FORMAT
Definition: datetime.c:93
#define ONEDIGITDAY
Definition: datetime.c:94

Referenced by DATETIME_GetText(), and DATETIME_Refresh().

◆ DATETIME_SendDateTimeChangeNotify()

static BOOL DATETIME_SendDateTimeChangeNotify ( const DATETIME_INFO infoPtr)
static

Definition at line 1336 of file datetime.c.

1337 {
1338  NMDATETIMECHANGE dtdtc;
1339 
1340  dtdtc.nmhdr.hwndFrom = infoPtr->hwndSelf;
1341  dtdtc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
1342  dtdtc.nmhdr.code = DTN_DATETIMECHANGE;
1343 
1344  dtdtc.dwFlags = infoPtr->dateValid ? GDT_VALID : GDT_NONE;
1345 
1346  dtdtc.st = infoPtr->date;
1347  return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
1348  dtdtc.nmhdr.idFrom, (LPARAM)&dtdtc);
1349 }
BOOL dateValid
Definition: datetime.c:59
HWND hwndNotify
Definition: datetime.c:55
#define GetWindowLongPtrW
Definition: winuser.h:4804
UINT code
Definition: winuser.h:3134
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT_PTR idFrom
Definition: winuser.h:3133
LONG_PTR LPARAM
Definition: windef.h:208
#define GDT_NONE
Definition: commctrl.h:4457
HWND hwndFrom
Definition: winuser.h:3132
#define GDT_VALID
Definition: commctrl.h:4456
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SYSTEMTIME date
Definition: datetime.c:58
#define DTN_DATETIMECHANGE
Definition: commctrl.h:4362
#define GWLP_ID
Definition: winuser.h:854
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DATETIME_ApplySelectedField(), DATETIME_KeyDown(), DATETIME_Notify(), and DATETIME_VScroll().

◆ DATETIME_SendSimpleNotify()

static BOOL DATETIME_SendSimpleNotify ( const DATETIME_INFO infoPtr,
UINT  code 
)
static

Definition at line 1353 of file datetime.c.

1354 {
1355  NMHDR nmhdr;
1356 
1357  TRACE("%x\n", code);
1358  nmhdr.hwndFrom = infoPtr->hwndSelf;
1359  nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
1360  nmhdr.code = code;
1361 
1362  return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
1363  nmhdr.idFrom, (LPARAM)&nmhdr);
1364 }
HWND hwndNotify
Definition: datetime.c:55
#define GetWindowLongPtrW
Definition: winuser.h:4804
UINT code
Definition: winuser.h:3134
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT_PTR idFrom
Definition: winuser.h:3133
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
HWND hwndFrom
Definition: winuser.h:3132
int code
Definition: i386-dis.c:3591
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GWLP_ID
Definition: winuser.h:854
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DATETIME_KillFocus(), DATETIME_LButtonDown(), DATETIME_Notify(), and DATETIME_SetFocus().

◆ DATETIME_SetFocus()

static LRESULT DATETIME_SetFocus ( DATETIME_INFO infoPtr,
HWND  lostFocus 
)
static

Definition at line 1307 of file datetime.c.

1308 {
1309  TRACE("got focus from %p\n", lostFocus);
1310 
1311  /* if monthcal is open and it loses focus, close monthcal */
1312  if (infoPtr->hMonthCal && (lostFocus == infoPtr->hMonthCal) &&
1313  IsWindowVisible(infoPtr->hMonthCal))
1314  {
1315  ShowWindow(infoPtr->hMonthCal, SW_HIDE);
1317  /* note: this get triggered even if monthcal loses focus to a dropdown
1318  * box click, which occurs without an intermediate WM_PAINT call
1319  */
1320  infoPtr->bDropdownEnabled = FALSE;
1321  return 0;
1322  }
1323 
1324  if (infoPtr->haveFocus == 0) {
1326  infoPtr->haveFocus = DTHT_GOTFOCUS;
1327  }
1328 
1329  InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1330 
1331  return 0;
1332 }
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HWND hMonthCal
Definition: datetime.c:54
smooth NULL
Definition: ftsmooth.c:416
int haveFocus
Definition: datetime.c:73
static BOOL DATETIME_SendSimpleNotify(const DATETIME_INFO *infoPtr, UINT code)
Definition: datetime.c:1353
#define TRACE(s)
Definition: solgame.cpp:4
#define NM_SETFOCUS
Definition: commctrl.h:135
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hwndSelf
Definition: datetime.c:53
#define DTHT_GOTFOCUS
Definition: datetime.c:125
#define DTN_CLOSEUP
Definition: commctrl.h:4450
BOOL bDropdownEnabled
Definition: datetime.c:66
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by DATETIME_WindowProc().

◆ DATETIME_SetFont()

static LRESULT DATETIME_SetFont ( DATETIME_INFO infoPtr,
HFONT  font,
BOOL  repaint 
)
static

Definition at line 1457 of file datetime.c.

1458 {
1459  infoPtr->hFont = font;
1460  if (repaint) InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1461  return 0;
1462 }
#define TRUE
Definition: types.h:120
Definition: mk_font.cpp:20
HFONT hFont
Definition: datetime.c:70
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hwndSelf
Definition: datetime.c:53

Referenced by DATETIME_WindowProc().

◆ DATETIME_SetFormatA()

static BOOL DATETIME_SetFormatA ( DATETIME_INFO infoPtr,
LPCSTR  lpszFormat 
)
static

Definition at line 343 of file datetime.c.

344 {
345  if (lpszFormat) {
346  BOOL retval;
347  INT len = MultiByteToWideChar(CP_ACP, 0, lpszFormat, -1, NULL, 0);
348  LPWSTR wstr = Alloc(len * sizeof(WCHAR));
349  if (wstr) MultiByteToWideChar(CP_ACP, 0, lpszFormat, -1, wstr, len);
350  retval = DATETIME_SetFormatW (infoPtr, wstr);
351  Free (wstr);
352  return retval;
353  }
354  else
355  return DATETIME_SetFormatW (infoPtr, 0);
356 
357 }
static BOOL DATETIME_SetFormatW(DATETIME_INFO *infoPtr, LPCWSTR format)
Definition: datetime.c:318
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:57
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DATETIME_WindowProc().

◆ DATETIME_SetFormatW()

static BOOL DATETIME_SetFormatW ( DATETIME_INFO infoPtr,
LPCWSTR  format 
)
static

Definition at line 318 of file datetime.c.

319 {
320  WCHAR format_buf[80];
321 
322  if (!format) {
323  DWORD format_item;
324 
325  if (infoPtr->dwStyle & DTS_LONGDATEFORMAT)
326  format_item = LOCALE_SLONGDATE;
327  else if ((infoPtr->dwStyle & DTS_TIMEFORMAT) == DTS_TIMEFORMAT)
328  format_item = LOCALE_STIMEFORMAT;
329  else /* DTS_SHORTDATEFORMAT */
330  format_item = LOCALE_SSHORTDATE;
331  GetLocaleInfoW(LOCALE_USER_DEFAULT, format_item, format_buf, ARRAY_SIZE(format_buf));
332  format = format_buf;
333  }
334 
335  DATETIME_UseFormat (infoPtr, format);
336  InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
337 
338  return TRUE;
339 }
#define TRUE
Definition: types.h:120
#define LOCALE_USER_DEFAULT
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define DTS_LONGDATEFORMAT
Definition: commctrl.h:4356
#define LOCALE_SLONGDATE
Definition: winnls.h:61
smooth NULL
Definition: ftsmooth.c:416
static void DATETIME_UseFormat(DATETIME_INFO *infoPtr, LPCWSTR formattxt)
Definition: datetime.c:245
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define ARRAY_SIZE(a)
Definition: main.h:24
HWND hwndSelf
Definition: datetime.c:53
#define DTS_TIMEFORMAT
Definition: commctrl.h:4358
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_Create(), DATETIME_SetFormatA(), and DATETIME_WindowProc().

◆ DATETIME_SetSelectedField()

static void DATETIME_SetSelectedField ( DATETIME_INFO infoPtr,
int  select 
)
static

Definition at line 932 of file datetime.c.

933 {
935 
936  infoPtr->select = select;
937  infoPtr->nCharsEntered = 0;
938 }
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
Definition: select.c:41
static void DATETIME_ApplySelectedField(DATETIME_INFO *infoPtr)
Definition: datetime.c:833
int nCharsEntered
Definition: datetime.c:69

Referenced by DATETIME_KeyDown(), DATETIME_KillFocus(), and DATETIME_LButtonDown().

◆ DATETIME_SetSystemTime()

static BOOL DATETIME_SetSystemTime ( DATETIME_INFO infoPtr,
DWORD  flag,
const SYSTEMTIME systime 
)
static

Definition at line 190 of file datetime.c.

191 {
192  if (!systime) return FALSE;
193 
194  TRACE("%04d/%02d/%02d %02d:%02d:%02d\n",
195  systime->wYear, systime->wMonth, systime->wDay,
196  systime->wHour, systime->wMinute, systime->wSecond);
197 
198  if (flag == GDT_VALID) {
199  if (systime->wYear == 0 ||
200  systime->wMonth < 1 || systime->wMonth > 12 ||
201  systime->wDay < 1 ||
202  systime->wDay > MONTHCAL_MonthLength(systime->wMonth, systime->wYear) ||
203  systime->wHour > 23 ||
204  systime->wMinute > 59 ||
205  systime->wSecond > 59 ||
206  systime->wMilliseconds > 999
207  )
208  return FALSE;
209 
210  /* Windows returns true if the date is valid but outside the limits set */
211  if (!DATETIME_IsDateInValidRange(infoPtr, systime))
212  return TRUE;
213 
214  infoPtr->dateValid = TRUE;
215  infoPtr->date = *systime;
216  /* always store a valid day of week */
218 
219  SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
221  } else if ((infoPtr->dwStyle & DTS_SHOWNONE) && (flag == GDT_NONE)) {
222  infoPtr->dateValid = FALSE;
224  }
225  else
226  return FALSE;
227 
228  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
229  return TRUE;
230 }
BOOL dateValid
Definition: datetime.c:59
#define TRUE
Definition: types.h:120
WORD wMonth
Definition: winbase.h:878
HWND hMonthCal
Definition: datetime.c:54
int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace)
Definition: monthcal.c:470
WORD wYear
Definition: winbase.h:877
HWND hwndCheckbut
Definition: datetime.c:60
WORD wMinute
Definition: winbase.h:882
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define MCM_SETCURSEL
Definition: commctrl.h:4182
#define BM_SETCHECK
Definition: winuser.h:1903
#define TRACE(s)
Definition: solgame.cpp:4
int MONTHCAL_MonthLength(int month, int year)
Definition: monthcal.c:217
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
WORD wSecond
Definition: winbase.h:883
WORD wMilliseconds
Definition: winbase.h:884
static BOOL DATETIME_IsDateInValidRange(const DATETIME_INFO *infoPtr, const SYSTEMTIME *date)
Definition: datetime.c:163
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
#define GDT_NONE
Definition: commctrl.h:4457
#define BST_UNCHECKED
Definition: winuser.h:199
WORD wDay
Definition: winbase.h:880
#define GDT_VALID
Definition: commctrl.h:4456
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WORD wHour
Definition: winbase.h:881
#define DTS_SHOWNONE
Definition: commctrl.h:4354
#define BST_CHECKED
Definition: winuser.h:197
SYSTEMTIME date
Definition: datetime.c:58
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_ApplySelectedField(), and DATETIME_WindowProc().

◆ DATETIME_Size()

static LRESULT DATETIME_Size ( DATETIME_INFO infoPtr,
INT  width,
INT  height 
)
static

Definition at line 1367 of file datetime.c.

1368 {
1369  /* set size */
1370  infoPtr->rcClient.bottom = height;
1371  infoPtr->rcClient.right = width;
1372 
1373  TRACE("Height=%d, Width=%d\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right);
1374 
1375  infoPtr->rcDraw = infoPtr->rcClient;
1376 
1377  if (infoPtr->dwStyle & DTS_UPDOWN) {
1378  SetWindowPos(infoPtr->hUpdown, NULL,
1379  infoPtr->rcClient.right-14, 0,
1380  15, infoPtr->rcClient.bottom - infoPtr->rcClient.top,
1382  }
1383  else {
1384  /* set the size of the button that drops the calendar down */
1385  /* FIXME: account for style that allows button on left side */
1386  infoPtr->calbutton.top = infoPtr->rcDraw.top;
1387  infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom;
1388  infoPtr->calbutton.left = infoPtr->rcDraw.right-15;
1389  infoPtr->calbutton.right = infoPtr->rcDraw.right;
1390  }
1391 
1392  /* set enable/disable button size for show none style being enabled */
1393  /* FIXME: these dimensions are completely incorrect */
1394  infoPtr->checkbox.top = infoPtr->rcDraw.top;
1395  infoPtr->checkbox.bottom = infoPtr->rcDraw.bottom;
1396  infoPtr->checkbox.left = infoPtr->rcDraw.left;
1397  infoPtr->checkbox.right = infoPtr->rcDraw.left + 10;
1398 
1399  InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1400 
1401  return 0;
1402 }
GLint GLint GLsizei width
Definition: gl.h:1546
RECT calbutton
Definition: datetime.c:64
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
RECT rcClient
Definition: datetime.c:61
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define SWP_NOACTIVATE
Definition: winuser.h:1227
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hUpdown
Definition: datetime.c:56
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
RECT rcDraw
Definition: datetime.c:62
RECT checkbox
Definition: datetime.c:63
HWND hwndSelf
Definition: datetime.c:53
LONG bottom
Definition: windef.h:309
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define DTS_UPDOWN
Definition: commctrl.h:4353
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_WindowProc().

◆ DATETIME_StyleChanged()

static LRESULT DATETIME_StyleChanged ( DATETIME_INFO infoPtr,
WPARAM  wStyleType,
const STYLESTRUCT lpss 
)
static

Definition at line 1423 of file datetime.c.

1424 {
1425  TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
1426  wStyleType, lpss->styleOld, lpss->styleNew);
1427 
1428  if (wStyleType != GWL_STYLE) return 0;
1429 
1430  infoPtr->dwStyle = lpss->styleNew;
1431 
1432  if ( !(lpss->styleOld & DTS_SHOWNONE) && (lpss->styleNew & DTS_SHOWNONE) ) {
1434  2, 2, 13, 13, infoPtr->hwndSelf, 0,
1436  SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, infoPtr->dateValid ? 1 : 0, 0);
1437  }
1438  if ( (lpss->styleOld & DTS_SHOWNONE) && !(lpss->styleNew & DTS_SHOWNONE) ) {
1439  DestroyWindow(infoPtr->hwndCheckbut);
1440  infoPtr->hwndCheckbut = 0;
1441  }
1442  if ( !(lpss->styleOld & DTS_UPDOWN) && (lpss->styleNew & DTS_UPDOWN) ) {
1443  infoPtr->hUpdown = CreateUpDownControl (WS_CHILD | WS_BORDER | WS_VISIBLE, 120, 1, 20, 20,
1444  infoPtr->hwndSelf, 1, 0, 0, UD_MAXVAL, UD_MINVAL, 0);
1445  }
1446  if ( (lpss->styleOld & DTS_UPDOWN) && !(lpss->styleNew & DTS_UPDOWN) ) {
1447  DestroyWindow(infoPtr->hUpdown);
1448  infoPtr->hUpdown = 0;
1449  }
1450 
1451  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1452  return 0;
1453 }
BOOL dateValid
Definition: datetime.c:59
#define TRUE
Definition: types.h:120
#define UD_MINVAL
Definition: commctrl.h:2125
#define WS_CHILD
Definition: pedump.c:617
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND hwndCheckbut
Definition: datetime.c:60
HWND WINAPI CreateUpDownControl(DWORD style, INT x, INT y, INT cx, INT cy, HWND parent, INT id, HINSTANCE inst, HWND buddy, INT maxVal, INT minVal, INT curVal)
Definition: commctrl.c:829
smooth NULL
Definition: ftsmooth.c:416
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BM_SETCHECK
Definition: winuser.h:1903
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define UD_MAXVAL
Definition: commctrl.h:2124
HWND hUpdown
Definition: datetime.c:56
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define GWL_STYLE
Definition: winuser.h:846
#define WS_BORDER
Definition: pedump.c:625
#define WC_BUTTONW
Definition: commctrl.h:4619
HWND hwndSelf
Definition: datetime.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DTS_SHOWNONE
Definition: commctrl.h:4354
DWORD styleNew
Definition: winuser.h:3668
DWORD styleOld
Definition: winuser.h:3667
#define GWLP_HINSTANCE
Definition: winuser.h:850
#define WS_VISIBLE
Definition: pedump.c:620
#define DTS_UPDOWN
Definition: commctrl.h:4353
DWORD dwStyle
Definition: datetime.c:57

Referenced by DATETIME_Create(), and DATETIME_WindowProc().

◆ DATETIME_StyleChanging()

static LRESULT DATETIME_StyleChanging ( DATETIME_INFO infoPtr,
WPARAM  wStyleType,
STYLESTRUCT lpss 
)
static

Definition at line 1405 of file datetime.c.

1406 {
1407  TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
1408  wStyleType, lpss->styleOld, lpss->styleNew);
1409 
1410  /* block DTS_SHOWNONE change */
1411  if ((lpss->styleNew ^ lpss->styleOld) & DTS_SHOWNONE)
1412  {
1413  if (lpss->styleOld & DTS_SHOWNONE)
1414  lpss->styleNew |= DTS_SHOWNONE;
1415  else
1416  lpss->styleNew &= ~DTS_SHOWNONE;
1417  }
1418 
1419  return 0;
1420 }
#define TRACE(s)
Definition: solgame.cpp:4
#define DTS_SHOWNONE
Definition: commctrl.h:4354
DWORD styleNew
Definition: winuser.h:3668
DWORD styleOld
Definition: winuser.h:3667

Referenced by DATETIME_WindowProc().

◆ DATETIME_Unregister()

void DATETIME_Unregister ( void  )

Definition at line 1684 of file datetime.c.

1685 {
1687 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
smooth NULL
Definition: ftsmooth.c:416
#define DATETIMEPICK_CLASSW
Definition: commctrl.h:4318

Referenced by DllMain().

◆ DATETIME_UseFormat()

static void DATETIME_UseFormat ( DATETIME_INFO infoPtr,
LPCWSTR  formattxt 
)
static

Definition at line 245 of file datetime.c.

246 {
247  unsigned int i;
248  int j, k, len;
249  BOOL inside_literal = FALSE; /* inside '...' */
250  int *nrFields = &infoPtr->nrFields;
251 
252  *nrFields = 0;
253  infoPtr->fieldspec[*nrFields] = 0;
255  k = 0;
256 
257  for (i = 0; formattxt[i]; i++) {
258  TRACE ("\n%d %c:", i, formattxt[i]);
259  if (!inside_literal) {
260  for (j = 0; j < len; j++) {
261  if (allowedformatchars[j]==formattxt[i]) {
262  TRACE ("%c[%d,%x]", allowedformatchars[j], *nrFields, infoPtr->fieldspec[*nrFields]);
263  if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
264  infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
265  break;
266  }
267  if (infoPtr->fieldspec[*nrFields] >> 4 != j) {
268  (*nrFields)++;
269  infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
270  break;
271  }
272  if ((infoPtr->fieldspec[*nrFields] & 0x0f) == maxrepetition[j]) {
273  (*nrFields)++;
274  infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
275  break;
276  }
277  infoPtr->fieldspec[*nrFields]++;
278  break;
279  } /* if allowedformatchar */
280  } /* for j */
281  }
282  else
283  j = len;
284 
285  if (formattxt[i] == '\'')
286  {
287  inside_literal = !inside_literal;
288  continue;
289  }
290 
291  /* char is not a specifier: handle char like a string */
292  if (j == len) {
293  if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
294  infoPtr->fieldspec[*nrFields] = DT_STRING + k;
295  infoPtr->buflen[*nrFields] = 0;
296  } else if ((infoPtr->fieldspec[*nrFields] & DT_STRING) != DT_STRING) {
297  (*nrFields)++;
298  infoPtr->fieldspec[*nrFields] = DT_STRING + k;
299  infoPtr->buflen[*nrFields] = 0;
300  }
301  infoPtr->textbuf[k] = formattxt[i];
302  k++;
303  infoPtr->buflen[*nrFields]++;
304  } /* if j=len */
305 
306  if (*nrFields == infoPtr->nrFieldsAllocated) {
307  FIXME ("out of memory; should reallocate. crash ahead.\n");
308  }
309  } /* for i */
310 
311  TRACE("\n");
312 
313  if (infoPtr->fieldspec[*nrFields] != 0) (*nrFields)++;
314 }
int * fieldspec
Definition: datetime.c:74
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define DT_STRING
Definition: datetime.c:118
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
int nrFieldsAllocated
Definition: datetime.c:71
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR allowedformatchars[]
Definition: datetime.c:130
int * buflen
Definition: datetime.c:76
static const int maxrepetition[]
Definition: datetime.c:131
int nrFields
Definition: datetime.c:72
int k
Definition: mpi.c:3369
WCHAR textbuf[256]
Definition: datetime.c:77

Referenced by DATETIME_SetFormatW().

◆ DATETIME_VScroll()

static LRESULT DATETIME_VScroll ( DATETIME_INFO infoPtr,
WORD  wScroll 
)
static

Definition at line 1254 of file datetime.c.

1255 {
1256  int fieldNum = infoPtr->select & DTHT_DATEFIELD;
1257 
1258  if ((SHORT)LOWORD(wScroll) != SB_THUMBPOSITION) return 0;
1259  if (!(infoPtr->haveFocus)) return 0;
1260  if ((fieldNum==0) && (infoPtr->select)) return 0;
1261 
1262  if (infoPtr->pendingUpdown >= 0) {
1263  DATETIME_IncreaseField (infoPtr, fieldNum, 1);
1265  }
1266  else {
1267  DATETIME_IncreaseField (infoPtr, fieldNum, -1);
1269  }
1270 
1271  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1272 
1273  return 0;
1274 }
#define TRUE
Definition: types.h:120
#define DTHT_DATEFIELD
Definition: datetime.c:120
static BOOL DATETIME_SendDateTimeChangeNotify(const DATETIME_INFO *infoPtr)
Definition: datetime.c:1336
static void DATETIME_IncreaseField(DATETIME_INFO *infoPtr, int number, int delta)
Definition: datetime.c:497
short SHORT
Definition: pedump.c:59
smooth NULL
Definition: ftsmooth.c:416
#define SB_THUMBPOSITION
Definition: winuser.h:572
int haveFocus
Definition: datetime.c:73
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
int pendingUpdown
Definition: datetime.c:79
HWND hwndSelf
Definition: datetime.c:53
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DATETIME_WindowProc().

◆ DATETIME_WindowProc()

static LRESULT WINAPI DATETIME_WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1542 of file datetime.c.

1543 {
1544  DATETIME_INFO *infoPtr = ((DATETIME_INFO *)GetWindowLongPtrW (hwnd, 0));
1545 
1546  TRACE ("%x, %lx, %lx\n", uMsg, wParam, lParam);
1547 
1548  if (!infoPtr && (uMsg != WM_CREATE) && (uMsg != WM_NCCREATE))
1549  return DefWindowProcW( hwnd, uMsg, wParam, lParam );
1550 
1551  switch (uMsg) {
1552 
1553  case DTM_GETSYSTEMTIME:
1554  return DATETIME_GetSystemTime (infoPtr, (SYSTEMTIME *) lParam);
1555 
1556  case DTM_SETSYSTEMTIME:
1557  return DATETIME_SetSystemTime (infoPtr, wParam, (SYSTEMTIME *) lParam);
1558 
1559  case DTM_GETRANGE:
1560  return SendMessageW (infoPtr->hMonthCal, MCM_GETRANGE, wParam, lParam);
1561 
1562  case DTM_SETRANGE:
1563  return SendMessageW (infoPtr->hMonthCal, MCM_SETRANGE, wParam, lParam);
1564 
1565  case DTM_SETFORMATA:
1566  return DATETIME_SetFormatA (infoPtr, (LPCSTR)lParam);
1567 
1568  case DTM_SETFORMATW:
1569  return DATETIME_SetFormatW (infoPtr, (LPCWSTR)lParam);
1570 
1571  case DTM_GETMONTHCAL:
1572  return (LRESULT)infoPtr->hMonthCal;
1573 
1574  case DTM_SETMCCOLOR:
1575  return SendMessageW (infoPtr->hMonthCal, MCM_SETCOLOR, wParam, lParam);
1576 
1577  case DTM_GETMCCOLOR:
1578  return SendMessageW (infoPtr->hMonthCal, MCM_GETCOLOR, wParam, 0);
1579 
1580  case DTM_SETMCFONT:
1581  return SendMessageW (infoPtr->hMonthCal, WM_SETFONT, wParam, lParam);
1582 
1583  case DTM_GETMCFONT:
1584  return SendMessageW (infoPtr->hMonthCal, WM_GETFONT, wParam, lParam);
1585 
1586  case WM_NOTIFY:
1587  return DATETIME_Notify (infoPtr, (LPNMHDR)lParam);
1588 
1589  case WM_ENABLE:
1590  return DATETIME_Enable (infoPtr, (BOOL)wParam);
1591 
1592  case WM_ERASEBKGND:
1593  return DATETIME_EraseBackground (infoPtr, (HDC)wParam);
1594 
1595  case WM_GETDLGCODE:
1597 
1598  case WM_PRINTCLIENT:
1599  case WM_PAINT:
1600  return DATETIME_Paint (infoPtr, (HDC)wParam);
1601 
1602  case WM_KEYDOWN:
1603  return DATETIME_KeyDown (infoPtr, wParam);
1604 
1605  case WM_CHAR:
1606  return DATETIME_Char (infoPtr, wParam);
1607 
1608  case WM_KILLFOCUS:
1609  return DATETIME_KillFocus (infoPtr, (HWND)wParam);
1610 
1611  case WM_NCCREATE:
1613 
1614  case WM_SETFOCUS:
1615  return DATETIME_SetFocus (infoPtr, (HWND)wParam);
1616 
1617  case WM_SIZE:
1618  return DATETIME_Size (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
1619 
1620  case WM_LBUTTONDOWN:
1621  return DATETIME_LButtonDown (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
1622 
1623  case WM_LBUTTONUP:
1624  return DATETIME_LButtonUp (infoPtr);
1625 
1626  case WM_VSCROLL:
1627  return DATETIME_VScroll (infoPtr, (WORD)wParam);
1628 
1629  case WM_CREATE:
1631 
1632  case WM_DESTROY:
1633  return DATETIME_Destroy (infoPtr);
1634 
1635  case WM_COMMAND:
1636  return DATETIME_Command (infoPtr, wParam, lParam);
1637 
1638  case WM_STYLECHANGING:
1640 
1641  case WM_STYLECHANGED:
1642  return DATETIME_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
1643 
1644  case WM_SETFONT:
1645  return DATETIME_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam);
1646 
1647  case WM_GETFONT:
1648  return (LRESULT) infoPtr->hFont;
1649 
1650  case WM_GETTEXT:
1651  return (LRESULT) DATETIME_GetText(infoPtr, wParam, (LPWSTR)lParam);
1652 
1653  case WM_SETTEXT:
1654  return CB_ERR;
1655 
1656  default:
1657  if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
1658  ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
1659  uMsg, wParam, lParam);
1660  return DefWindowProcW (hwnd, uMsg, wParam, lParam);
1661  }
1662 }
#define DTM_GETRANGE
Definition: commctrl.h:4329
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DTM_SETRANGE
Definition: commctrl.h:4331
#define DLGC_WANTCHARS
Definition: winuser.h:2593
static LRESULT DATETIME_StyleChanging(DATETIME_INFO *infoPtr, WPARAM wStyleType, STYLESTRUCT *lpss)
Definition: datetime.c:1405
static BOOL DATETIME_SetFormatW(DATETIME_INFO *infoPtr, LPCWSTR format)
Definition: datetime.c:318
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_CHAR
Definition: winuser.h:1699
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define DTM_SETFORMATW
Definition: commctrl.h:4334
#define WM_GETTEXT
Definition: winuser.h:1600
static LRESULT DATETIME_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: datetime.c:1295
#define MCM_GETRANGE
Definition: commctrl.h:4258
static LRESULT DATETIME_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: datetime.c:1466
static LRESULT DATETIME_KeyDown(DATETIME_INFO *infoPtr, DWORD vkCode)
Definition: datetime.c:1143
static LRESULT DATETIME_LButtonUp(DATETIME_INFO *infoPtr)
Definition: datetime.c:1021
static HDC
Definition: imagelist.c:92
static INT DATETIME_GetText(const DATETIME_INFO *infoPtr, INT count, LPWSTR dst)
Definition: datetime.c:1522
static BOOL DATETIME_SetFormatA(DATETIME_INFO *infoPtr, LPCSTR lpszFormat)
Definition: datetime.c:343
#define GetWindowLongPtrW
Definition: winuser.h:4804
static LRESULT DATETIME_SetFont(DATETIME_INFO *infoPtr, HFONT font, BOOL repaint)
Definition: datetime.c:1457
HFONT hFont
Definition: datetime.c:70
#define MCM_SETRANGE
Definition: commctrl.h:4260
HWND hMonthCal
Definition: datetime.c:54
#define WM_NCCREATE
Definition: winuser.h:1665
WPARAM wParam
Definition: combotst.c:138
#define WM_ENABLE
Definition: winuser.h:1597
#define WM_PRINTCLIENT
Definition: richedit.h:70
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DTM_GETMCFONT
Definition: commctrl.h:4348
#define DTM_SETMCFONT
Definition: commctrl.h:4346
static LRESULT DATETIME_SetFocus(DATETIME_INFO *infoPtr, HWND lostFocus)
Definition: datetime.c:1307
unsigned int BOOL
Definition: ntddk_ex.h:94
short SHORT
Definition: pedump.c:59
static LRESULT DATETIME_Char(DATETIME_INFO *infoPtr, WPARAM vkCode)
Definition: datetime.c:1213
#define WM_GETFONT
Definition: winuser.h:1633
#define WM_KEYDOWN
Definition: winuser.h:1697
#define DTM_GETMCCOLOR
Definition: commctrl.h:4342
const char * LPCSTR
Definition: xmlstorage.h:183
#define WM_SETTEXT
Definition: winuser.h:1599
#define CB_ERR
Definition: winuser.h:2410
#define WM_DESTROY
Definition: winuser.h:1591
#define MCM_SETCOLOR
Definition: commctrl.h:4198
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_KILLFOCUS
Definition: winuser.h:1596
#define WM_SIZE
Definition: winuser.h:1593
static DWORD DATETIME_GetSystemTime(const DATETIME_INFO *infoPtr, SYSTEMTIME *systime)
Definition: datetime.c:138
static LRESULT DATETIME_Size(DATETIME_INFO *infoPtr, INT width, INT height)
Definition: datetime.c:1367
unsigned short WORD
Definition: ntddk_ex.h:93
static LRESULT DATETIME_Destroy(DATETIME_INFO *infoPtr)
Definition: datetime.c:1504
#define DTM_SETFORMATA
Definition: commctrl.h:4333
static BOOL DATETIME_SetSystemTime(DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *systime)
Definition: datetime.c:190
#define DTM_GETSYSTEMTIME
Definition: commctrl.h:4325
#define WM_PAINT
Definition: winuser.h:1602
static LRESULT DATETIME_Notify(DATETIME_INFO *infoPtr, const NMHDR *lpnmh)
Definition: datetime.c:1117
#define DTM_GETMONTHCAL
Definition: commctrl.h:4344
#define DTM_SETSYSTEMTIME
Definition: commctrl.h:4327
static LRESULT DATETIME_LButtonDown(DATETIME_INFO *infoPtr, INT x, INT y)
Definition: datetime.c:941
#define WM_APP
Definition: eventvwr.h:70
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_USER
Definition: winuser.h:1877
#define ERR(fmt,...)
Definition: debug.h:109
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_SETFONT
Definition: winuser.h:1632
static LRESULT DATETIME_VScroll(DATETIME_INFO *infoPtr, WORD wScroll)
Definition: datetime.c:1254
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static LRESULT DATETIME_KillFocus(DATETIME_INFO *infoPtr, HWND lostFocus)
Definition: datetime.c:1278
#define WM_CREATE
Definition: winuser.h:1590
static LRESULT DATETIME_Enable(DATETIME_INFO *infoPtr, BOOL bEnable)
Definition: datetime.c:1075
#define HIWORD(l)
Definition: typedefs.h:247
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
static LRESULT DATETIME_Paint(DATETIME_INFO *infoPtr, HDC hdc)
Definition: datetime.c:1033
#define MCM_GETCOLOR
Definition: commctrl.h:4200
static LRESULT DATETIME_StyleChanged(DATETIME_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: datetime.c:1423
#define DTM_SETMCCOLOR
Definition: commctrl.h:4340
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_SETFOCUS
Definition: winuser.h:1595
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
static LRESULT DATETIME_EraseBackground(const DATETIME_INFO *infoPtr, HDC hdc)
Definition: datetime.c:1090
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define DLGC_WANTARROWS
Definition: winuser.h:2585
static LRESULT DATETIME_Command(DATETIME_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: datetime.c:1065
#define WM_NOTIFY
Definition: richedit.h:61
#define WM_VSCROLL
Definition: winuser.h:1726

Referenced by DATETIME_Register().

◆ MONTHCAL_CalculateDayOfWeek()

int MONTHCAL_CalculateDayOfWeek ( SYSTEMTIME date,
BOOL  inplace 
)

Definition at line 470 of file monthcal.c.

471 {
472  SYSTEMTIME st = st_null;
473  FILETIME ft;
474 
475  MONTHCAL_CopyDate(date, &st);
476 
477  SystemTimeToFileTime(&st, &ft);
478  FileTimeToSystemTime(&ft, &st);
479 
480  if (inplace) date->wDayOfWeek = st.wDayOfWeek;
481 
482  return st.wDayOfWeek;
483 }
WORD wDayOfWeek
Definition: winbase.h:879
static void MONTHCAL_CopyDate(const SYSTEMTIME *from, SYSTEMTIME *to)
Definition: monthcal.c:282
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
__u16 date
Definition: mkdosfs.c:366
static const SYSTEMTIME st_null
Definition: monthcal.c:152

Referenced by DATETIME_IncreaseField(), DATETIME_SetSystemTime(), MONTHCAL_GetDayFromPos(), MONTHCAL_GetDayPos(), MONTHCAL_GetMaxDate(), MONTHCAL_GetMinDate(), MONTHCAL_GetMonth(), MONTHCAL_GetMonthRange(), MONTHCAL_HitTest(), MONTHCAL_PaintWeeknumbers(), MONTHCAL_SetCurSel(), and MONTHCAL_SetSelRange().

◆ MONTHCAL_MonthLength()

int MONTHCAL_MonthLength ( int  month,
int  year 
)

Definition at line 217 of file monthcal.c.

218 {
219  const int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
220  /* Wrap around, this eases handling. Getting length only we shouldn't care
221  about year change here cause January and December have
222  the same day quantity */
223  if(month == 0)
224  month = 12;
225  else if(month == 13)
226  month = 1;
227 
228  /* special case for calendar transition year */
229  if(month == min_allowed_date.wMonth && year == min_allowed_date.wYear) return 19;
230 
231  /* if we have a leap year add 1 day to February */
232  /* a leap year is a year either divisible by 400 */
233  /* or divisible by 4 and not by 100 */
234  if(month == 2) { /* February */
235  return mdays[month - 1] + ((year%400 == 0) ? 1 : ((year%100 != 0) &&
236  (year%4 == 0)) ? 1 : 0);
237  }
238  else {
239  return mdays[month - 1];
240  }
241 }
WORD wMonth
Definition: winbase.h:878
static const SYSTEMTIME min_allowed_date
Definition: monthcal.c:155
WORD wYear
Definition: winbase.h:877
int month[12]
Definition: systime.c:13

Referenced by DATETIME_ApplySelectedField(), DATETIME_IncreaseField(), DATETIME_SetSystemTime(), MONTHCAL_GetDayPos(), MONTHCAL_GetMaxDate(), MONTHCAL_GetMinDate(), MONTHCAL_GetMonth(), MONTHCAL_GetMonthRange(), MONTHCAL_HitTest(), MONTHCAL_PaintCalendar(), MONTHCAL_PaintLeadTrailMonths(), MONTHCAL_PaintWeeknumbers(), and MONTHCAL_ValidateDate().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( datetime  )

◆ wrap()

static int wrap ( int  val,
int  delta,
int  minVal,
int  maxVal 
)
static

Definition at line 488 of file datetime.c.

489 {
490  val += delta;
491  if (delta == INT_MIN || val < minVal) return maxVal;
492  if (delta == INT_MAX || val > maxVal) return minVal;
493  return val;
494 }
#define INT_MAX
Definition: limits.h:40
GLuint GLfloat * val
Definition: glext.h:7180
#define INT_MIN
Definition: limits.h:39

Referenced by DATETIME_IncreaseField(), and DATETIME_KeyDown().

Variable Documentation

◆ allowedformatchars

const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', 0}
static

Definition at line 130 of file datetime.c.

Referenced by DATETIME_UseFormat().

◆ max_allowed_date

const SYSTEMTIME max_allowed_date = { 9999, 12, 0, 31 }
static

Definition at line 134 of file datetime.c.

Referenced by DATETIME_IsDateInValidRange().

◆ maxrepetition

const int maxrepetition[] = {4,2,2,2,4,2,2,4,-1}
static

Definition at line 131 of file datetime.c.

Referenced by DATETIME_UseFormat().

◆ min_allowed_date

const SYSTEMTIME min_allowed_date = { 1752, 9, 0, 14 }
static

Definition at line 135 of file datetime.c.

Referenced by DATETIME_IsDateInValidRange().