• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

tdehtmlview.h

00001 /* This file is part of the KDE project
00002 
00003    Copyright (C) 1997 Martin Jones (mjones@kde.org)
00004              (C) 1998 Waldo Bastian (bastian@kde.org)
00005              (C) 1998, 1999 Torben Weis (weis@kde.org)
00006              (C) 1999 Lars Knoll (knoll@kde.org)
00007              (C) 1999 Antti Koivisto (koivisto@kde.org)
00008 
00009    This library is free software; you can redistribute it and/or
00010    modify it under the terms of the GNU Library General Public
00011    License as published by the Free Software Foundation; either
00012    version 2 of the License, or (at your option) any later version.
00013 
00014    This library is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017    Library General Public License for more details.
00018 
00019    You should have received a copy of the GNU Library General Public License
00020    along with this library; see the file COPYING.LIB.  If not, write to
00021    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00022    Boston, MA 02110-1301, USA.
00023 */
00024 
00025 #ifndef TDEHTMLVIEW_H
00026 #define TDEHTMLVIEW_H
00027 
00028 // qt includes and classes
00029 #include <tqscrollview.h>
00030 
00031 #include <tdelibs_export.h>
00032 
00033 class TQPainter;
00034 class TQRect;
00035 template< typename T > class TQValueVector;
00036 
00037 namespace DOM {
00038     class HTMLDocumentImpl;
00039     class DocumentImpl;
00040     class ElementImpl;
00041     class HTMLElementImpl;
00042     class HTMLTitleElementImpl;
00043     class HTMLGenericFormElementImpl;
00044     class HTMLFormElementImpl;
00045     class HTMLAnchorElementImpl;
00046     class HTMLInputElementImpl;
00047     class Range;
00048     class NodeImpl;
00049     class CSSProperty;
00050 }
00051 
00052 namespace KJS {
00053     class WindowFunc;
00054     class ExternalFunc;
00055 }
00056 
00057 namespace tdehtml {
00058     class RenderObject;
00059     class RenderCanvas;
00060     class RenderStyle;
00061     class RenderLineEdit;
00062     class RenderPartObject;
00063     class RenderWidget;
00064     class CSSStyleSelector;
00065     class LineEditWidget;
00066     class CaretBox;
00067     void applyRule(DOM::CSSProperty *prop);
00068 }
00069 
00070 class TDEHTMLPart;
00071 class TDEHTMLViewPrivate;
00072 
00078 class TDEHTML_EXPORT TDEHTMLView : public TQScrollView
00079 {
00080     Q_OBJECT
00081 
00082     friend class DOM::HTMLDocumentImpl;
00083     friend class DOM::HTMLTitleElementImpl;
00084     friend class DOM::HTMLGenericFormElementImpl;
00085     friend class DOM::HTMLFormElementImpl;
00086     friend class DOM::HTMLAnchorElementImpl;
00087     friend class DOM::HTMLInputElementImpl;
00088     friend class DOM::DocumentImpl;
00089     friend class TDEHTMLPart;
00090     friend class tdehtml::RenderCanvas;
00091     friend class tdehtml::RenderObject;
00092     friend class tdehtml::RenderLineEdit;
00093     friend class tdehtml::RenderPartObject;
00094     friend class tdehtml::RenderWidget;
00095     friend class tdehtml::CSSStyleSelector;
00096     friend class tdehtml::LineEditWidget;
00097     friend class KJS::WindowFunc;
00098     friend class KJS::ExternalFunc;
00099     friend void tdehtml::applyRule(DOM::CSSProperty *prop);
00100 
00101 
00102 public:
00106     TDEHTMLView( TDEHTMLPart *part, TQWidget *parent, const char *name=0 );
00107     virtual ~TDEHTMLView();
00108 
00113     TDEHTMLPart *part() const { return m_part; }
00114 
00115     int frameWidth() const { return _width; }
00116 
00120     void setMarginWidth(int x);
00121 
00127     int marginWidth() const { return _marginWidth; }
00128 
00129     /*
00130      * Sets a margin in y direction.
00131      */
00132     void setMarginHeight(int y);
00133 
00139     int marginHeight() { return _marginHeight; }
00140 
00144     virtual void setVScrollBarMode ( ScrollBarMode mode );
00145 
00149     virtual void setHScrollBarMode ( ScrollBarMode mode );
00150 
00154     void print();
00155 
00160     void print( bool quick ); // KDE 4.0: merge with above
00161 
00165     void layout(); // KDE 4.0: make private
00169     void displayAccessKeys();
00170 
00171 
00172 
00173 signals:
00178     void finishedLayout();
00179     void cleared();
00180     void zoomView( int );
00181     void hideAccessKeys();
00182     void repaintAccessKeys();
00183     void findAheadActive( bool );
00184 //#define NO_SMOOTH_SCROLL_HACK
00185 #ifndef NO_SMOOTH_SCROLL_HACK
00186 public slots:
00187     void scrollBy(int dx, int dy);
00188 #endif
00189 
00190 protected:
00191     void clear();
00192 
00193     virtual void resizeEvent ( TQResizeEvent * event );
00194     virtual void showEvent ( TQShowEvent * );
00195     virtual void hideEvent ( TQHideEvent *);
00196     virtual bool focusNextPrevChild( bool next );
00197     virtual void drawContents ( TQPainter * p, int clipx, int clipy, int clipw, int cliph );
00198     virtual void drawContents( TQPainter* );
00199     virtual void viewportMousePressEvent( TQMouseEvent * );
00200     virtual void focusInEvent( TQFocusEvent * );
00201     virtual void focusOutEvent( TQFocusEvent * );
00202     virtual void viewportMouseDoubleClickEvent( TQMouseEvent * );
00203     virtual void viewportMouseMoveEvent(TQMouseEvent *);
00204     virtual void viewportMouseReleaseEvent(TQMouseEvent *);
00205     virtual void viewportResizeEvent(TQResizeEvent*);
00206 #ifndef QT_NO_WHEELEVENT
00207     virtual void viewportWheelEvent(TQWheelEvent*);
00208 #endif
00209     virtual void dragEnterEvent( TQDragEnterEvent* );
00210     virtual void dropEvent( TQDropEvent* );
00211     virtual void closeEvent ( TQCloseEvent * );
00212     virtual bool eventFilter(TQObject *, TQEvent *);
00213 
00214     void keyPressEvent( TQKeyEvent *_ke );
00215     void keyReleaseEvent ( TQKeyEvent *_ke );
00216     void contentsContextMenuEvent ( TQContextMenuEvent *_ce );
00217     void doAutoScroll();
00218     void timerEvent ( TQTimerEvent * );
00219 
00220 #ifndef NO_SMOOTH_SCROLL_HACK
00221     void startScrolling();
00222     void stopScrolling();
00223 #ifndef QT_NO_WHEELEVENT
00224     void scrollViewWheelEvent( TQWheelEvent* e );
00225 #endif
00226 #endif
00227 
00228 protected slots:
00229     void slotPaletteChanged();
00230     void slotScrollBarMoved();
00231 #ifndef NO_SMOOTH_SCROLL_HACK
00232     void scrollTick();
00233 #else
00234     void scrollTick() {}; // moc cannot handle #if
00235 #endif
00236 
00237 private slots:
00238     void tripleClickTimeout();
00239     void findTimeout();
00240     void accessKeysTimeout();
00241 
00247     void slotMouseScrollTimer();
00248 
00249 private:
00250 
00251     void scheduleRelayout(tdehtml::RenderObject* clippedObj=0);
00252     void unscheduleRelayout();
00253 
00254     void scheduleRepaint(int x, int y, int w, int h, bool asap=false);
00255     void unscheduleRepaint();
00256 
00257     bool needsFullRepaint() const;
00258 
00259     void closeChildDialogs();
00260     bool dialogsAllowed();
00261 
00270     void paint(TQPainter *p, const TQRect &rc, int yOff = 0, bool *more = 0);
00271 
00272 #if 0
00273 
00277     void paint(TQPainter *p, int width);
00278 #endif
00279 
00290     void setMediaType( const TQString &medium );
00291     TQString mediaType() const;
00292 
00293     bool pagedMode() const;
00294 
00295     bool scrollTo(const TQRect &);
00296 
00297     bool focusNextPrevNode(bool next);
00298     bool handleAccessKey(const TQKeyEvent* ev);
00299     bool focusNodeWithAccessKey(TQChar c, TDEHTMLView* caller = NULL);
00300     TQMap< DOM::ElementImpl*, TQChar > buildFallbackAccessKeys() const;
00301     void displayAccessKeys( TDEHTMLView* caller, TDEHTMLView* origview, TQValueVector< TQChar >& taken, bool use_fallbacks );
00302 
00303     void useSlowRepaints();
00304 
00305     void setIgnoreWheelEvents(bool e);
00306 
00307     void init();
00308 
00309     DOM::NodeImpl *nodeUnderMouse() const;
00310     DOM::NodeImpl *nonSharedNodeUnderMouse() const;
00311 
00312     void restoreScrollBar();
00313 
00314     TQStringList formCompletionItems(const TQString &name) const;
00315     void clearCompletionHistory(const TQString& name);
00316     void addFormCompletionItem(const TQString &name, const TQString &value);
00317     void removeFormCompletionItem(const TQString &name, const TQString &value);
00318 
00319     void addNonPasswordStorableSite( const TQString& host );
00320     bool nonPasswordStorableSite( const TQString& host ) const;
00321 
00322     bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode,
00323                 DOM::NodeImpl *targetNodeNonShared, bool cancelable,
00324                 int detail,TQMouseEvent *_mouse, bool setUnder,
00325                 int mouseEventType);
00326     bool dispatchKeyEvent( TQKeyEvent *_ke );
00327     bool dispatchKeyEventHelper( TQKeyEvent *_ke, bool generate_keypress );
00328 
00329     void complete( bool pendingAction );
00330 
00331 #ifndef TDEHTML_NO_TYPE_AHEAD_FIND
00332     void findAhead(bool increase);
00333     void updateFindAheadTimeout();
00334     void startFindAhead( bool linksOnly );
00335 #endif // TDEHTML_NO_TYPE_AHEAD_FIND
00336 
00337 #ifndef TDEHTML_NO_CARET
00338     // -- caret-related member functions (for caretMode as well as designMode)
00339 
00350     void initCaret(bool keepSelection = false);
00353     bool caretOverrides() const;
00361     void ensureNodeHasFocus(DOM::NodeImpl *node);
00368     void recalcAndStoreCaretPos(tdehtml::CaretBox *hintBox = 0);
00375     void caretOn();
00381     void caretOff();
00390     void showCaret(bool forceRepaint = false);
00397     void hideCaret();
00402     void ensureCaretVisible();
00403 
00419     bool foldSelectionToCaret(DOM::NodeImpl *startNode, long startOffset,
00420                     DOM::NodeImpl *endNode, long endOffset);
00421 
00431     bool placeCaret(tdehtml::CaretBox *hintBox = 0);
00432 
00449     bool extendSelection(DOM::NodeImpl *startNode, long startOffset,
00450                 DOM::NodeImpl *endNode, long endOffset);
00451 
00461     void updateSelection(DOM::NodeImpl *startNode, long startOffset,
00462             DOM::NodeImpl *endNode, long endOffset);
00463 
00468     int caretDisplayPolicyNonFocused() const;
00469 
00476     void setCaretDisplayPolicyNonFocused(int policy);
00477 
00478     // -- caret event handler
00479 
00483     void caretKeyPressEvent(TQKeyEvent *);
00484 
00485     // -- caret navigation member functions
00486 
00498     bool moveCaretTo(DOM::NodeImpl *node, long offset, bool clearSelection);
00499 
00505     enum CaretMovement { CaretByCharacter, CaretByWord };
00506 
00517     void moveCaretBy(bool next, CaretMovement cmv, int n);
00518 
00521     void moveCaretByLine(bool next, int n);
00522 
00527     void moveCaretToLineBoundary(bool end);
00528 
00533     void moveCaretToDocumentBoundary(bool end);
00534 
00543     void placeCaretOnChar(tdehtml::CaretBox *hintBox);
00544 
00561     void placeCaretOnLine(tdehtml::CaretBox *caretBox, int x, int absx, int absy);
00562 
00566     void moveCaretByPage(bool next);
00567 
00570     void moveCaretPrevWord();
00571 
00574     void moveCaretNextWord();
00575 
00580     void moveCaretPrevLine(int n = 1);
00581 
00586     void moveCaretNextLine(int n = 1);
00587 
00590     void moveCaretPrevPage();
00591 
00594     void moveCaretNextPage();
00595 
00598     void moveCaretToLineBegin();
00599 
00602     void moveCaretToLineEnd();
00603 
00604 #endif // TDEHTML_NO_CARET
00605 
00606     // ------------------------------------- member variables ------------------------------------
00607  private:
00608 
00609     void setWidgetVisible(::tdehtml::RenderWidget*, bool visible);
00610 
00611     int _width;
00612     int _height;
00613 
00614     int _marginWidth;
00615     int _marginHeight;
00616 
00617     TDEHTMLPart *m_part;
00618     TDEHTMLViewPrivate *d;
00619 
00620     TQString m_medium;   // media type
00621 };
00622 
00623 #endif
00624 

tdehtml

Skip menu "tdehtml"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.6.3
This website is maintained by Timothy Pearson.