1998-11-08 12:30:27 +01:00
|
|
|
/*
|
|
|
|
* Date and time picker control
|
|
|
|
*
|
1999-03-12 18:42:50 +01:00
|
|
|
* Copyright 1998, 1999 Eric Kohl
|
1998-11-08 12:30:27 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This is just a dummy control. An author is needed! Any volunteers?
|
|
|
|
* I will only improve this control once in a while.
|
|
|
|
* Eric <ekohl@abo.rhein-zeitung.de>
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - All messages.
|
|
|
|
* - All notifications.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1999-03-16 11:53:11 +01:00
|
|
|
#include "winbase.h"
|
1998-11-08 12:30:27 +01:00
|
|
|
#include "commctrl.h"
|
|
|
|
#include "datetime.h"
|
1999-06-12 17:45:58 +02:00
|
|
|
#include "debugtools.h"
|
1998-11-08 12:30:27 +01:00
|
|
|
|
1999-04-19 16:56:29 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(datetime)
|
|
|
|
|
1998-11-08 12:30:27 +01:00
|
|
|
|
1999-03-12 18:42:50 +01:00
|
|
|
#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0))
|
1998-11-08 12:30:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 18:42:50 +01:00
|
|
|
DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1998-11-08 12:30:27 +01:00
|
|
|
{
|
|
|
|
DATETIME_INFO *infoPtr;
|
|
|
|
|
|
|
|
/* allocate memory for info structure */
|
|
|
|
infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO));
|
|
|
|
if (infoPtr == NULL) {
|
1999-06-12 17:45:58 +02:00
|
|
|
ERR("could not allocate info memory!\n");
|
1998-11-08 12:30:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-03-12 18:42:50 +01:00
|
|
|
SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
|
|
|
|
|
1998-11-08 12:30:27 +01:00
|
|
|
|
|
|
|
/* initialize info structure */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 18:42:50 +01:00
|
|
|
DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1998-11-08 12:30:27 +01:00
|
|
|
{
|
1999-03-12 18:42:50 +01:00
|
|
|
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
1998-11-08 12:30:27 +01:00
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
/* free datetime info data */
|
1998-11-08 12:30:27 +01:00
|
|
|
COMCTL32_Free (infoPtr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LRESULT WINAPI
|
1999-02-26 12:11:13 +01:00
|
|
|
DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1998-11-08 12:30:27 +01:00
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
case DTM_GETSYSTEMTIME:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_GETSYSTEMTIME\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return GDT_VALID;
|
|
|
|
|
|
|
|
case DTM_SETSYSTEMTIME:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_SETSYSTEMTIME\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
case DTM_GETRANGE:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_GETRANGE\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_SETRANGE:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_SETRANGE\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 1;
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
case DTM_SETFORMATA:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_SETFORMAT32A\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 1;
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
case DTM_SETFORMATW:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_SETFORMAT32W\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
case DTM_SETMCCOLOR:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_SETMCCOLOR\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_GETMCCOLOR:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_GETMCCOLOR\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_GETMONTHCAL:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_GETMONTHCAL\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_SETMCFONT:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_SETMCFONT\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_GETMCFONT:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Unimplemented msg DTM_GETMCFONT\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
1998-11-08 12:30:27 +01:00
|
|
|
|
|
|
|
case WM_CREATE:
|
1999-03-12 18:42:50 +01:00
|
|
|
return DATETIME_Create (hwnd, wParam, lParam);
|
1998-11-08 12:30:27 +01:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
1999-03-12 18:42:50 +01:00
|
|
|
return DATETIME_Destroy (hwnd, wParam, lParam);
|
1998-11-08 12:30:27 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
if (uMsg >= WM_USER)
|
1999-06-12 17:45:58 +02:00
|
|
|
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
1998-11-08 12:30:27 +01:00
|
|
|
uMsg, wParam, lParam);
|
1999-02-26 12:11:13 +01:00
|
|
|
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
1998-11-08 12:30:27 +01:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 10:27:49 +02:00
|
|
|
DATETIME_Register (void)
|
1998-11-08 12:30:27 +01:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
WNDCLASSA wndClass;
|
1998-11-08 12:30:27 +01:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
if (GlobalFindAtomA (DATETIMEPICK_CLASSA)) return;
|
1998-11-08 12:30:27 +01:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
1998-11-08 12:30:27 +01:00
|
|
|
wndClass.style = CS_GLOBALCLASS;
|
1999-02-26 12:11:13 +01:00
|
|
|
wndClass.lpfnWndProc = (WNDPROC)DATETIME_WindowProc;
|
1998-11-08 12:30:27 +01:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof(DATETIME_INFO *);
|
1999-02-26 12:11:13 +01:00
|
|
|
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
|
|
|
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
|
|
wndClass.lpszClassName = DATETIMEPICK_CLASSA;
|
1998-11-08 12:30:27 +01:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
RegisterClassA (&wndClass);
|
1998-11-08 12:30:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 10:27:49 +02:00
|
|
|
DATETIME_Unregister (void)
|
1998-11-08 12:30:27 +01:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
if (GlobalFindAtomA (DATETIMEPICK_CLASSA))
|
|
|
|
UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL);
|
1998-11-08 12:30:27 +01:00
|
|
|
}
|
|
|
|
|