Example #1
0
void Widget::setCursor(const Cursor& cursor)
{
    GdkCursor* pcur = cursor.impl();

    // http://bugs.webkit.org/show_bug.cgi?id=16388
    // [GTK] Widget::setCursor() gets called frequently
    //
    // gdk_window_set_cursor() in certain GDK backends seems to be an
    // expensive operation, so avoid it if possible.

    if (pcur == m_data->cursor)
        return;

    gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformWindow())->window, pcur);
    m_data->cursor = pcur;
}
Example #2
0
void ScrollView::platformSetContentsSize()
{
    wxWindow* win = platformWidget();
    if (!win)
        return;

    win->SetVirtualSize(m_contentsSize.width(), m_contentsSize.height());
    adjustScrollbars();
}
    virtual void frameRectsChanged()
    {
        if (!platformWidget())
            return;

        IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
        platformWidget()->setGeometry(windowRect);

        ScrollView* parentScrollView = parent();
        if (!parentScrollView)
            return;

        ASSERT(parentScrollView->isFrameView());
        IntRect clipRect(static_cast<FrameView*>(parentScrollView)->windowClipRect());
        clipRect.move(-windowRect.x(), -windowRect.y());
        clipRect.intersect(platformWidget()->rect());
        platformWidget()->setMask(QRegion(clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height()));
    }
Example #4
0
void Widget::setFrameRect(const IntRect& rect)
{
    // Take a reference to this Widget, because calling functions of the PlatformWidget can invoke arbitrary
    // code, which can deref it.
    RefPtr<Widget> protectedThis(this);

    if (PlatformWidget widget = platformWidget())
        widget->SetSize(rect);
    
    m_frame = rect;
}
Example #5
0
void ScrollView::platformRepaintContentRectangle(const IntRect& updateRect, bool now)
{
    // we need to convert coordinates to scrolled position
    wxRect contentsRect = updateRect;
    contentsRect.Offset(-scrollX(), -scrollY());
    wxWindow* win = platformWidget();
    if (win) {
        win->RefreshRect(contentsRect, true);
        if (now)
            win->Update();
    }
}
Example #6
0
void ScrollView::adjustScrollbars(int x, int y, bool refresh)
{
    wxWindow* win = platformWidget();
    if (!win)
        return;

    wxRect crect(win->GetClientRect()), vrect(win->GetVirtualSize());

    if (x == -1) x = m_data->viewStart.x;
    if (y == -1) y = m_data->viewStart.y;

    long style = win->GetWindowStyle();

    // by setting the wxALWAYS_SHOW_SB wxWindow flag before
    // each SetScrollbar call, we can control the scrollbars
    // visibility individually.

    // horizontal scrollbar
    switch (m_data->hScrollbarMode) {
        case ScrollbarAlwaysOff:
            win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB);
            win->SetScrollbar(wxHORIZONTAL, 0, 0, 0, refresh);
            break;

        case ScrollbarAuto:
            win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB);
            win->SetScrollbar(wxHORIZONTAL, x, crect.width, vrect.width, refresh);
            break;

        default: // ScrollbarAlwaysOn
            win->SetWindowStyleFlag(style | wxALWAYS_SHOW_SB);
            win->SetScrollbar(wxHORIZONTAL, x, crect.width, vrect.width, refresh);
            break;
    }

    // vertical scrollbar
    switch (m_data->vScrollbarMode) {
        case ScrollbarAlwaysOff:
            win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB);
            win->SetScrollbar(wxVERTICAL, 0, 0, 0, refresh);
            break;

        case ScrollbarAlwaysOn:
            win->SetWindowStyleFlag(style | wxALWAYS_SHOW_SB);
            win->SetScrollbar(wxVERTICAL, y, crect.height, vrect.height, refresh);
            break;

        default: // case ScrollbarAuto:
            win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB);
            win->SetScrollbar(wxVERTICAL, y, crect.height, vrect.height, refresh);
    }
}
Example #7
0
void Widget::setCursor(const Cursor& cursor)
{
    if (!platformWidget() || !evas())
         return;

    const char *group = cursor.impl();
    if (!group || String(group) == m_data->m_cursorGroup)
        return;

    m_data->m_cursorGroup = group;

    applyCursor();
}
Example #8
0
IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const
{
    wxWindow* win = platformWidget();
    if (!win)
        return IntRect();

    int width, height;

    if (includeScrollbars)
        win->GetSize(&width, &height);
    else
        win->GetClientSize(&width, &height);
        
    return IntRect(m_data->viewStart.x, m_data->viewStart.y, width, height);
}
Example #9
0
    virtual void frameRectsChanged()
    {
        if (!platformWidget())
            return;

        IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
        platformWidget()->setGeometry(windowRect);

        ScrollView* parentScrollView = parent();
        if (!parentScrollView)
            return;

        ASSERT(parentScrollView->isFrameView());
        IntRect clipRect(static_cast<FrameView*>(parentScrollView)->windowClipRect());
        clipRect.move(-windowRect.x(), -windowRect.y());
        clipRect.intersect(platformWidget()->rect());

        QRegion clipRegion = QRegion(clipRect);
        platformWidget()->setMask(clipRegion);

        // if setMask is set with an empty QRegion, no clipping will
        // be performed, so in that case we hide the platformWidget
        platformWidget()->setVisible(!clipRegion.isEmpty());
    }
void GtkPluginWidget::paint(GraphicsContext* context, const IntRect& rect)
{
    if (!context->gdkExposeEvent())
        return;

    /* only paint widgets with NO_WINDOW this way */
    if (!GTK_WIDGET_NO_WINDOW(platformWidget()))
        return;

    GtkWidget* widget = platformWidget();
    ASSERT(GTK_WIDGET_NO_WINDOW(widget));

    GdkEvent* event = gdk_event_new(GDK_EXPOSE);
    event->expose = *context->gdkExposeEvent();
    event->expose.area = static_cast<GdkRectangle>(rect);

    IntPoint loc = parent()->contentsToWindow(rect.location());

    event->expose.area.x = loc.x();
    event->expose.area.y = loc.y();

    event->expose.region = gdk_region_rectangle(&event->expose.area);

    /*
     * This will be unref'ed by gdk_event_free.
     */
    g_object_ref(event->expose.window);

    /*
     * If we are going to paint do the translation and GtkAllocation manipulation.
     */
    if (!gdk_region_empty(event->expose.region))
        gtk_widget_send_expose(widget, event);

    gdk_event_free(event);
}
Example #11
0
void Widget::setCursor(const Cursor& cursor)
{
#if PLATFORM(AMIGAOS4)
    static const Cursor *waitCursorPtr = &waitCursor();
    BalWidget *widget = platformWidget();
    Window *window = widget ? widget->window : 0;

    if (window)
        if (waitCursorPtr == &cursor && !cursor.impl())
            IIntuition->SetWindowPointer(window, WA_BusyPointer, TRUE, TAG_DONE);
        else if (widget->curentCursor != cursor.impl()) {
            IIntuition->SetWindowPointer(window, WA_Pointer, cursor.impl(), TAG_DONE);
            widget->curentCursor = cursor.impl();
        }
#endif
}
Example #12
0
void ScrollView::platformSetScrollPosition(const IntPoint& scrollPoint)
{
    wxWindow* win = platformWidget();

    wxPoint scrollOffset = m_data->viewStart;
    wxPoint orig(scrollOffset);
    wxPoint newScrollOffset(scrollPoint);

    wxRect vRect(win->GetVirtualSize());
    wxRect cRect(win->GetClientSize());

    // clamp to scroll area
    if (newScrollOffset.x < 0)
        newScrollOffset.x = 0;
    else if (newScrollOffset.x + cRect.width > vRect.width)
        newScrollOffset.x = max(0, vRect.width - cRect.width);

    if (newScrollOffset.y < 0)
        newScrollOffset.y = 0;
    else if (newScrollOffset.y + cRect.height > vRect.height)
        newScrollOffset.y = max(0, vRect.height - cRect.height);

    if (newScrollOffset == scrollOffset)
        return;

    m_data->viewStart = newScrollOffset;

    wxPoint delta(orig - newScrollOffset);

    if (canBlitOnScroll())
        win->ScrollWindow(delta.x, delta.y);
    else
        win->Refresh();

    adjustScrollbars();
}
Example #13
0
void Widget::hide()
{
    if (PlatformWidget widget = platformWidget())
        widget->Hide();
}
Example #14
0
void Widget::show()
{
    if (PlatformWidget widget = platformWidget())
        widget->Show();
}
Example #15
0
void Widget::setFocus()
{
    if (PlatformWidget widget = platformWidget())
        widget->SetFocus();
}
void Widget::retainPlatformWidget()
{
    Retain(platformWidget());
}
void Widget::releasePlatformWidget()
{
    Release(platformWidget());
}
Example #18
0
void Widget::setFocus()
{
    gtk_widget_grab_focus(platformWidget() ? platformWidget() : GTK_WIDGET(root()->hostWindow()->platformWindow()));
}
Example #19
0
void Widget::setFocus()
{
    if (platformWidget())
        platformWidget()->MakeFocus();
}
Example #20
0
void Widget::show()
{
    if (platformWidget())
        platformWidget()->Show();
}
Example #21
0
 virtual void invalidateRect(const IntRect& r)
 { 
     if (platformWidget())
         platformWidget()->update(r);
 }
Example #22
0
 ~QtPluginWidget()
 {
     if (platformWidget())
         platformWidget()->deleteLater();
 }
Example #23
0
void Widget::invalidateRect(const IntRect& r)
{
    if (PlatformWidget widget = platformWidget())
        widget->RefreshRect(r);
}
Example #24
0
void Widget::setFocus(bool focused)
{
    if (focused)
        gtk_widget_grab_focus(platformWidget() ? platformWidget() : GTK_WIDGET(root()->hostWindow()->platformPageClient()));
}
Example #25
0
void Widget::paint(GraphicsContext*,const IntRect& r)
{
    invalidateRect(r);
    if (PlatformWidget widget = platformWidget())
        widget->Update();
}
Example #26
0
void Widget::show()
{
    if (!platformWidget())
         return;
    gtk_widget_show(platformWidget());
}
Example #27
0
void Widget::setCursor(const Cursor& cursor)
{
    if (platformWidget())
        platformWidget()->SetViewCursor(cursor.impl());
}
Example #28
0
void Widget::retainPlatformWidget()
{
    if (!platformWidget())
         return;
    g_object_ref_sink(platformWidget());
}
Example #29
0
void Widget::hide()
{
    if (platformWidget())
        platformWidget()->Hide();
}
Example #30
0
void Widget::releasePlatformWidget()
{
    if (!platformWidget())
         return;
    g_object_unref(platformWidget());
}