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
commview.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// OWL NExt
4// Copyright � 1999 by Yura Bidus . All Rights Reserved.
5//
6/// \file
7/// Class definition for TTreeViewCtrlView (TTreeViewCtrl).
8/// Class definition for TListViewCtrlView (TListViewCtrl).
9//
10//------------------------------------------------------------------------------
11
12#if !defined(OWL_COMMVIEW_H) // Sentry, use file only if it's not already included.
13#define OWL_COMMVIEW_H
14
15#include <owl/private/defs.h>
16#if defined(BI_HAS_PRAGMA_ONCE)
17# pragma once
18#endif
19
20#include <owl/docview.h>
21#include <owl/treeviewctrl.h>
22#include <owl/listviewctrl.h>
23
24
25namespace owl {
26
27#include <owl/preclass.h>
28
29/// \addtogroup docview
30/// @{
31/// \class TTreeViewCtrlView
32// ~~~~~ ~~~~~~~~~~~~~~~
33//
34//
36 public:
37 TTreeViewCtrlView(TDocument& doc, TWindow* parent = 0, int id = -1);
38 virtual ~TTreeViewCtrlView() override;
39
40 static LPCTSTR StaticName(); // put in resource
41
42 // Override virtuals from TWindow
43 //
44 auto CanClose() -> bool override;
45
46 // Override virtuals from TView
47 //
48 auto GetViewName() -> LPCTSTR override;
49 auto GetWindow() -> TWindow* override;
50 auto SetDocTitle(LPCTSTR docname, int index) -> bool override;
51
52 private:
53 // Event handlers
54 //
55 bool VnIsWindow(HWND hWnd);
56
58};
59
61
62//
63/// \class TListViewCtrlView
64// ~~~~~ ~~~~~~~~~~~~~~~
65//
66//
67
69 public:
70 TListViewCtrlView(TDocument& doc, TWindow* parent = 0, int id = -1);
71 virtual ~TListViewCtrlView();
72
73 static LPCTSTR StaticName(); // put in resource
74
75 // Override virtuals from TWindow
76 //
77 auto CanClose() -> bool override;
78
79 // Override virtuals from TView
80 //
81 auto GetViewName() -> LPCTSTR override;
82 auto GetWindow() -> TWindow* override;
83 auto SetDocTitle(LPCTSTR docname, int index) -> bool override;
84
85 private:
86 // Event handlers
87 //
88 bool VnIsWindow(HWND hWnd);
89
91};
92/// @}
93
95
96
97#include <owl/posclass.h>
98
99//
100// Inlines
101//
102
103//
104/// \class TTreeViewCtrlView
105// ~~~~~ ~~~~~~~~~~~~~~~
109//
111{
112 return _T("TreeWindow View");
113}
114//
115// Only query document if this is the last view open to it.
116//
118{
119 return TTreeViewCtrl::CanClose() &&
120 (Doc->NextView(this) ||
121 Doc->NextView(nullptr) != this ||
122 Doc->CanClose());
123}
124//
126{
127 return StaticName();
128}
129//
131{
132 return static_cast<TWindow*>(this);
133}
134//
135/// Does a given HWND belong to this view? Yes if it is us, or a child of us
136//
137inline bool TTreeViewCtrlView::VnIsWindow(HWND hWnd)
138{
139 return hWnd == GetHandle() || IsChild(hWnd);
140}
141//
143{
144 return TTreeViewCtrl::SetDocTitle(docname, index);
145}
146
147//
148//
149/// \class TListViewCtrlView
150// ~~~~~ ~~~~~~~~~~~~~~~
154//
156{
157 return _T("ListWindow View");
158}
159//
160/// Only query document if this is the last view open to it.
161//
163{
164 return TListViewCtrl::CanClose() &&
165 (Doc->NextView(this) ||
166 Doc->NextView(nullptr) != this ||
167 Doc->CanClose());
168}
169//
171{
172 return StaticName();
173}
174//
176{
177 return static_cast<TWindow*>(this);
178}
179//
180/// Does a given HWND belong to this view? Yes if it is us, or a child of us
181//
182inline bool TListViewCtrlView::VnIsWindow(HWND hWnd)
183{
184 return hWnd == GetHandle() || IsChild(hWnd);
185}
186//
188{
189 return TListViewCtrl::SetDocTitle(docname, index);
190}
191//================================================================
192
193} // OWL namespace
194
195#endif // OWL_COMMVIEW_H sentry.
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
Definition docview.h:187
Encapsulates the ListView control, a window that displays a collection of items, each item consisting...
virtual ~TListViewCtrlView()
Definition commview.h:151
auto GetViewName() -> LPCTSTR override
Definition commview.h:170
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
Definition commview.h:187
auto CanClose() -> bool override
Only query document if this is the last view open to it.
Definition commview.h:162
static LPCTSTR StaticName()
Definition commview.h:155
auto GetWindow() -> TWindow *override
Definition commview.h:175
Encapsulates the TreeView common control.
auto CanClose() -> bool override
Definition commview.h:117
auto GetWindow() -> TWindow *override
Definition commview.h:130
virtual ~TTreeViewCtrlView() override
Definition commview.h:106
static LPCTSTR StaticName()
Definition commview.h:110
auto GetViewName() -> LPCTSTR override
Definition commview.h:125
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
Definition commview.h:142
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
bool IsChild(HWND hWnd) const
Returns true if the window is a child window or a descendant window of this window.
Definition window.h:3176
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
Definition window.cpp:2795
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
#define _T(x)
Definition cygwin.h:51
Definition of classes TDocument, TView, TWindowView, TStream, TInStream, TOutStream.
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
TTreeViewCtrlView TTreeWindowView
Definition commview.h:60
Definition of TListViewCtrl class.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
TListViewCtrlView TListWindowView
Definition commview.h:94
#define _OWLCLASS
Definition defs.h:338
Declares TTreeViewCtrl, TTreeNode, and TTvItem.