OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
commdial.h
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/// Definition of Common Dialog abstract base class
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_COMMDIAL_H)
10#define OWL_COMMDIAL_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/dialog.h>
18
19#if !defined(_INC_COMMDLG)
20# include <commdlg.h>
21#endif
22
23#include <cderr.h>
24
25
26namespace owl {
27
28#include <owl/preclass.h>
29
30
31/// \addtogroup commdlg
32/// @{
33/// \class TCommonDialog
34// ~~~~~ ~~~~~~~~~~~~~
35/// Derived from TDialog, TCommonDialog is the abstract base class for TCommonDialog
36/// objects. It provides the basic functionality for creating dialog boxes using the
37/// common dialog DLL. The ObjectWindows classes that inherit this common dialog
38/// functionality include
39/// - \c \b TChooseColorDialog - a modal dialog box that lets a user select
40/// colors for an application.
41/// - \c \b TChooseFontDialog - a modal dialog box that lets a user select
42/// fonts for an application.
43/// - \c \b TReplaceDialog a modeless dialog box that lets a user specify a
44/// text selection to replace.
45/// - \c \b TFindDialog a modeless dialog box that lets a user specify a text
46/// selection to find.
47/// - \c \b TFileOpenDialog - a modal dialog box that lets a user specify a
48/// file to open.
49/// - \c \b TFileSaveDialog - a modal dialog box that lets a user specify a
50/// file to save.
51/// - \c \b TPrintDialog - a modal dialog box that lets a user specify printer
52/// options.
53///
54/// Each common dialog class uses a nested class, TData, that stores the attributes
55/// and user-specified data. For example, the TChooseColorDialog::TData class stores
56/// the color attributes the user selects in response to a prompt in a common dialog
57/// box. In fact, to create a common dialog box, you construct a TData object first,
58/// then fill in the data members of the TData object before you even construct the
59/// common dialog box object. Finally, you either execute a modal dialog box or
60/// create a modeless dialog box.
61///
63 public:
64 TCommonDialog(TWindow* parent, LPCTSTR title = nullptr, TModule* module = nullptr);
65 TCommonDialog(TWindow* parent, const tstring& title, TModule* = nullptr);
66 ~TCommonDialog() override;
67
68 auto DoExecute() -> int override;
69
70 protected:
71 const tstring& GetCDTitle() const;
72
73 // Override virtual functions defined by class TWindow
74 //
75 auto PerformCreate() -> THandle override;
76 void SetupWindow() override;
77
78 // Default behavior inline for message response functions
79 //
80 void CmOkCancel(); //EV_COMMAND(IDOK or IDCANCEL
81 void EvClose(); //EV_CLOSE
82 void CmHelp(); //EV_COMMAND(pshHelp,
83
85 tstring CDTitle; ///< Stores the optional caption displayed in the common dialog box.
86
87 private:
89 TCommonDialog& operator=(const TCommonDialog&);
90
93};
94
95/// @}
96
97#include <owl/posclass.h>
98
99
100
101//----------------------------------------------------------------------------
102// Inline implementations
103//
104
105//
106/// Return the title from the common dialog.
107//
109{
110 return CDTitle;
111}
112
113//
114/// Responds to a click on the dialog box's OK or Cancel button by calling
115/// DefaultProcessing to let the common dialog DLL process the command.
116//
118{
120}
121
122//
123/// Responds to a WM_CLOSE message by calling DefaultProcessing to let the common
124/// dialog DLL process the command.
125//
127{
129}
130
131//
132/// Default handler for the pshHelp push button (the Help button in the dialog box).
133//
135{
137}
138
139} // OWL namespace
140
141
142#endif // OWL_COMMDIAL_H
Derived from TDialog, TCommonDialog is the abstract base class for TCommonDialog objects.
Definition commdial.h:62
void EvClose()
Responds to a WM_CLOSE message by calling DefaultProcessing to let the common dialog DLL process the ...
Definition commdial.h:126
const tstring & GetCDTitle() const
Return the title from the common dialog.
Definition commdial.h:108
void CmOkCancel()
Responds to a click on the dialog box's OK or Cancel button by calling DefaultProcessing to let the c...
Definition commdial.h:117
void CmHelp()
Default handler for the pshHelp push button (the Help button in the dialog box).
Definition commdial.h:134
Typically used to obtain information from a user, a dialog box is a window inside of which other cont...
Definition dialog.h:85
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
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
Definition window.cpp:852
Definition of TDialog class and TDialogAttr struct.
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
#define DECLARE_CASTABLE
Definition objstrm.h:1440
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
std::string tstring
Definition defs.h:79
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338