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.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1998 by Bidus Yura, All Rights Reserved
4//
5/// \file
6/// Implementation of the TMonthCalendar class
7//----------------------------------------------------------------------------
8#include <owl/pch.h>
9
10#include <owl/monthcal.h>
11
12
13namespace owl {
14
16DIAG_DECLARE_GROUP(OwlCommCtrl); // Common Controls diagnostic group
17
18//
19//
20//
21TMonthCalendar::TMonthCalendar(TWindow* parent, int id, int x, int y, int w,
22 int h, TModule* module)
23:
24 TControl(parent,id,_T(""),x,y,w,h,module)
25{
27}
28
29
30//
31//
32//
39
40//
41/// Constructs a month calendar object to encapsulate (alias) an existing control.
42//
49
50//
51//
52//
56
57
62
63//
64//
65//
66int
68{
70
71 SYSTEMTIME sysTimes[2];
72 memset(sysTimes, 0, sizeof(sysTimes));
73
74 int count = static_cast<int>(const_cast<TMonthCalendar*>(this)->SendMessage(MCM_GETMONTHRANGE,
75 TParam1(flags), TParam2(sysTimes)));
76
77 minm = sysTimes[0];
78 maxm = sysTimes[1];
79 return count;
80}
81
82//
83//
84//
87{
89
90 SYSTEMTIME sysTimes[2];
91 memset(sysTimes, 0, sizeof(sysTimes));
92
93 uint32 ranges = static_cast<uint32>(const_cast<TMonthCalendar*>(this)->SendMessage(MCM_GETRANGE, 0, TParam2(sysTimes)));
94 minm = TSystemTime(0,0,0);
95 maxm = TSystemTime(0,0,0);
96
97 if (ranges & GDTR_MIN)
98 minm = sysTimes[0];
99 if (ranges & GDTR_MAX)
100 maxm = sysTimes[1];
101
102 return ranges;
103}
104
105//
106//
107//
108bool
117
118//
119//
120//
121bool
129
130//
131//
132//
133bool
141
142//
143//
144//
145bool
147{
150
151 SYSTEMTIME sysTimes[2];
152 bool retval = ToBool((const_cast<TMonthCalendar*>(this))->SendMessage(MCM_GETSELRANGE, 0, TParam2(sysTimes)));
153 if (retval){
154 minm = sysTimes[0];
155 maxm = sysTimes[1];
156 }
157 return retval;
158}
159
160bool
172
173//
174//
175//
176uint
178{
179 if (!buffer && direction != tdSizeData) return 0;
181 if (direction == tdGetData) {
182 if(mcData->MultiSel)
183 GetSelRange(mcData->Date1, mcData->Date2);
184 else
185 GetCurSel(mcData->Date1);
186 }
187 else if (direction == tdSetData) {
188 if(mcData->MultiSel)
189 SetSelRange(mcData->Date1, mcData->Date2);
190 else
191 SetCurSel(mcData->Date1);
192 }
193 return sizeof(TMonthCalendarData);
194}
195} // OWL namespace
196/* ========================================================================== */
#define PRECONDITION(condition)
Definition checks.h:227
#define DIAG_DECLARE_GROUP(group)
Definition checks.h:404
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Definition control.h:38
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
bool SetMinDate(const TSystemTime &minm)
Definition monthcal.cpp:122
bool SetRange(const TSystemTime &minm, const TSystemTime &maxm)
Definition monthcal.cpp:109
bool SetMaxDate(const TSystemTime &minm)
Definition monthcal.cpp:134
uint Transfer(TMonthCalendarData &data, TTransferDirection direction)
Safe overload.
Definition monthcal.h:118
bool GetCurSel(TSystemTime &tm) const
Definition monthcal.h:163
bool SetSelRange(const TSystemTime &minm, const TSystemTime &maxm)
Definition monthcal.cpp:161
bool SetCurSel(const TSystemTime &tm)
Definition monthcal.h:156
virtual auto GetWindowClassName() -> TWindowClassName
Definition monthcal.cpp:58
int GetMonthRange(TSystemTime &minm, TSystemTime &maxm, uint32 flags=GMR_DAYSTATE) const
Definition monthcal.cpp:67
uint32 GetRange(TSystemTime &minm, TSystemTime &maxm) const
Definition monthcal.cpp:86
bool GetSelRange(TSystemTime &minm, TSystemTime &maxm) const
Definition monthcal.cpp:146
TMonthCalendar(TWindow *parent, int id, int x, int y, int w, int h, TModule *=0)
Definition monthcal.cpp:21
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 THandle
TWindow encapsulates an HWND.
Definition window.h:418
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
#define _T(x)
Definition cygwin.h:51
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Definition window.h:92
@ tdSizeData
Return the size of data transferred by the class.
Definition window.h:95
@ tdSetData
Set data from the buffer into the window.
Definition window.h:94
@ tdGetData
Get data from the window into the buffer.
Definition window.h:93
Definition of class TMonthCalendar.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
void InitializeCommonControls(uint controlFlags)
Wrapper for the Windows API function InitCommmonControlsEx.
Definition commctrl.cpp:19
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
OWL_DIAGINFO
Definition animctrl.cpp:14
unsigned int uint
Definition number.h:25