OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
datetime.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1993, 1996 by Borland International, All Rights Reserved
4// Copyright (c) 1998 by Bidus Yura, All Rights Reserved
5//
6/// \file
7/// Implementation of the TDateTimePicker class
8//----------------------------------------------------------------------------
9#include <owl/pch.h>
10
11#include <stdio.h>
12#ifndef _MAX_PATH
13//JJH
14# if !defined(WINELIB)
15# include <dos.h>
16# endif // WINELIB
17#endif
18
19#include <owl/imagelst.h>
20#include <stdio.h>
21
22#include <owl/datetime.h>
23
24namespace owl {
25
27DIAG_DECLARE_GROUP(OwlCommCtrl); // Common Controls diagnostic group
28
29//
30// class TDateTimePicker
31// ~~~~~ ~~~~~~~~~~~~~~~
32//
33TDateTimePicker::TDateTimePicker(TWindow* parent, int id,int x, int y, int w,
34 int h, TModule* module)
35:
36 TControl(parent, id, _T(""), x, y, w, h, module)
37{
39}
40
41//
42//
43//
50
51//
52/// Constructs a date time picker object to encapsulate (alias) an existing control.
53//
60
61//
62//
63//
67
68// Return the proper class name.
69// Windows class: DATETIMEPICK_CLASS is defined in commctrl.h
74
75//
76bool
78{
79 SYSTEMTIME st[2];
80 TParam1 param = 0;
81
82 if(mint != TSystemTime(0,0,0)){
83 st[0] = mint;
84 param |= GDTR_MIN;
85 }
86
87 if(maxt != TSystemTime(0,0,0)){
88 st[1] = maxt;
89 param |= GDTR_MAX;
90 }
92}
93
94//
95void
97{
99 SYSTEMTIME st[2];
100 uint flags = static_cast<uint>(::SendMessage(GetHandle(), DTM_GETRANGE, 0, TParam2(&st)));
101
102 if(flags & GDTR_MIN)
103 mint = st[0];
104 else
105 mint = TSystemTime(0,0,0);
106
107 if(flags & GDTR_MAX)
108 maxt = st[1];
109 else
110 maxt = TSystemTime(0,0,0);
111}
112
113//
114//
115//
116uint
118{
119 if (!buffer && direction != tdSizeData) return 0;
121 if (direction == tdGetData) {
122 GetTime(dtData->DateTime);
123 SetRange(dtData->MinDate, dtData->MaxDate);
124 }
125 else if (direction == tdSetData) {
126 SetTime(dtData->DateTime);
127 SetRange(dtData->MinDate, dtData->MaxDate);
128 }
129 return sizeof(TDateTimePickerData);
130}
131
132
133} // OWL namespace
134/* ========================================================================== */
#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
virtual auto GetWindowClassName() -> TWindowClassName
Definition datetime.cpp:70
bool SetTime(const TSystemTime &dt)
Definition datetime.h:154
void GetRange(TSystemTime &mint, TSystemTime &maxt) const
Definition datetime.cpp:96
bool SetRange(const TSystemTime &mint, const TSystemTime &maxt)
Definition datetime.cpp:77
TDateTimePicker(TWindow *parent, int id, int x, int y, int w, int h, TModule *module=0)
Definition datetime.cpp:33
TSystemTime GetTime() const
Definition datetime.h:76
uint Transfer(TDateTimePickerData &data, TTransferDirection direction)
Safe overload.
Definition datetime.h:86
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
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
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
Definition of class TDateTimePicker.
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 TImageList, an ImageList Common Control wrapper.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
void InitializeCommonControls(uint controlFlags)
Wrapper for the Windows API function InitCommmonControlsEx.
Definition commctrl.cpp:19
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
bool ToBool(const T &t)
Definition defs.h:291
OWL_DIAGINFO
Definition animctrl.cpp:14
unsigned int uint
Definition number.h:25