Mercurial > ~dholland > hg > ag > index.cgi
view anagram/vaclgui/fileview.hpp @ 14:a02e9434072e
Fix friend declaration for gcc10.
XXX: did not check it against the IBM compiler, might end up needing
XXX: to be conditional.
author | David A. Holland |
---|---|
date | Tue, 31 May 2022 00:59:42 -0400 |
parents | 13d2b8934445 |
children |
line wrap: on
line source
/* * AnaGram, A System for Syntax Directed Programming * Copyright 1997-2002 Parsifal Software. All Rights Reserved. * See the file COPYING for license and usage terms. * * fileview.hpp */ #ifndef FILEVIEW_HPP #define FILEVIEW_HPP #include "agview.hpp" #include "textfile.h" //#define INCLUDE_LOGGING //#include "log.h" class FileView : public AgView { protected: text_file file; public: FileView(IWindow *owner, text_file &file_); ~FileView(); virtual void reload() { file.read_file(); } virtual unsigned nLines() { return file.lx.size(); } virtual AgString getLine(unsigned ln); virtual AgString headTitle() { return file.name; } AgNotificationAction<FileView> dataColorChange; void onColorChange() { refresh(); } AgNotificationAction<FileView> fontChange; void onFontChange(); virtual Boolean findNext(AgString); virtual Boolean findPrev(AgString); }; class FileWindow : public AgFrame { private: FileView fileView; int windowId; void init(text_file &file, IRectangle r); public: /* FileWindow(text_file &file) : AgFrame() , fileView(this, file) { init(file); } */ FileWindow(int id, text_file &file, IRectangle r) : AgFrame(id) , fileView(this, file) { //LOGSECTION("File Window constructor"); init(file, r); } ~FileWindow() { //LOGSECTION("File Window destructor"); } FileWindow &setFocus() { //LOGSECTION("FileWindow::setFocus"); fileView.setFocus(); return *this; } FileWindow &enableCursor(int flag = true) { fileView.enableCursor(flag); return *this; } FileWindow &enableCursorBar(int flag = true) { //fileView.cursorLineHighlight = flag; fileView.enableCursorBar(flag); return *this; } cint getCursorLocation() { return fileView.getCursorLocation(); } FileWindow &setCursorLocation(cint x) { fileView.setCursorLocation(x); return *this; } virtual Boolean findNext(AgString s) { return fileView.findNext(s); } virtual Boolean findPrev(AgString s) { return fileView.findPrev(s); } }; #endif /* FILEVIEW_HPP */