OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
richedv.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1998 by Bidus Yura, All Rights Reserved
4//
5/// \file
6/// Definition of class TRichEditView
7/// Based on Russell Morris class.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_RICHEDV_H)
11#define OWL_RICHEDV_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/docmanag.h>
19#include <owl/richedit.h>
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25/// \addtogroup newctrl
26/// @{
27/// \class TRichEditView
28// ~~~~~ ~~~~~~~~~~~~~
29class _OWLCLASS TRichEditView : public TRichEdit, public TView {
30 public:
31 TRichEditView(TDocument& doc, TWindow* parent = 0);
32 ~TRichEditView() override;
33
34 static LPCTSTR StaticName(); // put in resource
35
36 // Overridden virtuals from TView
37 //
38 auto GetViewName() -> LPCTSTR override;
39 auto GetWindow() -> TWindow* override;
40 auto SetDocTitle(LPCTSTR docname, int index) -> bool override;
41 using TView::SetDocTitle; ///< String-aware overload
42
43 // Overridden virtuals from TWindow
44 //
45 auto Create() -> bool override;
46 auto CanClose() -> bool override;
47
48 protected:
49 virtual bool LoadData();
50 void SetupWindow() override;
51
52 // Doc/View functions
53 //
54 bool VnCommit(bool force);
55 bool VnRevert(bool clear);
56 bool VnIsWindow(HWND hWnd);
57 bool VnIsDirty() ;
58 bool VnDocClosed(int omode);
59
60
61 // Menu response functions
62 //
63 void CmFormatFont();
64 void CmFormatColor();
65 void CmFormatBkColor();
66
67 void CmParagraphLeft();
68 void CmParagraphCenter();
69 void CmParagraphRight();
70 void CmParagraphBullet();
71
72 void CmFormatBold();
73 void CmFormatItalic();
74 void CmFormatUnderline();
75 void CmFormatStrikeout();
76
77 void CeFormatFont(TCommandEnabler&);
78 void CeFormatColor(TCommandEnabler&);
79 void CeFormatBkColor(TCommandEnabler&);
80 void CeFormatBold(TCommandEnabler&);
81 void CeFormatItalic(TCommandEnabler&);
82 void CeFormatUnderline(TCommandEnabler&);
83 void CeFormatStrikeout(TCommandEnabler&);
84
85 void CeParagraphLeft(TCommandEnabler&);
86 void CeParagraphCenter(TCommandEnabler&);
87 void CeParagraphRight(TCommandEnabler&);
88 void CeParagraphBullet(TCommandEnabler&);
89
90 // Overridden TEditFile functions
91 //
92 auto CanClear() -> bool override;
93
94 // Override TEditFile open/save functions to let doc manager handle
95 // all that stuff...
96 //
97 //void CmFileOpen() { GetApplication()->GetDocManager()->CmFileOpen(); }
98 void CmFileSave() { GetApplication()->GetDocManager()->CmFileSave(); }
99 void CmFileSaveAs() { GetApplication()->GetDocManager()->CmFileSaveAs();}
100 void CmFileClose() { GetApplication()->GetDocManager()->CmFileClose(); }
101 //void CmFileNew() { GetApplication()->GetDocManager()->CmFileNew(); }
102
103
106};
107
109
110/// @}
111
112#include <owl/posclass.h>
113
114
115//----------------------------------------------------------------------------
116// Inline implementation
117//
118
119//
121 return _T("RichEdit View");
122} // put in resource
123
124//
126 return StaticName();
127}
128
129//
131 return static_cast<TWindow*>(this);
132}
133
134//
136 return TRichEdit::SetDocTitle(docname, index);
137}
138
139//
141 return TRichEdit::CanClose() &&
142 (Doc->NextView(this) ||
143 Doc->NextView(nullptr) != this ||
144 Doc->CanClose());
145}
146
147
148//
150 return TRichEdit::IsModified();
151}
152
153
154} // OWL namespace
155
156#endif // OWL_EDITVIEW_H
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
Definition window.h:209
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
Definition docview.h:187
TRichEdit encapsulates a rich edit control, a window in which a user can enter, edit and format text.
Definition richedit.h:261
static LPCTSTR StaticName()
Definition richedv.h:120
auto GetViewName() -> LPCTSTR override
Definition richedv.h:125
void CmFileSaveAs()
Definition richedv.h:99
DECLARE_RESPONSE_TABLE(TRichEditView)
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
Definition richedv.h:135
auto GetWindow() -> TWindow *override
Definition richedv.h:130
auto CanClose() -> bool override
Definition richedv.h:140
void CmFileSave()
Definition richedv.h:98
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.
#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 _OWLCLASS
Definition defs.h:338
Definition of class TRichEdit.