Mercurial > ~dholland > hg > ag > index.cgi
view anagram/vaclgui/dview.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. * * dview.hpp */ #ifndef DVIEW_HPP #define DVIEW_HPP #include <icanvas.hpp> #include <iclipbrd.hpp> #include <icmdevt.hpp> #include <icmdhdr.hpp> //#include <icoordsy.hpp> //#include <iexcbase.hpp> //#include <ifont.hpp> #include <ikeyevt.hpp> #include <ikeyhdr.hpp> #include <imenuevt.hpp> #include <imenuhdr.hpp> #include <imoushdr.hpp> #include <imousevt.hpp> #include <ipainevt.hpp> #include <ipainhdr.hpp> #include <ipopmenu.hpp> //#include <irefcnt.hpp> #include <iscroll.hpp> #include <iscrlevt.hpp> #include <iscrlhdr.hpp> //#include <isizeevt.hpp> #include <isizehdr.hpp> //#include <istattxt.hpp> #include <itimer.hpp> //#include <ititle.hpp> class AgFrame; // from frame.hpp #include "agstring.h" #include "agview.hpp" #include "search.h" class AgDataView : public ICanvas , public ICommandHandler , public IKeyboardHandler , public IMenuHandler , public IMouseHandler , public IPaintHandler , public IResizeHandler , public IScrollHandler , public AgHelpHandler , public AgFocusHandler { public: static const int defaultWindowHeight; class MouseDragTimer : public ITimerFn { private: AgDataView *window; int mouseLine; int topLine; public: MouseDragTimer(AgDataView *, int, int); void timerExpired(unsigned long timerId); }; // Constructor AgDataView(IWindow *, WindowData *); AgDataView(IWindow *ownerWindow_); AgDataView &init(WindowData *); AgDataView &reset(); // Destructor ~AgDataView(); void disconnect(); AgAction enterAction; AgDataView &setEnterAction(AgAction action) { enterAction = action; return *this; } //virtual void onEnter() { // enterAction.performDeferred(); //} AgAction selectAction; AgDataView &setSelectAction(AgAction action) { selectAction = action; return *this; } //virtual void onSelect() { // selectAction.performDeferred(); //} int getCursorLine(); AgDataView &setCursorLine(int); AgDataView &synchCursor(int); void mouseDragTimerInterrupt(int &topLine, int mouseLine); ISize suggestSize(); AgDataView &setLayoutDistorted(unsigned long, unsigned long); AgDataView &layout(); int tableWidth; int columnHeadWidth; AgDataView &adjustMaxWidth(AgString); AgDataView &setColumnTitles(AgString title); AgColumnHead columnHeadTitle; AgStaticText dataArea; int lineHeight() const { return font().externalLeading() + font().maxSize().height(); } int charWidth() const { return font().maxSize().width(); } int avgCharWidth() const { return font().avgCharWidth(); } int maxDescender() const { return font().maxDescender(); } AgDataView &repaintLine(int); SearchProcess searchProcess; Boolean findNext(AgString); Boolean findPrev(AgString); AgDataView ©To(IClipboard &c); virtual void showHelp(); protected: // Layout functions AgDataView &doLayout(); Boolean windowResize(IResizeEvent &); ISize calcMinimumSize() const; AgDataView &repositionWindow(); int findMaxWidth(void); // Handler functions // Command Handler Boolean command(ICommandEvent &event); // Keyboard handler Boolean virtualKeyPress(IKeyboardEvent &); Boolean key(IKeyboardEvent &); // Menu handler Boolean makePopUpMenu(IMenuEvent &event); IPopUpMenu popUpMenu; AgArray<AgMenuItem> auxMenu; Boolean menuEnded(IMenuEvent &); AgDataView &initPopUp(); AgDataView &validatePopUp(); virtual Boolean showHelp(IEvent &event); virtual ColorSpec *getLineColor(int); // Mouse handler Boolean mouseClicked(IMouseClickEvent &event); Boolean mouseMoved(IMouseEvent &event); void dragMouse(int topLine, int mouseLine); Boolean gotFocus(IEvent &); Boolean lostFocus(IEvent &); Boolean mouseDown; int mouseDownCursorLine; ITimer mouseTimer; // Paint handler Boolean paintWindow(IPaintEvent &); // Scroll handler Boolean lineDown(IScrollEvent &); Boolean lineLeft(IScrollEvent &); Boolean lineRight(IScrollEvent &); Boolean lineUp(IScrollEvent &); Boolean pageDown(IScrollEvent &); Boolean pageLeft(IScrollEvent &); Boolean pageRight(IScrollEvent &); Boolean pageUp(IScrollEvent &); Boolean scrollBoxTrack(IScrollEvent &); Boolean scrollBoxTrackEnd(IScrollEvent &event); /* virtual Boolean scrollBoxTrackEnd(IScrollEvent &event) { return scrollBoxTrack(event); } */ public: // child windows IScrollBar horizontalScrollBar; IScrollBar verticalScrollBar; AgDataView &setFrame(AgFrame *f) {frameWindow = f; return *this;} // window parameters AgString copyTitle; int windowId; IWindow *ownerWindow; AgFrame *frameWindow; WindowData *windowData; ColorSpec *color; ColorSpec *cursorColor; AgNotificationAction<AgDataView> dataColorChange; AgNotificationAction<AgDataView> fontChange; void onColorChange() { refresh(); } void onFontChange(); int *tabArray; int popUpInitialized; char *helpTopic; // layout state Boolean vsbShowing; Boolean hsbShowing; int columnHeadsPresent; int tableHeight; int verticalLineCount; // window state int cursorLine; int prevHorizontal; int prevVertical; int rightButtonDown; enum ButtonState { buttonIdle, buttonDown, waitingForClick }; ButtonState rightButtonState; private: int layoutActive; int layoutComplete; }; inline int AgDataView::getCursorLine() { return cursorLine; } void logFont(IFont activeFont); void logFont(IFont activeFont, char *p); #endif /* DVIEW_HPP */