OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
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
84
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//
135inline bool TRichEditView::SetDocTitle(LPCTSTR docname, int index) {
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
TRichEdit(TWindow *parent, int id, LPCTSTR text, int x, int y, int w, int h, LPCTSTR fileName=nullptr, TModule *module=nullptr)
Constructor for a TRichEdit object.
Definition richedit.cpp:707
static LPCTSTR StaticName()
Definition richedv.h:120
void CeParagraphBullet(TCommandEnabler &)
Definition richedv.cpp:505
void CeFormatItalic(TCommandEnabler &)
Definition richedv.cpp:369
TRichEditView(TDocument &doc, TWindow *parent=0)
Definition richedv.cpp:76
void CeParagraphLeft(TCommandEnabler &)
Definition richedv.cpp:469
bool VnDocClosed(int omode)
Definition richedv.cpp:106
auto GetViewName() -> LPCTSTR override
Definition richedv.h:125
void CmFormatUnderline()
Definition richedv.cpp:327
void CmFileSaveAs()
Definition richedv.h:99
void CmFormatStrikeout()
Definition richedv.cpp:336
auto Create() -> bool override
< String-aware overload
Definition richedv.cpp:149
DECLARE_RESPONSE_TABLE(TRichEditView)
void CeFormatColor(TCommandEnabler &)
Definition richedv.cpp:538
void CeFormatFont(TCommandEnabler &)
Definition richedv.cpp:346
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
Definition richedv.h:135
auto GetWindow() -> TWindow *override
Definition richedv.h:130
void SetupWindow() override
Definition richedv.cpp:222
auto CanClear() -> bool override
Definition richedv.cpp:256
bool VnCommit(bool force)
Definition richedv.cpp:173
void CeFormatBold(TCommandEnabler &)
Definition richedv.cpp:354
void CeFormatUnderline(TCommandEnabler &)
Definition richedv.cpp:385
void CmParagraphRight()
Definition richedv.cpp:442
virtual bool LoadData()
Definition richedv.cpp:120
void CeFormatStrikeout(TCommandEnabler &)
Definition richedv.cpp:401
void CeParagraphCenter(TCommandEnabler &)
Definition richedv.cpp:481
bool VnRevert(bool clear)
Definition richedv.cpp:210
auto CanClose() -> bool override
Definition richedv.h:140
void CmParagraphBullet()
Definition richedv.cpp:454
void CeParagraphRight(TCommandEnabler &)
Definition richedv.cpp:493
void CeFormatBkColor(TCommandEnabler &)
Definition richedv.cpp:566
void CmFileSave()
Definition richedv.h:98
void CmParagraphCenter()
Definition richedv.cpp:430
bool VnIsWindow(HWND hWnd)
Definition richedv.cpp:96
virtual bool SetDocTitle(LPCTSTR docname, int index)
Stores the document title.
Definition docview.h:1071
friend class TDocument
needs access to NextView
Definition docview.h:477
TView(TDocument &doc)
Constructs a TView object of the document associated with the view.
Definition view.cpp:34
virtual LPCTSTR GetViewName()=0
Pure virtual function that returns 0.
virtual TWindow * GetWindow()
Returns the TWindow instance associated with the view, or 0 if no view exists.
Definition docview.h:1049
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
TApplication * GetApplication() const
Gets a pointer to the TApplication object associated with this.
Definition window.h:1855
virtual bool SetDocTitle(LPCTSTR docname, int index)
Default behavior for updating document title is to pass it to parent frame.
Definition window.cpp:778
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
Definition window.cpp:2795
#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
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.