OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
commdial.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of Common Dialog abstract base class
7//----------------------------------------------------------------------------
8#include <owl/pch.h>
9#include <owl/commdial.h>
10#include <owl/applicat.h>
11
12#if defined(__BORLANDC__)
13# pragma option -w-ccc // Disable "Condition is always true/false"
14#endif
15
16namespace owl {
17
18// Diagnostic group for Common Dialog
21
24 EV_COMMAND(IDOK, CmOkCancel),
25 EV_COMMAND(IDCANCEL, CmOkCancel),
27
28//
29/// Invokes a TWindow constructor, passing the parent window parent, and constructs
30/// a common dialog box that you can modify to suit your specifications. You can
31/// indicate the module ID (module) and window caption (title), which otherwise
32/// default to 0 and blank, respectively.
33//
36 TModule* module)
37:
38 TDialog(parent, 0, module),
39 CDTitle(title ? title : _T(""))
40{
41 TRACEX(OwlCommDialog, OWL_CDLEVEL, "TCommonDialog constructed @" << (void*)this);
42}
43
44//
45/// String-aware overload
46//
48 : TDialog(parent, title.c_str(), module),
49 CDTitle(title)
50{
51 TRACEX(OwlCommDialog, OWL_CDLEVEL, "TCommonDialog constructed @" << (void*)this);
52}
53
54//
55/// Generate message in diagnostic libraries.
56//
58{
59 TRACEX(OwlCommDialog, OWL_CDLEVEL, "TCommonDialog destructed @" << (void*)this);
60}
61
62//
63/// Assigns the caption of the dialog box to CDTitle if CDTitle is non-blank.
64///
65/// Override virtual to set the caption.
66//
67void
69{
70 TRACEX(OwlCommDialog, 1, "TCommonDialog::SetupWindow() @" << (void*)this);
71
73 if (!CDTitle.empty())
74 SetCaption(CDTitle);
75}
76
77//
78/// Default handler for a modeless common dialog.
79/// Wrong usage if here.
80//
83{
84 PRECONDITIONX(false, _T("Wrong usage for a modal common dialog. Use Execute() instead."));
85 return nullptr;
86}
87
88//
89/// Default handler for a modal common dialog.
90/// Wrong usage if here.
91//
92/// Called by Execute, DoExecute executes a modal dialog box. If the dialog box
93/// execution is canceled or unsuccessful, DoExecute returns IDCANCEL.
94//
96{
97 TRACEX(OwlCommDialog, 0, "Wrong usage for a modeless common dialog. Use Create() instead.");
98 return IDCANCEL;
99}
100
101} // OWL namespace
102/* ========================================================================== */
Definition of class TApplication.
#define PRECONDITIONX(condition, message)
Definition checks.h:231
#define TRACEX(group, level, message)
Definition checks.h:263
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)
Definition checks.h:429
Derived from TDialog, TCommonDialog is the abstract base class for TCommonDialog objects.
Definition commdial.h:62
TCommonDialog(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Invokes a TWindow constructor, passing the parent window parent, and constructs a common dialog box t...
Definition commdial.cpp:34
auto PerformCreate() -> THandle override
Default handler for a modeless common dialog.
Definition commdial.cpp:82
auto DoExecute() -> int override
Default handler for a modal common dialog.
Definition commdial.cpp:95
~TCommonDialog() override
Generate message in diagnostic libraries.
Definition commdial.cpp:57
void SetupWindow() override
Assigns the caption of the dialog box to CDTitle if CDTitle is non-blank.
Definition commdial.cpp:68
Typically used to obtain information from a user, a dialog box is a window inside of which other cont...
Definition dialog.h:85
void SetupWindow() override
Overrides the virtual function defined in TWindow.
Definition dialog.cpp:825
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
void SetCaption(LPCTSTR title)
Copies title to an allocated string pointed to by title.
Definition window.cpp:3410
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
Definition of Common Dialog abstract base class.
#define _T(x)
Definition cygwin.h:51
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition eventhan.h:492
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
OWL_DIAGINFO
Definition animctrl.cpp:14
END_RESPONSE_TABLE
Definition button.cpp:26
std::string tstring
Definition defs.h:79
EV_WM_CLOSE
Definition commdial.cpp:23
#define OWL_CDLEVEL
Definition defs.h:171
#define OWL_INI
Definition defs.h:170
#define EV_COMMAND(id, method)
Response table entry for a menu/accelerator/push button message.
Definition windowev.h:171