OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
timegadg.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5//----------------------------------------------------------------------------
6#include <owl/pch.h>
7#if !defined(OWL_TIMEGADG_H)
8# include <owl/timegadg.h>
9#endif
10#include <owl/time.h>
11#include <owl/pointer.h>
12
13namespace owl {
14
16
17//
18/// Constructor for TTimeGadget.
19//
22 TFont* font)
23:
25 TimeFunc(timeFunc)
26{
27 SetShrinkWrap(false, true);
28}
29
30//
31/// String-aware overload
32//
34 TGetTimeFunc timeFunc,
35 int id,
39 const tstring& text,
40 TFont* font
41 )
43 TimeFunc(timeFunc)
44{
45 SetShrinkWrap(false, true);
46}
47
48//
49/// Overriden from TGadget to inform gadget window to setup a timer
50//
51void
57
58//
59/// Overridden from TGadget to display the current time.
60//
61bool
63{
65
67 TimeFunc(newTime);
68 SetText(newTime.c_str());
69
70 // NOTE: Don't return true to drain system. Let GadgetWindow Timer
71 // message indirectly trigger IdleAction.
72 //
73 return false;
74}
75
76//
77/// Retrieves the current time.
78//
79void
85
86//
87// Win32 specific
88//
89
90//
91/// Retrieves the system time using the Win32 API.
92//
93void
110
111//
112/// Retrieves the local time using the Win32 API
113//
114void
131
132
133} // OWL namespace
134/* ========================================================================== */
135
136
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
Definition gdiobjec.h:296
virtual bool IdleAction(long idleCount)
Called during idle time to allow the gadget to perform any idle actions.
Definition gadget.cpp:120
TGadgetWindow * GetGadgetWindow()
Return a pointer to the owning or parent window for the gadget.
Definition gadget.h:536
virtual void Created()
This is the virtual called after the window holding a gadget has been created.
Definition gadget.cpp:300
void SetShrinkWrap(bool shrinkWrapWidth, bool shrinkWrapHeight)
Simple set accessor to set whether shrinkwrapping is performed horizontally and/or vertically.
Definition gadget.cpp:165
TBorderStyle
Gadget border styles.
Definition gadget.h:127
bool EnableTimer()
Inform GadgetWindow to start a Timer notification.
Definition gadgetwi.cpp:226
Derived from TGadget, TTextGadget is a text gadget object.
Definition textgadg.h:37
TAlign
Enumerates the text-alignment attributes.
Definition textgadg.h:42
void SetText(LPCTSTR text)
Set the text for this gadget.
Definition textgadg.cpp:133
static void GetTTime(tstring &)
Retrieves the current time.
Definition timegadg.cpp:80
void Created()
Overriden from TGadget to inform gadget window to setup a timer.
Definition timegadg.cpp:52
bool IdleAction(long count)
Overridden from TGadget to display the current time.
Definition timegadg.cpp:62
static void GetLocalTime(tstring &)
Retrieves the local time using the Win32 API.
Definition timegadg.cpp:115
TTimeGadget(TGetTimeFunc timeFunc=&TTimeGadget::GetSystemTime, int id=0, TBorderStyle=Recessed, TAlign=Center, uint numChars=12, LPCTSTR text=0, TFont *font=0)
Constructor for TTimeGadget.
Definition timegadg.cpp:20
static void GetSystemTime(tstring &)
Retrieves the system time using the Win32 API.
Definition timegadg.cpp:94
The TTime class encapsulates time functions and characteristics.
Definition time.h:38
#define _T(x)
Definition cygwin.h:51
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
OWL_DIAGINFO
Definition animctrl.cpp:14
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
Various types of smart pointer templatized classes.
Definition of class TTimeGadget.