9#ifndef OWL_TRANSFERBUFFER_H
10#define OWL_TRANSFERBUFFER_H
131template <
class TControlType>
141template <
class TBuffer>
160 template <
class TControlType,
class TFieldType>
161 TControlType&
Bind(TFieldType TBuffer::* field, TControlType& c)
173 TBuffer*
const p = 0;
174 const size_t offset =
reinterpret_cast<char*
>(&(p->*field)) -
reinterpret_cast<char*
>(p);
186 template <
class TControlType,
class TFieldType>
187 TControlType&
Bind(TFieldType TBuffer::* field,
int id)
195 template <
class TControlType,
class TFieldType,
class TArg1>
196 TControlType&
Bind(TFieldType TBuffer::* field,
int id, TArg1 a1)
204 template <
class TControlType,
class TFieldType,
class TArg1,
class TArg2>
205 TControlType&
Bind(TFieldType TBuffer::* field,
int id, TArg1 a1, TArg2 a2)
213 template <
class TControlType,
class TFieldType,
class TArg1,
class TArg2,
class TArg3>
214 TControlType&
Bind(TFieldType TBuffer::* field,
int id, TArg1 a1, TArg2 a2, TArg3 a3)
222 template <
class TControlType,
class TFieldType,
class TArg1,
class TArg2,
class TArg3,
class TArg4>
223 TControlType&
Bind(TFieldType TBuffer::* field,
int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4)
231 template <
class TControlType,
class TFieldType,
class TArg1,
class TArg2,
class TArg3,
class TArg4,
class TArg5>
232 TControlType&
Bind(TFieldType TBuffer::* field,
int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5)
240 template <
class TControlType,
class TFieldType,
class TArg1,
class TArg2,
class TArg3,
class TArg4,
class TArg5,
class TArg6>
241 TControlType&
Bind(TFieldType TBuffer::* field,
int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6)
249 template <
class TControlType,
class TFieldType,
class TArg1,
class TArg2,
class TArg3,
class TArg4,
class TArg5,
class TArg6,
class TArg7>
250 TControlType&
Bind(TFieldType TBuffer::* field,
int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6, TArg7 a7)
252 return Bind(field,
TTransferBufferBinder<TControlType>::Create(field,
this,
id, a1, a2, a3, a4, a5, a6, a7));
272template <
class TControlType,
class TBuffer, u
int N>
275 WARN(c.GetTextLimit() > 0 && c.GetTextLimit() != N,
276 _T(
"Corrected text limit and field size mismatch for control #")
280 WARN(
true,
_T(
"Character array fields are deprecated for use with transfer buffers. ")
281 <<
_T(
"Use a standard string class instead for control #")
286 c.SetTransferBufferFieldType(TControlType::tbftCharArray);
293template <
class TControlType,
class TFieldType>
298 template <
class TBuffer>
299 static void Restrict(TFieldType TBuffer::*, TControlType&)
305 template <
class TBuffer>
308 return *
new TControlType(p,
id);
311 template <
class TBuffer,
class TArg1>
315 return *
new TControlType(p,
id, a1);
318 template <
class TBuffer,
class TArg1,
class TArg2>
322 return *
new TControlType(p,
id, a1, a2);
325 template <
class TBuffer,
class TArg1,
class TArg2,
class TArg3>
327 TArg1 a1, TArg2 a2, TArg3 a3)
329 return *
new TControlType(p,
id, a1, a2, a3);
332 template <
class TBuffer,
class TArg1,
class TArg2,
class TArg3,
class TArg4>
334 TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4)
336 return *
new TControlType(p,
id, a1, a2, a3, a4);
339 template <
class TBuffer,
class TArg1,
class TArg2,
class TArg3,
class TArg4,
class TArg5>
341 TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5)
343 return *
new TControlType(p,
id, a1, a2, a3, a4, a5);
346 template <
class TBuffer,
class TArg1,
class TArg2,
class TArg3,
class TArg4,
class TArg5,
class TArg6>
348 TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6)
350 return *
new TControlType(p,
id, a1, a2, a3, a4, a5, a6);
353 template <
class TBuffer,
class TArg1,
class TArg2,
class TArg3,
class TArg4,
class TArg5,
class TArg6,
class TArg7>
355 TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6, TArg7 a7)
357 return *
new TControlType(p,
id, a1, a2, a3, a4, a5, a6, a7);
370 template <
class TBuffer, u
int N>
376 template <
class TBuffer>
382 template <
class TBuffer, u
int N>
386 return *
new TStatic(p,
id, textLimit, m);
389 template <
class TBuffer>
393 return *
new TStatic(p,
id, textLimit, m);
406 template <
class TBuffer, u
int N>
412 template <
class TBuffer>
418 template <
class TBuffer, u
int N>
422 return *
new TEdit(p,
id, textLimit, m);
425 template <
class TBuffer>
429 return *
new TEdit(p,
id, textLimit, m);
530 template <
class TBuffer, u
int N>
536 template <
class TBuffer>
542 template <
class TBuffer>
548 template <
class TBuffer, u
int N>
552 return *
new TMemComboBox(p,
id, name, textLimit, itemLimit, m);
555 template <
class TBuffer>
559 return *
new TMemComboBox(p,
id, name, textLimit, itemLimit, m);
562 template <
class TBuffer>
566 return *
new TMemComboBox(p,
id, name, textLimit, itemLimit, m);
Definition of class TCheckBox.
Definition of class TCheckList, an ownerdrawn listbox to select multiple items.
#define WARN(condition, message)
TCheckBox is a streamable interface class that represents a check box control.
TCheckList is an owner-drawn list box to select multiple items.
An interface object that represents a transfer buffer for a TComboBox.
ComboBoxEx controls are combo box controls that provide native support for item images.
You can use TComboBox to create a combo box or a combo box control in a parent TWindow,...
A TEdit is an interface object that represents an edit control interface element.
THotKey encapsulates the hot-key control, a window that allows the user to enter a combination of key...
An interface object that represents a corresponding list box element.
void SetTransferBufferFieldType(TTransferBufferFieldType)
TMemComboBox(TWindow *parent, int id, int x, int y, int w, int h, const tstring &name, uint textLimit=255, uint itemLimit=25, TModule *=0)
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
An abstract base class derived from TScrollBar, TSlider defines the basic behavior of sliders (contro...
An interface object that represents a static text interface element.
void SetTransferBufferFieldType(TTransferBufferFieldType)
TStatic(TWindow *parent, int id, LPCTSTR title, int x, int y, int w, int h, uint textLen=0, TModule *=nullptr)
Constructs a static control object with the supplied parent window (parent), control ID (Id),...
static TEdit & Create(tchar(TBuffer::*)[N], TWindow *p, int id, uint textLimit=0, TModule *m=0)
static TEdit & Create(tstring TBuffer::*, TWindow *p, int id, uint textLimit=0, TModule *m=0)
static void Restrict(tstring TBuffer::*field, TEdit &c)
static void Restrict(tchar(TBuffer::*field)[N], TEdit &c)
static void Restrict(tstring TBuffer::*field, TMemComboBox &c)
static TMemComboBox & Create(TComboBoxData TBuffer::*, TWindow *p, int id, const tstring &name, uint textLimit=255, uint itemLimit=25, TModule *m=0)
static TMemComboBox & Create(tstring TBuffer::*, TWindow *p, int id, const tstring &name, uint textLimit=255, uint itemLimit=25, TModule *m=0)
static TMemComboBox & Create(tchar(TBuffer::*)[N], TWindow *p, int id, const tstring &name, uint textLimit=255, uint itemLimit=25, TModule *m=0)
static void Restrict(tchar(TBuffer::*field)[N], TMemComboBox &c)
static void Restrict(TComboBoxData TBuffer::*field, TMemComboBox &c)
static TStatic & Create(tchar(TBuffer::*)[N], TWindow *p, int id, uint textLimit=0, TModule *m=0)
static void Restrict(tstring TBuffer::*field, TStatic &c)
static void Restrict(tchar(TBuffer::*field)[N], TStatic &c)
static TStatic & Create(tstring TBuffer::*, TWindow *p, int id, uint textLimit=0, TModule *m=0)
Provides a customization hook for binding and creating controls.
Generic binder implementation; restricts the field type for the given control type.
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6, TArg7 a7)
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5)
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id)
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id, TArg1 a1)
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6)
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id, TArg1 a1, TArg2 a2)
static void Restrict(TFieldType TBuffer::*, TControlType &)
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id, TArg1 a1, TArg2 a2, TArg3 a3)
static TControlType & Create(TFieldType TBuffer::*, TWindow *p, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4)
TXFieldConflict(TWindow &c)
TXMeddlingValidator(TEdit &c)
TXPolygamousControl(TWindow &c)
TXUnboundControl(TWindow &c)
void AssignField(TWindow &, size_t offset, size_t size)
Stores the field details and enables transfer for the given control.
TTransferBufferWindowBase()
Initializes the private implementation.
virtual uint Transfer(void *buffer, TTransferDirection direction)
TWindow override Dispatches to all the children.
virtual void TransferData(TTransferDirection direction)
TWindow override Initiates the transfer of the children data to or from the transfer buffer.
Provides the type-safe interface needed to set up a safe transfer buffer.
TControlType & Bind(TFieldType TBuffer::*field, int id, TArg1 a1)
Overload; forwards extra constructor arguments to Create.
TControlType & Bind(TFieldType TBuffer::*field, int id, TArg1 a1, TArg2 a2, TArg3 a3)
Overload; forwards extra constructor arguments to Create.
TControlType & Bind(TFieldType TBuffer::*field, TControlType &c)
Maps the given control to the given field.
TBuffer TTransferBuffer
The template argument type.
TControlType & Bind(TFieldType TBuffer::*field, int id, TArg1 a1, TArg2 a2)
Overload; forwards extra constructor arguments to Create.
TControlType & Bind(TFieldType TBuffer::*field, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4)
Overload; forwards extra constructor arguments to Create.
TControlType & Bind(TFieldType TBuffer::*field, int id)
Creates a new control of the specified type by passing along the given arguments, then maps the given...
TControlType & Bind(TFieldType TBuffer::*field, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6, TArg7 a7)
Overload; forwards extra constructor arguments to Create.
TControlType & Bind(TFieldType TBuffer::*field, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5)
Overload; forwards extra constructor arguments to Create.
TControlType & Bind(TFieldType TBuffer::*field, int id, TArg1 a1, TArg2 a2, TArg3 a3, TArg4 a4, TArg5 a5, TArg6 a6)
Overload; forwards extra constructor arguments to Create.
void SetTransferBuffer(TBuffer *b)
Hides the unsafe version in TWindow.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
void SetTransferBuffer(void *transferBuffer, uint size)
Sets TransferBuffer and TransferBufferSize.
Definition of class TComboBoxEx.
Definition of class TComboBox and TComboBoxData the base class for all combobox controls.
Definition of class TDateTimePicker.
Definition of class TEdit.
#define _OBJ_FULLTYPENAME(obj)
TEdit(TWindow *parent, int id, LPCTSTR text, int x, int y, int w, int h, uint textLimit=0, bool multiline=false, TModule *=nullptr)
Constructs an edit control object with a parent window (parent).
TXOwl(const tstring &msg, uint resId=0)
An OWL exception with a given message for displaying and an unsigned Id that can be used for identifi...
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Definition of class THotKey.
Definition of class TListBox and TlistBoxData.
Class definition for TMemComboBox (TComboBox).
Definition of class TMonthCalendar.
Object Windows Library (OWLNext Core).
tstring GetFullTypeName(T *w)
Helper; returns the type of a window as an tstring.
TControlType & RestrictCharArray(tchar(TBuffer::*)[N], TControlType &c)
Helper for char buffers; restricts the field type to a char array type of the right size.
Definition of class TRadioButton.
Definition of classes TSlider & TVSlider.
Definition of class TStatic, the class for static controls and base for any control that manages simp...
Base window class TWindow definition, including HWND encapsulation.