Commit b2e91b6a authored by Alex Priem's avatar Alex Priem Committed by Alexandre Julliard

First try at the month calendar common control. Main features

basically OK.
parent 450270bb
......@@ -28,3 +28,18 @@ extern HMODULE COMCTL32_hModule;
#define IDC_MOVEUP_BTN 206
#define IDC_MOVEDN_BTN 207
/* Month calendar month menu popup */
#define IDD_MCMONTHMENU 300
#define IDM_JAN 301
#define IDM_FEB 302
#define IDM_MAR 303
#define IDM_APR 304
#define IDM_MAY 305
#define IDM_JUN 306
#define IDM_JUL 307
#define IDM_AUG 308
#define IDM_SEP 309
#define IDM_OCT 310
#define IDM_NOV 311
#define IDM_DEC 311
......@@ -33,3 +33,23 @@ BEGIN
LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
END
IDD_MCMONTHMENU MENU LOADONCALL DISCARDABLE
{
POPUP ""
BEGIN
MENUITEM "&January", IDM_JAN
MENUITEM "&February", IDM_FEB
MENUITEM "&March", IDM_MAR
MENUITEM "&April", IDM_APR
MENUITEM "&May", IDM_MAY
MENUITEM "J&une", IDM_JUN
MENUITEM "Ju&ly", IDM_JUL
MENUITEM "Au&gust", IDM_AUG
MENUITEM "&September", IDM_SEP
MENUITEM "&October", IDM_OCT
MENUITEM "&November", IDM_NOV
MENUITEM "&December", IDM_DEC
END
}
......@@ -6,6 +6,7 @@
#define __WINE_COMMCTRL_H
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "imagelist.h"
#include "prsht.h"
......@@ -2931,12 +2932,166 @@ typedef struct tagNMIPADDRESS
/**************************************************************************
* Month calendar control
*
*/
#define MONTHCAL_CLASSA "SysMonthCal32"
#define MONTHCAL_CLASSW L"SysMonthCal32"
#define MONTHCAL_CLASS WINELIB_NAME_AW(MONTHCAL_CLASS)
#define MCM_FIRST 0x1000
#define MCN_FIRST (0U-750U)
#define MCN_LAST (0U-759U)
#define MCM_GETCURSEL (MCM_FIRST + 1)
#define MCM_SETCURSEL (MCM_FIRST + 2)
#define MCM_GETMAXSELCOUNT (MCM_FIRST + 3)
#define MCM_SETMAXSELCOUNT (MCM_FIRST + 4)
#define MCM_GETSELRANGE (MCM_FIRST + 5)
#define MCM_SETSELRANGE (MCM_FIRST + 6)
#define MCM_GETMONTHRANGE (MCM_FIRST + 7)
#define MCM_SETDAYSTATE (MCM_FIRST + 8)
#define MCM_GETMINREQRECT (MCM_FIRST + 9)
#define MCM_SETCOLOR (MCM_FIRST + 10)
#define MCM_GETCOLOR (MCM_FIRST + 11)
#define MCM_SETTODAY (MCM_FIRST + 12)
#define MCM_GETTODAY (MCM_FIRST + 13)
#define MCM_HITTEST (MCM_FIRST + 14)
#define MCM_SETFIRSTDAYOFWEEK (MCM_FIRST + 15)
#define MCM_GETFIRSTDAYOFWEEK (MCM_FIRST + 16)
#define MCM_GETRANGE (MCM_FIRST + 17)
#define MCM_SETRANGE (MCM_FIRST + 18)
#define MCM_GETMONTHDELTA (MCM_FIRST + 19)
#define MCM_SETMONTHDELTA (MCM_FIRST + 20)
#define MCM_GETMAXTODAYWIDTH (MCM_FIRST + 21)
#define MCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT
#define MCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT
/* Notifications */
#define MCN_SELCHANGE (MCN_FIRST + 1)
#define MCN_GETDAYSTATE (MCN_FIRST + 3)
#define MCN_SELECT (MCN_FIRST + 4)
#define MCSC_BACKGROUND 0
#define MCSC_TEXT 1
#define MCSC_TITLEBK 2
#define MCSC_TITLETEXT 3
#define MCSC_MONTHBK 4
#define MCSC_TRAILINGTEXT 5
#define MCS_DAYSTATE 0x0001
#define MCS_MULTISELECT 0x0002
#define MCS_WEEKNUMBERS 0x0004
#define MCS_NOTODAY 0x0010
#define MCS_NOTODAYCIRCLE 0x0008
#define MCHT_TITLE 0x00010000
#define MCHT_CALENDAR 0x00020000
#define MCHT_TODAYLINK 0x00030000
#define MCHT_NEXT 0x01000000
#define MCHT_PREV 0x02000000
#define MCHT_NOWHERE 0x00000000
#define MCHT_TITLEBK (MCHT_TITLE)
#define MCHT_TITLEMONTH (MCHT_TITLE | 0x0001)
#define MCHT_TITLEYEAR (MCHT_TITLE | 0x0002)
#define MCHT_TITLEBTNNEXT (MCHT_TITLE | MCHT_NEXT | 0x0003)
#define MCHT_TITLEBTNPREV (MCHT_TITLE | MCHT_PREV | 0x0003)
#define MCHT_CALENDARBK (MCHT_CALENDAR)
#define MCHT_CALENDARDATE (MCHT_CALENDAR | 0x0001)
#define MCHT_CALENDARDATENEXT (MCHT_CALENDARDATE | MCHT_NEXT)
#define MCHT_CALENDARDATEPREV (MCHT_CALENDARDATE | MCHT_PREV)
#define MCHT_CALENDARDAY (MCHT_CALENDAR | 0x0002)
#define MCHT_CALENDARWEEKNUM (MCHT_CALENDAR | 0x0003)
#define GMR_VISIBLE 0
#define GMR_DAYSTATE 1
/* Month calendar's structures */
typedef struct {
UINT cbSize;
POINT pt;
UINT uHit;
SYSTEMTIME st;
} MCHITTESTINFO, *PMCHITTESTINFO;
typedef struct tagNMSELCHANGE
{
NMHDR nmhdr;
SYSTEMTIME stSelStart;
SYSTEMTIME stSelEnd;
} NMSELCHANGE, *LPNMSELCHANGE;
typedef NMSELCHANGE NMSELECT, *LPNMSELECT;
typedef DWORD MONTHDAYSTATE, *LPMONTHDAYSTATE;
typedef struct tagNMDAYSTATE
{
NMHDR nmhdr;
SYSTEMTIME stStart;
int cDayState;
LPMONTHDAYSTATE prgDayState;
} NMDAYSTATE, *LPNMDAYSTATE;
/* macros */
#define MonthCal_GetCurSel(hmc, pst) \
(BOOL)SNDMSG(hmc, MCM_GETCURSEL, 0, (LPARAM)(pst))
#define MonthCal_SetCurSel(hmc, pst) \
(BOOL)SNDMSG(hmc, MCM_SETCURSEL, 0, (LPARAM)(pst))
#define MonthCal_GetMaxSelCount(hmc) \
(DWORD)SNDMSG(hmc, MCM_GETMAXSELCOUNT, 0, 0L)
#define MonthCal_SetMaxSelCount(hmc, n) \
(BOOL)SNDMSG(hmc, MCM_SETMAXSELCOUNT, (WPARAM)(n), 0L)
#define MonthCal_GetSelRange(hmc, rgst) \
SNDMSG(hmc, MCM_GETSELRANGE, 0, (LPARAM) (rgst))
#define MonthCal_SetSelRange(hmc, rgst) \
SNDMSG(hmc, MCM_SETSELRANGE, 0, (LPARAM) (rgst))
#define MonthCal_GetMonthRange(hmc, gmr, rgst) \
(DWORD)SNDMSG(hmc, MCM_GETMONTHRANGE, (WPARAM)(gmr), (LPARAM)(rgst))
#define MonthCal_SetDayState(hmc, cbds, rgds) \
SNDMSG(hmc, MCM_SETDAYSTATE, (WPARAM)(cbds), (LPARAM)(rgds))
#define MonthCal_GetMinReqRect(hmc, prc) \
SNDMSG(hmc, MCM_GETMINREQRECT, 0, (LPARAM)(prc))
#define MonthCal_SetColor(hmc, iColor, clr)\
SNDMSG(hmc, MCM_SETCOLOR, iColor, clr
#define MonthCal_GetColor(hmc, iColor) \
SNDMSG(hmc, MCM_SETCOLOR, iColor, 0)
#define MonthCal_GetToday(hmc, pst)\
(BOOL)SNDMSG(hmc, MCM_GETTODAY, 0, (LPARAM)pst)
#define MonthCal_SetToday(hmc, pst)\
SNDMSG(hmc, MCM_SETTODAY, 0, (LPARAM)pst)
#define MonthCal_HitTest(hmc, pinfo) \
SNDMSG(hmc, MCM_HITTEST, 0, (LPARAM)(PMCHITTESTINFO)pinfo)
#define MonthCal_SetFirstDayOfWeek(hmc, iDay) \
SNDMSG(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay)
#define MonthCal_GetFirstDayOfWeek(hmc) \
(DWORD)SNDMSG(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0)
#define MonthCal_GetRange(hmc, rgst) \
(DWORD)SNDMSG(hmc, MCM_GETRANGE, 0, (LPARAM)(rgst))
#define MonthCal_SetRange(hmc, gd, rgst) \
(BOOL)SNDMSG(hmc, MCM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst))
#define MonthCal_GetMonthDelta(hmc) \
(int)SNDMSG(hmc, MCM_GETMONTHDELTA, 0, 0)
#define MonthCal_SetMonthDelta(hmc, n) \
(int)SNDMSG(hmc, MCM_SETMONTHDELTA, n, 0)
#define MonthCal_GetMaxTodayWidth(hmc) \
(DWORD)SNDMSG(hmc, MCM_GETMAXTODAYWIDTH, 0, 0)
#define MonthCal_SetUnicodeFormat(hwnd, fUnicode) \
(BOOL)SNDMSG((hwnd), MCM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0)
#define MonthCal_GetUnicodeFormat(hwnd) \
(BOOL)SNDMSG((hwnd), MCM_GETUNICODEFORMAT, 0, 0)
/**************************************************************************
* Date and time picker control
......
......@@ -2,18 +2,58 @@
* Month calendar class extra info
*
* Copyright 1998 Eric Kohl
* Copyright 1999 Alex Priem
*/
#ifndef __WINE_MONTHCAL_H
#define __WINE_MONTHCAL_H
#include "windef.h"
#define MC_SEL_LBUTUP 0 /* Left button released */
#define MC_SEL_LBUTDOWN 1 /* Left button pressed */
typedef struct tagMONTHCAL_INFO
{
DWORD dwDummy; /* just to keep the compiler happy ;-) */
COLORREF bk;
COLORREF txt;
COLORREF titlebk;
COLORREF titletxt;
COLORREF monthbk;
COLORREF trailingtxt;
HFONT hFont;
HFONT hBoldFont;
int textHeight;
int textWidth;
int firstDayplace; /* place of the first day of the current month */
int delta; /* scroll rate; # of months that the */
/* control moves when user clicks a scroll button */
int visible; /* # of months visible */
int firstDay; /* Start month calendar with firstDay's day */
int monthRange;
MONTHDAYSTATE *monthdayState;
SYSTEMTIME todaysDate;
DWORD currentMonth;
DWORD currentYear;
int selValid; /* See MC_SEL flags */
int curSelDay; /* current selected day */
int firstSelDay; /* first selected day */
int maxSelCount;
SYSTEMTIME minSel;
SYSTEMTIME maxSel;
DWORD rangeValid;
SYSTEMTIME minDate;
SYSTEMTIME maxDate;
RECT rcClient; /* rect for whole client area */
RECT title; /* rect for the header above the calendar */
RECT titlebtnnext; /* the `next month' button in the header */
RECT titlebtnprev; /* the `prev month' button in the header */
RECT titlemonth; /* the `month name' txt in the header */
RECT titleyear; /* the `year number' txt in the header */
RECT prevmonth; /* day numbers of the previous month */
RECT nextmonth; /* day numbers of the next month */
RECT days; /* week numbers at left side */
RECT weeknums; /* week numbers at left side */
RECT today; /* `today: xx/xx/xx' text rect */
} MONTHCAL_INFO, *LPMONTHCAL_INFO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment