Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Events | Private Member Functions | Private Attributes | Friends
QTMWidget Class Reference

#include <QTMWidget.hpp>

Inheritance diagram for QTMWidget:
Inheritance graph
[legend]
Collaboration diagram for QTMWidget:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 QTMWidget (simple_widget_rep *_wid)
 ~QTMWidget ()
simple_widget_reptm_widget ()
void invalidate_rect (int x1, int y1, int x2, int y2)
void invalidate_all ()
void repaint_invalid_regions ()
void scrollContentsBy (int dx, int dy)
void setCursorPos (QPoint pos)
void setOrigin (QPoint newOrigin)
void setExtents (QRect newExtents)
QRect extents ()
QWidget * surface ()
QPoint origin ()
void ensureVisible (int cx, int cy, int mx=50, int my=50)
QPoint viewportToContents (QPoint const &pos) const
QPoint contentsToViewport (QPoint const &pos) const

Public Attributes

QPoint backing_pos
QLabel * imwidget
QPoint cursor_pos

Static Public Attributes

static QSet< QTMWidget * > all_widgets

Protected Member Functions

virtual void paintEvent (QPaintEvent *event)
virtual void focusInEvent (QFocusEvent *event)
virtual void focusOutEvent (QFocusEvent *event)
virtual void keyPressEvent (QKeyEvent *event)
virtual void inputMethodEvent (QInputMethodEvent *event)
virtual void mousePressEvent (QMouseEvent *event)
virtual void mouseReleaseEvent (QMouseEvent *event)
virtual void mouseMoveEvent (QMouseEvent *event)
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
void updateScrollBars ()
virtual bool viewportEvent (QEvent *e)
virtual bool surfaceEvent (QEvent *e)
virtual bool event (QEvent *e)

Events

virtual bool(QEvent *event)
virtual voi 
resizeEvent )(QResizeEvent *event)

Private Member Functions

basic_renderer_repgetRenderer ()

Private Attributes

rectangles invalid_regions
QPixmap backingPixmap

Friends

class QTMSurface

Detailed Description

Definition at line 25 of file QTMWidget.hpp.


Constructor & Destructor Documentation

Definition at line 154 of file QTMWidget.cpp.

  : QTMScrollView (), backingPixmap(), imwidget(NULL) {
  setObjectName("A QTMWidget");
  setProperty ("texmacs_widget", QVariant::fromValue ((void*) _wid));
  surface()->setMouseTracking (true);
  setFocusPolicy (Qt::StrongFocus);
  backing_pos = origin();
  setAttribute(Qt::WA_InputMethodEnabled);
}

Here is the call graph for this function:

Definition at line 165 of file QTMWidget.cpp.

                       {
  if (DEBUG_QT) cout << "destroying " << this << LF;
}

Member Function Documentation

QPoint QTMScrollView::contentsToViewport ( QPoint const &  pos) const [inline, inherited]

Definition at line 49 of file QTMScrollView.hpp.

{ return pos - p_origin; };
void QTMScrollView::ensureVisible ( int  cx,
int  cy,
int  mx = 50,
int  my = 50 
) [inherited]

Definition at line 109 of file QTMScrollView.cpp.

                                                              {
       QWidget *_viewport = QAbstractScrollArea::viewport();
       int w = _viewport->width();
       int h = _viewport->height();
  
       int dx = - p_origin.x();
       int dy = - p_origin.y();
       int cw = p_extents.width();
       int ch = p_extents.height();
  
       if (w < mx * 2) mx = w / 2;
       if (h < my * 2) my = h / 2;
  
       if (cw <= w) { mx = 0; dx = 0; }
  
       if (ch <= h) { my = 0; dy = 0; }
  
       if (cx < mx - dx) dx = mx - cx;
       else if (cx >= w - mx - dx) dx  = w - mx - cx;
  
       if (cy < my - dy) dy = my - cy;
       else if (cy >= h - my - dy) dy  = h - my - cy;
  
       if (dx > 0) dx = 0;
       else if (dx < w - cw && cw > w) dx = w - cw;
  
       if (dy > 0) dy = 0;
       else if (dy < h - ch && ch > h) dy = h - ch;
  
       setOrigin (QPoint(-dx, -dy));
}

Here is the call graph for this function:

bool QTMScrollView::event ( QEvent *  e) [protected, virtual, inherited]

Definition at line 264 of file QTMScrollView.cpp.

                                        {
  switch (event->type()) {
    case QEvent::Resize:
    {
      bool res = QAbstractScrollArea::event(event);
      updateScrollBars();
      return res;
    }
    default:
      break;
  }
  return QAbstractScrollArea::event(event);
}

Here is the call graph for this function:

Here is the caller graph for this function:

QRect QTMScrollView::extents ( ) [inline, inherited]

Definition at line 40 of file QTMScrollView.hpp.

{ return p_extents; }

Here is the caller graph for this function:

void QTMWidget::focusInEvent ( QFocusEvent *  event) [protected, virtual]

Definition at line 831 of file QTMWidget.cpp.

                                              {
  if (DEBUG_QT) cout << "FOCUSIN" << LF;
  simple_widget_rep *wid = tm_widget ();
  if (wid) {
    the_gui -> process_keyboard_focus (wid, true, texmacs_time());
    //wid -> handle_keyboard_focus (true, texmacs_time ());
  }
  QTMScrollView::focusInEvent (event);
}

Here is the call graph for this function:

void QTMWidget::focusOutEvent ( QFocusEvent *  event) [protected, virtual]

Definition at line 842 of file QTMWidget.cpp.

                                               {
  if (DEBUG_QT)   cout << "FOCUSOUT" << LF;
  simple_widget_rep *wid = tm_widget ();
  if (wid) {
    the_gui -> process_keyboard_focus (wid, false, texmacs_time());
//    wid -> handle_keyboard_focus (false, texmacs_time ());
  }
  QTMScrollView::focusOutEvent (event);
}

Here is the call graph for this function:

Definition at line 194 of file QTMWidget.cpp.

                       {
#ifdef USE_CAIRO
  cairo_renderer_rep *ren = the_cairo_renderer ();
  cairo_surface_t *surf;
#ifdef Q_WS_X11
  //const QX11Info & info = x11Info();//qt_x11Info(this);
  //    Display *dpy = x11Info().display();
  //backingPixmap = QPixmap(width(),height());
  //cout << backingPixmap.width() << LF;
  Display *dpy = QX11Info::display();
  Drawable drawable = backingPixmap.handle();
  Visual *visual = (Visual*)(backingPixmap.x11Info().visual());
  surf = tm_cairo_xlib_surface_create (dpy, drawable, visual, 
                            backingPixmap.width (), backingPixmap.height ());
#elif defined(Q_WS_MAC)
  surf = tm_cairo_quartz_surface_create_for_cg_context (
                    (CGContextRef)(this->macCGHandle()), width(), height());
#endif
  cairo_t *ct = tm_cairo_create (surf);
  ren->begin (ct);
  tm_cairo_surface_destroy (surf);
  tm_cairo_destroy (ct);
#else
  qt_renderer_rep * ren = the_qt_renderer();
  ren->begin(&backingPixmap);
#endif
  return ren;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QTMWidget::inputMethodEvent ( QInputMethodEvent *  event) [protected, virtual]

Definition at line 690 of file QTMWidget.cpp.

                                                     {
  
  QString const & preedit_string = event->preeditString();
  QString const & commit_string = event->commitString();
  
  if (!commit_string.isEmpty()) {
    if (DEBUG_QT)
      cout << "IM committing :" << commit_string.toUtf8().data() << LF;
    
    int key = 0;
#if 1
    for (int i = 0; i < commit_string.size(); ++i) {
      QKeyEvent ev(QEvent::KeyPress, key, Qt::NoModifier, commit_string[i]);
      keyPressEvent(&ev);
    }
#else
    QKeyEvent ev(QEvent::KeyPress, key, Qt::NoModifier, commit_string);
    keyPressEvent(&ev);
#endif
  }
  
  if (DEBUG_QT)
    cout << "IM preediting :" << preedit_string.toUtf8().data() << LF;
  
  string r = "pre-edit:";
  if (!preedit_string.isEmpty())
  {
    
    // find cursor position in the preedit string
    QList<QInputMethodEvent::Attribute>  const & attrs = event->attributes();
    //    int pos = preedit_string.count();
    int pos = 0;
    bool visible_cur = false;
    for(int i=0; i< attrs.count(); i++) 
      if (attrs[i].type == QInputMethodEvent::Cursor) {
        pos = attrs[i].start;
        visible_cur = (attrs[i].length != 0);
      }
    
    // find selection in the preedit string
    int sel_start = 0;
    int sel_length = 0;
    if (pos <  preedit_string.count()) {
      for(int i=0; i< attrs.count(); i++) 
        if ((attrs[i].type == QInputMethodEvent::TextFormat) &&
            (attrs[i].start <= pos) &&
            (pos < attrs[i].start + attrs[i].length)) {
          sel_start = attrs[i].start;
          sel_length =  attrs[i].length;
          if (!visible_cur) pos += attrs[i].length;
        }
    } else {
      sel_start = pos;
      sel_length = 0;
    }
    (void) sel_start; (void) sel_length;
    
    r = r * as_string(pos) * ":" * from_qstring(preedit_string);
  }
  simple_widget_rep *wid =  tm_widget();
  if (wid)
    the_gui -> process_keypress (wid, r, texmacs_time());
  event->accept();
}  

Here is the call graph for this function:

QVariant QTMWidget::inputMethodQuery ( Qt::InputMethodQuery  query) const [protected, virtual]

Definition at line 756 of file QTMWidget.cpp.

                                                             {
  switch (query) {
    case Qt::ImMicroFocus :
      return QVariant (QRect (cursor_pos, QSize (5,5)));
    default:
      return QWidget::inputMethodQuery (query);
  }
}

Definition at line 184 of file QTMWidget.cpp.

                           {
  QSize sz = surface()->size();
 // QPoint pt = QAbstractScrollArea::viewport()->pos();
   //cout << "invalidate all " << LF;
  invalid_regions = rectangles();
  invalidate_rect (0, 0, sz.width(), sz.height());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QTMWidget::invalidate_rect ( int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 170 of file QTMWidget.cpp.

                                                          {
#ifdef Q_WS_MAC
  //HACK: for unknown reasons we need to enlarge the invalid rect to prevent
  //artifacts while moving the cursor (for example at the end of a formula like
  // $a+f$. These artifacts seems present only on 64 bit Macs. 
  rectangle r = rectangle (x1-10, y1-10, x2+10, y2+10);
#else
  rectangle r = rectangle (x1, y1, x2, y2);
#endif
  // cout << "invalidating " << r << LF;
  invalid_regions = invalid_regions | rectangles (r);
}

Here is the caller graph for this function:

void QTMWidget::keyPressEvent ( QKeyEvent *  event) [protected, virtual]

Definition at line 423 of file QTMWidget.cpp.

                                          {
  static bool fInit = false;
  if (!fInit) {
    if (DEBUG_QT)
      cout << "Initializing keymap\n";
    initkeymap();
    fInit= true;
  }

  if (DEBUG_QT)
    cout << "keypressed\n";
  simple_widget_rep *wid =  tm_widget();
  if (!wid) return;

  {
    int key = event->key();
    Qt::KeyboardModifiers mods = event->modifiers();

    if (DEBUG_QT) {
      cout << "key  : " << key << LF;
      cout << "text : " << event->text().toAscii().data() << LF;
      cout << "count: " << event->text().count() << LF;
      if (mods & Qt::ShiftModifier) cout << "shift\n";
      if (mods & Qt::MetaModifier) cout << "meta\n";
      if (mods & Qt::ControlModifier) cout << "control\n";
      if (mods & Qt::KeypadModifier) cout << "keypad\n";
      if (mods & Qt::AltModifier) cout << "alt\n";
    }

    string r;
#ifdef __MINGW32__
    // denis begin
    if (event->text().count() == 1) {
      QChar c= event->text()[0];
      if (c.isPrint() && event->modifiers() != Qt::MetaModifier) {
       // not a control character or dead key or modifier
       char ac=c.toAscii();
       if (ac && ac != ' ') { // a true ascii printable
         r= ac;
         if (DEBUG_QT) cout << "ascii key= " <<r << "\n";      
         the_gui->process_keypress(wid, r, texmacs_time());
         return;
       }
      }
    }
    // denis end
#endif
    if (qtkeymap->contains (key)) {
      r = qtkeymap[key];
    }
    else if (qtdeadmap->contains (key)) {
      mods &=~ Qt::ShiftModifier;
      r = qtdeadmap[key];
    }
    else {
      QString nss = event->text();
      unsigned short unic= nss.data()[0].unicode();
      if (unic < 32 && key < 128 && key > 0) {
        if (((char) key) >= 'A' && ((char) key) <= 'Z') {
          if ((mods & Qt::ShiftModifier) == 0)
            key= (int) (key + ((int) 'a') - ((int) 'A'));
        }
        mods &=~ Qt::ShiftModifier;
        r= string ((char) key);
      } else {
        switch(unic) {
        case 96:   r= "`"; 
            // unicode to cork conversion not appropriate for this case...
#ifdef Q_WS_MAC
          // CHECKME: are these two MAC exceptions really needed?
                   if (mods & Qt::AltModifier) r= "grave";
#endif
                   break;
        case 168:  r= "umlaut"; break;
        case 180:  r= "acute"; break;
        // the following combining characters should be caught by qtdeadmap
        case 0x300: r= "grave"; break;
        case 0x301: r= "acute"; break;
        case 0x302: r= "hat"; break;
        case 0x308: r= "umlaut"; break;
        case 0x33e: r= "tilde"; break;
        default:
          QByteArray buf= nss.toUtf8();
          string rr (buf.constData(), buf.count());
          r= utf8_to_cork (rr);
          if (r == "<less>") r= "<";
          if (r == "<gtr>") r= ">";
        }
#ifdef Q_WS_MAC
        // CHECKME: are these two MAC exceptions really needed?
        mods &=~ Qt::AltModifier;
#endif
        mods &=~ Qt::ShiftModifier;
      }
    }

    if (r == "") return;

#ifdef Q_WS_MAC
    if (mods & Qt::ShiftModifier) r= "S-" * r;
    if (mods & Qt::MetaModifier) r= "C-" * r;        // The "Control" key
    if (mods & Qt::AltModifier) r= "A-" * r;
    if (mods & Qt::ControlModifier) r= "M-" * r;  // The "Command" key
    //if (mods & Qt::KeypadModifier) r= "K-" * r;
#else
    if (mods & Qt::ShiftModifier) r= "S-" * r;
    if (mods & Qt::ControlModifier) r= "C-" * r;
    if (mods & Qt::AltModifier) r= "A-" * r;
    if (mods & Qt::MetaModifier) r= "M-" * r;     // The "Windows" key
    //if (mods & Qt::KeypadModifier) r= "K-" * r;
#endif

    if (DEBUG_QT)
      cout << "key press: " << r << LF;
    //int start= texmacs_time ();
    //wid -> handle_keypress (r, texmacs_time());
    the_gui -> process_keypress (wid, r, texmacs_time());
    //int end= texmacs_time ();
    //if (end > start) cout << "Keypress " << end - start << "\n";
  //  the_gui->update (); // FIXME: remove this line when
                        // edit_typeset_rep::get_env_value will be faster
    
//    needs_update();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QTMWidget::mouseMoveEvent ( QMouseEvent *  event) [protected, virtual]

Definition at line 803 of file QTMWidget.cpp.

                                             {
  simple_widget_rep *wid = tm_widget();
  if (!wid) return;
  QPoint point = event->pos() + origin();
  scale (point);
  unsigned int mstate= mouse_state (event, false);
  string s= "move";
  the_gui -> process_mouse (wid, s, point.x (), point.y (), 
                            mstate, texmacs_time ());
//  wid -> handle_mouse (s, point.x (), point.y (), mstate, texmacs_time ());
  if (DEBUG_QT)
    cout << "mouse event: " << s << " at "
         << point.x () << ", " << point.y () << LF;
}

Here is the call graph for this function:

void QTMWidget::mousePressEvent ( QMouseEvent *  event) [protected, virtual]

Definition at line 771 of file QTMWidget.cpp.

                                              {
  simple_widget_rep *wid= tm_widget ();
  if (!wid) return;
  QPoint point = event->pos() + origin();
  scale (point);
  unsigned int mstate= mouse_state (event, false);
  string s= "press-" * mouse_decode (mstate);
  the_gui -> process_mouse (wid, s, point.x (), point.y (), 
                            mstate, texmacs_time ());
 // wid -> handle_mouse (s, point.x (), point.y (), mstate, texmacs_time ());
  if (DEBUG_QT)
    cout << "mouse event: " << s << " at "
         << point.x () << ", " << point.y () << LF;
}

Here is the call graph for this function:

void QTMWidget::mouseReleaseEvent ( QMouseEvent *  event) [protected, virtual]

Definition at line 787 of file QTMWidget.cpp.

                                                {
  simple_widget_rep *wid = tm_widget();
  if (!wid) return;
  QPoint point = event->pos() + origin();
  scale (point);
  unsigned int mstate= mouse_state (event, true);
  string s= "release-" * mouse_decode (mstate);
  the_gui -> process_mouse (wid, s, point.x (), point.y (), 
                            mstate, texmacs_time ());
//  wid -> handle_mouse (s, point.x (), point.y (), mstate, texmacs_time ());
  if (DEBUG_QT)
    cout << "mouse event: " << s << " at "
         << point.x () << ", " << point.y () << LF;
}

Here is the call graph for this function:

QPoint QTMScrollView::origin ( ) [inline, inherited]

Definition at line 42 of file QTMScrollView.hpp.

{ return p_origin; }

Here is the caller graph for this function:

void QTMWidget::paintEvent ( QPaintEvent *  event) [protected, virtual]

Definition at line 394 of file QTMWidget.cpp.

                                         {
  // In the current implementation repainting take place during the call to
  // the widget's repaint_invalid_regions method in the_gui::update. All
  // we have to do is to take the backing store and put it on screen according
  // to the QRegion marked invalid. 
  // CHECK: Maybe just put onscreen all the region bounding rectangle could not 
  // be so expensive.
  
  
  if (DEBUG_QT) 
  {
    QRect rect = event->rect ();
    cout << "paintEvent ("<< rect.x() << "," <<  rect.y()
    << "," <<  rect.width() << "," <<  rect.height() << ")" << LF ;
  }
    
  {    
    QPainter p (surface());
    QVector<QRect> rects = event->region().rects();
    for (int i=0; i< rects.count(); i++) {
      QRect qr = rects.at(i);
      p.drawPixmap(qr,backingPixmap,qr);
    }
  } 
  
}

Here is the call graph for this function:

Definition at line 224 of file QTMWidget.cpp.

                                    {

  // this function is called by the qt_gui::update method to keep the backing
  // store in sync and propagate the changes to the surface on screen.
  // first we check that the backing store geometry is right and then we
  // request to the texmacs canvas widget to repaint the regions which were
  // marked invalid. Subsequently, for each succesfully repainted region, we
  // propagate its contents from the backing store to the onscreen surface.
  // If repaint has been interrupted we do not propagate the changes and proceed
  // to mark the region invalid again.

  QRegion qrgn; 
  // qrgn is to keep track of the area on the sceen which needs to be updated 

  // update backing store origin wrt. TeXmacs document
  if ( backing_pos != origin() ) {

    int dx =  origin().x() - backing_pos.x();
    int dy =  origin().y() - backing_pos.y();
    backing_pos = origin();
    
    QPixmap newBackingPixmap (backingPixmap.size());
    QPainter p (&newBackingPixmap);
    //newBackingPixmap.fill(Qt::black);
    p.drawPixmap(-dx,-dy,backingPixmap);
    p.end();
    backingPixmap = newBackingPixmap;
    //cout << "SCROLL CONTENTS BY " << dx << " " << dy << LF;
    
    QSize sz = backingPixmap.size();
    
    rectangles invalid;
    while (!is_nil(invalid_regions)) {
      rectangle r = invalid_regions->item ;
      //      rectangle q = rectangle(r->x1+dx,r->y1-dy,r->x2+dx,r->y2-dy);
      rectangle q = rectangle(r->x1-dx,r->y1-dy,r->x2-dx,r->y2-dy);
      invalid = rectangles (q, invalid);
      //cout << r << " ---> " << q << LF;
      invalid_regions = invalid_regions->next;
    }
    invalid_regions= invalid & 
    rectangles(rectangle(0,0,
                         sz.width(),sz.height())) ;
    
    if (dy<0) 
      invalidate_rect(0,0,sz.width(),min(sz.height(),-dy));
    else if (dy>0)
      invalidate_rect(0,max(0,sz.height()-dy),sz.width(),sz.height());
    
    if (dx<0) 
      invalidate_rect(0,0,min(-dx,sz.width()),sz.height());
    else if (dx>0)
      invalidate_rect(max(0,sz.width()-dx),0,sz.width(),sz.height());
    
    // we cal update now to allow repainint of invalid regions
    // this cannot be done directly since interpose handler needs
    // to be run at least once in some situations
    // (for example when scrolling is initiated by TeXmacs itself)
    //the_gui->update();
    //  QAbstractScrollArea::viewport()->scroll(-dx,-dy);
   // QAbstractScrollArea::viewport()->update();
    qrgn += QRect(QPoint(0,0),sz);
  }
  
  
  // update backing store size
  {
    QSize _oldSize = backingPixmap.size();
    QSize _newSize = surface()->size();
    if (_newSize != _oldSize) {
      // cout << "RESIZING BITMAP"<< LF;
      QPixmap newBackingPixmap (_newSize);
      QPainter p (&newBackingPixmap);
      p.drawPixmap(0,0,backingPixmap);
      //p.fillRect(0, 0, _newSize.width(), _newSize.height(), Qt::red);
      if (_newSize.width() >= _oldSize.width()) {
        invalidate_rect(_oldSize.width(), 0, _newSize.width(), _newSize.height());
        p.fillRect(QRect(_oldSize.width(), 0, _newSize.width()-_oldSize.width(), _newSize.height()), Qt::gray);
      }
      if (_newSize.height() >= _oldSize.height()) {
        invalidate_rect(0,_oldSize.height(), _newSize.width(), _newSize.height());
        p.fillRect(QRect(0,_oldSize.height(), _newSize.width(), _newSize.height()-_oldSize.height()), Qt::gray);
      }
      p.end();
      backingPixmap = newBackingPixmap;
    }
  }
  
  // repaint invalid rectangles
  {
    rectangles new_regions;
    if (!is_nil (invalid_regions)) {
      rectangle lub= least_upper_bound (invalid_regions);
      if (area (lub) < 1.2 * area (invalid_regions))
        invalid_regions= rectangles (lub);
      
      basic_renderer_rep* ren = getRenderer();
      tm_widget()->set_current_renderer(ren);
      
      SI ox = -backing_pos.x()*PIXEL;
      SI oy = backing_pos.y()*PIXEL;
      
      rectangles rects = invalid_regions;
      invalid_regions = rectangles();
      
      while (!is_nil (rects)) {
        rectangle r = copy (rects->item);
        rectangle r0 = rects->item;
        QRect qr = QRect(r0->x1, r0->y1, r0->x2 - r0->x1, r0->y2 - r0->y1);
        //cout << "repainting " << r0 << "\n";
        ren->set_origin(ox,oy); 
        ren->encode (r->x1, r->y1);
        ren->encode (r->x2, r->y2);
        ren->set_clipping (r->x1, r->y2, r->x2, r->y1);
        tm_widget()->handle_repaint (r->x1, r->y2, r->x2, r->y1);
        if (ren->interrupted ()) {
          //cout << "interrupted repainting of  " << r0 << "\n";
          //ren->set_color(green);
          //ren->line(r->x1, r->y1, r->x2, r->y2);
          //ren->line(r->x1, r->y2, r->x2, r->y1);
          invalidate_rect (r0->x1, r0->y1, r0->x2, r0->y2);
        } 
        qrgn += qr;
        rects = rects->next;
      }
      
      tm_widget()->set_current_renderer(NULL);
      ren->end();
    } // !is_nil(invalid_regions)
    
  }

  // propagate immediatly the changes to the screen  
  surface()->repaint(qrgn);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QTMWidget::scrollContentsBy ( int  dx,
int  dy 
)

Reimplemented from QTMScrollView.

Definition at line 362 of file QTMWidget.cpp.

                                             {
  QTMScrollView::scrollContentsBy (dx,dy);

  force_update();
  // we force an update of the internal state to be in sync with the moving
  // scrollbars
}

Here is the call graph for this function:

void QTMWidget::setCursorPos ( QPoint  pos) [inline]

Definition at line 56 of file QTMWidget.hpp.

{ cursor_pos = pos; };
void QTMScrollView::setExtents ( QRect  newExtents) [inherited]

Definition at line 99 of file QTMScrollView.cpp.

                                             {
  if (p_extents != newExtents) {
    p_extents = newExtents;
    if (p_extents.width() < 0) p_extents.setWidth(0);
    if (p_extents.height() < 0) p_extents.setHeight(0);
    updateScrollBars();
  }
}

Here is the call graph for this function:

void QTMScrollView::setOrigin ( QPoint  newOrigin) [inherited]

Definition at line 89 of file QTMScrollView.cpp.

                                            {
  if (newOrigin.x() != p_origin.x()) {
    QAbstractScrollArea::horizontalScrollBar()->setSliderPosition(newOrigin.x());
  }
  if (newOrigin.y() != p_origin.y()) {
       QAbstractScrollArea::verticalScrollBar()->setSliderPosition(newOrigin.y());
  } 
}

Here is the caller graph for this function:

QWidget * QTMScrollView::surface ( ) [inherited]

Definition at line 82 of file QTMScrollView.cpp.

                                {
  return p_surface;
}

Here is the caller graph for this function:

bool QTMScrollView::surfaceEvent ( QEvent *  e) [protected, virtual, inherited]

Definition at line 229 of file QTMScrollView.cpp.

{
  switch (e->type()) {
    case QEvent::Resize:
    case QEvent::Paint:
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
    case QEvent::MouseButtonDblClick:
#if QT_VERSION >= 0x040600
    case QEvent::TouchBegin:
    case QEvent::TouchUpdate:
    case QEvent::TouchEnd:
#endif
    case QEvent::MouseMove:
    case QEvent::ContextMenu:
    case QEvent::Wheel:
    case QEvent::Drop:
    case QEvent::DragEnter:
    case QEvent::DragMove:
    case QEvent::DragLeave:
      return QFrame::event(e);
    case QEvent::LayoutRequest:
#if QT_VERSION >= 0x040600
#ifndef QT_NO_GESTURES
    case QEvent::Gesture:
    case QEvent::GestureOverride:
      return event(e);
#endif
#endif
    default:
      break;
  }
  return false; // let the surface widget handle the event
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 44 of file QTMWidget.hpp.

              {
    QVariant v= property("texmacs_widget");
    return (simple_widget_rep *)
      (v.canConvert<void*> ()? v.value<void*> (): NULL);
  }

Here is the caller graph for this function:

void QTMScrollView::updateScrollBars ( void  ) [protected, inherited]

Definition at line 142 of file QTMScrollView.cpp.

                                     {
       QWidget *_viewport = QAbstractScrollArea::viewport();
       int w = _viewport->width()  ; // -2
       int h = _viewport->height() ; // -2
  
       QScrollBar *_hScrollBar = QAbstractScrollArea::horizontalScrollBar();
       int cw = (p_extents.width() > w ? p_extents.width() - w : 0);
       if (_hScrollBar->sliderPosition() > cw)
              _hScrollBar->setSliderPosition(cw);
       _hScrollBar->setRange(0, cw);
       _hScrollBar->setSingleStep((w >> 4) + 1);
       _hScrollBar->setPageStep(w);
  
  QRect r = (p_extents.width() > w) ? QRect(0,0,w,h) 
    : QRect ((w-p_extents.width())/2,0,p_extents.width(),h);
//  surface()->setGeometry(r);
  surface()->setMinimumWidth(r.width());
  
       QScrollBar *_vScrollBar = QAbstractScrollArea::verticalScrollBar();
       int ch = (p_extents.height() > h ? p_extents.height() - h : 0);
       if (_vScrollBar->sliderPosition() > ch)
              _vScrollBar->setSliderPosition(ch);
       _vScrollBar->setRange(0, ch);
       _vScrollBar->setSingleStep((h >> 4) + 1);
       _vScrollBar->setPageStep(h);
  
  
  // we may need a relayout if the surface width is changed
  updateGeometry();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool QTMScrollView::viewportEvent ( QEvent *  e) [protected, virtual, inherited]

Definition at line 192 of file QTMScrollView.cpp.

{
  switch (e->type()) {
    case QEvent::Resize:
    case QEvent::Paint:
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
    case QEvent::MouseButtonDblClick:
#if QT_VERSION >= 0x040600
    case QEvent::TouchBegin:
    case QEvent::TouchUpdate:
    case QEvent::TouchEnd:
#endif
    case QEvent::MouseMove:
    case QEvent::ContextMenu:
    case QEvent::Wheel:
    case QEvent::Drop:
    case QEvent::DragEnter:
    case QEvent::DragMove:
    case QEvent::DragLeave:
//      return QFrame::event(e);
      return false; // let the viewport widget handle the event
    case QEvent::LayoutRequest:
#if QT_VERSION >= 0x040600
#ifndef QT_NO_GESTURES
    case QEvent::Gesture:
    case QEvent::GestureOverride:
      return event(e);
#endif
#endif
    default:
      break;
  }
  return false; // let the viewport widget handle the event
}

Here is the call graph for this function:

QPoint QTMScrollView::viewportToContents ( QPoint const &  pos) const [inline, inherited]

Definition at line 48 of file QTMScrollView.hpp.

{ return pos + p_origin; };

Friends And Related Function Documentation

friend class QTMSurface [friend, inherited]

Definition at line 63 of file QTMScrollView.hpp.


Member Data Documentation

QSet< QTMWidget * > QTMWidget::all_widgets [static]

Definition at line 33 of file QTMWidget.hpp.

Definition at line 34 of file QTMWidget.hpp.

QPixmap QTMWidget::backingPixmap [private]

Definition at line 29 of file QTMWidget.hpp.

Definition at line 38 of file QTMWidget.hpp.

Definition at line 37 of file QTMWidget.hpp.

Definition at line 28 of file QTMWidget.hpp.


Event Documentation

void QTMWidget::resizeEvent [protected]

Definition at line 68 of file QTMWidget.hpp.


The documentation for this class was generated from the following files: