Esempio n. 1
0
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

#ifdef __WXGTK20__
    // Draw grip first
    if ( ShowsSizeGrip() )
    {
        const wxRect& rc = GetSizeGripRect();
        GdkWindowEdge edge =
            GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST :
                                                           GDK_WINDOW_EDGE_SOUTH_EAST;
        gtk_paint_resize_grip(gtk_widget_get_style(m_widget),
                            GTKGetDrawingWindow(),
                            gtk_widget_get_state(m_widget),
                            NULL,
                            m_widget,
                            "statusbar",
                            edge,
                            rc.x, rc.y, rc.width, rc.height );
    }
#endif // __WXGTK20__

    if (GetFont().IsOk())
        dc.SetFont(GetFont());

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
    for (size_t i = 0; i < m_panes.GetCount(); i ++)
        DrawField(dc, i, textHeight);
}
Esempio n. 2
0
void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event)
{
#ifdef __WXGTK20__
    int width, height;
    GetClientSize(&width, &height);

    if ( ShowsSizeGrip() && (event.GetX() > width-height) )
    {
        GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget );

        if (!GTK_IS_WINDOW (ancestor))
            return;

        GdkWindow *source = GTKGetDrawingWindow();

        int org_x = 0;
        int org_y = 0;
        gdk_window_get_origin( source, &org_x, &org_y );

        gtk_window_begin_move_drag (GTK_WINDOW (ancestor),
                                2,
                                org_x + event.GetX(),
                                org_y + event.GetY(),
                                0);
    }
    else
    {
        event.Skip( true );
    }
#else
    event.Skip( true );
#endif
}
Esempio n. 3
0
void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event)
{
    int width, height;
    GetClientSize(&width, &height);

    GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget);
#ifdef __WXGTK3__
    GdkRectangle rect;
    if (ancestor && gtk_window_get_resize_grip_area(GTK_WINDOW(ancestor), &rect) &&
        rect.width && rect.height)
    {
        ancestor = NULL;
    }
#endif

    if (ancestor && ShowsSizeGrip() && event.GetX() > width - height)
    {
        GdkWindow *source = GTKGetDrawingWindow();

        int org_x = 0;
        int org_y = 0;
        gdk_window_get_origin( source, &org_x, &org_y );

        gtk_window_begin_move_drag (GTK_WINDOW (ancestor),
                                2,
                                org_x + event.GetX(),
                                org_y + event.GetY(),
                                0);
    }
    else
    {
        event.Skip( true );
    }
}
Esempio n. 4
0
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

#ifdef __WXGTK20__
    // Draw grip first
    if ( ShowsSizeGrip() )
    {
        const wxRect& rc = GetSizeGripRect();
#ifdef __WXGTK3__
        GtkWidget* toplevel = gtk_widget_get_toplevel(m_widget);
        GdkRectangle rect;
        if (toplevel && (!gtk_window_get_resize_grip_area(GTK_WINDOW(toplevel), &rect) ||
            rect.width == 0 || rect.height == 0))
        {
            GtkStyleContext* sc = gtk_widget_get_style_context(toplevel);
            gtk_style_context_save(sc);
            gtk_style_context_add_class(sc, GTK_STYLE_CLASS_GRIP);
            GtkJunctionSides sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT;
            if (GetLayoutDirection() == wxLayout_RightToLeft)
                sides = GTK_JUNCTION_CORNER_BOTTOMLEFT;
            gtk_style_context_set_junction_sides(sc, sides);
            gtk_render_handle(sc,
                static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext()),
                rc.x, rc.y, rc.width, rc.height);
            gtk_style_context_restore(sc);
        }
#else
        GdkWindowEdge edge =
            GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST :
                                                           GDK_WINDOW_EDGE_SOUTH_EAST;
        gtk_paint_resize_grip(gtk_widget_get_style(m_widget),
                            GTKGetDrawingWindow(),
                            gtk_widget_get_state(m_widget),
                            NULL,
                            m_widget,
                            "statusbar",
                            edge,
                            rc.x, rc.y, rc.width, rc.height );
#endif
    }
#endif // __WXGTK20__

    if (GetFont().IsOk())
        dc.SetFont(GetFont());

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
    for (size_t i = 0; i < m_panes.GetCount(); i ++)
        DrawField(dc, i, textHeight);
}
Esempio n. 5
0
void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event)
{
    int width, height;
    GetClientSize(&width, &height);

    GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget);
#ifdef __WXGTK3__
    GdkRectangle rect;
    if (ancestor && gtk_window_get_resize_grip_area(GTK_WINDOW(ancestor), &rect) &&
        rect.width && rect.height)
    {
        ancestor = NULL;
    }
#endif

    if (ancestor && ShowsSizeGrip() && event.GetX() > width - height)
    {
        GdkWindow *source = GTKGetDrawingWindow();

        int org_x = 0;
        int org_y = 0;
        gdk_window_get_origin( source, &org_x, &org_y );

        if (GetLayoutDirection() == wxLayout_RightToLeft)
        {
            gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
                                  GDK_WINDOW_EDGE_SOUTH_WEST,
                                  1,
                                  org_x - event.GetX() + GetSize().x ,
                                  org_y + event.GetY(),
                                  0);
        }
        else
        {
            gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
                                  GDK_WINDOW_EDGE_SOUTH_EAST,
                                  1,
                                  org_x + event.GetX(),
                                  org_y + event.GetY(),
                                  0);
        }
    }
    else
    {
        event.Skip( true );
    }
}
Esempio n. 6
0
void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event)
{
#ifdef __WXGTK20__
    int width, height;
    GetClientSize(&width, &height);

    if ( ShowsSizeGrip()  && (event.GetX() > width-height) )
    {
        GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget );

        if (!GTK_IS_WINDOW (ancestor))
            return;

        GdkWindow *source = GTKGetDrawingWindow();

        int org_x = 0;
        int org_y = 0;
        gdk_window_get_origin( source, &org_x, &org_y );

        if (GetLayoutDirection() == wxLayout_RightToLeft)
        {
            gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
                                  GDK_WINDOW_EDGE_SOUTH_WEST,
                                  1,
                                  org_x - event.GetX() + GetSize().x ,
                                  org_y + event.GetY(),
                                  0);
        }
        else
        {
            gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
                                  GDK_WINDOW_EDGE_SOUTH_EAST,
                                  1,
                                  org_x + event.GetX(),
                                  org_y + event.GetY(),
                                  0);
        }
    }
    else
    {
        event.Skip( true );
    }
#else
    event.Skip( true );
#endif
}
Esempio n. 7
0
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

#ifdef __WXGTK20__
    // Draw grip first
    if ( ShowsSizeGrip() )
    {
        const wxRect& rc = GetSizeGripRect();
#ifdef __WXGTK3__
        GtkWidget* toplevel = gtk_widget_get_toplevel(m_widget);
        GdkRectangle rect;
        wxGCC_WARNING_SUPPRESS(deprecated-declarations)
        if (toplevel && (!gtk_window_get_resize_grip_area(GTK_WINDOW(toplevel), &rect) ||
            rect.width == 0 || rect.height == 0))
        wxGCC_WARNING_RESTORE()
        {
            GtkStyleContext* sc = gtk_widget_get_style_context(toplevel);
            gtk_style_context_save(sc);
            gtk_style_context_add_class(sc, GTK_STYLE_CLASS_GRIP);
            GtkJunctionSides sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT;
            if (GetLayoutDirection() == wxLayout_RightToLeft)
                sides = GTK_JUNCTION_CORNER_BOTTOMLEFT;
            gtk_style_context_set_junction_sides(sc, sides);
            gtk_render_handle(sc,
                static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext()),
                rc.x, rc.y, rc.width, rc.height);
            gtk_style_context_restore(sc);
        }
#else
        GdkWindowEdge edge =
            GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST :
                                                           GDK_WINDOW_EDGE_SOUTH_EAST;
        gtk_paint_resize_grip(gtk_widget_get_style(m_widget),
                            GTKGetDrawingWindow(),
                            gtk_widget_get_state(m_widget),
                            NULL,
                            m_widget,
                            "statusbar",
                            edge,
                            rc.x, rc.y, rc.width, rc.height );
#endif
    }
Esempio n. 8
0
Window wxGLCanvas::GetXWindow() const
{
    GdkWindow* window = GTKGetDrawingWindow();
    return window ? GDK_WINDOW_XID(window) : 0;
}