OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ipaddres.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 TIPAddress.
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_IPADDRES_H)
10#define OWL_IPADDRES_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
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25/// \addtogroup newctrl
26/// @{
27/// \class TIPAddressBits
28// ~~~~~ ~~~~~~~~~~~~~~
29//
30/// Also used as transfer buffer
31//
33 public:
35 TIPAddressBits(int fld0, int fld1, int fld2, int fld3)
36 : Address(MakeIPAddress(fld0,fld1,fld2,fld3)){}
37
38 static uint32 MakeIPAddress(int f0, int f1, int f2, int f3)
39 { return static_cast<uint32>(((static_cast<uint32>(f0)<<24)+(static_cast<uint32>(f1)<<16)+(static_cast<uint32>(f2)<<8)+(static_cast<uint32>(f3)))); }
40
41 void SetAddress(int f0, int f1, int f2, int f3) { Address = MakeIPAddress(f0,f1,f2,f3); }
42 void SetAddress(uint32 address) {Address = address;}
43
44 int GetFirst() { return ((Address>>24)& 0xff); }
45 int GetSecond() { return ((Address>>16) & 0xff); }
46 int GetThird() { return ((Address>>8) & 0xff); }
47 int GetFourth() { return (Address & 0xff); }
48
49 operator uint32() { return Address;}
50
52};
53
54
55//
56/// \class TIPAddress
57// ~~~~~ ~~~~~~~~~~
58//
60 public:
67
68 TIPAddress(TWindow* parent, int id, int x, int y, int w, int h, TModule* module = 0);
69 TIPAddress(TWindow* parent, int resourceId, TModule* module = 0);
70 TIPAddress(THandle hWnd, TModule* module = 0);
72
73 void Clear();
74
75 void SetAddress(const TIPAddressBits& address);
76 int GetAddress(TIPAddressBits& address) const;
78
79 bool IsBlank() const;
80 void SetFocus(const TIPFields& fld);
81
82 bool SetRange(const TIPFields& fld, int minv, int maxv);
83
84 /// Safe overload
85 //
87
88 protected:
89
90 // Override TWindow virtual member functions
91 //
92 uint Transfer(void* buffer, TTransferDirection direction);
93 virtual auto GetWindowClassName() -> TWindowClassName;
94
95 private:
96 // Hidden to prevent accidental copying or assignment
97 //
98 TIPAddress(const TIPAddress&);
100};
101
102/// @}
103
104#include <owl/posclass.h>
105
106//
107// inlines
108//
109
110//
115
116//
121
122//
125 return static_cast<int>(const_cast<TIPAddress*>(this)->SendMessage(IPM_GETADDRESS, 0, TParam2(&address.Address)));
126}
127
128//
129inline bool TIPAddress::IsBlank() const{
131 return ToBool(const_cast<TIPAddress*>(this)->SendMessage(IPM_ISBLANK, 0, 0));
132}
133
134//
139
140//
145
146
147} // OWL namespace
148
149#endif // OWL_MONTHCAL_H
#define PRECONDITION(condition)
Definition checks.h:227
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Definition control.h:38
Also used as transfer buffer.
Definition ipaddres.h:32
void SetAddress(int f0, int f1, int f2, int f3)
Definition ipaddres.h:41
static uint32 MakeIPAddress(int f0, int f1, int f2, int f3)
Definition ipaddres.h:38
TIPAddressBits(int fld0, int fld1, int fld2, int fld3)
Definition ipaddres.h:35
void SetAddress(uint32 address)
Definition ipaddres.h:42
TIPAddressBits(uint32 address=0)
Definition ipaddres.h:34
TIPAddressBits GetAddress() const
Definition ipaddres.h:77
bool IsBlank() const
Definition ipaddres.h:129
bool SetRange(const TIPFields &fld, int minv, int maxv)
Definition ipaddres.h:141
uint Transfer(TIPAddressBits &address, TTransferDirection direction)
Safe overload.
Definition ipaddres.h:86
void SetAddress(const TIPAddressBits &address)
Definition ipaddres.h:117
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
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
HWND SetFocus()
Sets the keyboard focus to current window and activates the window that receives the focus by sending...
Definition window.h:2151
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
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
unsigned int uint
Definition number.h:25
#define _OWLCLASS
Definition defs.h:338