OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
monthcal.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1998 by Yura Bidus, All Rights Reserved
4//
5/// \file
6/// Definition of class TMonthCalendar.
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_MONTHCAL_H)
10#define OWL_MONTHCAL_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/control.h>
18#include <owl/commctrl.h>
19
20namespace owl {
21
22#include <owl/preclass.h>
23
24/// \addtogroup commctrl
25/// @{
26
27//
28/// \struct TMonthCalendarData
29//
42
43//
44/// \class TMonthCalendar
45//
47 : public TControl
48{
49 public:
50
52 {
53 mcBackColor=MCSC_BACKGROUND,
54 mcTextColor=MCSC_TEXT,
55 mcTitleBackColor=MCSC_TITLEBK,
56 mcTitleTextColor=MCSC_TITLETEXT,
57 mcMonthBackColor=MCSC_MONTHBK,
58 mcTrailingTextColor=MCSC_TRAILINGTEXT,
59 };
60
71
72 TMonthCalendar(TWindow* parent, int id, int x, int y, int w, int h, TModule* = 0);
73 TMonthCalendar(TWindow* parent, int resourceId, TModule* = 0);
74 TMonthCalendar(THandle hWnd, TModule* module = 0);
76
77 void SetColor(TColors index, const TColor& clr);
78 TColor GetColor(TColors index) const;
79
80 bool SetCurSel(const TSystemTime& tm);
81 bool GetCurSel(TSystemTime& tm) const;
82
83 bool SetFirstDayOfWeek(TDaysOfWeek day);
84 TDaysOfWeek GetFirstDayOfWeek(bool* local = 0) const;
85
86 bool SetMaxSelCount(int count);
87 int GetMaxSelCount() const;
88
89 int GetMaxTodayWidth() const;
90
91 bool GetMinReqRect(TRect& rc) const;
92
93 int SetMonthDelta(int delta);
94 int GetMonthDelta() const;
95
96 int GetMonthRange(TSystemTime& minm, TSystemTime& maxm, uint32 flags=GMR_DAYSTATE) const;
97
98 uint32 GetRange(TSystemTime& minm, TSystemTime& maxm) const;
99 bool SetRange(const TSystemTime& minm, const TSystemTime& maxm);
100 bool SetMinDate(const TSystemTime& minm);
101 bool SetMaxDate(const TSystemTime& minm);
102
103 bool GetSelRange(TSystemTime& minm, TSystemTime& maxm) const;
104 bool SetSelRange(const TSystemTime& minm, const TSystemTime& maxm);
105
106 bool GetToday(TSystemTime& today) const;
107 void SetToday(const TSystemTime& today);
108
109 bool IsUnicode() const;
110 void SetUnicode(bool unicode = true);
111
112 uint32 HitTest(TMCHitTestInfo& hitinfo);
113
114 bool SetDayState(int months, LPMONTHDAYSTATE states);
115
116 /// Safe overload
117 //
119
120 protected:
121
122 // Override TWindow virtual member functions
123 //
124 uint Transfer(void* buffer, TTransferDirection direction);
125 virtual auto GetWindowClassName() -> TWindowClassName;
126
127 private:
128
129 // Hidden to prevent accidental copying or assignment
130 //
133};
134
135/// @}
136
137#include <owl/posclass.h>
138
139//
140// inlines
141//
142
143//
144inline void TMonthCalendar::SetColor(TColors index, const TColor& clr){
146 SendMessage(MCM_SETCOLOR, TParam1(index), TParam2(clr.GetValue()));
147}
148
149//
152 return static_cast<COLORREF>(CONST_CAST(TMonthCalendar*,this)->SendMessage(MCM_GETCOLOR,TParam1(index),0));
153}
154
155//
161
162//
168
169//
174
175//
184
185//
188 return static_cast<int>(CONST_CAST(TMonthCalendar*,this)->SendMessage(MCM_GETMAXSELCOUNT, 0, 0));
189}
190
191//
192inline bool TMonthCalendar::SetMaxSelCount(int count){
194 return ToBool(SendMessage(MCM_SETMAXSELCOUNT, TParam1(count), 0));
195}
196
197//
200 return static_cast<int>(CONST_CAST(TMonthCalendar*,this)->SendMessage(MCM_GETMAXTODAYWIDTH, 0, 0));
201}
202
203//
208
209//
212 return static_cast<int>(SendMessage(MCM_SETMONTHDELTA, TParam1(delta), 0));
213}
214
215//
218 return static_cast<int>(CONST_CAST(TMonthCalendar*,this)->SendMessage(MCM_GETMONTHDELTA, 0, 0));
219}
220
221//
226
227//
232
233//
238
239//
244
245//
250
251//
255
256} // OWL namespace
257
258#endif // OWL_MONTHCAL_H
#define PRECONDITION(condition)
Definition checks.h:227
Class wrapper for management of color values.
Definition color.h:245
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Definition control.h:38
MonthCalendar Control notifications.
Definition commctrl.h:650
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TColor GetColor(TColors index) const
Definition monthcal.h:150
void SetToday(const TSystemTime &today)
Definition monthcal.h:228
bool SetFirstDayOfWeek(TDaysOfWeek day)
Definition monthcal.h:170
void SetColor(TColors index, const TColor &clr)
Definition monthcal.h:144
int GetMaxTodayWidth() const
Definition monthcal.h:198
bool IsUnicode() const
Definition monthcal.h:234
TDaysOfWeek GetFirstDayOfWeek(bool *local=0) const
Definition monthcal.h:176
uint Transfer(TMonthCalendarData &data, TTransferDirection direction)
Safe overload.
Definition monthcal.h:118
bool GetCurSel(TSystemTime &tm) const
Definition monthcal.h:163
bool SetMaxSelCount(int count)
Definition monthcal.h:192
bool GetToday(TSystemTime &today) const
Definition monthcal.h:222
bool GetMinReqRect(TRect &rc) const
Definition monthcal.h:204
int SetMonthDelta(int delta)
Definition monthcal.h:210
bool SetCurSel(const TSystemTime &tm)
Definition monthcal.h:156
int GetMonthDelta() const
Definition monthcal.h:216
bool SetDayState(int months, LPMONTHDAYSTATE states)
Definition monthcal.h:252
uint32 HitTest(TMCHitTestInfo &hitinfo)
Definition monthcal.h:246
void SetUnicode(bool unicode=true)
Definition monthcal.h:240
int GetMaxSelCount() const
Definition monthcal.h:186
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
TSystemTime is a class derived from the structure SYSTEMTIME.
Definition wsyscls.h:420
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
uint32 GetStyle() const
Gets the style bits of the underlying window or the 'Style' member of the attribute structure associa...
Definition window.cpp:3558
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
Definition window.cpp:3288
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
Definition of classes for CommonControl encapsulation.
Definition of class TControl.
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Definition window.h:92
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
uint16 HiUint16(LRESULT r)
Definition defs.h:270
unsigned long uint32
Definition number.h:34
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
bool ToBool(const T &t)
Definition defs.h:291
WPARAM TParam1
First parameter type.
Definition dispatch.h:54
uint16 LoUint16(LRESULT r)
Definition defs.h:264
unsigned int uint
Definition number.h:25
#define CONST_CAST(targetType, object)
Definition defs.h:273
#define _OWLCLASS
Definition defs.h:338
TMonthCalendarData(const TSystemTime &minsel, const TSystemTime &maxsel)
Definition monthcal.h:35
TMonthCalendarData(const TSystemTime &cursel)
Definition monthcal.h:33