OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
editview.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 class TEditView
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_EDITVIEW_H)
10#define OWL_EDITVIEW_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/docmanag.h>
18#include <owl/editsear.h>
19
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25/// \addtogroup docview
26/// @{
27/// \class TEditView
28// ~~~~~ ~~~~~~~~~
29/// Derived from TView and TEditSearch, TEditView provides a view wrapper for the
30/// ObjectWindows text edit class (TEdit). A streamable class, TEditView includes
31/// several event-handling functions that handle messages between a document and its
32/// views.
33//
34class _OWLCLASS TEditView : public TEditSearch, public TView {
35 public:
36 TEditView(TDocument& doc, TWindow* parent = 0);
37 ~TEditView() override;
38 static LPCTSTR StaticName(); /// put in resource
39
40 // Overridden virtuals from TView
41 //
42 auto GetViewName() -> LPCTSTR override;
43 auto GetWindow() -> TWindow* override;
44 auto SetDocTitle(LPCTSTR docname, int index) -> bool override;
45 using TView::SetDocTitle; ///< String-aware overload
46
47 // Overridden virtuals from TWindow
48 //
49 auto Create() -> bool override;
50 auto CanClose() -> bool override;
51
52 protected:
53 bool LoadData();
54
55 long GetOrigin() const;
56 void SetOrigin(long origin);
57
58 // message response functions
59 //
60 void EvNCDestroy();
61 bool VnCommit(bool force);
62 bool VnRevert(bool clear);
63 bool VnIsWindow(HWND hWnd);
64 bool VnIsDirty() ;
65 bool VnDocClosed(int omode);
66
68/// Holds the file position at the beginning of the display.
69 long Origin;
70
73};
74/// @}
75
77
78#include <owl/posclass.h>
79
80
81//----------------------------------------------------------------------------
82// Inline implementation
83//
84
85//
86/// Returns "Edit View", the descriptive name of the class for the ViewSelect menu.
87//
89 return _T("Edit View");
90} // put in resource
91
92//
93/// Overrides TView::GetViewName and returns the descriptive name of the class
94/// ("StaticName").
95//
97 return StaticName();
98}
99
100//
101/// Overrides TView::GetWindow and returns this as a TWindow.
102//
104 return static_cast<TWindow*>(this);
105}
106
107//
108/// Overrides TView::SetDocTitle and forwards the title to its base class,
109/// TEditSearch. index is the number of the view displayed in the caption bar.
110/// docname is the name of the document displayed in the view window.
111//
112inline bool TEditView::SetDocTitle(LPCTSTR docname, int index) {
113 return TEditSearch::SetDocTitle(docname, index);
114}
115
116//
117/// Returns a nonzero value if the view can be closed.
118//
120 return TEditSearch::CanClose() &&
121 (Doc->NextView(this) ||
122 Doc->NextView(nullptr) != this ||
123 Doc->CanClose());
124}
125
126//
127/// Returns the position of the stream buffer at which the edit buffer is stored.
128//
129inline long TEditView::GetOrigin() const {
130 return Origin;
131}
132
133//
134/// Sets the position of the stream buffer that the edit buffer is stored.
135//
136inline void TEditView::SetOrigin(long origin) {
137 Origin = origin;
138}
139
140//
141/// Returns a nonzero value if changes made to the data in the view have not been
142/// saved to the document; otherwise, it returns 0.
143//
144inline bool TEditView::VnIsDirty() {
146}
147
148
149} // OWL namespace
150
151
152#endif // OWL_EDITVIEW_H
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
Definition docview.h:187
TEditSearch is an edit control that responds to Find, Replace, and FindNext menu commands.
Definition editsear.h:35
Derived from TView and TEditSearch, TEditView provides a view wrapper for the ObjectWindows text edit...
Definition editview.h:34
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
Overrides TView::SetDocTitle and forwards the title to its base class, TEditSearch.
Definition editview.h:112
long GetOrigin() const
Returns the position of the stream buffer at which the edit buffer is stored.
Definition editview.h:129
auto GetViewName() -> LPCTSTR override
put in resource
Definition editview.h:96
static LPCTSTR StaticName()
Returns "Edit View", the descriptive name of the class for the ViewSelect menu.
Definition editview.h:88
auto CanClose() -> bool override
Returns a nonzero value if the view can be closed.
Definition editview.h:119
bool VnIsDirty()
Returns a nonzero value if changes made to the data in the view have not been saved to the document; ...
Definition editview.h:144
void SetOrigin(long origin)
Sets the position of the stream buffer that the edit buffer is stored.
Definition editview.h:136
auto GetWindow() -> TWindow *override
Overrides TView::GetWindow and returns this as a TWindow.
Definition editview.h:103
Abstract base class for view access from document.
Definition docview.h:397
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
virtual bool SetDocTitle(LPCTSTR docname, int index)
Default behavior for updating document title is to pass it to parent frame.
Definition window.cpp:778
#define _T(x)
Definition cygwin.h:51
Definition of class TDocManager.
Definition of class TEditSearch, an edit control that responds to Find, Replace and FindNext menu com...
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
auto CanClose() -> bool override
Checks to see if all child windows can be closed before closing the current window.
Definition edit.cpp:432
bool IsModified() const
Returns true if the user has changed the text in the edit control.
Definition edit.h:418
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338