12#include <owl/listboxview.rh>
13#include <owl/docview.rh>
63 Attr.Style &= ~(LBS_SORT);
64 Attr.Style |= (WS_HSCROLL | LBS_NOINTEGRALHEIGHT);
65 Attr.AccelTable = IDA_LISTVIEW;
77 if (!(style & LBS_SORT)) {
79 if (itemsInListBox > 0) {
93 if (str.length() == 0)
100 if (extent.cx > MaxWidth)
110 if (DirtyFlag == 2 || !(omode &
ofWrite))
131 if (!(style & LBS_SORT))
137 if ((inStream = Doc->InStream(ios::in)) ==
nullptr) {
138 Doc->PostError(IDS_UNABLEOPEN, MB_OK);
144 inStream->getline(buf,
COUNTOF(buf)-1);
145 if (!inStream->gcount() && !inStream->good()) {
146 status =
ToBool(inStream->eof());
156 Doc->PostError(IDS_READERROR, MB_OK);
173 Doc->PostError(IDS_NOMEMORYFORVIEW, MB_OK);
176 if (Doc->GetDocPath() ==
nullptr) {
192 if (!force && !DirtyFlag)
195 tostream* outStream = Doc->OutStream(ios::out);
196 if (outStream ==
nullptr) {
197 Doc->PostError(IDS_UNABLEOPEN, MB_OK);
200 outStream->seekp(Origin);
202 for (
int index = 0; index < count-1; index++) {
206 *outStream << static_cast<tchar*>(buf) <<
_T(
'\n');
211 bool status =
ToBool(outStream->good());
215 Doc->PostError(IDS_WRITEERROR, MB_OK);
228 if (!clear && Doc->GetDocPath() !=
nullptr)
246 retVal |= DLGC_WANTCHARS;
281 if (count <= 1 || index >= count)
287 HANDLE cbhdl = ::GlobalAlloc(GHND,len+0+1);
288 LPTSTR buf = (LPTSTR)::GlobalLock(cbhdl);
290 ::GlobalUnlock(cbhdl);
320 LPTSTR text = (LPTSTR)::GlobalLock(cbhdl);
324 ::GlobalUnlock(cbhdl);
337 if (count <= 1 || index >= count-1)
361 if (!(style & LBS_SORT))
365static int linePrompt(
TWindow* parent,
int index, UINT
id,
366 LPTSTR buf,
int buflen)
381 tchar inputText[101];
388 if (linePrompt(
this,index+1,CM_EDITADD,inputText,
COUNTOF(inputText)) == IDOK) {
407 if (index == count-1) {
412 if (index < 0 || index >= count-1)
415 tchar inputText[101];
418 if (linePrompt(
this,index+1,CM_EDITEDIT,inputText,
COUNTOF(inputText))==IDOK) {
441#if OWL_PERSISTENT_STREAMS
451 is >> GetObject()->Origin;
459TListBoxView::Streamer::Write(opstream &os)
const
463 os << GetObject()->Origin;
Pointer to an array of type T.
A device context class derived from TWindowDC, TClientDC provides access to the client area owned by ...
The clipboard class encapsulates the methods for the clipboard object of Windows.
HANDLE SetClipboardData(uint format, HANDLE handle)
Copy the data onto the clipboard in the format.
bool EmptyClipboard()
Clears the Clipboard and frees any handles to the Clipboard's data.
HANDLE GetClipboardData(uint format) const
Retrieves data from the Clipboard in the format specified by format.The following formats are support...
bool GetTextExtent(const tstring &str, int stringLen, TSize &size) const
Computes the extent (width and height) in logical units of the text line consisting of stringLen char...
An interface object that represents a corresponding list box element.
virtual int SetSelIndex(int index)
For single-selection list boxes.
virtual void SetHorizontalExtent(int horzExtent)
Sets the number of pixels by which the list box can be scrolled horizontally.
virtual int AddString(LPCTSTR str)
Adds str to the list box, returning its position in the list (0 is the first position).
virtual int GetStringLen(int index) const
Returns the string length (excluding the terminating NULL) of the item at the position index supplied...
virtual int SetTopIndex(int index)
The system scrolls the list box contents so that either the specified item appears at the top of the ...
virtual int InsertString(LPCTSTR str, int index)
Inserts str in the list box at the position supplied in index, and returns the item's actual position...
virtual int GetCount() const
Returns the number of items in the list box, or a negative value if an error occurs.
TListBox(TWindow *parent, int id, int x, int y, int w, int h, TModule *module=0)
Constructs a list box object with the supplied parent window (parent) library ID (module),...
virtual int DeleteString(int index)
Deletes the item in the list at the position (starting at 0) supplied in index.
virtual void ClearList()
Clears all the entries in the associated listbox.
virtual int GetSelString(TCHAR *str, int maxChars) const
For single-selection list boxes.
virtual int GetTopIndex() const
Returns the index of the first item displayed at the top of the list box.
virtual int GetString(TCHAR *str, int index) const
Retrieves the contents of the string at the passed index of the associated listbox.
virtual int GetSelIndex() const
For single-selection list boxes.
Provides views for list boxes.
bool LoadData(int top, int sel)
Reads the view from the stream and closes the file.
bool VnDocClosed(int omode)
Indicates that the document has been closed.
void CmEditClear()
Automatically responds to a menu selection with a menu ID of CM_EDITCLEAR by clearing the items in th...
void CmEditCopy()
Automatically responds to a menu selection with a menu ID of CM_EDITCOPY and copies the selected text...
void SetExtent(const tstring &str)
Sets the maximum horizontal extent for the list view window.
void CmEditAdd()
Automatically responds to CM_LISTADD message by getting the length of the input string and inserting ...
void CmEditItem()
Automatically responds to a CM_LISTEDIT message by getting the input text and inserting the text into...
auto AddString(LPCTSTR) -> int override
< String-aware overload
void CmEditCut()
Automatically responds to a menu selection with a menu ID of CM_EDITCUT by calling CmEditCopy and CmE...
bool VnRevert(bool clear)
Indicates if changes made to the view should be erased, and if the data from the document should be r...
void CmSelChange()
Automatically responds to a LBN_SELCHANGE message (which indicates that the contents of the list view...
void CmEditPaste()
Automatically responds to a menu selection with a menu ID of CM_EDITPASTE by inserting text into the ...
TListBoxView(TDocument &doc, TWindow *parent=0)
Creates a TListBoxView object associated with the specified document and parent window.
void CmEditDelete()
Automatically responds to a menu selection with a menu ID of CM_EDITDELETE by deleting the currently ...
void CmEditUndo()
Handler to undo the last operation performed on the underlying ListBox.
bool VnCommit(bool force)
Commits changes made in the view to the document.
uint EvGetDlgCode(const MSG *)
Overrides TWindow's response to a WM_GETDLGCODE message (an input procedure associated with a control...
The tagSIZE struct is defined as.
Abstract base class for view access from document.
friend class TDocument
needs access to NextView
TView(TDocument &doc)
Constructs a TView object of the document associated with the view.
void SetViewMenu(TMenuDescr *menu)
static uint GetNextViewId()
Next global ID to assign.
void NotOK()
To flag errors in creation.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
tstring LoadString(uint id) const
int MessageBox(LPCTSTR text, LPCTSTR caption=0, uint flags=MB_OK) const
Displays a message in a modal pop-up dialog box.
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
long GetWindowLong(int index) const
Retrieves information about the window depending on the value stored in index.
TModule * GetModule() const
Returns a pointer to the module object.
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
TXOwl is root class of the ObjectWindows exception hierarchy.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
void ReadBaseObject(Base *base, ipstream &in)
void WriteBaseObject(Base *base, opstream &out)
@ ofWrite
ios::out, open for writing
Definition of class TListBoxView.
Object Windows Library (OWLNext Core).
const tchar VirtualLastLineStr[]
EV_NOTIFY_AT_CHILD(BN_CLICKED, BNClicked)
IMPLEMENT_STREAMABLE2(TEditView, TEditSearch, TView)
EV_COMMAND(IDOK, CmOkCancel)
DIAG_DECLARE_GROUP(OwlThread)
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.