1998-11-08 11:30:27 +00:00
|
|
|
/*
|
|
|
|
* Month calendar control
|
|
|
|
*
|
1999-03-12 17:42:50 +00:00
|
|
|
* Copyright 1998, 1999 Eric Kohl
|
1998-11-08 11:30:27 +00: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 10:53:11 +00:00
|
|
|
#include "winbase.h"
|
1998-11-08 11:30:27 +00:00
|
|
|
#include "commctrl.h"
|
|
|
|
#include "monthcal.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
1999-04-19 14:56:29 +00:00
|
|
|
DEFAULT_DEBUG_CHANNEL(monthcal)
|
|
|
|
|
1998-11-08 11:30:27 +00:00
|
|
|
|
1999-03-12 17:42:50 +00:00
|
|
|
#define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongA (hwnd, 0))
|
1998-11-08 11:30:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 17:42:50 +00:00
|
|
|
MONTHCAL_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1998-11-08 11:30:27 +00:00
|
|
|
{
|
|
|
|
MONTHCAL_INFO *infoPtr;
|
|
|
|
|
|
|
|
/* allocate memory for info structure */
|
|
|
|
infoPtr = (MONTHCAL_INFO *)COMCTL32_Alloc (sizeof(MONTHCAL_INFO));
|
1999-03-12 17:42:50 +00:00
|
|
|
SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
|
1998-11-08 11:30:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* initialize info structure */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 17:42:50 +00:00
|
|
|
MONTHCAL_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1998-11-08 11:30:27 +00:00
|
|
|
{
|
1999-03-12 17:42:50 +00:00
|
|
|
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr (hwnd);
|
1998-11-08 11:30:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* free ipaddress info data */
|
|
|
|
COMCTL32_Free (infoPtr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LRESULT WINAPI
|
1999-02-26 11:11:13 +00:00
|
|
|
MONTHCAL_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1998-11-08 11:30:27 +00:00
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
case WM_CREATE:
|
1999-03-12 17:42:50 +00:00
|
|
|
return MONTHCAL_Create (hwnd, wParam, lParam);
|
1998-11-08 11:30:27 +00:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
1999-03-12 17:42:50 +00:00
|
|
|
return MONTHCAL_Destroy (hwnd, wParam, lParam);
|
1998-11-08 11:30:27 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
if (uMsg >= WM_USER)
|
|
|
|
ERR (monthcal, "unknown msg %04x wp=%08x lp=%08lx\n",
|
|
|
|
uMsg, wParam, lParam);
|
1999-02-26 11:11:13 +00:00
|
|
|
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
1998-11-08 11:30:27 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
|
|
|
MONTHCAL_Register (VOID)
|
|
|
|
{
|
1999-02-26 11:11:13 +00:00
|
|
|
WNDCLASSA wndClass;
|
1998-11-08 11:30:27 +00:00
|
|
|
|
1999-02-26 11:11:13 +00:00
|
|
|
if (GlobalFindAtomA (MONTHCAL_CLASSA)) return;
|
1998-11-08 11:30:27 +00:00
|
|
|
|
1999-02-26 11:11:13 +00:00
|
|
|
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
1998-11-08 11:30:27 +00:00
|
|
|
wndClass.style = CS_GLOBALCLASS;
|
1999-02-26 11:11:13 +00:00
|
|
|
wndClass.lpfnWndProc = (WNDPROC)MONTHCAL_WindowProc;
|
1998-11-08 11:30:27 +00:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof(MONTHCAL_INFO *);
|
1999-02-26 11:11:13 +00:00
|
|
|
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
|
|
|
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
|
|
wndClass.lpszClassName = MONTHCAL_CLASSA;
|
1998-11-08 11:30:27 +00:00
|
|
|
|
1999-02-26 11:11:13 +00:00
|
|
|
RegisterClassA (&wndClass);
|
1998-11-08 11:30:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
|
|
|
MONTHCAL_Unregister (VOID)
|
|
|
|
{
|
1999-02-26 11:11:13 +00:00
|
|
|
if (GlobalFindAtomA (MONTHCAL_CLASSA))
|
|
|
|
UnregisterClassA (MONTHCAL_CLASSA, (HINSTANCE)NULL);
|
1998-11-08 11:30:27 +00:00
|
|
|
}
|
|
|
|
|