16#if defined(OWL_SUPPORT_BWCC)
20#include <owl/winres.rh>
57#define dfTmplMask 0x0f0000
58#define dfTmplDelMask 0x0a0000
107 Init(parent,
nullptr, module);
126 Init(parent,
nullptr, module);
145 Init(parent,
nullptr, module);
158#if defined(OWL5_COMPAT)
247#if defined(OWL_SUPPORT_BWCC)
274#if defined(OWL_SUPPORT_BWCC)
277 const auto b =
a->BWCCEnabled();
376 : Current{
ce}, Previous{
ce}
391 return Current.
Win == Previous.
Win &&
412#if defined(OWL_SUPPORT_CTL3D)
455 if (!dlg)
return false;
463 TRACEX(
OwlWin, 0,
_T(
"TDialog::StdDlgProc: Suspending unhandled exception for message: ") <<
msg);
494#if defined(OWL5_COMPAT)
599#if defined(OWL5_COMPAT)
643 WARN(
r >
INT_MAX,
_T(
"TDialog::DoExecute: EndDialog 64-bit result truncated to 32 bits."));
644 return static_cast<int>(
r);
675 if (!
hDat)
return false;
677 if (!
res)
return false;
680 if (!
res)
return true;
704 if (
res[
len - 1] !=
'\0')
return false;
713 if (
res[
len - 1] !=
'\0')
return false;
722 if (
res[
len - 1] !=
'\0')
return false;
728 if (
r == -1)
return false;
737 TRACE(
_T(
"Corrupt OWL_DLGINIT_COMMAND in DLGINIT. Expected data size 0, but size was ") <<
len <<
_T(
".\n"));
747 IFDIAG(
static const tchar error[] =
_T(
"Either correct the command in the control title, or remove the OWL_DLGINIT_COMMAND message in DLGINIT.");)
750 in.setf(ios::skipws);
756 TRACE(
_T(
"PerformDlgInit expected {<command>} in the title of control #") <<
idc
760 if (
cmd ==
_T(
"LoadString"))
767 TRACE(
_T(
"PerformDlgInit found a syntax error in the title of control #") <<
idc
775 TRACE(
_T(
"PerformDlgInit didn't recognize the command in the title of control #") <<
idc
783 WARNX(
OwlMsg,
true, 1,
_T(
"Default DLGINIT item handler sent message #") <<
msg <<
_T(
" to control #") <<
idc <<
_T(
" with no error handling."));
827#if defined(OWL_SUPPORT_CTL3D)
893 w.EnableAutoCreate();
1020 if (!
r)
throw TXOwl{
_T(
"TDialog::MapDialogRectToScreen failed")};
1049#if OWL_PERSISTENT_STREAMS
1059 is >> (
TResId&)GetObject()->DialogAttr.Name;
1063 isModal ? GetObject()->SetFlag(dfIsModal) : GetObject()->ClearFlag(dfIsModal);
1072TDialog::Streamer::Write(opstream&
os)
const
1076 os << TResId(GetObject()->DialogAttr.Name);
1077 os << (
bool)GetObject()->IsFlagSet(dfIsModal);
Definition of class TAppDictionary.
Definition of class TApplication.
Legacy support for Borland Windows Custom Controls (BWCC)
#define WARNX(group, condition, level, message)
#define WARN(condition, message)
#define PRECONDITION(condition)
#define DIAG_DECLARE_GROUP(group)
#define TRACEX(group, level, message)
TApplication * GetApplication(uint pid=0)
Looks up and returns the application associated with a given process ID.
void ResumeThrow()
Rethrows the suspended exception stored by a previous call to SuspendThrow.
void SuspendThrow(std::exception_ptr)
Stores the given exception so that it can be rethrown later by a call to ResumeThrow.
void Condemn(TWindow *win)
Condemns the given window to be deleted the at the next available safe time.
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
virtual void Enable(bool enable=true)
Enables or disables the command sender.
HWND GetReceiver() const
Returns the handle of the window that this enabler was destined for.
A TCommandEnabler for child controls in a dialog.
void SetCheck(int check)
Use with only buttons!
void Enable(bool enable=true)
Enables/disables the control.
void SetText(LPCTSTR text)
Set the text of the control.
TControlEnabler(uint id, HWND hWndReceiver=0)
Constructor. Initializes the base class.
Typically used to obtain information from a user, a dialog box is a window inside of which other cont...
void Init(TWindow *parent, LPCTSTR title, TModule *module)
Common initialization in constructor.
void SetControlFocus(HWND hwnd)
Sets focus within a dialog to a specific control.
void CloseWindow(int retValue=IDCANCEL) override
Overrides the virtual function defined by TWindow and conditionally shuts down the dialog box.
virtual bool EvInitDialog(HWND hWndFocus)
Virtual handler for WM_INITDIALOG message, called from DialogFunction()
void GetWindowClass(WNDCLASS &) override
Overrides the virtual function defined in TWindow.
auto Create() -> bool override
Creates a modeless dialog box interface element associated with the TDialog object.
auto PreProcessMsg(MSG &) -> bool override
Preprocess posted messages to provide various accelerator translations.
THow
Enumeration to be used when invoking the 'SetControlFocus' method.
@ Next
Set focus to the next sibling.
bool PerformDlgInit()
Initialize dialog controls with contents of DLGINIT resources, if any.
bool SetMsgResult(TResult result)
Sets the dialog procedure message result (DWLP_MSGRESULT) and returns true.
auto Execute() -> int override
Creates and executes a modal dialog box interface element associated with the TDialog object.
void EvClose()
Message response function for WM_CLOSE by unconditionally closing the window.
void EvReposition()
Reposition the dialog so that it fits within the desktop area.
auto PerformCreate() -> THandle override
Called from Create to perform the final step in creating an Windows interface element to be associate...
void CmOk()
Responds to a click on the dialog box's OK button with the identifier IDOK.
void SetupWindow() override
Overrides the virtual function defined in TWindow.
TDialogAttr DialogAttr
New name.
uint EvGetDefId()
Return the default Id.
~TDialog() override
Destructor for a TDialog.
void Destroy(int retValue=IDCANCEL) override
Destroys the interface element associated with the TDialog object.
virtual INT_PTR DialogFunction(TMsgId, TParam1, TParam2)
Override this to process messages within the dialog function.
bool EvSetDefId(int id)
Set the pushbutton with identifier id the default button for the dialog.
void RegisterChildObjects()
Registers WINDOW class(es) of Children.
auto GetWindowClassName() -> TWindowClassName override
Overrides the virtual function defined in TWindow and returns the name of the dialog box's default Wi...
void EvPaint()
Handler for WM_PAINT.
void CmCancel()
Responds to an incoming notification message from a button with an Id equal to IDCANCEL.
static INT_PTR CALLBACK StdDlgProc(HWND, UINT, WPARAM, LPARAM) noexcept
Callback procs for hooking TDialog to native window.
auto DoExecute() -> int override
Overriden TWindow virtual to modaly execute this dialog & return the result.
auto MapDialogRectToScreen(const TRect &) const -> TRect
Returns the rect, specified in screen coordinates, corresponding to the given rect,...
TDialog(TWindow *parent, TResId resId, TModule *module=nullptr)
Constructor for a TDialog object.
auto IdleAction(long idleCount) -> bool override
Handle enabling and disabling of child controls.
A nested class, TEventInfo provides specific information about the type of message sent,...
virtual bool Find(TEventInfo &info, TEqualOperator op=0)
Searches the list of response table entries looking for a match.
TResult Dispatch(TEventInfo &info, TParam1, TParam2=0)
Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handl...
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TRect is a mathematical class derived from tagRect.
bool IsString() const
Returns true if this resource identifier encodes a string pointer.
static BOOL GetClassInfo(HINSTANCE, LPCTSTR, LPWNDCLASS)
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
HWND GetParentH() const
Return the handle of the parent.
TCurrentEvent & GetCurrentEvent()
Returns the current event to be processed in the message queue.
void SetDlgItemText(int childId, LPCTSTR text) const
Sets the title or text of a control in a dialog box.
TApplication * GetApplication() const
Gets a pointer to the TApplication object associated with this.
void GetHWndState(bool forceStyleSync=false)
Copies the style, coordinate, and the resource id (but not the title) from the existing HWnd into the...
virtual bool PreProcessMsg(MSG &msg)
Called from TApplication::ProcessAppMsg() to give the window an opportunity to perform preprocessing ...
HWND GetWindow(uint cmd) const
Returns the handle of the window that has the indicated relationship to this window.
auto GetChildren()
Returns a TWindow::TChildrenRange that can be iterated by standard means.
virtual void Destroy(int retVal=0)
Destroys an MS-Windows element associated with the TWindow.
TWindow * GetParent() const
Retrieves the OWL object of the parent window. If none exists, returns 0.
virtual int DoExecute()
Do actual modal execution using the Begin/End Modal support of TApplication.
void GetWindowTextTitle()
Updates the TWindow internal caption (Title) from the current window's caption.
void DisableAutoCreate()
Disables the feature that allows an associated child window interface element to be created and displ...
void PerformSetupAndTransfer()
Ensures that the window is fully set up; then transfers data into the window.
void SetHandle(THandle)
Sets the window handle in a derived class.
long GetWindowLong(int index) const
Retrieves information about the window depending on the value stored in index.
void Init(TWindow *parent, LPCTSTR title, TModule *module)
Normal initialization of a default constructed TWindow.
void SetFlag(uint mask)
Sets the specified TWindow wfXxxx constant flags (for example wfAlias, wfTransfer,...
TWindow * GetParentO() const
Return the OWL's parent for this window.
TModule * GetModule() const
Returns a pointer to the module object.
void LoadAcceleratorTable()
Loads a handle to the window's accelerator table specified in the TWindowAttr structure (Attr....
void RouteCommandEnable(HWND hInitCmdTarget, TCommandEnabler &ce)
Walks the chain of windows from the initial target window to this window.
bool IsWindow() const
Returns true if an HWND is being used.
void SetCaption(LPCTSTR title)
Copies title to an allocated string pointed to by title.
virtual bool IdleAction(long idleCount)
Called when no messages are waiting to be processed, IdleAction performs idle processing as long as t...
TResult SendDlgItemMessage(int childId, TMsgId, TParam1=0, TParam2=0)
Sends a message (msg) to the control specified in childId.
void SubclassWindowFunction()
Installs the instance thunk as the WindowProc and saves the old window function in DefaultProc.
LPCTSTR GetCaption() const
Returns the Title member of TWindow.
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
void ClearFlag(uint mask)
Clears the specified TWindow wfXxxx constant flags (for example wfAlias, wfTransfer,...
virtual void TransferData(TTransferDirection direction)
Transfers data between the TWindow's data buffer and the child windows in its ChildList (data is not ...
virtual bool Register()
Registers the Windows registration class of this window, if this window is not already registered.
int GetDlgItemText(int childId, TCHAR *text, int maxValue) const
Retrieves the text of a control specified by childId.
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
virtual void SetupWindow()
Performs setup following creation of an associated MS-Windows window.
bool IsFlagSet(uint mask)
Returns the state of the bit flag in Attr.Flags whose mask is supplied.
HWND THandle
TWindow encapsulates an HWND.
HWND GetHandle() const
Returns the handle of the window.
virtual void CloseWindow(int retVal=0)
Determines if it is okay to close a window before actually closing the window.
TXOwl is root class of the ObjectWindows exception hierarchy.
A nested class, TXWindow describes an exception that results from trying to create an invalid window.
static void Raise(TWindow *win=nullptr, uint resourceId=IDS_INVALIDWINDOW)
Creates the TXWindow exception and throws it.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition of classes for CommonControl encapsulation.
Definition of TDialog class and TDialogAttr struct.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
void ReadBaseObject(Base *base, ipstream &in)
#define IMPLEMENT_STREAMABLE1(cls, base1)
void WriteBaseObject(Base *base, opstream &out)
THandle GetHandle() const
Return the instance handle of the library module represented by the TModule obect.
auto GetClassInfo(TWindowClassName, WNDCLASS *wndclass) const -> bool
Retrieves information about the given window class.
HGLOBAL LoadResource(HRSRC hRsrc) const
Wrapper for the Windows API.
HRSRC FindResource(TResId id, TResId type) const
Wrapper for the Windows API to find a particular resource.
HRSRC FindResourceEx(TResId id, TResId type, TLangId langId=LangNeutral) const
Wrapper for the Windows API to find a particular resource.
@ wfDeleteOnClose
Window is condemned on EvClose.
@ wfAlias
TWindow is an alias to a preexisting HWND.
@ wfFromResource
Handle comes from HWND created from resource.
@ wfFullyCreated
Window is fully created & not being destroyed.
@ tdGetData
Get data from the window into the buffer.
char * strnewdup(const char *s, size_t minAllocSize=0)
Object Windows Library (OWLNext Core)
UINT TMsgId
Message ID type.
TWindow * GetWindowPtr(HWND, const TApplication *)
Raw function to retrieve a TWindow pointer given an HWND from the a given app, or any app (app==0).
LPARAM TParam2
Second parameter type.
WPARAM TParam1
First parameter type.
std::istringstream tistringstream
TAppDictionary & OWLGetAppDictionary()
Global exported TAppDictionary in Owl.
LRESULT TResult
Result type.
Definition of class TString, a flexible universal string envelope class.
Current event structure for windows events.
TMsgId Message
Message ID.
TWindow * Win
Window that message was sent/dispatched to.
TParam1 Param1
First parameter (WPARAM)
TParam2 Param2
Second parameter (LPARAM)
LPARAM Param
Param is used to pass initialization data to the dialog box when it is constructed.
TCHAR * Name
Name holds the identifier, which can be either a string or an integer resource identifier,...
#define EV_COMMAND(id, method)
Response table entry for a menu/accelerator/push button message.