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"
|
|
|
|
#include "debug.h"
|
|
|
|
|
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) {
|
|
|
|
ERR (datetime, "could not allocate info memory!\n");
|
|
|
|
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:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_GETSYSTEMTIME\n");
|
|
|
|
return GDT_VALID;
|
|
|
|
|
|
|
|
case DTM_SETSYSTEMTIME:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_SETSYSTEMTIME\n");
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case DTM_GETRANGE:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_GETRANGE\n");
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_SETRANGE:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_SETRANGE\n");
|
|
|
|
return 1;
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
case DTM_SETFORMATA:
|
1999-01-17 17:32:32 +01:00
|
|
|
FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32A\n");
|
|
|
|
return 1;
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
case DTM_SETFORMATW:
|
1999-01-17 17:32:32 +01:00
|
|
|
FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32W\n");
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case DTM_SETMCCOLOR:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_SETMCCOLOR\n");
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_GETMCCOLOR:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_GETMCCOLOR\n");
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_GETMONTHCAL:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_GETMONTHCAL\n");
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_SETMCFONT:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_SETMCFONT\n");
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case DTM_GETMCFONT:
|
|
|
|
FIXME (datetime, "Unimplemented msg DTM_GETMCFONT\n");
|
|
|
|
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)
|
|
|
|
ERR (datetime, "unknown msg %04x wp=%08x lp=%08lx\n",
|
|
|
|
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
|
|
|
|
DATETIME_Register (VOID)
|
|
|
|
{
|
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
|
|
|
|
DATETIME_Unregister (VOID)
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|