OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
listboxview.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1993, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TListBoxView
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_LISTBOXVIEW_H)
10#define OWL_LISTBOXVIEW_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/listbox.h>
19#include <owl/listboxview.rh>
20
21
22namespace owl {
23
24#include <owl/preclass.h>
25
26/// \addtogroup docview
27/// @{
28/// \class TListBoxView
29// ~~~~~ ~~~~~~~~~
30/// Provides views for list boxes.
31class _OWLCLASS TListBoxView : public TListBox, public TView {
32 public:
33 TListBoxView(TDocument& doc, TWindow* parent = 0);
34
35 // Overridden virtuals from TView
36 //
37 auto GetViewName() -> LPCTSTR override;
38 auto GetWindow() -> TWindow* override;
39 auto SetDocTitle(LPCTSTR docname, int index) -> bool override;
40 using TView::SetDocTitle; ///< String-aware overload
41
42 // Overridden virtuals from TListBox
43 //
44 auto AddString(LPCTSTR) -> int override;
45 using TListBox::AddString; // Inject string-aware overload.
46
47 // Overridden virtuals from TWindow
48 //
49 auto CanClose() -> bool override;
50 auto Create() -> bool override;
51
52 static LPCTSTR StaticName(); ///< put in resource
53
54 protected:
55 long GetOrigin() const;
56 void SetOrigin(long origin);
57
58 int GetMaxWidth() const;
59 void SetMaxWidth(int maxwidth);
60
61 void SetExtent(const tstring& str);
62 bool LoadData(int top, int sel);
63
64 // Message response functions
65 //
66 void CmEditUndo();
67 void CmEditCut();
68 void CmEditCopy();
69 void CmEditPaste();
70 void CmEditDelete();
71 void CmEditClear();
72 void CmEditAdd();
73 void CmEditItem();
74 void CmSelChange();
75
76 uint EvGetDlgCode(const MSG*);
77
78 bool VnDocClosed(int omode);
79 bool VnCommit(bool force);
80 bool VnRevert(bool clear);
81 bool VnIsWindow(HWND hWnd);
82 bool VnIsDirty();
83
85 int DirtyFlag; ///< flag to indicate if the view is dirty
86
88 long Origin; ///< object's beginning position on the stream
89 int MaxWidth; ///< maximum horizontal extent (the number of pixels by which the view can be scrolled horizontally)
90
93};
94/// @}
95
97
98#include <owl/posclass.h>
99
100//----------------------------------------------------------------------------
101// Inline implementations
102//
103
104//
105/// Returns a constant string for the view name, ListView. This information is
106/// displayed in the user interface selection box.
107//
109 return _T("List View");
110}
111
112//
113/// Overrides TView's virtual GetViewName function and returns the descriptive name
114/// of the class (StaticName).
115//
117 return StaticName();
118}
119
120//
121/// Overrides TView's virtual GetWindow function and returns the list view object as
122/// a TWindow.
123//
125 return static_cast<TWindow*>(this);
126}
127
128//
129/// Overrides TView's virtual SetDocTitle function and stores the document title.
130/// This name is forwarded up the parent chain until a TFrameWindow object accepts
131/// the data and displays it in its caption.
132//
134 return TListBox::SetDocTitle(docname, index);
135}
136
137//
138/// Return true if both the listbox and the document can close.
139///
140/// Checks to see if all child views can be closed before closing the current view.
141/// If any child returns 0, CanClose returns 0 and aborts the process. If all
142/// children return nonzero, it calls TDocManager::FlushDoc.
143//
145 return TListBox::CanClose() &&
146 (Doc->NextView(this) ||
147 Doc->NextView(nullptr) != this ||
148 Doc->CanClose());
149}
150
151//
152/// Returns the origin position on the persistent stream.
153//
154inline long TListBoxView::GetOrigin() const {
155 return Origin;
156}
157
158//
159/// Sets the position of the object
160//
162 Origin = origin;
163}
164
165//
166/// Returns the maximum width of the strings.
167//
168inline int TListBoxView::GetMaxWidth() const {
169 return MaxWidth;
170}
171
172//
173/// Sets the maximum width of the strings.
174//
176 MaxWidth = maxwidth;
177}
178
179//
180/// Returns a nonzero value if the window's handle passed in hWnd is the same as
181/// that of the view's display window.
182//
184 return GetHandle() == hWnd;
185}
186
187//
188/// Returns a nonzero value if changes made to the data in the view have not been
189/// saved to the document; otherwise, returns 0.
190//
192 return DirtyFlag != 0;
193}
194
195
196} // OWL namespace
197
198
199#endif // OWL_LISTBOXVIEW_H
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
Definition docview.h:187
An interface object that represents a corresponding list box element.
Definition listbox.h:43
Provides views for list boxes.
Definition listboxview.h:31
auto GetViewName() -> LPCTSTR override
Overrides TView's virtual GetViewName function and returns the descriptive name of the class (StaticN...
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
Overrides TView's virtual SetDocTitle function and stores the document title.
bool VnIsDirty()
Returns a nonzero value if changes made to the data in the view have not been saved to the document; ...
int GetMaxWidth() const
Returns the maximum width of the strings.
void SetMaxWidth(int maxwidth)
Sets the maximum width of the strings.
bool VnIsWindow(HWND hWnd)
Returns a nonzero value if the window's handle passed in hWnd is the same as that of the view's displ...
long GetOrigin() const
Returns the origin position on the persistent stream.
auto CanClose() -> bool override
Return true if both the listbox and the document can close.
auto GetWindow() -> TWindow *override
Overrides TView's virtual GetWindow function and returns the list view object as a TWindow.
static LPCTSTR StaticName()
put in resource
void SetOrigin(long origin)
Sets the position of the object.
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
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 class TDocManager.
#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
Definition of class TListBox and TlistBoxData.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
std::string tstring
Definition defs.h:79
#define protected_data
Definition defs.h:208
#define public_data
Definition defs.h:207
#define _OWLCLASS
Definition defs.h:338